near-ledger-js

0.2.1 • Public • Published

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.

/near-ledger-js/

    Package Sidebar

    Install

    npm i near-ledger-js

    Weekly Downloads

    288

    Version

    0.2.1

    License

    MIT

    Unpacked Size

    21.8 kB

    Total Files

    11

    Last publish

    Collaborators

    • maximushaximus
    • nearvlad