Skip to content

Supported chains #42

Answered by tmm
jasheal asked this question in Q&A
Jan 6, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Yes, in wagmi you define supported chains on a per connector-basic. InjectedConnector, WalletConnectConnector, etc. all have a chains property. For example,

const connectors = [
  WalletConnectConnector({
    chains: [chain.mainnet, chain.rinkeby],
    options: {
      ...
    },
  })
]

When someone connects to an unsupported network, you can use the useNetwork hook to identify that it is unsupported (data.unsupported) and show a prompt for switching the network.

Will consider adding unsupported somewhere to response of connector.connect as well.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@tmm
Comment options

@jasheal
Comment options

Answer selected by tmm
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