Miss any of our Open RFC calls?Watch the recordings here! »

@umaprotocol/web3-subprovider

4.74.5 • Public • Published

@ledgerhq/web3-subprovider

Library for Ledger Hardware Wallets.

Github, Ledger Devs Slack

API

Table of Contents

SubproviderOptions

Type: {networkId: number, path: string?, askConfirm: boolean?, accountsLength: number?, accountsOffset: number?}

Properties

createLedgerSubprovider

Create a HookedWalletSubprovider for Ledger devices.

Parameters

  • getTransport function (): Transport<any> gets lazily called each time the device is needed. It is a function that returns a Transport instance. You can typically give ()=>TransportU2F.create()
  • options SubproviderOptions?

Examples

import Web3 from "web3";
import createLedgerSubprovider from "@ledgerhq/web3-subprovider";
import TransportU2F from "@ledgerhq/hw-transport-u2f";
import ProviderEngine from "web3-provider-engine";
import RpcSubprovider from "web3-provider-engine/subproviders/rpc";
const engine = new ProviderEngine();
const getTransport = () => TransportU2F.create();
const ledger = createLedgerSubprovider(getTransport, {
accountsLength: 5
});
engine.addProvider(ledger);
engine.addProvider(new RpcSubprovider({ rpcUrl }));
engine.start();
const web3 = new Web3(engine);

Returns HookedWalletSubprovider

Install

npm i @umaprotocol/web3-subprovider

DownloadsWeekly Downloads

172

Version

4.74.5

License

Apache-2.0

Unpacked Size

138 kB

Total Files

22

Last publish

Collaborators

  • avatar
  • avatar
  • avatar
  • avatar