Interact With Your Smart Contract
With blockchain explorer
With verified contracts on blockchain explorer, we can easily interact with them via blockchain explorer UI.
Read contract
Public fields of the contract:
They are displayed on the explorer, at Read contract
tab:
Public fields and view functions are displayed on the explorer.
Write contract
Contract have a function:
Since it is publicly set, user can interact with this function via explorer's UI:
To interact with contract, you have to connect your wallet to the explorer.
With Hardhat
The same as above method, we will call withdraw()
on Lock
contract.
Back to your sample project, at scripts
folder, add following withdraw.ts
file:
Then run it by:
And the result:
With a frontend and web3.js
Please head to next section Integrate Your Smart Contract With a Frontend.
Last updated