Value Transfer Memo
TxTypeValueTransferMemo is used when a user wants to send KAIA with a specific message.
Import the web3 and @kaiachain/web3js-ext packages to add kaia features on web3
Define sender, fee payer addresses and private keys
Set up the provider with the specified kairos testnet URL. A provider in web3 is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from kairos to quicknode
Create a sender's wallet with the private key using web3.eth.accounts.privateKeyToAccount
Create a fee payer's wallet with the private key using web3.eth.accounts.privateKeyToAccount
Define the transaction object.
Set type: TxType.FeeDelegatedValueTransferMemo
for transaction to send a memo value transfer with a fee payer
Set value: toPeb("0.01")
to define the value to be transfered, use toPeb
to convert Klay to Peb
Set data: "0x1234567890"
to define the memo value attached with the transaction
Set others params like from, to
Sign the transaction with sender account using signTransaction
Sign the transaction with fee payer account using signTransactionAsFeePayer
Send the transaction to blockchain. It will return the transaction receipt