Connector for integrating wagmi v2.x with the MetaKeep.xyz platform.
Features:
- ⚙ Connects with wagmi v2
- 🔮 Supports Web3Modal
- 📐 Session validations and caching
- 🔐 Supports One-Click Auth / SIWE
- 💡 Lightweight ~26kB
- ✍️ TypeScript/ESM/Dynamic import
You can install metakeep-wagmi-connector using npm, yarn, or pnpm:
pnpm add @belongnet/metakeep-wagmi-connector
Once installed, add metakeep to your wagmi configuration as a connector. Here's a sample configuration:
import { metaKeep } from '@belongnet/metakeep-wagmi-connector'
const config = createConfig({
// ...
connectors: [
metaKeep({
appId: import.meta.env.VITE_META_KEEP_APP_ID,
}),
],
})
Make sure to set the appId
in your environment variables, for example in a .env
file:
VITE_META_KEEP_APP_ID=your-app-id
Enjoy!
The connector will automatically handle the authentication process with wagmi. see the wagmi documentation for more information.
const { connect } = useConnect()
connect({ connector: 'metakeep' })
You can use the useAccount hook to access the native connector provider.
Warning
Use this only if you know what you're doing. Instead, it's better to utilize methods at the wagmi level.
import type { MetaKeepProvider } from '@belongnet/metakeep-wagmi-connector'
const { connector } = useAccount()
const provider = <MetaKeepProvider>await connector.value?.getProvider()
const authorizedUser = provider.getUser()
console.log(authorizedUser)
- https://wagmi.sh/dev/creating-connectors
- https://github.com/blocto/blocto-sdk/blob/develop/adapters/wagmi-connector/src/connector.ts
- https://github.com/magiclabs/wagmi-magic-connector/blob/main/src/lib/connectors/dedicatedWalletConnector.ts
- https://github.com/Web3Auth/web3auth-wagmi-connector/blob/master/src/lib/connector.ts
This project is licensed under the terms of the MIT license.