diff options
| author | John Barratt <[email protected]> | 2022-12-15 11:38:19 -0800 |
|---|---|---|
| committer | John Barratt <[email protected]> | 2022-12-15 11:38:19 -0800 |
| commit | 69c8473d7c5989e17576c54bcb7a6d58651e8fef (patch) | |
| tree | 730c8140906530ea4fff49070bce3bee88dc8793 | |
| parent | 48eb9eca72b88cc9682e53b68154214ba06a639b (diff) | |
| download | coinos-server-69c8473d7c5989e17576c54bcb7a6d58651e8fef.tar.gz coinos-server-69c8473d7c5989e17576c54bcb7a6d58651e8fef.zip | |
decoding invoice endpoint
| -rw-r--r-- | routes/invoices.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routes/invoices.js b/routes/invoices.js index 86836295..d6592d81 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -9,6 +9,7 @@ import bc from "$lib/bitcoin"; import lq from "$lib/liquid"; import { SATS, bip21, deriveAddress, derivePayRequest } from "$lib/utils"; import { emit } from "$lib/sockets"; +import bolt11 from "bolt11"; app.get("/invoice", async (req, res, next) => { try { @@ -211,8 +212,15 @@ app.post( app.post("/conversion", async (req, res, next) => { let { invoice_id, text } = req.body; - + console.log("HERE", invoice_id, text) let conversion = await db.Conversion.create({ invoice_id, text }); res.send(conversion); } ); + +app.post("/invoice/decode", + async (req, res, next) => { + let {text} = req.body; + res.send(bolt11.decode(text)) + } +)
\ No newline at end of file |
