From eb9a9c048ebcda09df0ba31745b9d9a5b543596f Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 25 Jul 2022 21:32:44 -0700 Subject: invoice endpoint --- src/routes/invoice.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/routes/invoice.js (limited to 'src/routes/invoice.js') diff --git a/src/routes/invoice.js b/src/routes/invoice.js new file mode 100644 index 00000000..fa493fe1 --- /dev/null +++ b/src/routes/invoice.js @@ -0,0 +1,20 @@ +import got from 'got'; + +const username = 'bob', + network = 'lightning'; + +export async function GET({ params }) { + let text = await got + .post('http://localhost:3119/lightning/invoice', { + json: { amount: 100 } + }) + .text(); + + let body = await got + .post('http://localhost:3119/invoice', { + json: { invoice: { text, network }, user: { username } } + }) + .json(); + + return { body }; +} -- cgit v1.2.3