Basic
LegacyTransaction
LegacyTransaction
represents a legacy transaction. A Klaytn account can execute a LegacyTransaction
only with AccountKeyLegacy. The transactionObject
can have properties below to create a LegacyTransaction
.
LegacyTransaction
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates LegacyTransaction
.
NOTE You can create an instance of LegacyTransaction
from RLP-encoded string. Please refer to the below example. NOTE caver.transaction.legacyTransaction.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
value
string
(optional, default: '0x0'
) The amount of KLAY in peb to be transferred. You can use caver.utils.toPeb
.
from
string
(optional) The address of the sender. If omitted, the keyring address used for signing will be set.
to
string
(optional, default: '0x'
) The account address that will receive the transferred value or smart contact address if a legacy transaction execute smart contract. If a legacy transaction deploys a smart contract, to
does not need to be defined.
input
string
(optional) Data attached to the transaction, used for smart contract deployment/execution.
signatures
Array
(optional) An array of signatures. A legacy transaction can have only one signature.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
ValueTransfer
ValueTransfer
represents a value transfer transaction. The transactionObject
can have properties below to create a ValueTransfer
transaction.
ValueTransfer
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates ValueTransfer
transaction.
NOTE You can create an instance of ValueTransfer
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.valueTransfer.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
value
string
The amount of KLAY in peb to be transferred. You can use caver.utils.toPeb
.
from
string
The address of the sender.
to
string
The account address that will receive the transferred value.
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
signatures
Array
(optional) An array of signatures.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
ValueTransferMemo
ValueTransferMemo
represents a value transfer memo transaction. The transactionObject
can have properties below to create a ValueTransferMemo
transaction.
ValueTransferMemo
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates ValueTransferMemo
transaction.
NOTE You can create an instance of ValueTransferMemo
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.valueTransferMemo.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
value
string
The amount of KLAY in peb to be transferred. You can use caver.utils.toPeb
.
from
string
The address of the sender.
to
string
The account address that will receive the transferred value.
input
string
Data attached to the transaction. The message should be passed to this property.
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
signatures
Array
(optional) An array of signatures.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
AccountUpdate
AccountUpdate
represents a account update transaction. The transactionObject
can have properties below to create an AccountUpdate
transaction.
AccountUpdate
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates AccountUpdate
transaction.
NOTE You can create an instance of AccountUpdate
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.accountUpdate.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
from
string
The address of the sender.
account
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
signatures
Array
(optional) An array of signatures.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
For how to create an Account instance for each AccountKey
, refer to Getting Started - Account Update or caver.account.create.
Example
SmartContractDeploy
SmartContractDeploy
represents a smart contract deploy transaction. The transactionObject
can have properties below to create a SmartContractDeploy
transaction.
SmartContractDeploy
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates SmartContractDeploy
transaction.
NOTE You can create an instance of SmartContractDeploy
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.smartContractDeploy.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
from
string
The address of the sender.
input
string
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
value
string
(optional, default: '0x0'
) The amount of KLAY in peb to be transferred to and stored in the balance of the smart contract address when the contract is initialized. You can use caver.utils.toPeb
.
to
string
(optional, default: '0x'
) Address to which the smart contract is deployed. Currently, this value cannot be defined. Specifying the address will be supported in the future.
humanReadable
boolean
(optional, default: false
) This must be false since human-readable address is not supported yet.
codeFormat
string
(optional, default: 'EVM'
) The code format of smart contract code. The supported value, for now, is EVM only. This value is converted to hex string after the assignment(e.g> EVM
is converted to 0x0
) internally.
signatures
Array
(optional) An array of signatures.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
SmartContractExecution
SmartContractExecution
represents a smart contract execution transaction. The transactionObject
can have properties below to create a SmartContractExecution
transaction.
SmartContractExecution
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates SmartContractExecution
transaction.
NOTE You can create an instance of SmartContractExecution
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.smartContractExecution.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
from
string
The address of the sender.
to
string
The address of the smart contract account to be executed.
input
string
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
value
string
(optional, default: '0x0'
) The amount of KLAY in peb to be transferred. You can use caver.utils.toPeb
.
signatures
Array
(optional) An array of signatures.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
Cancel
Cancel
represents a cancel transaction. The transactionObject
can have properties below to create a Cancel
transaction.
Cancel
transaction cancels the execution of the transaction with the same nonce in the transaction pool.
Cancel
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates Cancel
transaction.
NOTE You can create an instance of Cancel
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.cancel.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
from
string
The address of the sender.
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
signatures
Array
(optional) An array of signatures.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
ChainDataAnchoring
ChainDataAnchoring
represents a chain data anchoring transaction. The transactionObject
can have properties below to create a ChainDataAnchoring
transaction.
ChainDataAnchoring
has the properties below as its member variables. Properties marked as optional
refer to properties that can be optionally given in transactionObject
when the user creates ChainDataAnchoring
transaction.
NOTE You can create an instance of ChainDataAnchoring
from RLP-encoded string. Please refer to the below example.
NOTE caver.transaction.chainDataAnchoring.create
is supported since caver-js v1.6.1.
properties
Name
Type
Description
from
string
The address of the sender.
input
string
Data of the service chain.
gas
string
The maximum amount of transaction fee the transaction is allowed to use.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, caver.rpc.klay.getTransactionCount(address, 'pending')
will be used to set nonce.
signatures
Array
(optional) An array of signatures.
gasPrice
string
(optional) A multiplier to get how much the sender will pay in tokens. If omitted, caver.rpc.klay.getGasPrice
will be used to set gasPrice.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, caver.rpc.klay.getChainId
will be used to set chainId.
Example
Last updated