Cancel
TxTypeCancel cancels the execution of the transaction with the same nonce in the transaction pool. This transaction type is useful when a submitted transaction seems unprocessed for a certain amount of time.
Import the web3 and @kaiachain/web3js-ext packages to add kaia features on web3
Define sender, fee payer addresses, and their *private keys**
Set up the provider with the specified kaia Baobab testnet URL. A provider in web3 is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from baobab to allthatnode
Create a KlaytnWeb3
instance using the provider
Convert the sender's private key to an account with privateKeyToAccount
Define a FeeDelegatedCancel transaction with params: type: TxType.FeeDelegatedCancel
, from: senderAddr
Sign the transaction with the sender account
Convert the fee payer's private key to an account
Sign the transaction as a fee payer
Send the signed transaction and log the receipt