aboutsummaryrefslogtreecommitdiffstats
path: root/lib/invoices.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-06 07:17:38 -0700
committerAdam Soltys <[email protected]>2024-09-06 07:17:38 -0700
commitda4ba5fd8a287b5c12e396c5fc478cdca7e3e8d3 (patch)
tree217faa485a387ca335858aefff0b8d588753c2d3 /lib/invoices.ts
parent80ae2ffb356a01da30c8c8d197cfc277a24674ef (diff)
downloadcoinos-server-da4ba5fd8a287b5c12e396c5fc478cdca7e3e8d3.tar.gz
coinos-server-da4ba5fd8a287b5c12e396c5fc478cdca7e3e8d3.zip
return expiry
Diffstat (limited to 'lib/invoices.ts')
-rw-r--r--lib/invoices.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/invoices.ts b/lib/invoices.ts
index 1532271e..6934a2d4 100644
--- a/lib/invoices.ts
+++ b/lib/invoices.ts
@@ -52,9 +52,9 @@ export let generate = async ({ invoice, user, sender = undefined }) => {
let id = v4();
let hash, text;
-
+
if (account) {
- bc = rpc({...config.bitcoin, wallet: account });
+ bc = rpc({ ...config.bitcoin, wallet: account });
hash = await bc.getNewAddress();
text = bip21(hash, invoice);
} else if (type === types.lightning) {
@@ -66,11 +66,12 @@ export let generate = async ({ invoice, user, sender = undefined }) => {
amount = Math.round(r.amount_msat / 1000);
r.bolt11 = bolt11;
} else {
+ expiry ||= 60 * 60 * 24 * 30;
r = await ln.invoice({
amount_msat: amount ? `${amount + tip}sat` : "any",
label: id,
description: memo || "",
- expiry: expiry || 60 * 60 * 24 * 30,
+ expiry,
deschashonly: true,
cltv: 19,
});
@@ -96,6 +97,7 @@ export let generate = async ({ invoice, user, sender = undefined }) => {
created: Date.now(),
currency,
hash,
+ expiry,
id,
items,
memo,