3.0.0 • Published 8 months ago

@toruslabs/torus-wagmi-connector v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
8 months ago

About

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

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

How to use

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

import { TorusConnector } from "@toruslabs/torus-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 TorusConnector({ 
      chains: chains,
      options: {
        chainId: "0x1",
        host: "mainnet",
      },
    }),
    new InjectedConnector({ chains }),
  ],
  provider,
});

Documentation

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

3.0.0

8 months ago

2.0.0

10 months ago

1.0.2

1 year ago

1.0.1

1 year ago