Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(avalanche mainnet) Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.5.0) #30

Open
ChrisChan888 opened this issue Feb 3, 2022 · 6 comments

Comments

@ChrisChan888
Copy link

      const callProvider = new Provider(
        new ethers.providers.JsonRpcProvider(
          "https://api.avax.network/ext/bc/C/rpc"
        )
      );
      callProvider.init();
      const daiContract = new Contract(daiAddress, daiAbi);
      const poolDaiBalanceCall = daiContract.balanceOf(poolAddress);
      const myDaiBalanceCall = daiContract.balanceOf(account);
      const [poolDaiBalance, myDaiBalance] = await callProvider.all([
        poolDaiBalanceCall,
        myDaiBalanceCall,
      ]);

in

const [poolDaiBalance, myDaiBalance] = await callProvider.all([
        poolDaiBalanceCall,
        myDaiBalanceCall,
      ]);

Error pop up, Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.5.0)

This was referenced Feb 3, 2022
@pajicf
Copy link
Contributor

pajicf commented Feb 3, 2022

try setting the chainId when instantiating the JsonRpcProvider,

new ethers.providers.JsonRpcProvider("https://api.avax.network/ext/bc/C/rpc", 43114)

@ChrisChan888
Copy link
Author

try setting the chainId when instantiating the JsonRpcProvider,

new ethers.providers.JsonRpcProvider("https://api.avax.network/ext/bc/C/rpc", 43114)

Thanks for your reply, it's still not work after setting chainId.

@pajicf
Copy link
Contributor

pajicf commented Feb 4, 2022

Have you tried setting it on the ethers-multicall provider instance instead?
_multiCallProvider = new Provider(yourJsonRpcProviderInstance, chainId);

@ChrisChan888
Copy link
Author

Have you tried setting it on the ethers-multicall provider instance instead? _multiCallProvider = new Provider(yourJsonRpcProviderInstance, chainId);

Yeah! Thank you!

@DeabitTech
Copy link

Have you tried setting it on the ethers-multicall provider instance instead? _multiCallProvider = new Provider(yourJsonRpcProviderInstance, chainId);

Yeah! Thank you!

so you resolved? i have the same issue

@rishavanand
Copy link

rishavanand commented Feb 21, 2024 via email

Repository owner deleted a comment from PuchkovaAnastasia Feb 22, 2024
Repository owner deleted a comment from ARRNAV26 Feb 23, 2024
Repository owner deleted a comment Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@rishavanand @pajicf @DeabitTech @ChrisChan888 and others