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