diff options
| author | Jurjen de Vries <[email protected]> | 2025-09-11 00:48:15 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-11 00:48:15 +0200 |
| commit | 0c69c9848c6b98c92609d209103efc60003c9723 (patch) | |
| tree | 445121def885f13d0f80c06864ad2ff4d5ef95a1 /src/routes/(app)/send/bitcoin | |
| parent | 2abcf6e435fca5d86960f3ba4228002bfb0a19e6 (diff) | |
| parent | 9277b2921e09ee9dd5f39cf4af30a2330f4d95d1 (diff) | |
| download | coinos-ui-0c69c9848c6b98c92609d209103efc60003c9723.tar.gz coinos-ui-0c69c9848c6b98c92609d209103efc60003c9723.zip | |
Merge branch 'coinos:master' into master
Diffstat (limited to 'src/routes/(app)/send/bitcoin')
3 files changed, 37 insertions, 20 deletions
diff --git a/src/routes/(app)/send/bitcoin/[address]/+page.svelte b/src/routes/(app)/send/bitcoin/[address]/+page.svelte index 060473ec..529e2691 100644 --- a/src/routes/(app)/send/bitcoin/[address]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/+page.svelte @@ -1,25 +1,32 @@ <script> + import { tick } from "svelte"; import { t } from "$lib/translations"; import Icon from "$comp/Icon.svelte"; import Numpad from "$comp/Numpad.svelte"; import { page } from "$app/stores"; import { rate } from "$lib/store"; - import { fail, s } from "$lib/utils"; + import { loc, fail, s } from "$lib/utils"; let { data } = $props(); let { balance, user } = data; let { address } = $page.params; let { currency, username } = user; + let locale = loc(user); let amount = $state(0); - let submit = $state(), fiat = $state(); + let a = $state(0); + let submit = $state(), + fiat = $state(); $effect(() => ($rate = data.rate)); + $effect(() => (amount = a)); - let setMax = (e) => { + let setMax = async (e) => { e.preventDefault(); fiat = false; amount = balance; + await tick(); + submit.click(); }; </script> @@ -28,7 +35,7 @@ <div class="text-xl text-secondary break-all">{address}</div> - <Numpad bind:amount bind:fiat {currency} {submit} bind:rate={$rate} /> + <Numpad bind:amount={a} bind:fiat {currency} {submit} bind:rate={$rate} {locale} /> <div class="flex justify-center gap-2"> <button @@ -39,7 +46,12 @@ > <form action={`/send/bitcoin/${address}/${amount}`} class="contents"> - <button use:focus bind:this={submit} type="submit" class="btn !w-auto grow btn-accent"> + <button + use:focus + bind:this={submit} + type="submit" + class="btn !w-auto grow btn-accent" + > {$t("payments.next")} </button> </form> diff --git a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts index 5f20d1bd..ddee9c1c 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.ts @@ -12,7 +12,7 @@ export async function load({ const aid = cookies.get("aid") || user.id; try { - const { fee, fees, inputs, ourfee, hex } = await post( + const { fee, fees, inputs, ourfee, hex, subtract } = await post( "/bitcoin/fee", { address, amount, feeRate, aid }, auth(cookies), @@ -29,6 +29,7 @@ export async function load({ feeRate, rate: rates[user.currency], ourfee, + subtract, hex, inputs, }; 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 7d9b8f64..1551cc2c 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.svelte @@ -1,6 +1,4 @@ <script> - import { run } from "svelte/legacy"; - import { tick } from "svelte"; import { t } from "$lib/translations"; import { enhance } from "$app/forms"; @@ -15,7 +13,6 @@ import { applyAction } from "$app/forms"; import { hex as hexUtil } from "@scure/base"; import * as btc from "@scure/btc-signer"; - import { hash160 } from "@scure/btc-signer/utils"; import { decrypt } from "nostr-tools/nip49"; import { HDKey } from "@scure/bip32"; import { entropyToMnemonic, mnemonicToSeed } from "@scure/bip39"; @@ -71,8 +68,18 @@ let toggle = () => (submitting = !submitting); - let { account, amount, address, message, fee, fees, ourfee, hex, inputs } = - $derived(data); + let { + account, + amount, + address, + message, + fee, + fees, + subtract, + ourfee, + hex, + inputs, + } = $derived(data); let { feeRate } = $state(data); @@ -116,7 +123,11 @@ {:else} <div class="text-xl text-secondary break-all">{address}</div> - <Amount {amount} rate={$rate} {currency} /> + <Amount + amount={subtract ? amount - fee - ourfee : amount} + rate={$rate} + {currency} + /> <div class="text-center"> <h2 class="text-secondary text-lg">{$t("payments.networkFee")}</h2> @@ -137,14 +148,7 @@ <div class="text-center"> <h2 class="text-secondary text-lg">{$t("payments.platformFee")}</h2> - <div class="flex flex-wrap gap-4 justify-center"> - <div class="my-auto"> - <h2 class="text-xl"> - {f(toFiat(ourfee, $rate), currency)} - </h2> - <h3 class="text-secondary">⚡️{s(ourfee)}</h3> - </div> - </div> + <Amount amount={ourfee} rate={$rate} {currency} /> </div> {/if} |
