aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/+layout.svelte17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index 6624fff8..66596038 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -1,5 +1,5 @@
<script>
- import { getWallet, getAddress } from "$lib/ark";
+ import { getWallet, getAddress, syncTransactions, settle } from "$lib/ark";
import { SvelteToast } from "@zerodevx/svelte-toast";
import { onDestroy, onMount } from "svelte";
import { close, connect, send, socket } from "$lib/socket";
@@ -22,7 +22,7 @@
import Password from "$comp/Password.svelte";
import { s, success, post, getCookie, warning } from "$lib/utils";
import { t, locale, loading } from "$lib/translations";
- import { goto, afterNavigate, preloadData } from "$app/navigation";
+ import { goto, invalidate, afterNavigate, preloadData } from "$app/navigation";
let { data, children } = $props();
@@ -64,6 +64,8 @@
invalidateAll: true,
noScroll: true,
});
+
+ settle().catch((e) => console.error("Ark settle failed:", e));
} catch (e) {
console.error("Failed to record ARK payment:", e);
}
@@ -76,7 +78,16 @@
if (user) {
const wallet = await getWallet();
- if (wallet) wallet.notifyIncomingFunds(handleArkPayment);
+ if (wallet) {
+ wallet.notifyIncomingFunds(handleArkPayment);
+
+ const aid = getCookie("aid") || user.id;
+ syncTransactions(aid).then((result) => {
+ if (result?.synced) invalidate("app:payments");
+ }).catch((e) => console.error("Ark sync failed:", e));
+
+ settle().catch((e) => console.error("Ark settle failed:", e));
+ }
}
// if (window.NDEFReader) {