Web3Button
Button that executes a function on a smart contract from the connected wallet when clicked.
It ensures the following criteria before attempting to call the contract function:
There is a connected wallet (if there is not, it renders a
ConnectWalletcomponent instead.The connected wallet is on the correct network as specified in the
ThirdwebProvider'sactiveChainprop. if it is not, it renders a "switch network" button instead.
If the action you are performing is async, make sure to return a Promise from the action function so that the SDK knows when the action is complete. This can be done by either using async/await or by returning a Promise .
Example