You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The main issue is that web3-react/core and others are using "@ethersproject/providers": "^5",
This creates issues with BigNumber vs the native BigInt used in ethers v6
Take this code for instance
function useBalances(provider?: ReturnType<Web3ReactHooks["useProvider"]>, accounts?: string[]): bigint[] | undefined {
const [balances, setBalances] = useState<bigint[] | undefined>();
useEffect(() => {
if (provider && accounts?.length) {
let stale = false;
void Promise.all(accounts.map((account) => provider.getBalance(account))).then((balances: Array<bigint>) => {
if (stale) return;
setBalances(balances);
});
return () => {
stale = true;
setBalances(undefined);
};
}
}, [provider, accounts]);
return balances;
}
It complains at accounts.map((account) => provider.getBalance(account))).then((balances: Array<bigint>)
because provider used is the one from web3-react that is coming from @ethersproject/providers which has this signature
The main issue is that web3-react/core and others are using
"@ethersproject/providers": "^5",
This creates issues with BigNumber vs the native BigInt used in ethers v6
Take this code for instance
It complains at
accounts.map((account) => provider.getBalance(account))).then((balances: Array<bigint>)
because provider used is the one from web3-react that is coming from
@ethersproject/providers
which has this signatureWhile I am trying to avoid the old
@ethersproject/providers BigNumber
and use ethers v6 instead.Another side effect is that I can not use
formatEther
fromether v6
because it expect a BigIntInstead I have to import the old
@ethersproject/units
so then I can display those balances from earlier
The text was updated successfully, but these errors were encountered: