Giter Club home page Giter Club logo

hdwallet-kuji's Introduction

HDWallet

CircleCI

A library for interacting with hardware wallets from JS/TS. Supports KeepKey, Trezor, and Ledger. Intended for use in web apps, chrome apps/extensions, and electron/node apps.

Try it out here!

Documentation

Installation

yarn add @keepkey/hdwallet-core
yarn add @keepkey/hdwallet-keepkey-webusb
yarn add @keepkey/hdwallet-trezor-connect
yarn add @keepkey/hdwallet-ledger-webusb

Importing Library

You can import the generated bundle to use each of the component libraries:

import { HDWallet } from "@keepkey/hdwallet-core";
import { isKeepKey, KeepKeyHDWallet } from "@keepkey/hdwallet-keepkey";
import { WebUSBKeepKeyAdapter } from "@keepkey/hdwallet-keepkey-webusb";

Usage

The recommended way to use the library is through a Keyring singleton, which manages connected devices:

import { Keyring } from "@keepkey/hdwallet-core";
const keyring = new Keyring();

To add in support for a given wallet type, add in the relevant Transport adapter by calling useKeyring() on it:

import { WebUSBKeepKeyAdapter } from "@keepkey/hdwallet-keepkey-webusb";

const keepkeyAdapter = WebUSBKeepKeyAdapter.useKeyring(keyring);

After setting up a Keyring, and plugging various transport adapters into it, the next step is to pair a device:

let wallet = await keepkeyAdapter.pairDevice();

wallet.getLabel().then((result) => {
  console.log(result);
});

Building

It is expected that this take quite some time (around 10 minutes), due to the large size of the compiled KeepKey protobuf encoder/decoder.

yarn clean
yarn
yarn build

Developing

To compile and watch the browser bundle, run:

yarn dev:sandbox

This will launch an ssl webserver that runs at https://localhost:1234, with a small demo app that shows how to use various HDWallet functionality.

We use Zeit Now for continuous deployment of this sandbox app. On pull requests, the builder will publish a new version of that app with the changes included (for example #68). Try out the latest build here: https://hdwallet.shapeshift.now.sh/

Tests

yarn
yarn build
yarn test

The integration tests have been set up to run either against a physical KeepKey with debug firmware on it, or in CI pointed at a dockerized version of the emulator. Trezor and Ledger tests run against mocks of their respective transport layers.

Contributing

See our developer guidelines here.

hdwallet-kuji's People

Contributors

gomesalexandre avatar mrnerdhair avatar pastaghost avatar bithighlander avatar kaladinlight avatar keepkeyjon avatar 0xmillz avatar 0xzoz avatar elmutt avatar keepkeybrett avatar markrypto avatar dviramontes avatar majorhayes avatar asamere avatar 0xapotheosis avatar 0xdef1cafe avatar cjthompson avatar gima-maya avatar loxator avatar natven avatar chxash avatar mvpratt avatar stevehadow avatar lmyslinski avatar thengoster avatar 0xtekgrinder avatar sterl avatar 0xean avatar ascension avatar woodenfurniture 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.