From 3ac2178c8bf514cd87742ed09fb7b19d45086799 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 12 Oct 2021 14:31:25 +0200 Subject: [PATCH] Improve Ledger docs --- packages/ledger-amino/README.md | 20 ++++++++++++++++++-- packages/ledger-amino/demo/node.js | 12 ++++++++---- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/ledger-amino/README.md b/packages/ledger-amino/README.md index 9c1fdc2cc6..b3adbbd79b 100644 --- a/packages/ledger-amino/README.md +++ b/packages/ledger-amino/README.md @@ -44,7 +44,7 @@ http://localhost:8000/demo. Then follow the instructions on that page. -## Runnng tests +## Running tests The tests in this package require a Ledger device [initialized with the mnemonic](https://support.ledger.com/hc/en-us/articles/360005434914) @@ -53,7 +53,23 @@ from (see "Ledger: accounts for Ledger based demos and tests") with an installed "Cosmos (ATOM)" app. The device must be connected via USB, unlocked and the Cosmos app must be opened. The tests require the user to manually approve -transactions. Start a local Launchpad blockchain as described in +transactions. + +### Stargate tests + +Start a local Stargate blockchain as described in +[scripts/simapp/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/simapp/README.md) +and execute: + +```sh +export LEDGER_ENABLED=1 +export SIMAPP_ENABLED=1 +yarn test +``` + +### Launchpad tests + +Start a local Launchpad blockchain as described in [scripts/launchpad/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/launchpad/README.md) and execute: diff --git a/packages/ledger-amino/demo/node.js b/packages/ledger-amino/demo/node.js index 6d9fe3a07b..fd94538842 100644 --- a/packages/ledger-amino/demo/node.js +++ b/packages/ledger-amino/demo/node.js @@ -10,18 +10,22 @@ async function run() { const accountNumber0 = 0; const address0 = accounts[accountNumber0].address; + console.info( + `Signing on Ledger device with account index ${accountNumber0} (${address0}). Please review and approve on the device now.`, + ); const signature0 = await demo.sign(signer, accountNumber0, address0, address0); - console.info(`Signature from Ledger device for account number 0 (${address0}):`); - console.info(signature0); + console.info("Signature:", signature0); // It seems the Ledger device needs a bit of time to recover await new Promise((resolve) => setTimeout(resolve, 1000)); const accountNumber10 = 10; const address10 = accounts[accountNumbers.findIndex((n) => n === accountNumber10)].address; + console.info( + `Signing on Ledger device with account index ${accountNumber10} (${address10}). Please review and approve on the device now.`, + ); const signature1 = await demo.sign(signer, accountNumber10, address10, address10); - console.info(`Signature from Ledger device for account number 10 (${address10}):`); - console.info(signature1); + console.info("Signature:", signature1); } run().catch(console.error);