aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-17 11:42:57 -0800
committerAdam Soltys <[email protected]>2023-01-17 11:42:57 -0800
commit46913d34e77f19c3dd7c105b1deec452348dd1db (patch)
treea1cdc217ce9f2031bbb4ca6b4aabc1093024161b /routes
parent220d6d52b8439a81b572a889d7012f826efc55c5 (diff)
downloadcoinos-server-46913d34e77f19c3dd7c105b1deec452348dd1db.tar.gz
coinos-server-46913d34e77f19c3dd7c105b1deec452348dd1db.zip
rename invoice id to hash
Diffstat (limited to 'routes')
-rw-r--r--routes/invoices.js12
1 files changed, 6 insertions, 6 deletions
diff --git a/routes/invoices.js b/routes/invoices.js
index 94b0d27d..acd9457e 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -5,8 +5,8 @@ import { db, g, s } from "$lib/db";
import ln from "$lib/ln";
export default {
- async get({ query: { id } }, res) {
- let invoice = await g(`invoice:${id}`);
+ async get({ query: { hash } }, res) {
+ let invoice = await g(`invoice:${hash}`);
invoice.user = await g(`user:${invoice.uid}`);
res.send(invoice);
},
@@ -28,7 +28,7 @@ export default {
if (!rate) rate = store.rates[currency];
if (amount < 0) throw new Error("invalid amount");
- let { payment_hash: id, bolt11: text } = await ln.invoice(
+ let { payment_hash: hash, bolt11: text } = await ln.invoice(
amount ? `${amount + tip}sat` : "any",
new Date(),
"",
@@ -37,7 +37,7 @@ export default {
invoice = {
...invoice,
- id,
+ hash,
amount,
currency,
rate,
@@ -57,8 +57,8 @@ export default {
`${text.substr(0, 8)}..${text.substr(-6)}`
);
- await s(`invoice:${id}`, invoice);
- await db.lPush(`${uid}:invoices`, id);
+ await s(`invoice:${hash}`, invoice);
+ await db.lPush(`${uid}:invoices`, hash);
if (request_id) {
let request = await g(`request:${request_id}`);