aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-31 23:11:49 -0800
committerAdam Soltys <[email protected]>2023-01-31 23:11:49 -0800
commit7611315ae6de9bf9592bfd65d841aa2b33d06e57 (patch)
treea7441d19144c1823a509660cb0a7e283a91dd36f /src
parentcf29dcc02e2c9ac593d6e8f0aff2589b80ffa994 (diff)
downloadcoinos-ui-7611315ae6de9bf9592bfd65d841aa2b33d06e57.tar.gz
coinos-ui-7611315ae6de9bf9592bfd65d841aa2b33d06e57.zip
classic payments
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/[username]/payments/[...page]/+page.svelte14
-rw-r--r--src/routes/(app)/invoice/[hash]/+layout.server.js2
-rw-r--r--src/routes/(app)/send/[...text]/+page.server.js5
-rw-r--r--src/routes/(app)/send/[uuid=uuid]/+page.server.js2
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 @@
<div class="text-secondary flex">
{#if p.type === types.lightning}
<div class="text-3xl">⚡️</div>
- {:else}
+ {:else if p.type === types.bitcoin}
<div class="my-auto mr-1">
<img
src="/images/bitcoin.svg"
diff --git a/src/routes/(app)/invoice/[hash]/+layout.server.js b/src/routes/(app)/invoice/[hash]/+layout.server.js
index 61a479ab..d38f945f 100644
--- a/src/routes/(app)/invoice/[hash]/+layout.server.js
+++ b/src/routes/(app)/invoice/[hash]/+layout.server.js
@@ -6,7 +6,7 @@ export async function load({ depends, params, url }) {
depends('app:invoice');
let { hash } = params;
- let invoice = await get(`/invoice?hash=${hash}`);
+ let invoice = await get(`/invoice/${hash}`);
let { amount, received } = invoice;
amount = parseInt(amount);
diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js
index 8e5e02d7..3d25ed7e 100644
--- a/src/routes/(app)/send/[...text]/+page.server.js
+++ b/src/routes/(app)/send/[...text]/+page.server.js
@@ -21,6 +21,11 @@ let parse = async (t, host) => {
} 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 };