diff options
| author | Adam Soltys <[email protected]> | 2026-02-02 23:30:20 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-11 15:33:09 -0800 |
| commit | e8200be39f7b89efd5379c3c5bc24ca4533bf39c (patch) | |
| tree | 46360ba397abeb8f919411fb8fdee0a0cfb50f0b /src/routes | |
| parent | e8105a9ad2eee8e8c3874851b245c6c755216298 (diff) | |
| download | coinos-ui-e8200be39f7b89efd5379c3c5bc24ca4533bf39c.tar.gz coinos-ui-e8200be39f7b89efd5379c3c5bc24ca4533bf39c.zip | |
sync and settle
Diffstat (limited to 'src/routes')
| -rw-r--r-- | src/routes/(app)/+layout.svelte | 17 |
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) { |
