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

Wrong eth balance for the first account generated by Ganache #11

Open
Macket opened this issue Jun 3, 2021 · 0 comments
Open

Wrong eth balance for the first account generated by Ganache #11

Macket opened this issue Jun 3, 2021 · 0 comments

Comments

@Macket
Copy link

Macket commented Jun 3, 2021

Code:

import { Provider } from 'ethers-multicall';
import { ethers } from 'ethers';

(async function() {
    const provider = new ethers.providers.JsonRpcProvider('http://localhost:8545/');
    const ethcallProvider = new Provider(provider);
    await ethcallProvider.init();

    const ganche_account_0 = '0x66aB6D9362d4F35596279692F0251Db635165871';
    const ethBalance = await provider.getBalance(ganche_account_0);
    const [ethBalanceMulticall] = await ethcallProvider.all([ethcallProvider.getEthBalance(ganche_account_0)]);

    console.log('ETH Balance:', ethers.utils.formatUnits(ethBalance));
    console.log('ETH Balance multicall:', ethers.utils.formatUnits(ethBalanceMulticall));
})()

Output:

ETH Balance: 100.0
ETH Balance multicall: 180143885.09481982
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

1 participant