@privy-io/wagmi-connector
TypeScript icon, indicating that this package has built-in type declarations

0.1.13 • Public • Published

WAGMI 🤝 Privy

wagmi-privy

This package only supports WAGMI V1. Please use our new @privy-io/wagmi library if you want to use WAGMI V2.

This plugin allows you to use WAGMI hooks with the Privy SDK. To integrate, simply wrap your components like so. (example next.js code below) (the below shows using goerli and mainnet)

The idea is that you first configure WAGMI as you would usually, and pass that to the PrivyWagmiConnector instead:

import {goerli, mainnet} from '@wagmi/chains';
import type {AppProps} from 'next/app';
import {configureChains} from 'wagmi';
import {publicProvider} from 'wagmi/providers/public';

import {PrivyProvider} from '@privy-io/react-auth';
import {PrivyWagmiConnector} from '@privy-io/wagmi-connector';

const configureChainsConfig = configureChains([mainnet, goerli], [publicProvider()]);

export default function App({Component, pageProps}: AppProps) {
  return (
    <PrivyProvider appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID as string}>
      <PrivyWagmiConnector wagmiChainsConfig={configureChainsConfig}>
        <Component {...pageProps} />
      </PrivyWagmiConnector>
    </PrivyProvider>
  );
}

Then, in your application, feel free to use WAGMI hooks like useAccount, useSignMessage, useEnsName, ...

Please do not use the useConnect hook to connect, but rather use {login} = usePrivy(). Privy controls the session and syncs it with WAGMI.

Package Sidebar

Install

npm i @privy-io/wagmi-connector

Weekly Downloads

2,440

Version

0.1.13

License

Apache-2.0

Unpacked Size

34.1 kB

Total Files

7

Last publish

Collaborators

  • koleok
  • joshnaviprivy
  • payton-privy
  • privy-bot
  • ankushswar1
  • ahollenbach
  • asta-li
  • sternhenri