Skip to main content

useContractReader

Call external functions.

Returns THookResult<undefined | Awaited<ReturnType<GContractFunc>>>

How to import

import { useContractReader } from 'eth-hooks';

How to use

const myMainnetDAIBalance = useContractReader(mainnetDai, mainnetDai?.balanceOf, [myAddress ?? '']);

Use with the useSignerAddress hook to read your DAI balance from the blockchain:

const [myAddress] = useSignerAddress(ethersContext.signer);
const myMainnetDAIBalance = useContractReader(mainnetDai, mainnetDai?.balanceOf, [myAddress ?? '']);

To learn more

Go here for this hooks full API documentation.