useContractRead
Generic hook for reading any data from a smart contract via it’s function/view/variable name.
If you have cached the ABI of your smart contract using thirdweb generate , the functionName and args parameters are strongly typed according to your smart contract’s ABI.
Example
Provide your smart contract instance from useContract
, a function name and the arguments to pass to the function (if any).
For example, to read the value of a view on your smart contract called getName
you would do the following:
Parameters
Returns
Query result object that includes the data returned by the function call