npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

ledger-wallet-provider

v2.0.1-beta.4

Published

Ledger Nano S wallet provider for the Web3 ProviderEngine

Readme

LedgerWalletProvider

The LedgerWalletProvider lets your dapp communicate directly with a user's Ledger Nano S using the zero client provider engine developed by Metamask.

Instead of setting your web3's provider to an HttpProvider or IpcProvider, you can create a custom provider using the provider engine and tell it to use LedgerWalletProvider for all id management requests (e.g getAccounts, approveTransaction and signTransaction). This way, your users can confirm your dapp's transactions directly from their Ledger Nano S!

Requirements

In order for your dapp to play nicely with the LedgerWallet over U2F, it will need to be served over https. In addition to this, your browser must support U2F. Firefox users can use this U2F extension. If on chrome or opera, LedgerWalletProvider will automatically polyfill U2F support for you.

Installation

npm install ledger-wallet-provider --save

Usage

In order to have a working provider you can pass to your web3, you will need these additional dependencies installed:

npm install web3-provider-engine --save
npm install web3 --save

In your project, add the following:

var Web3 = require('web3');
var ProviderEngine = require('web3-provider-engine');
var RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
var LedgerWalletSubproviderFactory = require('ledger-wallet-provider').default;

var engine = new ProviderEngine();
var web3 = new Web3(engine);

var ledgerWalletSubProvider = async LedgerWalletSubproviderFactory();
engine.addProvider(ledgerWalletSubProvider);
engine.addProvider(new RpcSubprovider({rpcUrl: '/api'})); // you need RPC endpoint
engine.start();

web3.eth.getAccounts(console.log);

To change derivation path that will be used to derive private/public keys on your nano, modify snippet above as follows

var derivation_path = "44'/60'/103'/0'";
var ledgerWalletSubProvider = async LedgerWalletSubproviderFactory(derivation_path);

All paths must start with 44'/60' or 44'/61'.

Note: In order to send requests to the Ledger wallet, the user must have done the following:

  • Plugged-in their Ledger Wallet Nano S
  • Input their 4 digit pin
  • Navigated to the Ethereum app on their device
  • Enabled 'browser' support from the Ethereum app settings

It is your responsibility to show the user a friendly message, instructing them to do so. In order to detect when they have completed these steps, you can poll web3.eth.getAccounts which will return undefined until the Ledger Wallet is accessible.

If you would like to detect whether or not a user's browser supports U2F, you can call the isSupported convenience method on the ledgerWalletSubProvider:

var LedgerWalletSubproviderFactory = require('ledger-wallet-provider').default;

var ledgerWalletSubProvider = LedgerWalletSubproviderFactory();
ledgerWalletSubProvider.isSupported()
    .then(function(isSupported) {
        console.log(isSupported ? 'Yes' : 'No');
    });

This might be helpful if you want to conditionally show Ledger Nano S support to users who could actually take advantage of it.

Development

Running tests

Currently we provide only kind of end to end tests. As we are testing integration with physical device it has to be manual process. There are following steps:

Obtain dependencies

Run yarn command.

Prepare config.js

Copy config.js.example to config.js and edit it setting up your Nano's public keys. You can obtain them using myetherwallet.

Run ganche-cli (former testrpc)

Run yarn ganache command.

Transfer test ether to Nano accounts that will be used in tests

Run yarn test-e2e-setup command.

Run tests using node

Change Nano's settings - disable browser support.
Run yarn test-e2e-node command.

Run tests in browser

Change Nano's settings - enable browser support.
Run yarn test-e2e-web command Browser should open on url https://localhost:8080. Open dev console (F12) and check console for errors.