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 strings. Please refer to the below example. NOTE: caver.transaction.legacyTransaction.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.legacyTransaction({...})
, please change it to caver.transaction.legacyTransaction.create({...})
.
properties
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 strings. Please refer to the below example. NOTE: caver.transaction.valueTransfer.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.valueTransfer({...})
, please change it to caver.transaction.valueTransfer.create({...})
.
properties
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 strings. Please refer to the below example. NOTE: caver.transaction.valueTransferMemo.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.valueTransferMemo({...})
, please change it to caver.transaction.valueTransferMemo.create({...})
.
properties
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 strings. Please refer to the below example. NOTE: caver.transaction.accountUpdate.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.accountUpdate({...})
, please change it to caver.transaction.accountUpdate.create({...})
.
properties
from
string
The address of the sender.
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 strings. Please refer to the below example. NOTE: caver.transaction.smartContractDeploy.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.smartContractDeploy({...})
, please change it to caver.transaction.smartContractDeploy.create({...})
.
properties
from
string
The address of the sender.
input
string
Data attached to the transaction. The byte code of the smart contract to be deployed and its arguments. You can get this through caver.abi.encodeContractDeploy.
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 strings. Please refer to the below example. NOTE: caver.transaction.smartContractExecution.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.smartContractExecution({...})
, please change it to caver.transaction.smartContractExecution.create({...})
.
properties
from
string
The address of the sender.
to
string
The address of the smart contract account to be executed.
input
string
Data attached to the transaction, used for transaction execution. The input is an encoded string that indicates a function to call and parameters to be passed to this function. You can get this through caver.abi.encodeFunctionCall.
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 strings. Please refer to the below example. NOTE: caver.transaction.cancel.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.xcancelxx({...})
, please change it to caver.transaction.cancel.create({...})
.
properties
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 strings. Please refer to the below example. NOTE: caver.transaction.chainDataAnchoring.create
is supported since caver-js v1.6.1.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.chainDataAnchoring({...})
, please change it to caver.transaction.chainDataAnchoring.create({...})
.
properties
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
EthereumAccessList
EthereumAccessList
represents an Ethereum access list transaction. A Klaytn account can execute a EthereumAccessList
only with AccountKeyLegacy. The transactionObject
can have properties below to create a EthereumAccessList
.
EthereumAccessList
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 EthereumAccessList
.
NOTE: You can create an instance of EthereumAccessList
from RLP-encoded strings. Please refer to the below example. NOTE: caver.transaction.ethereumAccessList
is supported since caver-js v1.8.0.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.ethereumAccessList({...})
, please change it to caver.transaction.ethereumAccessList.create({...})
.
properties
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 an ethereum access list transaction execute smart contract. If an ethereum access list 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. An ethereum access list 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.
accessList
Array
(optional) As an EIP-2930 access list that contains all storage slots and addresses read and written by the transaction.
Example
EthereumDynamicFee
EthereumDynamicFee
represents an Ethereum dynamic fee transaction. A Klaytn account can execute a EthereumDynamicFee
only with AccountKeyLegacy. The transactionObject
can have properties below to create a EthereumDynamicFee
.
EthereumDynamicFee
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 EthereumDynamicFee
. And note that EthereumDynamicFee
does not use gasPrice
, it uses maxPriorityFeePerGas
and maxFeePerGas
.
NOTE: You can create an instance of EthereumDynamicFee
from RLP-encoded strings. Please refer to the below example. NOTE: caver.transaction.ethereumDynamicFee
is supported since caver-js v1.8.0.
NOTE: As of caver-js v1.8.1-rc.4, creating transactions is only supported using the create
function. If you've been creating transactions using a constructor like new caver.transaction.ethereumDynamicFee({...})
, please change it to caver.transaction.ethereumDynamicFee.create({...})
.
properties
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, it will be set to the keyring address used for signing.
to
string
(optional, default: '0x'
) The account address that will receive the transferred value or smart contact address when an ethereum dynamic fee transaction executes a smart contract. When an ethereum dynamic fee 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. An ethereum dynamic fee transaction can have only one signature.
nonce
string
(optional) A value used to uniquely identify a sender’s transaction. If omitted, it will be set to caver.rpc.klay.getTransactionCount(address, 'pending')
.
maxPriorityFeePerGas
string
(optional) Gas tip cap for the transaction in peb. Since Klaytn has a fixed gas price, it should be set to the same value as caver.rpc.klay.getGasPrice
. If omitted, it will be set to caver.rpc.klay.getMaxPriorityFeePerGas()
.
maxFeePerGas
string
(optional) A maximum amount to pay for the transaction to execute. Since Klaytn has a fixed gas price, it should be set to the same value as caver.rpc.klay.getGasPrice
. If omitted, the value of baseFeePerGas * 2 + maxPriorityFeePerGas
is set to maxFeePerGas
.
chainId
string
(optional) The chain id of the Klaytn network. If omitted, it will be set to caver.rpc.klay.getChainId
.
accessList
Array
(optional) As an EIP-2930 access list that contains all storage slots and addresses read and written by the transaction.
Example
Last updated