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/__layout.svelte | 19 +++++++++++++++++++ src/routes/invoice.js | 20 ++++++++++++++++++++ src/routes/invoice.svelte | 13 +++++++++++++ src/routes/receive.svelte | 5 +++-- 4 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 src/routes/invoice.js create mode 100644 src/routes/invoice.svelte (limited to 'src/routes') diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte index 2e511e00..0168bb7c 100644 --- a/src/routes/__layout.svelte +++ b/src/routes/__layout.svelte @@ -1,5 +1,24 @@ 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 }; +} diff --git a/src/routes/invoice.svelte b/src/routes/invoice.svelte new file mode 100644 index 00000000..6ea9e67f --- /dev/null +++ b/src/routes/invoice.svelte @@ -0,0 +1,13 @@ + + + QR code + + {$rate} + diff --git a/src/routes/receive.svelte b/src/routes/receive.svelte index 8d0e95fa..7aa8536f 100644 --- a/src/routes/receive.svelte +++ b/src/routes/receive.svelte @@ -1,6 +1,7 @@