mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Improve Ledger docs
This commit is contained in:
parent
2d1600b4f4
commit
3ac2178c8b
@ -44,7 +44,7 @@ http://localhost:8000/demo.
|
|||||||
|
|
||||||
Then follow the instructions on that page.
|
Then follow the instructions on that page.
|
||||||
|
|
||||||
## Runnng tests
|
## Running tests
|
||||||
|
|
||||||
The tests in this package require a Ledger device
|
The tests in this package require a Ledger device
|
||||||
[initialized with the mnemonic](https://support.ledger.com/hc/en-us/articles/360005434914)
|
[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
|
(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 (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
|
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)
|
[scripts/launchpad/README.md](https://github.com/cosmos/cosmjs/blob/main/scripts/launchpad/README.md)
|
||||||
and execute:
|
and execute:
|
||||||
|
|
||||||
|
@ -10,18 +10,22 @@ async function run() {
|
|||||||
|
|
||||||
const accountNumber0 = 0;
|
const accountNumber0 = 0;
|
||||||
const address0 = accounts[accountNumber0].address;
|
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);
|
const signature0 = await demo.sign(signer, accountNumber0, address0, address0);
|
||||||
console.info(`Signature from Ledger device for account number 0 (${address0}):`);
|
console.info("Signature:", signature0);
|
||||||
console.info(signature0);
|
|
||||||
|
|
||||||
// It seems the Ledger device needs a bit of time to recover
|
// It seems the Ledger device needs a bit of time to recover
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
|
||||||
const accountNumber10 = 10;
|
const accountNumber10 = 10;
|
||||||
const address10 = accounts[accountNumbers.findIndex((n) => n === accountNumber10)].address;
|
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);
|
const signature1 = await demo.sign(signer, accountNumber10, address10, address10);
|
||||||
console.info(`Signature from Ledger device for account number 10 (${address10}):`);
|
console.info("Signature:", signature1);
|
||||||
console.info(signature1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
run().catch(console.error);
|
run().catch(console.error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user