@ledgerhq/hw-app-exchange
TypeScript icon, indicating that this package has built-in type declarations

0.4.7 • Public • Published

GitHub, Ledger Devs Discord, Developer Portal

@ledgerhq/hw-app-exchange

Ledger Hardware Wallet Exchange app.

API

Table of Contents

resolveTransactionType

Adapt ExchangeTypes following partner info. For "legacy" partner, we don't change the provided type. For new one, we call the new APDU commands (Ng, Next Gen).

Parameters

  • type ExchangeTypes
  • partnerVersion number?

Returns ExchangeTypes

OkStatus

Those values map the one defined in the app-exchange code (@see protocol.md and swap_errors.h)

Type: number

Integration test

1. Prerequisite

Download latest version of Ledger SDK.

docker pull ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest

The rest of the documentation is about testing on NanoSP.

2. Compile app-exchange

docker run --privileged -v '<ABSOLUTE_PATH_TO_APP_EXCHANGE_SRC>:/app' -t -d --name ledger-app-dev-tools ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools

docker exec -it ledger-app-dev-tools bash -c 'export BOLOS_SDK="$NANOSP_SDK" && make -j DEBUG=1 TESTING=1 TEST_PUBLIC_KEY=1'

It is important to set the value of DEBUG to 1, as we need the fake Ledger private key in our test.

3. Launch speculos

You can compile only the app-exchange, but it can be useful to compile a coin-app like app-ethereum.

In the documentation, we assume the following name for the apps binary:

  • app-exchange: exchange_nanosp.elf
  • app-ethereum: ethereum_nanosp.elf
docker run -v '<ABSOLUTE_PATH_TO_ELFS>:/app' -p 5000:5000 -t -d --name speculos ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools

docker exec -it speculos bash -c 'speculos --model "nanosp" /app/exchange_nanosp.elf -l /app/ethereum_nanosp.elf --display headless'

4. Launch integration tests

From Ledger Live root directory:

pnpm ljs:hw-app-exchange test-integ

Package Sidebar

Install

npm i @ledgerhq/hw-app-exchange

Weekly Downloads

295

Version

0.4.7

License

Apache-2.0

Unpacked Size

269 kB

Total Files

85

Last publish

Collaborators

  • thomas.coudray
  • ldg-github-ci
  • aboissiere
  • vbouzon
  • gbrahm-ledger
  • sergii-shkolin
  • phenry-ledger