Skip to main content

useContract() function

Use this resolve a contract address to a smart contract instance.

Example

const { contract, isLoading, error } = useContract("{{contract_address}}", ABI);

Signature:

export declare function useContract(
contractAddress: RequiredParam<ContractAddress>,
_abi: ContractInterface,
): UseContractResult<SmartContract>;

Parameters

ParameterTypeDescription
contractAddressRequiredParam<ContractAddress>the address of the deployed contract
_abiContractInterfacethe ABI of the contract to use

Returns:

UseContractResult<SmartContract>

a response object that includes the contract once it is resolved