aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/send
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-09 01:19:24 -0800
committerAdam Soltys <[email protected]>2026-02-11 15:34:34 -0800
commit8aad862255f18f80de9547eb14d2514aad16b783 (patch)
tree93f6ef16483735a20be1941e818465d3a77cebf6 /src/routes/(app)/send
parentf85f5bebc49f566eaeb7bd81a285b6516dbefa9f (diff)
downloadcoinos-ui-8aad862255f18f80de9547eb14d2514aad16b783.tar.gz
coinos-ui-8aad862255f18f80de9547eb14d2514aad16b783.zip
ark fixes
Diffstat (limited to 'src/routes/(app)/send')
-rw-r--r--src/routes/(app)/send/ark/[address]/+page.svelte14
-rw-r--r--src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte56
2 files changed, 35 insertions, 35 deletions
diff --git a/src/routes/(app)/send/ark/[address]/+page.svelte b/src/routes/(app)/send/ark/[address]/+page.svelte
index 140a2393..5361f292 100644
--- a/src/routes/(app)/send/ark/[address]/+page.svelte
+++ b/src/routes/(app)/send/ark/[address]/+page.svelte
@@ -5,8 +5,6 @@
import { page } from "$app/stores";
import { fiat as fiatStore, rate } from "$lib/store";
import { loc, fail, s, f, sats } from "$lib/utils";
- import { getWallet } from "$lib/ark";
-
let { data } = $props();
let { balance, user } = data;
@@ -30,16 +28,6 @@
submit.click();
};
- let send = async () => {
- console.log("SENDING", a);
- let wallet = await getWallet();
- const txid = await wallet.sendBitcoin({
- address,
- amount,
- });
-
- console.log(txid);
- };
</script>
<div class="container px-4 max-w-xl mx-auto space-y-5 text-center">
@@ -72,10 +60,8 @@
<form
action={`/send/ark/${address}/${amount}`}
class="contents"
- onsubmit={send}
>
<button
- use:focus
bind:this={submit}
type="submit"
class="btn !w-auto grow btn-accent"
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 92bddd15..95812266 100644
--- a/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte
+++ b/src/routes/(app)/send/ark/[address]/[amount]/[...feeRate]/+page.svelte
@@ -2,7 +2,7 @@
import { t } from "$lib/translations";
import { enhance } from "$app/forms";
import Spinner from "$comp/Spinner.svelte";
- import { focus, s } from "$lib/utils";
+ import { focus, s, post } from "$lib/utils";
import { pin } from "$lib/store";
import { goto, invalidate } from "$app/navigation";
import { rate } from "$lib/store";
@@ -15,30 +15,44 @@
let error = $state("");
- let handler = async ({ cancel }) => {
- submitting = true;
- error = "";
+ let handler = ({ cancel }) => {
+ if (account.type === "ark") {
+ cancel();
- try {
- if (account.type === "ark") {
- const txid = await sendArk(address, amount);
- console.log("ARK tx:", txid);
- }
+ (async () => {
+ submitting = true;
+ error = "";
+ try {
+ const txid = await sendArk(address, parseInt(amount));
- return async ({ result }) => {
- submitting = false;
- if (result.type === "redirect") {
- goto(result.location);
- } else {
- await applyAction(result);
- invalidate("app:payments");
+ const p = await post("/post/ark/vault-send", {
+ hash: txid,
+ amount: parseInt(amount),
+ aid: account.id,
+ });
+
+ goto(`/sent/${p.id}`, { invalidateAll: true });
+ } catch (e) {
+ submitting = false;
+ error = e.message || "Failed to send";
}
- };
- } catch (e) {
- submitting = false;
- error = e.message || "Failed to send";
- cancel();
+ })();
+
+ return;
}
+
+ submitting = true;
+ error = "";
+
+ return async ({ result }) => {
+ submitting = false;
+ if (result.type === "redirect") {
+ goto(result.location);
+ } else {
+ await applyAction(result);
+ invalidate("app:payments");
+ }
+ };
};
let { account, amount, address, message } = $derived(data);