feat(gui): Approve dialog before publishing Bitcoin lock transaction#291
Merged
binarybaron merged 13 commits intomasterfrom Apr 17, 2025
Merged
feat(gui): Approve dialog before publishing Bitcoin lock transaction#291binarybaron merged 13 commits intomasterfrom
binarybaron merged 13 commits intomasterfrom
Conversation
|
this one is forked off asb/cache-quotes i think, we should rebase before merging |
Author
will do but let's merge #288 first. I don't want to deal with merge conflicts. |
b15ce25 to
35e58dc
Compare
b2abd72 to
5fc1c6c
Compare
Author
|
@Einliterflasche @b-enedict @delta1 This is ready for review. I think the changes are mostly fine. Unless there any objections I'm going to merge this. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 diff introduces a new "approvals" mechanism that alters the swap flow by requiring explicit user intervention before the Bitcoin lock transaction is broadcast. Previously, the Bitcoin lock was executed automatically without any user prompt. Now, the backend defines
ApprovalRequestType(e.g. aPreBtcLockvariant with details likebtc_lock_amount,btc_network_fee, andxmr_receive_amount) andApprovalEvent(with statuses such asPending,Resolved, andRejected). The methodrequest_approval()in theTauriHandlestruct uses a oneshot channel and concurrent timeout handling viatokio::select!to wait for the user's decision. Based on the outcome—explicit approval or timeout/rejection—the approval event is emitted through theemit_approval()helper, thereby gating the subsequent broadcast of the Bitcoin lock transaction.On the UI side, changes have been made to reflect the new flow; the modal (for example, in
SwapSetupInflightPage.tsx) now displays the swap details along with explicit action buttons that callresolveApproval()via RPC when clicked. The Redux store, selectors, and hooks likeusePendingPreBtcLockApproval()have been updated to track and display these approval events. As a result, the overall functionality now requires the user to explicitly approve the swap offer before proceeding, ensuring they are aware of the swap's key parameters and that the locking of funds occurs only after their confirmation.OfferAcceptFlow.mov