Skip to content

Using Alchemy with the Injected Connector configuration #338

Answered by connorphill
connorphill asked this question in Q&A
Discussion options

You must be logged in to vote

Something that I missed in the documentation is the direct reference of the ethers package and in that packages code there is an AlchemyProvider() method. This resolved my issue.

wagmi Documentation - provider (optional)

My updated code:

import { providers } from 'ethers'
import { Provider, defaultChains } from 'wagmi'
import { InjectedConnector } from 'wagmi/connectors/injected'

const provider = ({ chainId }) => new providers.AlchemyProvider(chainId, process.env.ALCHEMY_API);

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by connorphill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants