aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lnurl.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-02-26 11:59:58 -0800
committerAdam Soltys <[email protected]>2025-02-26 11:59:58 -0800
commit1d541fd97210389f006e65d46ab783afbe82cea8 (patch)
tree66781ea2992fa99198ed1e450cdb9b68acfbc4d9 /routes/lnurl.ts
parenta14b987a392bc700975b048f37838da08e4ed255 (diff)
downloadcoinos-server-1d541fd97210389f006e65d46ab783afbe82cea8.tar.gz
coinos-server-1d541fd97210389f006e65d46ab783afbe82cea8.zip
payment types
Diffstat (limited to 'routes/lnurl.ts')
-rw-r--r--routes/lnurl.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/routes/lnurl.ts b/routes/lnurl.ts
index 05d369fc..294e6d7c 100644
--- a/routes/lnurl.ts
+++ b/routes/lnurl.ts
@@ -4,12 +4,13 @@ import ln from "$lib/ln";
import { err, warn } from "$lib/logging";
import { serverPubkey } from "$lib/nostr";
import { credit } from "$lib/payments";
-import { types } from "$lib/payments";
import { bail, fail, getInvoice, getUser } from "$lib/utils";
import { bech32 } from "bech32";
import got from "got";
import { v4 } from "uuid";
+import { PaymentType } from "$lib/types";
+
const { URL } = process.env;
const host = URL.split("/").at(-1);
@@ -124,7 +125,7 @@ export default {
invoice: {
amount: Math.round(amount / 1000),
memo: metadata,
- type: types.lightning,
+ type: PaymentType.lightning,
},
user,
});
@@ -158,7 +159,13 @@ export default {
let p;
if (invoice) {
const { hash } = invoice;
- p = await credit({ hash, amount, memo: id, ref: id, type: types.fund });
+ p = await credit({
+ hash,
+ amount,
+ memo: id,
+ ref: id,
+ type: PaymentType.fund,
+ });
} else {
await ln.xpay({
invstring: pr.replace(/\s/g, "").toLowerCase(),
@@ -173,7 +180,7 @@ export default {
confirmed: true,
rate: rates.USD,
currency: "USD",
- type: types.fund,
+ type: PaymentType.fund,
ref: id,
created: Date.now(),
};