Skip to content

Does useBalance only retrieve eth mainnet balance? #87

Answered by tmm
lsbyerley asked this question in Q&A
Discussion options

You must be logged in to vote

It should work for all networks. Does your ethers.js Provider use the current chain id?

import { providers } from 'ethers'
import { Provider } from 'wagmi'

// Use `chainId` to make ethers.js provider network-aware
const provider = ({ chainId }) =>
  new providers.InfuraProvider(chainId, 'Your infura id')

const App = () => (
  <Provider provider={provider}>
    <YourRoutes />
  </Provider>
)

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@lsbyerley
Comment options

Answer selected by lsbyerley
Comment options

You must be logged in to vote
10 replies
@lsbyerley
Comment options

@tmm
Comment options

@lsbyerley
Comment options

@tmm
Comment options

@JanRuettinger
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants