useContract() function
Use this resolve a contract address to a smart contract instance.
Example
const { contract, isLoading, error } = useContract(
"{{contract_address}}",
"nft-drop",
);
Signature:
export declare function useContract<TContractType extends ContractType>(
contractAddress: RequiredParam<ContractAddress>,
_contractType: TContractType,
): UseContractResult<
TContractType extends PrebuiltContractType
? ContractForPrebuiltContractType<TContractType>
: SmartContract
>;
Parameters
Parameter | Type | Description |
---|---|---|
contractAddress | RequiredParam<ContractAddress> | the address of the deployed contract |
_contractType | TContractType | the type of the contract |
Returns:
UseContractResult<TContractType extends PrebuiltContractType ? ContractForPrebuiltContractType<TContractType> : SmartContract>
a response object that includes the contract once it is resolved