Read
You can call functions in Smart Contract via "Call" RPC API. What you can call here is limited to view functions that is not changing any states in the Contract.
Import the @kaiachain/ethers-ext modules to add kaia features on web3.
Initializes a public client for read-only interactions with the Kaia blockchain.
Set the Abi generated from solidity code
Define contract address to interact with
The readContract
method is called on the public client to query the number function (a view function that doesn’t modify state) from the contract at the specified address.