aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/invoice.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-07-25 21:32:44 -0700
committerAdam Soltys <[email protected]>2022-07-25 21:32:44 -0700
commiteb9a9c048ebcda09df0ba31745b9d9a5b543596f (patch)
tree4f6e01f85f8b442b6688638a17194d3ff7118c1f /src/routes/invoice.js
parent5640d62d160cb6e00289db28d7ff25b6881db71d (diff)
downloadcoinos-ui-eb9a9c048ebcda09df0ba31745b9d9a5b543596f.tar.gz
coinos-ui-eb9a9c048ebcda09df0ba31745b9d9a5b543596f.zip
invoice endpoint
Diffstat (limited to 'src/routes/invoice.js')
-rw-r--r--src/routes/invoice.js20
1 files changed, 20 insertions, 0 deletions
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 };
+}