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 ConnectWallet Button instead).
- The connected wallet is on the correct network which is specified in the
activeChain
prop of ThirdwebProvider component. if wallet is connected to any other network, it renders a switch network button instead.
Usage
Render the Web3Button
component with two required props to display the button:
contractAddress
: The address of the smart contract to interact with.action
: The logic to execute when the button is clicked.