-
Notifications
You must be signed in to change notification settings - Fork 315
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
Feat/LIVE-12193 track swap cancel accept #6799
Merged
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cf2cca3
feat: send Swap Metadata information to swap live app
andreicovaciu 349e1e3
feat: adds custom.device.get as CustomHandler
andreicovaciu 9f45615
feat: removes unused props
andreicovaciu d16cad5
feat: fix lint
andreicovaciu 2e26f0d
feat: updates mobile custom handlers
andreicovaciu b099b70
feat: add changeset
andreicovaciu 3cbcf90
feat: updates based on review
andreicovaciu 4e4e276
feat: updates based on review
andreicovaciu ffdc09b
feat: updates based on review
andreicovaciu 6c8cd44
feat: fix types
andreicovaciu d68fbea
feat: fix mobile implementation
andreicovaciu b4543d1
feat: fix mobile onResult types
andreicovaciu 32560e2
feat: fix PlatformAPIWebview
andreicovaciu 8fca0f8
feat: fix lint
andreicovaciu 11c839e
feat: infer types
andreicovaciu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
"ledger-live-desktop": minor | ||
"live-mobile": minor | ||
"@ledgerhq/live-common": minor | ||
"@ledgerhq/wallet-api-exchange-module": minor | ||
--- | ||
|
||
Track swap cancel and accept with by returning device property from custom.exchange.start handler |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,12 +52,12 @@ export function usePTXCustomHandlers(manifest: WebviewProps["manifest"]) { | |
}, | ||
onResult: result => { | ||
if (result.startExchangeError) { | ||
onCancel(result.startExchangeError); | ||
onCancel(result.startExchangeError, result.device); | ||
} | ||
|
||
if (result.startExchangeResult) { | ||
setDevice(result.device); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll have to look at this |
||
onSuccess(result.startExchangeResult); | ||
onSuccess(result.startExchangeResult, result.device); | ||
} | ||
|
||
navigation.pop(); | ||
|
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
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
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
Oops, something went wrong.
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.
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.
Not sure how much it keeps the device in sync here because it will be hoisted when the
custom.exchange.start
is called it could be the old valueIt would probably be better if
onResult
andonCancel
could return the device as it's done for LLMI checked the code and it seems pretty straightforward to add some data:
Another solution could be to simply use
const device = useSelector(getCurrentDevice);
inapps/ledger-live-desktop/src/renderer/components/LiveAppDrawer.tsx
because if we do the changes above we might want to update LLM so result.device comes from the action and not a state.You can also cleanup this types that are not needed anymore
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.
I feel this is a very deep understanding of the code and product to produce such detailed comment. Do you mind sharing any piece of documentation for future use cases? Thank you, @Justkant! ππ½
P.S. I'll update accordingly
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.
Hey not sure we have a lot of documentation on the device actions and exchange part to be honest
I'm pretty familiar with this because I worked on some issues around it
My main concern here is to avoid having to much differences between LLD and LLM and sharing as much as possible, especially because you have a lot of ways to pass the data in the end correctly
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.
Updated