xmr-btc-swap/swap/src
Mohan 9ddf2daafe
feat(gui): Approve dialog before publishing Bitcoin lock transaction (#291)
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. a `PreBtcLock` variant with details like `btc_lock_amount`, `btc_network_fee`, and `xmr_receive_amount`) and `ApprovalEvent` (with statuses such as `Pending`, `Resolved`, and `Rejected`). The method `request_approval()` in the `TauriHandle` struct uses a oneshot channel and concurrent timeout handling via `tokio::select!` to wait for the user's decision. Based on the outcome—explicit approval or timeout/rejection—the approval event is emitted through the `emit_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 call `resolveApproval()` via RPC when clicked. The Redux store, selectors, and hooks like `usePendingPreBtcLockApproval()` 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.
2025-04-18 01:51:55 +02:00
..
asb feat(asb): Cache quotes (#288) 2025-04-17 16:22:30 +02:00
bin feat(asb): Print more information when history command is invoked (#218) 2024-12-20 12:00:56 +01:00
bitcoin feat(asb): Change log level of rendezvous register logs to TRACE (#188) 2024-11-19 14:57:49 +01:00
cli feat(gui): Approve dialog before publishing Bitcoin lock transaction (#291) 2025-04-18 01:51:55 +02:00
common feat(asb, cli): Listen on onion address, dial onion addresses (#203) 2024-12-03 21:24:33 +01:00
database feat(swap): Use art_client to dial over Tor (#196) 2024-11-21 01:00:36 +01:00
monero fix(swap): Error handling for fallback during Monero tx monitoring (#278) 2025-03-17 15:58:51 +01:00
network fix(asb): Compilation error introduced in #203 (#222) 2024-12-03 22:18:24 +01:00
protocol feat(gui): Approve dialog before publishing Bitcoin lock transaction (#291) 2025-04-18 01:51:55 +02:00
rpc feat(gui, swap): allow change-address to be omitted and default to internal wallet (#68) 2024-09-09 19:47:15 +02:00
asb.rs feat(asb + cli): Redact logs + unify tracing infrastructure (#1733) (#55) 2024-09-01 18:13:43 +02:00
bitcoin.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00
cli.rs feat(asb, cli): Listen on onion address, dial onion addresses (#203) 2024-12-03 21:24:33 +01:00
database.rs feat(tauri, gui): Send event on changes to details, timelocks and tx_lock confirmations (#100) 2024-10-09 15:06:57 +02:00
env.rs feat(consensus): Increase refund window from 72 to 144 blocks (#130) 2024-11-13 19:53:17 +01:00
fs.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00
kraken.rs feat(swap): Log tracing in rolling log files (#155) 2024-11-16 21:54:02 +01:00
lib.rs feat(asb, cli): Listen on onion address, dial onion addresses (#203) 2024-12-03 21:24:33 +01:00
libp2p_ext.rs refactor(swap): Upgrade libp2p to 0.53.2, reliable retry mechanisms (#109) 2024-11-11 00:14:42 +01:00
monero.rs feat(asb): Print more information when history command is invoked (#218) 2024-12-20 12:00:56 +01:00
monero_ext.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00
network.rs feat(swap): Use art_client to dial over Tor (#196) 2024-11-21 01:00:36 +01:00
proptest.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00
protocol.rs feat(gui): Allow to select from recently used monero addresses (#139) 2024-11-09 12:11:00 +01:00
rpc.rs refactor(tauri, swap): move rpc api to cli/api 2024-08-26 15:41:00 +02:00
seed.rs feat(asb, cli): Listen on onion address, dial onion addresses (#203) 2024-12-03 21:24:33 +01:00
tracing_ext.rs feat: cargo project at root 2024-08-08 00:49:04 +02:00