-
Hi, I'm trying to connect my wagmi-based app to a local Hardhat node, e.g. on http://localhost:8545. I'd like to use Metamask as part of the development experience. Should I use the InjectedConnector (with Metamask pointing to http://localhost:8545) or us the JsonRPCProvider pointing to http://localhost:8545? Many thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
import { chain } from 'wagmi'
import { InjectedConnector } from 'wagmi/connectors/injected'
const connector = new InjectedConnector({
chains: [chain.hardhat],
}) |
Beta Was this translation helpful? Give feedback.
-
Hey @tmm, awesome work! Having some trouble with the above: import { chain } from 'wagmi'
import { InjectedConnector } from 'wagmi/connectors/injected'
const connector = new InjectedConnector({
chains: [chain.hardhat],
})
<Provider
connectors={[connector]}
>
<NextHead>
<title>wagmi</title>
</NextHead>
<Component {...pageProps} />
</Provider> It thinks it is connected to hardhat, but it is displaying data from ethereum mainnet. I have a feeling this is related to the How do we properly override the provider? |
Beta Was this translation helpful? Give feedback.
InjectedConnector
configured withchain.hardhat
should work fine: