mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-24 22:19:37 -04:00
Bitcoin–Monero Cross-chain Atomic Swap
![]() 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. |
||
---|---|---|
.cargo | ||
.github | ||
.vscode | ||
dev-docs | ||
dev_scripts | ||
docs | ||
monero-harness | ||
monero-rpc | ||
monero-wallet | ||
src-gui | ||
src-tauri | ||
swap | ||
utils/gpg_keys | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
CHANGELOG.md | ||
CONTRIBUTING.md | ||
Dockerfile | ||
dprint.json | ||
LICENSE | ||
README.md | ||
rust-toolchain.toml |
UnstoppableSwap
This is the monorepo containing the source code for all of our core projects:
swap
contains the source code for the main swapping binaries,asb
andswap
gui
contains the new tauri based user interfacetauri
contains the tauri bindings between binaries and user interface- and other crates we use in our binaries
If you're just here for the software, head over to the releases tab and grab the binary for your operating system! If you're just looking for documentation, check out our docs page or our github docs.
Join our Matrix room to follow development more closely.