Created
October 20, 2023 03:31
-
-
Save XuNeal/a39128186dbc6649a137512f78c67f07 to your computer and use it in GitHub Desktop.
imKey With Wagmi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { configureChains, createConfig } from '@wagmi/core' | |
import { mainnet, polygon, optimism } from '@wagmi/core/chains' | |
import { alchemyProvider } from '@wagmi/core/providers/alchemy' | |
import { publicProvider } from '@wagmi/core/providers/public' | |
import { InjectedConnector } from '@wagmi/core/connectors/injected' | |
import ImKeyProvider from "@imkey/web3-provider" | |
const imKeyProvider = new ImKeyProvider({ | |
rpcUrl: 'put your infura address here', | |
chainId: 1, | |
headers: { | |
"": "" | |
} | |
}) | |
// must enable before call any API | |
imKeyProvider.enable() | |
const { chains, publicClient } = configureChains( | |
[mainnet, polygon, optimism], | |
[imKeyProvider], | |
) | |
const config = createConfig({ | |
autoConnect: true, | |
connectors: [new InjectedConnector({ chains })], | |
publicClient, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment