ThirdwebSDK.getContractFromAbi() method
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Get an instance of a Custom contract from a json ABI
Example
// 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,
);
Signature:
getContractFromAbi(address: string, abi: ContractInterface): Promise<SmartContract<ethers.BaseContract>>;
Parameters
Parameter | Type | Description |
---|---|---|
address | string | the address of the deployed contract |
abi | ContractInterface | the JSON abi |
Returns:
Promise<SmartContract<ethers.BaseContract>>
the contract