From 3aab57df2063d913bd16b953187ced242421f66a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 26 Nov 2025 21:44:55 -0800 Subject: ark stuff --- src/routes/(app)/+layout.svelte | 14 +- src/routes/(app)/account/ark/+page.svelte | 228 +++++++++++++++++++++++ src/routes/(app)/account/bitcoin/+page.svelte | 34 ++++ src/routes/(app)/account/savings/+page.svelte | 49 ++--- src/routes/(app)/ark/+page.server.ts | 11 -- src/routes/(app)/ark/+page.svelte | 113 ----------- src/routes/(app)/invoice/[id]/+layout.server.ts | 1 - src/routes/(app)/send/ark/[address]/+page.svelte | 3 + 8 files changed, 292 insertions(+), 161 deletions(-) create mode 100644 src/routes/(app)/account/ark/+page.svelte create mode 100644 src/routes/(app)/account/bitcoin/+page.svelte delete mode 100644 src/routes/(app)/ark/+page.server.ts delete mode 100644 src/routes/(app)/ark/+page.svelte (limited to 'src/routes') diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index ed76e103..6624fff8 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -76,19 +76,7 @@ if (user) { const wallet = await getWallet(); - wallet.notifyIncomingFunds(handleArkPayment); - - // Sync ARK address with backend if changed - const arkAddress = await getAddress(); - if (arkAddress !== user.arkAddress) { - try { - console.log("SYNCING", arkAddress); - await post("/post/user", { arkAddress }); - user.arkAddress = arkAddress; - } catch (e) { - console.error("Failed to sync ARK address:", e); - } - } + if (wallet) wallet.notifyIncomingFunds(handleArkPayment); } // if (window.NDEFReader) { diff --git a/src/routes/(app)/account/ark/+page.svelte b/src/routes/(app)/account/ark/+page.svelte new file mode 100644 index 00000000..ff313664 --- /dev/null +++ b/src/routes/(app)/account/ark/+page.svelte @@ -0,0 +1,228 @@ + + +
+
+ +

Create Ark Wallet

+
+ +
+ {#if !confirmed} +
+

+ Your Ark wallet is secured by a private key. Back it up now - you won't be able to see it again without your password. +

+ + {#if showNsec} +
+
Your backup key (nsec)
+
copy(nsec)} + > + {nsec} +
+
+ Click to copy. Store this somewhere safe - anyone with this key can spend your funds. +
+
+ +
+ + +
+ {:else} + + {/if} +
+ {:else} +
+

+ Set a password to encrypt your key. You'll need this password to send funds. +

+ + + + + +
+ + +
+
+ {/if} +
+
diff --git a/src/routes/(app)/account/bitcoin/+page.svelte b/src/routes/(app)/account/bitcoin/+page.svelte new file mode 100644 index 00000000..d45ff8c6 --- /dev/null +++ b/src/routes/(app)/account/bitcoin/+page.svelte @@ -0,0 +1,34 @@ + + +
+

+ {$t("accounts.accountSetup")} +

+ + +
diff --git a/src/routes/(app)/account/savings/+page.svelte b/src/routes/(app)/account/savings/+page.svelte index 22d550b4..a474ad52 100644 --- a/src/routes/(app)/account/savings/+page.svelte +++ b/src/routes/(app)/account/savings/+page.svelte @@ -1,37 +1,40 @@

- {$t("accounts.accountSetup")} + Choose wallet type

-
-
- -
-
- -
-
-
{$t("accounts.create")}
-
{$t("accounts.generateSeed")}
+
diff --git a/src/routes/(app)/ark/+page.server.ts b/src/routes/(app)/ark/+page.server.ts deleted file mode 100644 index bac0a02a..00000000 --- a/src/routes/(app)/ark/+page.server.ts +++ /dev/null @@ -1,11 +0,0 @@ -import getRates from "$lib/rates"; - -export async function load({ depends, parent }) { - depends("app:payments"); - depends("app:items"); - - const { user } = await parent(); - - const rates = await getRates(); - return { rate: rates[user.currency] }; -} diff --git a/src/routes/(app)/ark/+page.svelte b/src/routes/(app)/ark/+page.svelte deleted file mode 100644 index 3089d887..00000000 --- a/src/routes/(app)/ark/+page.svelte +++ /dev/null @@ -1,113 +0,0 @@ - - -
-
- -

Ark Wallet

-
- -
- {#if loading} -
-
-
- {:else} -
- - {#if balance.pending > 0} -
- +{s(balance.pending)} pending -
- {/if} -
- - - - - -
- -
-
Your ARK Address
-
copy(address)} - > - {address} -
-
- -
-
Backup Key
- {#if showNsec} -
- {nsec} -
-
⚠️ Keep this secret! Anyone with this key can spend your funds.
- {:else} - - {/if} -
- {/if} -
-
diff --git a/src/routes/(app)/invoice/[id]/+layout.server.ts b/src/routes/(app)/invoice/[id]/+layout.server.ts index a18dad4e..ab41dddc 100644 --- a/src/routes/(app)/invoice/[id]/+layout.server.ts +++ b/src/routes/(app)/invoice/[id]/+layout.server.ts @@ -11,7 +11,6 @@ export async function load({ cookies, depends, params, url, parent }) { if (id) { invoice = await get(`/invoice/${id}`); - console.log("INV", invoice); const options = !!url.searchParams.get("options"); let { amount, pending, received } = invoice; amount = parseInt(amount); diff --git a/src/routes/(app)/send/ark/[address]/+page.svelte b/src/routes/(app)/send/ark/[address]/+page.svelte index 6ff6ed58..4f355ec1 100644 --- a/src/routes/(app)/send/ark/[address]/+page.svelte +++ b/src/routes/(app)/send/ark/[address]/+page.svelte @@ -6,6 +6,7 @@ import { page } from "$app/stores"; import { rate } from "$lib/store"; import { loc, fail, s } from "$lib/utils"; + import { getWallet } from "$lib/ark"; let { data } = $props(); @@ -31,6 +32,8 @@ }; let send = async () => { + console.log("SENDING", a); + let wallet = await getWallet(); const txid = await wallet.sendBitcoin({ address, amount, -- cgit v1.2.3