Account Update
feeDelegation
Import the ethers and @kaiachain/ethers-ext packages to add kaia features on ethers.js
Declaring sender , fee payer address and private keys.
senderNewPriv is the private key to be updated
Creating a JSON-RPC provider instance with the specified URL
Also, you can change the default provider. For example, using the alchemy provider.
Compute new public key from new private key
Creating a transaction object to update new publickey
Populate the transaction with sender's wallet.
Sign the transaction with senderWallet
Send the transaction to blockchain using fee payer's wallet. Function sendTransactionAsFeePayer
adds a signature with FeePayer’s private key to the sender’s signature and transmits it to the blockchain network.
Wait for the transaction receipt