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}}");

Signature:

export declare function useContract<
TContract extends ValidContractInstance = SmartContract,
>(
contractAddress: RequiredParam<ContractAddress>,
): UseContractResult<TContract>;

Parameters

ParameterTypeDescription
contractAddressRequiredParam<ContractAddress>the address of the deployed contract

Returns:

UseContractResult<TContract>

a response object that includes the contract once it is resolved