Skip to content
This repository has been archived by the owner on Feb 14, 2024. It is now read-only.

LedgerHQ/ledger-wagmi-connector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

@ledgerhq/ledger-wagmi-connector is a connector for the popular wagmi library based on the Ledger Connect Kit, @ledgerhq/connect-kit.

This connector can be used to add a Ledger button to your DApp. Have a look at the Ledger developer portal for more information on Connect Kit and the Ledger button.

How to use

Here is an example of a wagmi client using the Ledger wagmi connector.

import { configureChains, defaultChains } from 'wagmi';
import { publicProvider } from 'wagmi/providers/public';
import { LedgerConnector } from '@ledgerhq/ledger-wagmi-connector';

const { chains } = configureChains(defaultChains, [
  publicProvider()
]);

export const connectors = {
  ledger: new LedgerConnector({
    chains,
    options: {
      enableDebugLogs: false,
      // passed to WalletConnect
      chainId: 1,
      // specify if no rpc, passed to WalletConnect
      infuraId: 'YOUR_INFURA_ID',
      // specify chain:URL if no infuraId, passed to WalletConnect
      rpc: {
        1: 'https://cloudflare-eth.com/', // Mainnet
        137: 'https://polygon-rpc.com/',  // Polygon
      }
    }
  }),
};

Contributing

You need to have a recent Node.js and yarn installed.

Install dependencies

yarn install

Build

Build the Connector

yarn build

Lint

Check code quality with

yarn lint

Documentation

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