UNPKG

@ledgerhq/hw-app-canton

Version:
106 lines (62 loc) 3.52 kB
<img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" /> [GitHub](https://github.com/LedgerHQ/ledger-live/), [Ledger Devs Discord](https://developers.ledger.com/discord-pro), [Developer Portal](https://developers.ledger.com/) ## @ledgerhq/hw-app-canton Ledger Hardware Wallet Canton JavaScript bindings. *** ## Are you adding Ledger support to your software wallet? You may be using this package to communicate with the Canton Nano App. For a smooth and quick integration: * See the developers’ documentation on the [Developer Portal](https://developers.ledger.com/docs/transport/overview/) and * Go on [Discord](https://developers.ledger.com/discord-pro/) to chat with developer support and the developer community. ## API <!-- Generated by documentation.js. Update this documentation by updating the source code. --> #### Table of Contents * [Canton](#canton) * [Parameters](#parameters) * [getAddress](#getaddress) * [Parameters](#parameters-1) * [signTransaction](#signtransaction) * [Parameters](#parameters-2) * [getAppConfiguration](#getappconfiguration) ### Canton Canton BOLOS API #### Parameters * `transport` **Transport**&#x20; * `scrambleKey` (optional, default `"canton_default_scramble_key"`) #### getAddress Get a Canton address for a given BIP-32 path. ##### Parameters * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP-32 format * `display` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** whether to display the address on the device (optional, default `false`) Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<CantonAddress>** the address and public key #### signTransaction Sign a Canton transaction. ##### Parameters * `path` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** a path in BIP-32 format * `txHash` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** the transaction hash to sign Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<CantonSignature>** the signature #### getAppConfiguration Get the app configuration. Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<AppConfig>** the app configuration including version ## Integration tests ### 1. Prerequisite Download latest version of Ledger SDK. ```sh 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-canton You have to [compile](https://github.com/ledgerhq/app-canton) or retrieve the app binaries. In the following line, the binaries directory is set as `<ABSOLUTE_PATH_TO_ELFS>` ### 3. Launch CantonApp within Speculos ```sh docker run --rm -t -d -v "<ABSOLUTE_PATH_TO_ELFS>:/app" -p 5000:5000 ghcr.io/ledgerhq/ledger-app-builder/ledger-app-dev-tools:latest 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: ```sh pnpm ljs:hw-app-canton test-integ ``` You can take a look at [Speculos UI](http://127.0.0.1:5000/)