mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-09-20 12:54:37 -04:00
feat(gui): Display state page for inflight swap setup (#158)
We now display a "Starting swap with provider to lock ... BTC" page when the Bitcoin have been deposited and the swap setup is inflight.
This commit is contained in:
parent
6b6737c056
commit
eac435aba6
6 changed files with 28 additions and 30 deletions
|
@ -149,7 +149,7 @@ pub enum TauriSwapProgressEvent {
|
|||
min_bitcoin_lock_tx_fee: bitcoin::Amount,
|
||||
quote: BidQuote,
|
||||
},
|
||||
Started {
|
||||
SwapSetupInflight {
|
||||
#[typeshare(serialized_as = "number")]
|
||||
#[serde(with = "::bitcoin::util::amount::serde::as_sat")]
|
||||
btc_lock_amount: bitcoin::Amount,
|
||||
|
|
|
@ -109,6 +109,16 @@ async fn next_state(
|
|||
.estimate_fee(TxCancel::weight(), btc_amount)
|
||||
.await?;
|
||||
|
||||
// Emit an event to tauri that we are negotiating with the swap provider to lock the Bitcoin
|
||||
event_emitter.emit_swap_progress_event(
|
||||
swap_id,
|
||||
TauriSwapProgressEvent::SwapSetupInflight {
|
||||
btc_lock_amount: btc_amount,
|
||||
// TODO: Replace this with the actual fee
|
||||
btc_tx_lock_fee: bitcoin::Amount::ZERO,
|
||||
},
|
||||
);
|
||||
|
||||
let state2 = event_loop_handle
|
||||
.setup_swap(NewSwap {
|
||||
swap_id,
|
||||
|
@ -146,16 +156,6 @@ async fn next_state(
|
|||
// Publish the signed Bitcoin lock transaction
|
||||
let (..) = bitcoin_wallet.broadcast(signed_tx, "lock").await?;
|
||||
|
||||
// Emit an event to tauri that the the swap started
|
||||
event_emitter.emit_swap_progress_event(
|
||||
swap_id,
|
||||
TauriSwapProgressEvent::Started {
|
||||
btc_lock_amount: tx_lock.lock_amount(),
|
||||
// TODO: Replace this with the actual fee
|
||||
btc_tx_lock_fee: bitcoin::Amount::ZERO,
|
||||
},
|
||||
);
|
||||
|
||||
BobState::BtcLocked {
|
||||
state3,
|
||||
monero_wallet_restore_blockheight,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue