Skip to main content

Getting a Contract

Connect to your smart contract using its contract address.

Connect to a contract

const sdk = useSDK();

const contract = await sdk.getContract("{{contract_address}}");
View in React SDK Documentation

Get Contract From ABI

If you have compiled your Solidity code into an ABI, you can use it to connect to your contract.

This is useful if you want to interact with a contract that was not deployed using thirdweb.

const sdk = useSDK();

// Import your ABI from a JSON file
import myABI from "./path/to/myABI.json";

const contract = sdk.getContractFromAbi(
// Pass in the "abi" field from the JSON file
View in React SDK Documentation