Introduction

Sections in this article

A wallet application contains business-service related code and typically also has a GUI. Its format can be a desktop or smartphone application, or a web application.

This section is a guide for using github.com/LedgerHQ/ledgerjs. You will learn how to:

  • Open a connection to a Nano, using a chosen transport protocol, on this page.
  • Push your Nano application API calls to the Nano. That is on the next page.

Choosing the right transport

Clickable Legend:


Note
All these transports implement a generic interface exposed by @ledgerhq/hw-transport.

Basic call structure

Typically subset calls that are used:

  • transport.open: (descriptor)=>Promise<Transport>
  • transport.listen: (observer)=>Subscription
  • transport.exchange(apdu: Buffer): Promise<Buffer>
  • transport.close()

and some additional calls:

  • transport.create(): Promise<Transport>: make use of listen and open for the most simple scenario.
  • transport.send(cla, ins, p1, p2, data): Promise<Buffer>: a small abstraction of exchange

Try our example

import Transport from "@ledgerhq/hw-transport-node-hid";
// import Transport from "@ledgerhq/hw-transport-webusb";
// import Transport from "@ledgerhq/react-native-hw-transport-ble";
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/0");
  return result.bitcoinAddress;
};
getBtcAddress().then(a => console.log(a));


You can see more examples in our dedicated Examples section.


Did you find this page helpful?

What would you like to see here?
Nano API calls
Getting Started
Theme Features
Customization