Write
You can make a "transaction" interacting with a Smart Contract when you **need to update some state ** in the contract.
Import the ethers and @kaiachain/ethers-ext modules to add kaia features on ethers.js.
Define sender address and private key
Set up the provider with the specified kairos testnet URL. A provider in ethers is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from kairos to quicknode
create a wallet from sender private key and web3 provider
Set the Abi generated from solidity code
Define contract address to interact with
Create a contract instance with ethers.Contract, fill in params contractAddr, abi, provider. You can read and write the contract through this instance
Get the number value before updated by using method counter.number()
Create a transaction data to update the number value
The wait function returns the tx receipt if it is completed in the blockchain.
Get the updated value number by using method counter.number()