mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 17:44:02 -05:00
fix(swap): Split approve-and-sign and publish-lock-tx into two states (#498)
* fix(swap): Split approve-and-sign and publish-lock-tx into two states * fix: cannot get blockchain height * add RetrievingMoneroBlockheight, RetrievingMoneroBlockheight tauri events * propagate daemon blcok height fetch error, treat height 0 as error * check if tx_lock was previously published
This commit is contained in:
parent
e7cfecd070
commit
0936d6210e
13 changed files with 147 additions and 32 deletions
|
|
@ -25,6 +25,7 @@ export type TauriSwapProgressEventExt<T extends TauriSwapProgressEventType> =
|
|||
export enum BobStateName {
|
||||
Started = "quote has been requested",
|
||||
SwapSetupCompleted = "execution setup done",
|
||||
BtcLockReadyToPublish = "btc lock ready to publish",
|
||||
BtcLocked = "btc is locked",
|
||||
XmrLockProofReceived = "XMR lock transaction transfer proof received",
|
||||
XmrLocked = "xmr is locked",
|
||||
|
|
@ -47,6 +48,8 @@ export function bobStateNameToHumanReadable(stateName: BobStateName): string {
|
|||
return "Started";
|
||||
case BobStateName.SwapSetupCompleted:
|
||||
return "Setup completed";
|
||||
case BobStateName.BtcLockReadyToPublish:
|
||||
return "Bitcoin lock ready to publish";
|
||||
case BobStateName.BtcLocked:
|
||||
return "Bitcoin locked";
|
||||
case BobStateName.XmrLockProofReceived:
|
||||
|
|
|
|||
|
|
@ -216,6 +216,10 @@ export function StateAlert({
|
|||
}
|
||||
return <PunishTimelockExpiredAlert />;
|
||||
|
||||
// If the Bitcoin lock transaction has not been published yet
|
||||
// there is no need to display an alert
|
||||
case BobStateName.BtcLockReadyToPublish:
|
||||
return null;
|
||||
default:
|
||||
exhaustiveGuard(swap.state_name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,14 @@ export default function SwapStatePage({ state }: { state: SwapState | null }) {
|
|||
return <SwapSetupInflightPage {...state.curr.content} />;
|
||||
}
|
||||
break;
|
||||
case "RetrievingMoneroBlockheight":
|
||||
return (
|
||||
<CircularProgressWithSubtitle description="Retrieving Monero blockheight..." />
|
||||
);
|
||||
case "BtcLockPublishInflight":
|
||||
return (
|
||||
<CircularProgressWithSubtitle description="Publishing Bitcoin lock transaction..." />
|
||||
);
|
||||
case "BtcLockTxInMempool":
|
||||
if (state.curr.type === "BtcLockTxInMempool") {
|
||||
return <BitcoinLockTxInMempoolPage {...state.curr.content} />;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue