aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-01-02 15:18:58 -0800
committerAdam Soltys <[email protected]>2024-01-02 15:18:58 -0800
commitc4a7b68048d389cac3c68797ce4a44bca7979d17 (patch)
tree81db583c95094fda89fc10559dcc63e00cdb9b5c /src/routes
parent4e37c853b1014637f12455c44cb49861343ed918 (diff)
downloadcoinos-ui-c4a7b68048d389cac3c68797ce4a44bca7979d17.tar.gz
coinos-ui-c4a7b68048d389cac3c68797ce4a44bca7979d17.zip
liquid payments
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/(app)/payment/[id]/+page.svelte9
-rw-r--r--src/routes/(app)/send/[...text]/+page.server.js4
-rw-r--r--src/routes/(app)/send/bitcoin/[address]/[amount]/[...feeRate]/+page.server.js8
3 files changed, 10 insertions, 11 deletions
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 @@
<span class="text-lg text-secondary">Txid</span>
<div class="flex">
<div>
- <a
+ <a
href={`${expl}/tx/${txid}${vout ? "#vout=" + vout : ""}`}
target="_blank"
rel="noreferrer">{txid}</a
diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js
index 3e6b7c13..73a44512 100644
--- a/src/routes/(app)/send/[...text]/+page.server.js
+++ b/src/routes/(app)/send/[...text]/+page.server.js
@@ -1,6 +1,6 @@
import { validate } from "bitcoin-address-validation";
import bip21 from "bip21";
-import { auth, get, post } from "$lib/utils";
+import { auth, get, isLiquid, post } from "$lib/utils";
import { fail, redirect } from "@sveltejs/kit";
import { PUBLIC_DOMAIN } from "$env/static/public";
@@ -46,7 +46,7 @@ let parse = async (t, host) => {
}
// 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)