Code Monkey home page Code Monkey logo

ledgerjs's Introduction


This repository hosts libraries to communicate with Ledger Nano / Nano S / Blue applications. There are implementations for Node and Browser.

Ledger Devs Slack License

Published Packages

Package Version Description
create-dapp npm Ledger DApp Ethereum starter kit
@ledgerhq/web3-subprovider npm web3 subprovider implementation for web3-provider-engine
Apps
@ledgerhq/hw-app-eth npm Ethereum Application API
@ledgerhq/hw-app-btc npm Bitcoin Application API
@ledgerhq/hw-app-xrp npm Ripple Application API
@ledgerhq/hw-app-str npm Stellar Application API
@ledgerhq/hw-app-ada npm Cardano ADA Application API
Transports
@ledgerhq/hw-transport-node-hid npm Node implementation of the communication layer, using node-hid (USB)
@ledgerhq/hw-transport-u2f npm Web implementation of the communication layer, using U2F api
@ledgerhq/react-native-hw-transport-ble npm BLE bluetooth for react-native communication layer
@ledgerhq/react-native-hid npm USB hid for react-native communication layer
@ledgerhq/hw-transport-http npm communicate to the device over HTTP. NB: DEV & testing purpose only. DO NOT use in PROD
@ledgerhq/hw-transport npm The generic interface of the communication layer
internal utility libraries
@ledgerhq/currencies npm deal with crypto currencies
Development Tools
@ledgerhq/hw-http-proxy-devserver npm HTTP server proxy to use with hw-transport-node-hid NB: DEV & testing purpose only. DO NOT use in PROD
@ledgerhq/hw-hid-cli npm CLI utility to send APDU to the device via node-hid
@ledgerhq/hw-transport-mocker npm Tool used for test to record and replay APDU calls.

Examples

Basic example:

import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-u2f"; // for browser
import AppBtc from "@ledgerhq/hw-app-btc";
const getBtcAddress = async () => {
  const transport = await Transport.create();
  const btc = new AppBtc(transport);
  const result = await btc.getWalletPublicKey("44'/0'/0'/0");
  return result.bitcoinAddress;
};
getBtcAddress().then(a => console.log(a));

When using in a browser, make sure to set up "Browser mode" in the application settings on the device if available.

More advanced examples:

  • TODO

Documentation

Contributing

Please read our contribution guidelines before getting started.

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

Install dependencies

yarn

Build

Build all packages

yarn build

Watch

Watch all packages change. Very useful during development to build only file that changes.

yarn watch

Lint

Lint all packages

yarn lint

Run Tests

First of all, this ensure the libraries are correctly building, and passing lint and flow:

yarn test

then to test on a real device...

Plug a device like the Nano S and open Bitcoin app.

Then run the test and accept the commands on the devices for the tests to continue.

yarn test-node

You can also test on the web:

yarn test-browser

make sure to configure your device app with "Browser support" set to "YES".

Deploy

Checklist before deploying a new release:

  • you have the right in the LedgerHQ org on NPM
  • you have run npm login once (check npm whoami)
  • Go to master branch
    • your master point on LedgerHQ repository (check with git config remote.$(git config branch.master.remote).url and fix it with git branch --set-upstream master origin/master)
    • you are in sync (git pull) and there is no changes in git status
  • Run yarn once, there is still no changes in git status

deploy a new release

 yarn run publish

then, go to /releases and create a release with change logs.

alternatively:

deploy a canary release (beta, etc)

 yarn run publish -- -c beta

NB: if there is a new package, AFAIK you need to manually npm publish it once on NPM.

ledgerjs's People

Contributors

amougel avatar banciur avatar btchip avatar dcrichards avatar fabioberger avatar farisissa8 avatar gre avatar hyperbolist avatar jamespic avatar loeck avatar logvinovleon avatar max-lt avatar meriadec avatar micahzoltu avatar mortalkastor avatar nastias avatar quaxsze avatar ratniex avatar rsmylskibc avatar stacec avatar williamchong avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.