Skip to main content

Connect to a Contract

Connect to a deployed smart contract to start interacting with it.

Usage​

Contract contract = sdk.GetContract("{{contract_address}}");

Configuration​

address (required)​

The address of the smart contract you want to connect to.

Must be a string.

Import Smart Contracts

If your smart contract was not deployed using thirdweb, you’ll need to import it on the dashboard.

Using Contract ABI​

Optionally, (if you don’t want to use the import feature), you can provide your smart contract’s ABI to the second parameter of the getContract method. Useful when developing on a local node, where it may be faster to use the ABI than to import the contract using the dashboard.

The ABI is only necessary if you have not deployed your contract with, or imported your contract to the thirdweb dashboard.

Contract contract = sdk.GetContract("0x...", "my-abi");