aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/nwc.ts3
-rw-r--r--lib/register.ts6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index 53cda3b4..f92017d8 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -123,6 +123,7 @@ const handle = (method, params, ev, app, user) =>
(a, b) =>
a +
(Math.abs(parseInt(b.amount || 0)) +
+ parseInt(b.tip || 0) +
parseInt(b.fee || 0) +
parseInt(b.ourfee || 0)),
0,
@@ -348,7 +349,7 @@ const handle = (method, params, ev, app, user) =>
description: p.memo,
preimage: p.ref,
payment_hash,
- amount: Math.abs(p.amount * 1000),
+ amount: (Math.abs(p.amount) + p.tip) * 1000,
fees_paid: p.fee * 1000,
created_at,
expires_at: created_at + week,
diff --git a/lib/register.ts b/lib/register.ts
index 90cfe060..1493211c 100644
--- a/lib/register.ts
+++ b/lib/register.ts
@@ -70,10 +70,12 @@ export default async (user, ip) => {
name: "Spending",
});
- const secret = bytesToHex(randomBytes(32));
+ const bytes = randomBytes(32);
+ const secret = bytesToHex(bytes);
const app = {
+ uid: id,
secret,
- pubkey: getPublicKey(secret),
+ pubkey: getPublicKey(bytes),
max_amount: 10000,
budget_renewal: "weekly",
name: username,