aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-26 13:36:28 -0800
committerAdam Soltys <[email protected]>2026-02-26 13:36:28 -0800
commita5faa64ba470f935ea3e7932feece3cd9fbadb90 (patch)
tree79ec7d6cb2038b5920d5cca977a244fbb189923c /src/routes/(app)/send
parentb137cdfca84cf68a2b8a620ba1c55337e88a0050 (diff)
downloadcoinos-ui-a5faa64ba470f935ea3e7932feece3cd9fbadb90.tar.gz
coinos-ui-a5faa64ba470f935ea3e7932feece3cd9fbadb90.zip
ark tests
Diffstat (limited to 'src/routes/(app)/send')
-rw-r--r--src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts6
-rw-r--r--src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte30
-rw-r--r--src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte9
3 files changed, 32 insertions, 13 deletions
diff --git a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts
index 10a6a737..9fa754d6 100644
--- a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts
+++ b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.server.ts
@@ -26,12 +26,18 @@ export async function load({ params: { address, amount }, cookies, parent }) {
}
const rate = rates[user.currency];
+ const serverArkAddress = account.type === "ark" ? await get("/ark/address") : null;
+
+ // Check if destination is the user's own vault address (custodial ark invoice)
+ const isCustodialForward = account.type === "ark" && address === account.arkAddress;
return {
account,
amount,
address,
rate,
+ serverArkAddress,
+ isCustodialForward,
};
}
diff --git a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte
index 02f1c4fb..744886ae 100644
--- a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte
+++ b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte
@@ -2,12 +2,12 @@
import { t } from "$lib/translations";
import { enhance } from "$app/forms";
import Spinner from "$comp/Spinner.svelte";
- import { focus, s, post } from "$lib/utils";
+ import { focus, loc, s, post } from "$lib/utils";
import { pin } from "$lib/store";
import { goto, invalidate } from "$app/navigation";
import { rate } from "$lib/store";
import { applyAction } from "$app/forms";
- import { sendArk } from "$lib/ark";
+ import { sendArk, sendArkViaForward } from "$lib/ark";
import Amount from "$comp/Amount.svelte";
@@ -23,13 +23,24 @@
submitting = true;
error = "";
try {
- const txid = await sendArk(address, parseInt(amount));
+ let p;
- const p = await post("/post/ark/vault-send", {
- hash: txid,
- amount: parseInt(amount),
- aid: account.id,
- });
+ if (data.serverArkAddress && (address === data.serverArkAddress || data.isCustodialForward)) {
+ // Vault→custodial: send to server and credit custodial account
+ p = await sendArkViaForward({
+ serverArkAddress: data.serverArkAddress,
+ amount: parseInt(amount),
+ aid: account.id,
+ user: data.user,
+ });
+ } else {
+ const txid = await sendArk(address, parseInt(amount));
+ p = await post("/post/ark/vault-send", {
+ hash: txid,
+ amount: parseInt(amount),
+ aid: account.id,
+ });
+ }
goto(`/sent/${p.id}`, { invalidateAll: true });
} catch (e: any) {
@@ -65,6 +76,7 @@
let balance = $derived(data.user.balance);
let currency = $derived(data.user.currency);
+ let locale = $derived(loc(data.user));
let submitting = $state(false),
submit = $state();
</script>
@@ -81,7 +93,7 @@
{#if !error}
<div class="text-xl text-secondary break-all">{address}</div>
- <Amount {amount} rate={$rate} {currency} />
+ <Amount {amount} rate={$rate} {currency} {locale} />
<form method="POST" use:enhance={handler}>
<input name="pin" value={$pin} type="hidden" />
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 967c47af..4cb22155 100644
--- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte
+++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte
@@ -6,7 +6,7 @@
import Spinner from "$comp/Spinner.svelte";
import WalletPass from "$comp/WalletPass.svelte";
import { page } from "$app/stores";
- import { toFiat, f, focus, s, sat, closest, network } from "$lib/utils";
+ import { toFiat, f, focus, loc, s, sat, closest, network } from "$lib/utils";
import { pin } from "$lib/store";
import { goto, invalidate } from "$app/navigation";
import { rate } from "$lib/store";
@@ -198,6 +198,7 @@
let balance = $derived(data.user.balance);
let currency = $derived(data.user.currency);
+ let locale = $derived(loc(data.user));
let submitting = $state(),
submit: any = $state(),
showSettings = $state();
@@ -231,7 +232,7 @@
<div class="text-xl text-secondary break-all">{address}</div>
{/if}
- <Amount amount={subtract ? amount - fee - ourfee : amount} rate={$rate} {currency} />
+ <Amount amount={subtract ? amount - fee - ourfee : amount} rate={$rate} {currency} {locale} />
{#if fees}
<div class="text-center">
@@ -245,7 +246,7 @@
</option>
{/each}
</select>
- <Amount amount={fee} rate={$rate} {currency} />
+ <Amount amount={fee} rate={$rate} {currency} {locale} />
</div>
</div>
@@ -253,7 +254,7 @@
<div class="text-center">
<h2 class="text-secondary text-lg">{$t("payments.platformFee")}</h2>
- <Amount amount={ourfee} rate={$rate} {currency} />
+ <Amount amount={ourfee} rate={$rate} {currency} {locale} />
</div>
{/if}
{/if}