Value Transfer
TxTypeValueTransfer is used when a user wants to send KAIA.
- As kaia provides multiple transaction types to make each transaction type serve a single purpose, TxTypeValueTransfer is limited to send KAIA to an externally owned account (EOA).
Fee Delegation
Import @kaiachain/viem-ext packages to add kaia features on web3
Set up sender and fee payer wallets using createWalletClient, configured with the Kairos chain, an HTTP transport, and the sender’s private key converted to an account.
Create a transaction request for a value transfer using prepareTransactionRequest, specifying the sender’s account, recipient address, value to transfer (0 KLAY in this example), and transaction type (TxType.FeeDelegatedValueTransfer).
Signing the transaction with the wallet client’s signTransaction method, and log the transaction hash.
The fee payer signs the already-signed transaction from the sender with function signTransactionAsFeePayer
, agreeing to pay the transaction fees.
Sends the fully signed, fee-delegated transaction (signed by both sender and fee payer) to the Kairos blockchain network using the kaia_sendRawTransaction
method, returning the transaction hash or response from the network.