Skip to content

Commit

Permalink
Fix EVM balance (#2124)
Browse files Browse the repository at this point in the history
  • Loading branch information
onnovisser authored May 13, 2024
1 parent fd321f5 commit 954ff6e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions centrifuge-react/src/components/WalletProvider/evm/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,17 @@ export function useEvmProvider() {
}

export function useNativeBalance(address?: string) {
const provider = useEvmProvider()
const { evm } = useWallet()

const addr = address || evm.selectedAddress

const query = useQuery(
['evmNativeBalance', addr, evm.chainId],
async () => {
const balance = await provider!.getBalance(addr!)
const balance = await evm.getProvider(evm.chainId!).getBalance(addr!)
return new CurrencyBalance(balance.toString(), 18)
},
{ enabled: !!provider && !!addr }
{ enabled: !!evm.chainId && !!addr }
)
return query
}
Expand Down

0 comments on commit 954ff6e

Please # to comment.