Write
컨트랙트의 일부 상태를 업데이트해야 할 때 스마트 컨트랙트와 상호작용하는 **"트랜잭션"**을 만들 수 있습니다.
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()