Skip to content

Class: TransactionBuilder

The TransactionBuilder class provides helper methods to easily create standard types of transactions. It can only be instantiated from a Client with client.transactionBuilder().

Table of contents

Constructors

Methods

Constructors

constructor

new TransactionBuilder(): TransactionBuilder

Returns

TransactionBuilder

Methods

free

free(): void

Returns

void

Defined in

web.d.ts:1772


newBasic

newBasic(sender, recipient, value, fee, validity_start_height, network_id): Transaction

Creates a basic transaction that transfers value amount of luna (NIM's smallest unit) from the sender to the recipient.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the numbers given for value and fee do not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
recipientAddress
valuebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1788


newBasicWithData

newBasicWithData(sender, recipient, data, value, fee, validity_start_height, network_id): Transaction

Creates a basic transaction that transfers value amount of luna (NIM's smallest unit) from the sender to the recipient. It can include arbitrary data, up to 64 bytes.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the numbers given for value and fee do not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
recipientAddress
dataUint8Array
valuebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1805


newCreateStaker

newCreateStaker(sender, delegation, value, fee, validity_start_height, network_id): Transaction

Creates a new staker in the staking contract and transfers value amount of luna (NIM's smallest unit) from the sender account to this new staker.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the numbers given for value and fee do not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
delegationAddress
valuebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1821


newCreateValidator

newCreateValidator(sender, reward_address, signing_key, voting_key_pair, signal_data, fee, validity_start_height, network_id): Transaction

Registers a new validator in the staking contract.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
reward_addressAddress
signing_keyPublicKey
voting_key_pairBLSKeyPair
signal_datastring
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1900


newDeactivateValidator

newDeactivateValidator(sender, validator, fee, validity_start_height, network_id): Transaction

Deactivates a validator in the staking contract.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
validatorAddress
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1931


newDeleteValidator

newDeleteValidator(sender, fee, validity_start_height, network_id): Transaction

Deleted a validator the staking contract. The deposit is returned to the Sender

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1944


newRetireValidator

newRetireValidator(sender, fee, validity_start_height, network_id): Transaction

Retires a validator in the staking contract.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1957


newSetInactiveStake

newSetInactiveStake(sender, new_inactive_balance, fee, validity_start_height, network_id): Transaction

Sets the inactive stake balance of the staker. This is a signaling transaction and as such does not transfer any value.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the number given for fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
new_inactive_balancebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1883


newStake

newStake(sender, staker_address, value, fee, validity_start_height, network_id): Transaction

Adds stake to a staker in the staking contract and transfers value amount of luna (NIM's smallest unit) from the sender account to this staker.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the numbers given for value and fee do not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
staker_addressAddress
valuebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1837


newUnstake

newUnstake(recipient, value, fee, validity_start_height, network_id): Transaction

Unstakes stake from the staking contract and transfers value amount of luna (NIM's smallest unit) from the staker to the recipient.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the numbers given for value and fee do not fit within a u64 or the networkId is unknown.

Parameters

NameType
recipientAddress
valuebigint
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1868


newUpdateStaker

newUpdateStaker(sender, new_delegation, reactivate_all_stake, fee, validity_start_height, network_id): Transaction

Updates a staker in the staking contract to stake for a different validator. This is a signaling transaction and as such does not transfer any value.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the number given for fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
new_delegationAddress
reactivate_all_stakeboolean
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1853


newUpdateValidator

newUpdateValidator(sender, reward_address, signing_key, voting_key_pair, signal_data, fee, validity_start_height, network_id): Transaction

Updates parameters of a validator in the staking contract.

The returned transaction is not yet signed. You can sign it e.g. with tx.sign(keyPair).

Throws when the fee does not fit within a u64 or the networkId is unknown.

Parameters

NameType
senderAddress
reward_addressAddress
signing_keyPublicKey
voting_key_pairBLSKeyPair
signal_datastring
feebigint
validity_start_heightnumber
network_idnumber

Returns

Transaction

Defined in

web.d.ts:1917