diff options
| author | Adam Soltys <[email protected]> | 2026-03-03 14:49:16 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-03-03 14:49:16 -0800 |
| commit | 1109581ac894bc7f872c53989d1aecde7cfa229f (patch) | |
| tree | 415b76b641a5036679a7acbb85d10103775cad4e /src | |
| parent | 6624b19b1d954dc69afbf1a9f6072e791771aff5 (diff) | |
| download | coinos-ui-1109581ac894bc7f872c53989d1aecde7cfa229f.tar.gz coinos-ui-1109581ac894bc7f872c53989d1aecde7cfa229f.zip | |
preload
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Account.svelte | 6 | ||||
| -rw-r--r-- | src/components/AppHeader.svelte | 2 | ||||
| -rw-r--r-- | src/components/Avatar.svelte | 2 | ||||
| -rw-r--r-- | src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte | 13 |
4 files changed, 17 insertions, 6 deletions
diff --git a/src/components/Account.svelte b/src/components/Account.svelte index 8388a9a7..44b53bdf 100644 --- a/src/components/Account.svelte +++ b/src/components/Account.svelte @@ -86,6 +86,8 @@ } }; + let receiveUrl = $derived(id === user.id ? `/${user.username}/receive` : "/invoice"); + let displayType = $derived( accountType === "ark" ? $t("accounts.ark") @@ -163,14 +165,14 @@ </div> <div class="flex w-full text-xl gap-2"> - <a href={"/invoice"} class="contents" onclick={(e) => setAccount(e, "/invoice")}> + <a href={receiveUrl} class="contents" data-sveltekit-preload-data="tap" onclick={(e) => setAccount(e, receiveUrl)}> <button class="btn !w-auto flex-1" data-testid="account-receive"> <PhHandCoinsBold width="32" style="transform: scaleX(-1)" /> <div class="my-auto">{$t("user.dashboard.receive")}</div> </button> </a> - <a href={`/send`} class="contents" onclick={(e) => setAccount(e, "/send")}> + <a href={`/send`} class="contents" data-sveltekit-preload-data="tap" onclick={(e) => setAccount(e, "/send")}> <button type="button" class="btn !w-auto flex-1"> <PhPaperPlaneRightBold width="32" /> <div class="my-auto">{$t("user.dashboard.send")}</div> diff --git a/src/components/AppHeader.svelte b/src/components/AppHeader.svelte index 586332e6..a12c656e 100644 --- a/src/components/AppHeader.svelte +++ b/src/components/AppHeader.svelte @@ -77,7 +77,7 @@ <nav class="flex justify-end items-center space-x-4 p-5"> {#if user} {#each links as { href, icon: Icon, label }} - <a {href} data-sveltekit-preload-code="eager" aria-label={label}> + <a {href} data-sveltekit-preload-data="tap" aria-label={label}> <button class="flex justify-center items-center bg-base-100 p-2 rounded-full w-12 h-12 sm:w-16 sm:h-16 drop-shadow-xl {opacity(href)}" aria-label={label}> <Icon width={(w ?? 0) > 640 ? 32 : 24} /> </button> diff --git a/src/components/Avatar.svelte b/src/components/Avatar.svelte index c56b7486..c5083d75 100644 --- a/src/components/Avatar.svelte +++ b/src/components/Avatar.svelte @@ -38,7 +38,7 @@ {#if disabled} {@render body()} {:else if link} - <a href={link} class:pointer-events-none={disabled}> + <a href={link} data-sveltekit-preload-data="tap" class:pointer-events-none={disabled}> {@render body()} </a> {:else} diff --git a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte index d5eb0293..54927f0f 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte @@ -31,7 +31,9 @@ try { await signTxWithPrf(prfKey); return; - } catch (e: any) {} + } catch (e: any) { + console.log("Signing with cached PRF key failed:", e.message); + } } const { getWalletEntropy, deriveNostrEntropy } = await import("$lib/walletEntropy"); const entropy = await getWalletEntropy(); @@ -39,12 +41,15 @@ try { await signTxWithPrf(entropy); return; - } catch (e: any) {} + } catch (e: any) { + console.log("Signing with wallet entropy failed:", e.message); + } } try { const interactiveEntropy = await deriveNostrEntropy(); await signTxWithPrf(interactiveEntropy); } catch (e: any) { + console.log("Signing with interactive entropy failed:", e.message); error = e.message || $t("payments.failedToSend"); } }; @@ -105,6 +110,10 @@ let master = HDKey.fromMasterSeed(seed, network as any); let child = master.derive(`m/84'/0'/${account.accountIndex ?? 0}'`); + if (account.pubkey && child.publicExtendedKey !== account.pubkey) { + throw new Error("Derived key does not match account — try logging in again"); + } + let raw = decode(hex); let isPSBT = raw[0] === 0x70 && raw[1] === 0x73 && raw[2] === 0x62 && raw[3] === 0x74; let tx: any = isPSBT ? Transaction.fromPSBT(raw) : Transaction.fromRaw(raw); |
