0.2.1 • Published 2 years ago

near-ledger-js v0.2.1

Weekly downloads
1,428
License
MIT
Repository
-
Last release
2 years ago

near-ledger-js

A JavaScript library for communication with Ledger Hardware Wallet.

Example usage

  import { createClient, getSupportedTransport } from "near-ledger-js";
  
  const transport = await getSupportedTransport();
  transport.setScrambleKey("NEAR");
  
  transport.on('disconnect', () => {...});

In an onClick handler:

  const client = await createClient(transport);
  // If no error thrown, ledger is available. NOTE: U2F transport will still get here even if device is not present 

To see debug logging for getSupportedTransport(), import setDebugLogging() and call setDebugLogging(true) before using the package.

How to run demo project

  1. yarn to install dependencies
  2. yarn start to start local server with Parcel
  3. Open https://localhost:1234 in your browser
  4. Open browser console
  5. Try examples shown on the page

License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE and LICENSE-APACHE for details.