-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow the triggering of make-app via message #125
Conversation
Still testing this but this will require a bundle update |
@@ -47,6 +47,8 @@ export default class LedgerBridge { | |||
this.updateTransportTypePreference(replyAction, 'u2f') | |||
} | |||
break | |||
case 'ledger-make-app': | |||
this.attemptMakeApp(replyAction); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This requires a break
afterward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in ed2be6b
@@ -91,6 +110,12 @@ export default class LedgerBridge { | |||
this.app = new LedgerEth(this.transport) | |||
} | |||
} else if (this.transportType === 'webhid') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This handles a pre-existing bug, but one that was only noticeable with the changes made in this PR
this.app = null | ||
if (this.transport) { | ||
this.transport.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pre-existing issue, but also needed for this PR to work correctly
ledger-bridge.js
Outdated
} | ||
|
||
async makeApp (config) { | ||
config = config || {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this line, can we do:
async makeApp (config = {}) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3c5d3ad
… of error detection (#125) * Allow the triggering of make-app via message * Update bundle.js * Break on ledger-make-app inswitch * Don't create new webhid transport if it already exists and is open * Fix attemptMakeApp * Only attempt to open existing webhid device in attemptMakeApp * Use default parameter in makeApp
This PR does two things:
'ledger-make-app'
message, which calls a new wrapper around themakeApp
method. This allows external callers to attempt to create a transport and device connection and then see whether that attempt succeeded or failed, decoupled from any action.