aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.ts12
-rw-r--r--routes/payments.ts7
2 files changed, 10 insertions, 9 deletions
diff --git a/index.ts b/index.ts
index 03926604..8c4b7b11 100644
--- a/index.ts
+++ b/index.ts
@@ -1,12 +1,12 @@
import app from "$lib/app";
-import { auth, admin, optional } from "$lib/auth";
+import { admin, auth, optional } from "$lib/auth";
import { listenForLightning } from "$lib/lightning";
import { getLocations } from "$lib/locations";
+import nwc from "$lib/nwc";
import { catchUp, check } from "$lib/payments";
import { getFx } from "$lib/rates";
import { sendHeartbeat } from "$lib/sockets";
-import nwc from "$lib/nwc";
import ecash from "$routes/ecash";
import email from "$routes/email";
@@ -67,7 +67,7 @@ app.post("/send", auth, payments.internal);
app.post("/gateway", payments.gateway);
app.post("/replace", auth, payments.replace);
app.get("/decode/:bolt11", payments.decode);
-app.get("/offer/:offer", payments.offer);
+app.post("/fetchinvoice", payments.fetchinvoice);
app.get("/encode", lnurl.encode);
app.get("/decode", lnurl.decode);
@@ -134,12 +134,12 @@ app.post("/echo", (req, res) => {
res.send(req.body);
});
-let host: string = process.env["HOST"] || "0.0.0.0";
-let port: number = parseInt(process.env["PORT"]) || 3119;
+const host: string = process.env["HOST"] || "0.0.0.0";
+const port: number = parseInt(process.env["PORT"]) || 3119;
app.listen({ host, port });
-let logerr = (e: Error) =>
+const logerr = (e: Error) =>
// (e &&
// e.message &&
// (e.message.includes("Invalid") ||
diff --git a/routes/payments.ts b/routes/payments.ts
index dfd9ad36..c8fd07dd 100644
--- a/routes/payments.ts
+++ b/routes/payments.ts
@@ -202,6 +202,7 @@ export default {
res.send({ alias, amount, ourfee });
} catch (e) {
+ console.log(e);
err("problem parsing", e.message);
bail(res, e.message);
}
@@ -548,8 +549,8 @@ export default {
res.send(await ln.decode(bolt11));
},
- async offer(req, res) {
- const { offer } = req.params;
- res.send(await ln.fetchinvoice(offer));
+ async fetchinvoice(req, res) {
+ const { amount, offer } = req.body;
+ res.send(await ln.fetchinvoice(offer, amount ? amount * 1000 : null));
},
};