Improve Ledger docs

This commit is contained in:
Simon Warta 2021-10-12 14:31:25 +02:00
parent 2d1600b4f4
commit 3ac2178c8b
2 changed files with 26 additions and 6 deletions

View File

@ -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:

View File

@ -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);