From c4a7b68048d389cac3c68797ce4a44bca7979d17 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 2 Jan 2024 15:18:58 -0800 Subject: liquid payments --- src/routes/(app)/payment/[id]/+page.svelte | 9 +++++++-- src/routes/(app)/send/[...text]/+page.server.js | 4 ++-- .../send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js | 8 +------- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/routes/(app)') diff --git a/src/routes/(app)/payment/[id]/+page.svelte b/src/routes/(app)/payment/[id]/+page.svelte index 1acd0d3d..e07d630a 100644 --- a/src/routes/(app)/payment/[id]/+page.svelte +++ b/src/routes/(app)/payment/[id]/+page.svelte @@ -16,7 +16,7 @@ import Avatar from "$comp/Avatar.svelte"; import Icon from "$comp/Icon.svelte"; import { format } from "date-fns"; - import { PUBLIC_EXPLORER as expl } from "$env/static/public"; + import { PUBLIC_EXPLORER, PUBLIC_LIQUID_EXPLORER } from "$env/static/public"; export let data; let { user, payment: p } = data; @@ -37,6 +37,11 @@ } = p; let a = Math.abs(amount); + let expl = { + bitcoin: PUBLIC_EXPLORER, + liquid: PUBLIC_LIQUID_EXPLORER, + }[type]; + let print = async () => { await post(`/payment/${id}/print`, { id }); success("Printing!"); @@ -157,7 +162,7 @@ Txid
- {txid} { } // bitcoin - if (validate(t)) { + if (validate(t) || isLiquid(t)) { try { ({ id, user } = await get(`/invoice/${t}`)); } catch (e) { diff --git a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js index 86f9fde8..6f735f32 100644 --- a/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js +++ b/src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js @@ -5,13 +5,7 @@ let seen = {}; export async function load({ params: { address, amount, feeRate }, cookies }) { try { - let fees = await fetch( - `https://mempool.space/api/v1/fees/recommended` - ).then((r) => r.json()); - - if (!feeRate) feeRate = fees.halfHourFee; - - let { fee, ourfee, hex } = await post( + let { fee, fees, ourfee, hex } = await post( "/bitcoin/fee", { address, amount, feeRate }, auth(cookies) -- cgit v1.2.3