diff options
| author | Adam Soltys <[email protected]> | 2022-09-13 15:59:07 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-13 15:59:07 -0700 |
| commit | 48108047dc4ab1557a2ca8f435885ff88d81e858 (patch) | |
| tree | df6fb758a2b602e3e2a532c362476f88e17b4eee /routes/lnurl.js | |
| parent | ff7514b07057ac5369a1c857f546ac0058fa310b (diff) | |
| download | coinos-server-48108047dc4ab1557a2ca8f435885ff88d81e858.tar.gz coinos-server-48108047dc4ab1557a2ca8f435885ff88d81e858.zip | |
refactor send internal into function
Diffstat (limited to 'routes/lnurl.js')
| -rw-r--r-- | routes/lnurl.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js index d7d6b172..edebc94d 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -15,7 +15,6 @@ import jwt from "jsonwebtoken"; import qs from "query-string"; import bolt11 from "bolt11"; - import { createInvoice, decodePaymentRequest, getPayments } from "lightning"; import { @@ -24,13 +23,14 @@ import { } from "./lightning/conversionFee.js"; import send from "$lib/send"; +import sendInternal from "$lib/sendInternal"; const logins = persist("data/logins.json"); const recipients = persist("data/recipients.json"); const lnurlPayments = persist("data/payments.json"); const withdrawals = persist("data/withdrawals.json"); -console.log("creating lnurl") +console.log("creating lnurl"); export const lnurlServer = lnurl.createServer(config.lnurl); app.get("/url", async (req, res, next) => { @@ -198,19 +198,14 @@ app.post("/pay", auth, async (req, res, next) => { lnurlPayments[secret] = user.id; if (recipients[secret]) { - url = `https://coinos.io/api/send`; - const { data } = await axios.post( - url, + let data = await sendInternal( { amount, memo: comment, username: recipients[secret].username }, - { - headers: { - authorization: req.headers.authorization - } - } + req.hostname, + user ); res.send(data); |
