Creates a useQuery hook for a contract call.
useQuery
import { createContractQuery } from "thirdweb/react";import { totalSupply } from "thirdweb/extensions/erc20";const useTotalSupply = createContractQuery(totalSupply);const { data, isLoading } = useTotalSupply({ contract });
function createContractQuery( readCall: ( options: BaseTransactionOptions<opts, abi>, ) => Promise<result>,): ( options: BaseTransactionOptions<opts, abi> & { queryOptions?: Partial<{ enabled: boolean }>; },) => UseQueryResult<result, Error>;
A function that performs the contract function call and returns the result.
let readCall: ( options: BaseTransactionOptions<opts, abi>,) => Promise<result>;
let returnType: ( options: BaseTransactionOptions<opts, abi> & { queryOptions?: Partial<{ enabled: boolean }>; },) => UseQueryResult<result, Error>;
An object containing the created useRead hook.
useRead