• Beta

    Get data from a contract read-function call

    Type Parameters

    • TContractAddress extends string

    • TContract extends ValidContractInstance

    • TContractInstance extends ValidContractInstance

    • TFunctionName extends string

    • TArgs extends unknown[]

    • TReturnType extends any

    Parameters

    • contract: TContractInstance extends ValidContractInstance
          ? RequiredParam<TContractInstance>
          : TContractAddress extends never
              ? RequiredParam<SmartContract<BaseContractForAddress<TContractAddress>>>
              : RequiredParam<SmartContract<BaseContract>>

      the contract instance of the contract to call a function on

    • functionName: RequiredParam<TFunctionName & string>

      the name of the function to call

    • Optional args: TArgs

      The arguments to pass to the function (if any), with optional call arguments as the last parameter

    • Optional overrides: CallOverrides

    Returns UseQueryResult<TReturnType, unknown>

    a response object that includes the data returned by the function call

    Example

    const { contract } = useContract("{{contract_address}}");
    const { data, isLoading, error } = useContractRead(contract, "functionName", ...args);

    See

    Documentation

Generated using TypeDoc