Skip to content

WillEtheridge/web3auth-wagmi-connector

 
 

Repository files navigation

Ledger

Web3Auth Wagmi Connector

Wagmi Connector for Web3Auth

About

@web3auth/web3auth-wagmi-connector is a connector for the popular wagmi library built on top of the @web3auth/web3auth .

It can be used to initialize a wagmi client that will seemlessly manage the interaction of your DApp with Web3Auth.

How to use

Here is an example of a wagmi client using both the Web3AuthConnector and the default InjectedConnector respectively.

import { Web3AuthConnector } from '@web3auth/web3auth-wagmi-connector';
import { chain, configureChains, createClient } from 'wagmi';
import { InjectedConnector } from 'wagmi/connectors/injected';
import { publicProvider } from 'wagmi/providers/public';

const { chains, provider } = configureChains(
  [chain.mainnet, chain.polygon],
  [publicProvider()]
);

const wagmiClient = createClient({
  autoConnect: true,
  connectors: [
    new Web3AuthConnector({ 
      chains,
      options: {
        enableLogging: true,
        clientId: "YOUR_CLIENT_ID", // Get your own client id from https://dashboard.web3auth.io
        network: "testnet", // web3auth network
        chainId: "0x1" // chainId that you want to connect with
      },
    }),
    new InjectedConnector({ chains }),
  ],
  provider,
});

Documentation

Have a look at the wagmi repo and the wagmi doc to learn more on connectors and wagmi.

About

Web3Auth connector for wagmi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 89.5%
  • JavaScript 10.0%
  • Shell 0.5%