Getting a Contract
Connect to your smart contract using its contract address.
Connect to a contract
- React
- Javascript
- Python
- Go
- Unity
const { contract, isLoading, error } = useContract("{{contract_address}}");
const contract = await sdk.getContract("{{contract_address}}");
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
// Ensure your sdk is initialized to the same network as the contract
Contract contract = sdk.GetContract("<your-smart-contract-address>");
// For marketplaces and packs:
Marketplace marketplace = contract.marketplace;
Pack pack = contract.pack;
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.
- React
- Javascript
- Python
- Go
- Unity
const sdk = useSDK();
// Import your ABI from a JSON file
import myABI from "./path/to/myABI.json";
const contract = sdk.getContractFromAbi(
"{{contract_address}}",
// Pass in the "abi" field from the JSON file
myABI.abi
);
// Import your ABI from a JSON file
import myABI from "./path/to/myABI.json";
const contract = sdk.getContractFromAbi(
"{{contract_address}}",
// Pass in the "abi" field from the JSON file
myABI.abi
);
This feature is missing a code snippet or might not be supported yet.
Check the Python SDK Reference for more information.
Reach out on Discord for further assistance!
This feature is missing a code snippet or might not be supported yet.
Check the Go SDK Reference for more information.
Reach out on Discord for further assistance!
Contract contract = sdk.GetContract("<your-smart-contract-address>", "<your-contract-abi>");