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

web3-provider-ledger

v1.0.6

Published

A web3 provider for signing transactions with Ledger hardware wallet.

Readme

Ledger web3 Provider

CircleCI npm version npm downloads dependencies devDependencies license

This web3 provider allows Ethereum transactions to be signed with a Ledger device.

Features

  • Lightweight, with minimal dependencies
  • Easy to use; just plug it in wherever a web3 provider is expected

Installing

Yarn:

$ yarn add web3-provider-ledger

npm:

$ npm install --save web3-provider-ledger

Usage

Let's assume we are using the ethjs library. This library, like Web3, is designed to be constructed with an instance of a web3 provider.

import Eth from 'ethjs';
import LedgerProvider from 'web3-provider-ledger';

const eth = new Eth(new LedgerProvider());

That's all you need to do in order to get an instance of ethjs, but this particular instance is only capable of generating signed transactions.

Here's one way you might end up with a transaction for interacting with a smart contract:

// Use the ethjs contract API to build a convenience wrapper for a contract
const myContract = eth.contract(myContractAbi).at(myContractAddress);

// Get the raw signed transaction
const tx = await myContract.myFunction(...myFunctionArgs);

At this point, tx gives us a signed transaction. We still need to send the transaction, which requires a network-capable provider. For this, you can use the built-in Eth.HttpProvider or look for an injected provider via the global web3.currentProvider.

Here's what this might look like:

// Constract a network-capable instance of ethjs
const ethNet = new Eth(web3.currentProvider);

// Use the network-capable provider to *send* the transaction
const txId = await ethNet.sendRawTransaction(tx);

Advanced Usage

See the API Reference for detailed code-level documentation.

In addition to the provider, this library includes a LedgerDevice, which allows operations to be performed directly on the device. This can be useful for account discovery (LedgerDevice#listAddresses()), which can be used to allow users to choose which account they would like to use. The index of the preferred account can then be provided to a new device via the accountIndex attribute, and this device can be given to LedgerProvider via its device attribute.

For example, here is how you might get a list of account addresses on the device:

import LedgerDevice from 'web3-provider-ledger/device';

const device = new LedgerDevice();
const accounts = await device.listAddresses();

Let's say the user has selected the account at index 3. To use that account, you would then construct the provider as follows:

import Eth from 'ethjs';
import LedgerDevice from 'web3-provider-ledger/device';
import LedgerProvider from 'web3-provider-ledger';

// Simple form
const eth = new Eth(new LedgerProvider({ accountIndex: 3 }));

// Advanced form (equivalent result to the simple form above)
const eth = new Eth(new LedgerProvider({
  device: new LedgerDevice({ accountIndex: 3 })
}));

Contributing

See CONTRIBUTING.md.

Code of Conduct

See CODE_OF_CONDUCT.md.

Security

See SECURITY.md.

License

This library is licensed under the MIT license.