This repository has been archived by the owner on Jun 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 375
Split the projects into scoped libs + improve API doc #37
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
listen yields event, not just the descriptor e.g. { type: "add", descriptor } { type: "remove", descriptor }
Closed
meriadec
approved these changes
Jan 22, 2018
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a major refactoring on the project to split the library into multiple libraries.
new packages
We are introducing new libraries to replace the monolithic
ledgerco
.to migrate, you will need to depend on the relevant packages instead of
ledgerco
. This will lighten your dependencies becauseledgerco
used to depend both onnode-hid
andu2f-api
.There is also new packages included (documented in the README.md and the API.md)
packages:
@ledgerhq/hw-app-eth
@ledgerhq/hw-app-btc
@ledgerhq/hw-transport-node-hid
node-hid
(USB)@ledgerhq/hw-transport-u2f
@ledgerhq/hw-transport-http
@ledgerhq/hw-transport
@ledgerhq/hw-http-proxy-devserver
hw-transport-node-hid
(bridge proxy forhw-transport
)api changes
There is also one more breaking change from the previous API: the
_async
suffix has been REMOVED in all methods of the APIs. The library is by nature asynchronous and it's common practice to do so in JS promise libraries. We also highly recommend you to use async/await babel transformer to make your code much simpler.BEFORE
AFTER
AFTER (modern)
create
transport function is deprecatedInstead you should use
list
anddiscover
and then useopen
.open
transport function creates the transport (async)listen
new transport functionWe are also introducing a
listen
function in Transport implementations which is an alternative to list and allow to discover device as they come. It takes an observer and returns a subscription, as in this spec: https://github.com/tc39/proposal-observable . More examples will come later and implementation is yet to be fully implemented.This is the first milestone for Ledger libs, we will have important other milestone soon! Cheers :)