mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-26 10:46:23 -05:00
fix(gui): Fetch balance after swap is released, re-fetch database after progress event, change wording in progress page (#237)
This commit is contained in:
parent
27e8467ac5
commit
cf20891638
7 changed files with 27 additions and 8 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -4747,7 +4747,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "libp2p-community-tor"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/umgefahren/libp2p-tor#8215104570a550cb3909a15c33af203387e88274"
|
||||
source = "git+https://github.com/umgefahren/libp2p-tor?branch=main#8215104570a550cb3909a15c33af203387e88274"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arti-client",
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import { listen } from "@tauri-apps/api/event";
|
||||
import { TauriSwapProgressEventWrapper, TauriContextStatusEvent, TauriLogEvent, BalanceResponse, TauriDatabaseStateEvent, TauriTimelockChangeEvent, TauriBackgroundRefundEvent } from "models/tauriModel";
|
||||
import { TauriSwapProgressEventWrapper, TauriContextStatusEvent, TauriLogEvent, BalanceResponse, TauriDatabaseStateEvent, TauriTimelockChangeEvent, TauriBackgroundRefundEvent, TauriTorEvent } from "models/tauriModel";
|
||||
import { contextStatusEventReceived, receivedCliLog, rpcSetBalance, timelockChangeEventReceived, rpcSetBackgroundRefundState } from "store/features/rpcSlice";
|
||||
import { swapProgressEventReceived } from "store/features/swapSlice";
|
||||
import logger from "utils/logger";
|
||||
import { updatePublicRegistry, updateRates } from "./api";
|
||||
import { checkContextAvailability, getSwapInfo, initializeContext, updateAllNodeStatuses } from "./rpc";
|
||||
import { store } from "./store/storeRenderer";
|
||||
import { torEventReceived } from "store/features/torSlice";
|
||||
|
||||
// Update the public registry every 5 minutes
|
||||
const PROVIDER_UPDATE_INTERVAL = 5 * 60 * 1_000;
|
||||
|
|
@ -56,7 +57,6 @@ export async function setupBackgroundTasks(): Promise<void> {
|
|||
});
|
||||
|
||||
listen<TauriLogEvent>("cli-log-emitted", (event) => {
|
||||
logger.info("Received cli log event", event.payload);
|
||||
store.dispatch(receivedCliLog(event.payload));
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ export default function DebugPage() {
|
|||
data={cliState}
|
||||
label="Swap Daemon State (exposed via API)"
|
||||
/>
|
||||
<CliLogsBox label="Tor Daemon Logs" logs={torStdOut.split("\n")} />
|
||||
<CliLogsBox label="Tor Daemon Logs" logs={(torStdOut || "").split("\n")} />
|
||||
</Box>
|
||||
</DialogContentText>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,6 @@ import CircularProgressWithSubtitle from "../../CircularProgressWithSubtitle";
|
|||
|
||||
export default function ReceivedQuotePage() {
|
||||
return (
|
||||
<CircularProgressWithSubtitle description="Exchanging keys, zero-knowledge proofs and generating multi-signature addresses" />
|
||||
<CircularProgressWithSubtitle description="Processing received quote" />
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ export const rpcSlice = createSlice({
|
|||
receivedCliLog(slice, action: PayloadAction<TauriLogEvent>) {
|
||||
const buffer = action.payload.buffer;
|
||||
const logs = getLogsAndStringsFromRawFileString(buffer);
|
||||
slice.logs = slice.logs.concat(logs);
|
||||
const logsWithoutExisting = logs.filter(log => !slice.logs.includes(log));
|
||||
slice.logs = slice.logs.concat(logsWithoutExisting);
|
||||
},
|
||||
contextStatusEventReceived(
|
||||
slice,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import { createListenerMiddleware } from "@reduxjs/toolkit";
|
||||
import { getAllSwapInfos, checkBitcoinBalance, updateAllNodeStatuses, fetchSellersAtPresetRendezvousPoints } from "renderer/rpc";
|
||||
import { getAllSwapInfos, checkBitcoinBalance, updateAllNodeStatuses, fetchSellersAtPresetRendezvousPoints, getSwapInfo } from "renderer/rpc";
|
||||
import logger from "utils/logger";
|
||||
import { contextStatusEventReceived } from "store/features/rpcSlice";
|
||||
import { addNode, setFetchFiatPrices, setFiatCurrency } from "store/features/settingsSlice";
|
||||
import { updateRates } from "renderer/api";
|
||||
import { store } from "renderer/store/storeRenderer";
|
||||
import { swapProgressEventReceived } from "store/features/swapSlice";
|
||||
|
||||
export function createMainListeners() {
|
||||
const listener = createListenerMiddleware();
|
||||
|
|
@ -30,6 +31,23 @@ export function createMainListeners() {
|
|||
},
|
||||
});
|
||||
|
||||
// Listener for:
|
||||
// - when a swap is released (fetch bitcoin balance)
|
||||
// - when a swap progress event is received (update the swap info)
|
||||
listener.startListening({
|
||||
actionCreator: swapProgressEventReceived,
|
||||
effect: async (action) => {
|
||||
if (action.payload.event.type === "Released") {
|
||||
logger.info("Swap released, updating bitcoin balance...");
|
||||
await checkBitcoinBalance();
|
||||
}
|
||||
|
||||
// Update the swap info
|
||||
logger.info("Swap progress event received, updating swap info from database...");
|
||||
await getSwapInfo(action.payload.swap_id);
|
||||
},
|
||||
});
|
||||
|
||||
// Update the rates when the fiat currency is changed
|
||||
listener.startListening({
|
||||
actionCreator: setFiatCurrency,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ hex = "0.4"
|
|||
jsonrpsee = { version = "0.16.2", features = [ "server" ] }
|
||||
jsonrpsee-core = "0.16.2"
|
||||
libp2p = { version = "0.53.2", features = [ "tcp", "yamux", "dns", "noise", "request-response", "ping", "rendezvous", "identify", "macros", "cbor", "json", "tokio", "serde", "rsa" ] }
|
||||
libp2p-community-tor = { git = "https://github.com/umgefahren/libp2p-tor", features = [ "listen-onion-service" ] }
|
||||
libp2p-community-tor = { git = "https://github.com/umgefahren/libp2p-tor", branch = "main", features = [ "listen-onion-service" ] }
|
||||
monero = { version = "0.12", features = [ "serde_support" ] }
|
||||
monero-rpc = { path = "../monero-rpc" }
|
||||
once_cell = "1.19"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue