aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-27 23:22:27 -0800
committerAdam Soltys <[email protected]>2023-12-28 22:51:02 -0800
commit02a373b8128c1544711d14ecd6ed19e20c7e3b0b (patch)
tree51327752718eac827273ada093fe6060d7184f56 /lib/utils.js
parentaaf8dd49b07066e534408a2d41d84c518a45c2b6 (diff)
downloadcoinos-server-02a373b8128c1544711d14ecd6ed19e20c7e3b0b.tar.gz
coinos-server-02a373b8128c1544711d14ecd6ed19e20c7e3b0b.zip
liquid wip
Diffstat (limited to 'lib/utils.js')
-rw-r--r--lib/utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/utils.js b/lib/utils.js
index 1e12214b..0c382a0c 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -27,8 +27,9 @@ export const uniq = (a, k) => [...new Map(a.map((x) => [k(x), x])).values()];
export const pick = (O, K) =>
K.reduce((o, k) => (typeof O[k] !== "undefined" && (o[k] = O[k]), o), {});
-export const bip21 = (address, { amount, memo, tip }) => {
- let url = amount || memo ? `bitcoin:${address}?` : address;
+export const bip21 = (address, { amount, memo, tip, type }) => {
+ let network = { liquid: "liquidnetwork", bitcoin: "bitcoin" }[type];
+ let url = amount || memo ? `${network}:${address}?` : address;
if (amount)
url += `amount=${((amount + tip) / SATS).toFixed(8)}${memo ? "&" : ""}`;
if (memo) url += `message=${memo}`;