aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-11-01 20:29:59 -0700
committerAdam Soltys <[email protected]>2024-11-01 20:29:59 -0700
commite3ec831eb9cbedd8e5d08cee4c1d6abc15b8a4d4 (patch)
tree60450fde56ea6d9180450eeecf340178a6ac5d61
parent88b32c9cd70916a742263c36703d8c2b073236c6 (diff)
downloadcoinos-server-e3ec831eb9cbedd8e5d08cee4c1d6abc15b8a4d4.tar.gz
coinos-server-e3ec831eb9cbedd8e5d08cee4c1d6abc15b8a4d4.zip
cleanup
-rw-r--r--lib/nwc.ts16
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index c5209612..bd8eefc1 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -22,6 +22,8 @@ const methods = [
"list_transactions",
];
+const week = 7 * 24 * 60 * 60;
+
export default () => {
const r = new Relay("ws://strfry:7777");
@@ -172,6 +174,7 @@ const handle = (method, params, user) =>
if (invoices.length) {
const {
amount_received_msat: amount,
+ description,
expires_at,
preimage,
paid_at: settled_at,
@@ -185,7 +188,7 @@ const handle = (method, params, user) =>
payment_hash,
amount,
fees_paid: 0,
- created_at: expires_at - 7 * 24 * 60 * 60,
+ created_at: expires_at - week,
expires_at,
settled_at,
});
@@ -217,14 +220,7 @@ const handle = (method, params, user) =>
},
async list_transactions() {
- const {
- from,
- until,
- limit = 10,
- offset = 0,
- unpaid = false,
- type,
- } = params;
+ const { from, until, limit = 10, offset = 0, type } = params;
const payments = await db.lRange(`${user.id}:payments`, 0, -1);
@@ -253,7 +249,7 @@ const handle = (method, params, user) =>
amount: Math.abs(p.amount * 1000),
fees_paid: p.fee * 1000,
created_at,
- expires_at: created_at + 7 * 24 * 60 * 60,
+ expires_at: created_at + week,
settled_at: p.amount > 0 ? created_at : undefined,
metadata: {},
});