Write (SmartContractExecution TxType)
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 up a wallet client using createWalletClient, configured with the Kairos chain, an HTTP transport, and the sender’s private key converted to an account.
Set the Abi generated from solidity code
Define contract address to interact with
Encode the function name and parameter with the encodeFunctionData function
Create a transaction request for a value transfer using prepareTransactionRequest, specifying the sender’s account, recipient address, value to transfer (0 KLAY in this example), and transaction type (TxType.SmartContractExecution).
Send the transaction to the Kaia blockchain using the wallet client’s sendTransaction method, and log the transaction hash.
Uses the public client to query the number function (a view function that doesn’t modify state) from the contract. This retrieves the current value of the number variable, which should reflect the timestamp set by the previous transaction (if successful).