near / near-cli

General purpose command line tools for interacting with NEAR Protocol
https://docs.near.org
MIT License
193 stars 92 forks source link

fix: bring back ledger support #1102

Closed gagdiez closed 4 months ago

gagdiez commented 4 months ago

This PR brings back Ledger support, that was removed while transitioning to v4.0.0. It uses the latest package version of Ledger Transport (used to talk with Ledger) and brings some improvements on error handling.

The most important change with respect to v3.5.0 is that the Ledger is now treated as a util instead of a middleware. This way, we can handle Ledger errors on the command, meaning that an error will print the Ledger error message, and NOT the (error message + stack trace + command help).

Finally, the commands where changed, now useLedgerKey is a boolean, and the path is set apart. This introduces no friction to the users using the default path (which we assume is the majority), making the commands fully retrocompatible with v3.5.0 for them.

Users that do select paths will need to use the --ledgerPath flag