From 7611315ae6de9bf9592bfd65d841aa2b33d06e57 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 31 Jan 2023 23:11:49 -0800 Subject: classic payments --- .../(app)/[username]/payments/[...page]/+page.svelte | 14 +++++++------- src/routes/(app)/invoice/[hash]/+layout.server.js | 2 +- src/routes/(app)/send/[...text]/+page.server.js | 5 +++++ src/routes/(app)/send/[uuid=uuid]/+page.server.js | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/routes/(app)/[username]/payments/[...page]/+page.svelte b/src/routes/(app)/[username]/payments/[...page]/+page.svelte index b46e31d6..c9731299 100644 --- a/src/routes/(app)/[username]/payments/[...page]/+page.svelte +++ b/src/routes/(app)/[username]/payments/[...page]/+page.svelte @@ -59,9 +59,9 @@ payments = payments.map((p) => ({ ...p, created: new Date(p.created), - fiat: f(((p.amount || 0) * p.rate) / sats, p.currency), - fiatfee: f(((p.fee || 0) * p.rate) / sats, p.currency), - fiattip: f(((p.tip || 0) * p.rate) / sats, p.currency) + amount_fiat: f((p.amount * p.rate) / sats, p.currency), + fee_fiat: p.fee ? f((p.fee * p.rate) / sats, p.currency) : null, + tip_fiat: p.tip ? f((p.tip * p.rate) / sats, p.currency) : null })); let keys = [ @@ -73,9 +73,9 @@ 'amount', 'fee', 'tip', - 'fiat', - 'fiatfee', - 'fiattip' + 'amount_fiat', + 'fee_fiat', + 'tip_fiat' ]; let csv = @@ -191,7 +191,7 @@
{#if p.type === types.lightning}
⚡️
- {:else} + {:else if p.type === types.bitcoin}
{ } catch (e) {} } + if (t.endsWith('@classic')) { + ({ uuid: id } = await get(`/invoice/classic/${t.replace('@classic', '')}`)); + if (id) throw redirect(307, `/send/${id}`); + } + if (t.includes('/pot')) throw redirect(307, t.substring(t.indexOf('/pot'))); if (t.toLowerCase().startsWith('lnurl')) throw redirect(307, `/ln/${t}`); diff --git a/src/routes/(app)/send/[uuid=uuid]/+page.server.js b/src/routes/(app)/send/[uuid=uuid]/+page.server.js index 7fa613bf..a59853d3 100644 --- a/src/routes/(app)/send/[uuid=uuid]/+page.server.js +++ b/src/routes/(app)/send/[uuid=uuid]/+page.server.js @@ -4,7 +4,7 @@ import { btc as asset, auth, get, post } from '$lib/utils'; export async function load({ params, parent }) { let { user } = await parent(); - let { amount, address, tip, text, user: recipient } = await get(`/invoice/${params.id}`); + let { amount, address, tip, text, user: recipient } = await get(`/invoice/${params.uuid}`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); if (tip) amount += tip; return { amount, address, payreq: text, recipient }; -- cgit v1.2.3