0.2.6 • Published 18 days ago

@reslear/metakeep-wagmi-connector v0.2.6

Weekly downloads
-
License
MIT
Repository
github
Last release
18 days ago

metakeep-wagmi-connector

Version Downloads install size

Connector for integrating wagmi v2.x with the MetaKeep.xyz platform.

Features:

  • ⚙ Connects with wagmi v2 (React/Core) or use-wagmi (Vue)
  • 🔮 Supports Web3Modal
  • 📐 Session validations and caching
  • 💡 Lightweight ~26kB
  • ✍️ TypeScript/ESM/Dynamic import

Installation

You can install metakeep-wagmi-connector using npm, yarn, or pnpm:

pnpm add @reslear/metakeep-wagmi-connector

Once installed, add metakeep to your wagmi configuration as a connector. Here's a sample configuration:

import { metaKeep } from '@reslear/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!

Usage

The connector will automatically handle the authentication process with wagmi. see the wagmi documentation for more information.

const { connect } = useConnect()

connect({ connector: 'metakeep' })

Metakeep Provider access

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 '@reslear/metakeep-wagmi-connector'

const { connector } = useAccount()

const provider = <MetaKeepProvider>await connector.value?.getProvider()

const authorizedUser = provider.getUser()
console.log(authorizedUser)

Migration Guide

  1. Follow the installation steps Wagmi migrate from v1 to v2.
  2. Update the @reslear/metakeep-wagmi-connector to the latest version.
  3. Update the connector configuration to use the new import
-import { MetaKeepConnector } from '@reslear/metakeep-wagmi-connector';
+import { metaKeep } from '@reslear/metakeep-wagmi-connector'
  1. Update the connector configuration to use the new import
  connectors: [
-    new MetaKeepConnector({
-     chains,
-      options: {
-        appId: import.meta.env.VITE_META_KEEP_APP_ID,
-      },
-    }),
+   metaKeep({
+     appId: import.meta.env.VITE_META_KEEP_APP_ID,
+   }),
  ],

Also connector for Wagmi v1 docs are still available at 0.x branch

Links

Related connectors

License

This project is licensed under the terms of the MIT license.

0.2.6

18 days ago

0.2.5

1 month ago

0.2.3

1 month ago

0.2.2

1 month ago

0.2.4

1 month ago

0.2.1

1 month ago

0.1.0

1 month ago

0.0.3

1 month ago

0.2.0

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.6

1 month ago

0.0.2

2 months ago

0.0.1

2 months ago