forked from comit-network/xmr-btc-swap
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(gui): Swap state stepper to use Tauri events (#77)
Previously we used the data we fetched via the rpc (`GetSwapInfo` call, saved in redux in `rpc.swapInfos`) to decide what to display in the state stepper to the user. The state stepper is displayed at the bottom of the `SwapDialog`. However, we are moving away from our depedence on periodic rpc calls and towards relying more and more on the events we receive from the Host (from Tauri). Our goal is to rely solely on the Tauri events for everything displayed about the currently running swap. This PR includes the following changes: - refactor the `SwapStateStepper` such that it relies only on the Tauri events - emit two new Tauri events (`EncryptedSignatureSent`, `CancelTimelockExpired`) in the state machine - correctly emit `BtcRefunded` Tauri event after Bitcoin refund transaction is published - differentiate between `"Waiting for them to redeem the Bitcoin"` and `"Revealing encrypted signature to the other party"` on the `SwapStatePage` (content displayed in the center of the `SwapDialog`)
- Loading branch information
1 parent
f91255f
commit 97510a8
Showing
21 changed files
with
608 additions
and
206 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { CliLog, SwapSpawnType } from "./cliModel"; | ||
import { TauriSwapProgressEvent } from "./tauriModel"; | ||
|
||
export type SwapState = { | ||
curr: TauriSwapProgressEvent; | ||
prev: TauriSwapProgressEvent | null; | ||
swapId: string; | ||
}; | ||
|
||
export interface SwapSlice { | ||
state: { | ||
curr: TauriSwapProgressEvent; | ||
prev: TauriSwapProgressEvent | null; | ||
swapId: string; | ||
} | null; | ||
state: SwapState | null; | ||
logs: CliLog[]; | ||
spawnType: SwapSpawnType | null; | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.