wevm / wagmi

React Hooks for Ethereum
https://wagmi.sh
MIT License
5.79k stars 968 forks source link

The contract function "balanceOf" returned no data ("0x") #4088

Closed dspoonia7 closed 1 week ago

dspoonia7 commented 1 week ago

Check existing issues

Describe the bug

Getting this error with default wagmi provided boilerplate:

"The contract function "balanceOf" returned no data ("0x").

This could be due to any of the following:
- The contract does not have the function "balanceOf",
- The parameters passed to the contract function may be invalid, or
- The address is not a contract.

Contract Call:
address:   0xFBA3912Ca04dd458c843e2EE08967fC04f3579c2
function:  balanceOf(address owner)
args:               (0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC)

Docs: https://viem.sh/docs/contract/multicall
Version: viem@2.6.1"

Link to Minimal Reproducible Example

No response

Steps To Reproduce

  1. Clone and install wagmi-v2-example locally
  2. npm install
  3. add active project ID to WC_PROJECT_ID in .env.local

What Wagmi package(s) are you using?

wagmi

Wagmi Version

2.5.4

Viem Version

2.6.1

TypeScript Version

^5.2.2

Anything else?

Getting these errors in useReadContract and useReadContracts hooks.

Error stack trace:

ContractFunctionExecutionError
    at getContractError (getContractError.js:34:12)
    at readContract (readContract.js:67:98)
 Caused by: ContractFunctionZeroDataError
    at eval (getContractError.js:22:20)
    at getContractError (getContractError.js:33:7)
    at readContract (readContract.js:67:98)
github-actions[bot] commented 1 week ago

Hello @dspoonia7.

Please provide a minimal reproduction using StackBlitz, TypeScript Playground (for type issues), or a separate minimal GitHub repository.

Minimal reproductions are required as they save us a lot of time reproducing your config/environment and issue, and allow us to help you faster.

Once a minimal reproduction is added, a team member will confirm it works, then re-open the issue.