aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/+layout.svelte26
-rw-r--r--src/routes/(app)/payment/[id]/+page.svelte17
2 files changed, 29 insertions, 14 deletions
diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte
index 8cd580e2..0c88ff19 100644
--- a/src/routes/(app)/+layout.svelte
+++ b/src/routes/(app)/+layout.svelte
@@ -11,6 +11,7 @@
passwordPrompt,
selectSigner,
password,
+ paymentSignal,
pin,
theme as themeStore,
fiat,
@@ -48,20 +49,25 @@
preloadData(`/${user.username}/receive`);
preloadData("/payments");
preloadData("/send");
- if ($arkkey) arkSync();
+ if ($arkkey) arkSync("afterNavigate");
}
});
let arkSyncing = false;
let arkForwarding = false;
- let arkSync = async () => {
- if (arkSyncing || arkSending) return;
+ let arkSync = async (source = "unknown") => {
+ if (arkSyncing || arkSending) {
+ console.log(`[arkSync] SKIPPED (source: ${source}, syncing: ${arkSyncing}, sending: ${arkSending})`);
+ return;
+ }
+ console.log(`[arkSync] START (source: ${source})`);
arkSyncing = true;
try {
const aid = $arkaid || getCookie("aid") || user.id;
const result = await syncTransactions(aid);
+ console.log(`[arkSync] DONE (source: ${source}, received: ${result?.received || 0})`);
if (result?.forward && !arkForwarding) {
arkForwarding = true;
@@ -96,7 +102,6 @@
let arkInitializedKey: string | undefined;
let arkRefreshTimer: ReturnType<typeof setInterval> | undefined;
- let arkSyncTimer: ReturnType<typeof setInterval> | undefined;
const initArk = async () => {
const key = $arkkey;
@@ -106,15 +111,11 @@
const wallet = await getWallet();
if (wallet) {
localStorage.setItem("arkkey:uid", user.id);
- wallet.notifyIncomingFunds(arkSync);
- arkSync();
+ wallet.notifyIncomingFunds(() => arkSync("notifyIncomingFunds"));
+ arkSync("initArk");
refresh().catch((e) => console.error("Ark refresh failed:", e));
settle().catch((e) => console.error("Ark settle failed:", e));
- // Poll for incoming ark transactions (fallback for SSE)
- if (arkSyncTimer) clearInterval(arkSyncTimer);
- arkSyncTimer = setInterval(() => arkSync(), 15_000);
-
// Periodically recover expired VTXOs
if (arkRefreshTimer) clearInterval(arkRefreshTimer);
arkRefreshTimer = setInterval(() => {
@@ -127,6 +128,10 @@
if (browser && user && $arkkey) initArk();
});
+ $effect(() => {
+ if ($paymentSignal && $arkkey) arkSync("paymentSignal");
+ });
+
onMount(async () => {
if (browser) {
@@ -194,7 +199,6 @@
if (browser) {
close();
clearTimeout(checkTimer);
- if (arkSyncTimer) clearInterval(arkSyncTimer);
if (arkRefreshTimer) clearInterval(arkRefreshTimer);
}
});
diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte
index 657f0c95..c435f844 100644
--- a/src/routes/(app)/payment/[id]/+page.svelte
+++ b/src/routes/(app)/payment/[id]/+page.svelte
@@ -81,9 +81,9 @@
aria-label="Toggle currency display"
>
{#if $fiat}
- <div class="flex items-center gap-1">{f(toFiat(amount, rate), currency, userLocale)}</div>
+ <div class="flex items-center">{f(toFiat(amount, rate), currency, userLocale)}</div>
{:else}
- <div class="flex items-center gap-1">
+ <div class="flex items-center">
<iconify-icon noobserver icon="ph:lightning-fill" class="text-yellow-300"></iconify-icon>
{s(amount, userLocale)}
</div>
@@ -144,7 +144,7 @@
<div>
<span class="text-lg text-secondary">{$t("payments.date")}</span>
<div>
- {format(new Date(created), "h:mmaaa", { locale })}{format(new Date(created), "MMM d, yyyy", { locale })}
+ {format(new Date(created), "MMM d, yyyy", { locale })} {format(new Date(created), "h:mmaaa", { locale })}
</div>
</div>
@@ -189,6 +189,17 @@
</div>
{/if}
+ {#if type === types.ark && hash}
+ <div>
+ <span class="text-lg text-secondary">Txid</span>
+ <div class="flex">
+ <div>{hash}</div>
+ <button class="flex font-bold hover:opacity-80 mb-auto my-auto" onclick={() => copy(hash)} aria-label="Copy transaction ID"
+ ></button>
+ </div>
+ </div>
+ {/if}
+
{#if type === "bitcoin" || type === "liquid"}
<div>
<span class="text-lg text-secondary">Txid</span>