mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-08-18 03:00:53 -04:00
feat(tauri, gui): Send event on changes to details, timelocks and tx_lock confirmations (#100)
- Send event when new swap state is inserated into database. The event only has the `swap_id` attached. The frontend then sends a request to the `get_swap_info` command to retrieve the updated version - Send event when the Bitcoin lock transaction gets a new confirmation - A new `watcher` daemon runs contineously and sends an event when the timelock updated. The event has the the `swap_id` and the timelock attached - Display logs on `ProcessExitedPage` (if swap was stopped prematurely) - Rename `CliLogEmittedEvent` to `TauriLogEvent` - Apply env_filter to tracing terminal writer to silence logging from other crates - Add `.env.*` files in `src-gui` to `.gitingore` Closes #93 and #12
This commit is contained in:
parent
e6dc7ddcef
commit
8f33fe5b41
28 changed files with 429 additions and 208 deletions
|
@ -29,6 +29,25 @@ function isCliLog(log: unknown): log is CliLog {
|
|||
);
|
||||
}
|
||||
|
||||
export function isCliLogRelatedToSwap(
|
||||
log: CliLog | string,
|
||||
swapId: string,
|
||||
): boolean {
|
||||
// If we only have a string, simply check if the string contains the swap id
|
||||
// This provides reasonable backwards compatability
|
||||
if (typeof log === "string") {
|
||||
return log.includes(swapId);
|
||||
}
|
||||
|
||||
// If we have a parsed object as the log, check if
|
||||
// - the log has the swap id as an attribute
|
||||
// - there exists a span which has the swap id as an attribute
|
||||
return (
|
||||
log.fields["swap_id"] === swapId ||
|
||||
(log.spans?.some((span) => span["swap_id"] === swapId) ?? false)
|
||||
);
|
||||
}
|
||||
|
||||
export function parseCliLogString(log: string): CliLog | string {
|
||||
try {
|
||||
const parsed = JSON.parse(log);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue