aboutsummaryrefslogtreecommitdiffstats
path: root/routes/invoices.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-01-20 11:40:10 -0800
committerAdam Soltys <[email protected]>2023-01-20 11:40:10 -0800
commit5dd47b9b2cb5a9359c57079205da68a675e10b45 (patch)
tree48f5065cbd9781342c4ed52300b1d68c2eb7f0e7 /routes/invoices.js
parent5264f702a2217fe8815cb5275aca14a672f6d4bb (diff)
downloadcoinos-server-5dd47b9b2cb5a9359c57079205da68a675e10b45.tar.gz
coinos-server-5dd47b9b2cb5a9359c57079205da68a675e10b45.zip
endpoint renaming
Diffstat (limited to 'routes/invoices.js')
-rw-r--r--routes/invoices.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/routes/invoices.js b/routes/invoices.js
index 62106f3a..8fbb25c1 100644
--- a/routes/invoices.js
+++ b/routes/invoices.js
@@ -4,6 +4,7 @@ import { emit } from "$lib/sockets";
import { db, g, s } from "$lib/db";
import { bip21, fail } from "$lib/utils";
import { types } from "$lib/payments";
+import { v4 } from "uuid";
import bc from "$lib/bitcoin";
import ln from "$lib/ln";
@@ -33,6 +34,7 @@ export default {
if (amount < 0) fail("invalid amount");
let hash, text;
+ console.log("TYPE", type)
if (type === types.lightning) {
let amt = amount ? `${amount + tip}sat` : "any";
let r = await ln.invoice(amt, new Date(), "", 3600);
@@ -42,6 +44,8 @@ export default {
} else if (type === types.bitcoin) {
hash = await bc.getNewAddress();
text = bip21(hash, invoice);
+ } else if (type === types.internal) {
+ hash = v4();
} else {
fail("unrecognized type");
}