Docs

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 as specified in the activeChain prop of ThirdwebProvider. if wallet is connected to any other network, it renders a switch network button instead.
import { Web3Button } from "@thirdweb-dev/react-native";

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.
import { Web3Button } from "@thirdweb-dev/react-native";
function App() {
return (
<Web3Button
contractAddress="0x..." // Your smart contract address
action={async (contract) => {
await someAction(contract);
}}
>
Execute Action
</Web3Button>
);
}

Props

Functionality

Callbacks

Appearance