mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-03 05:54:47 -05:00
feat(gui): Refund swap in the background (#154)
Swaps will now be refunded as soon as the cancel timelock expires if the GUI is running but the swap dialog is not open.
This commit is contained in:
parent
4cf5cf719a
commit
e46be4a9ff
12 changed files with 210 additions and 27 deletions
|
|
@ -5,6 +5,7 @@ import {
|
|||
GetSwapInfoResponse,
|
||||
TauriContextStatusEvent,
|
||||
TauriTimelockChangeEvent,
|
||||
BackgroundRefundState,
|
||||
} from "models/tauriModel";
|
||||
import { MoneroRecoveryResponse } from "../../models/rpcModel";
|
||||
import { GetSwapInfoResponseExt } from "models/tauriModelExt";
|
||||
|
|
@ -27,6 +28,10 @@ interface State {
|
|||
// TODO: Reimplement this using Tauri
|
||||
updateState: false;
|
||||
};
|
||||
backgroundRefund: {
|
||||
swapId: string;
|
||||
state: BackgroundRefundState;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface RPCSlice {
|
||||
|
|
@ -46,6 +51,7 @@ const initialState: RPCSlice = {
|
|||
moneroWalletRpc: {
|
||||
updateState: false,
|
||||
},
|
||||
backgroundRefund: null,
|
||||
},
|
||||
logs: [],
|
||||
};
|
||||
|
|
@ -109,6 +115,12 @@ export const rpcSlice = createSlice({
|
|||
rpcResetMoneroRecoveryKeys(slice) {
|
||||
slice.state.moneroRecovery = null;
|
||||
},
|
||||
rpcSetBackgroundRefundState(slice, action: PayloadAction<{ swap_id: string, state: BackgroundRefundState }>) {
|
||||
slice.state.backgroundRefund = {
|
||||
swapId: action.payload.swap_id,
|
||||
state: action.payload.state,
|
||||
};
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -122,6 +134,7 @@ export const {
|
|||
rpcSetSwapInfo,
|
||||
rpcSetMoneroRecoveryKeys,
|
||||
rpcResetMoneroRecoveryKeys,
|
||||
rpcSetBackgroundRefundState,
|
||||
timelockChangeEventReceived
|
||||
} = rpcSlice.actions;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue