diff options
| author | Adam Soltys <[email protected]> | 2024-09-05 12:12:39 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-09-05 12:12:39 -0700 |
| commit | ac63d9cb30690f335616aa046e2b6512b05ecb44 (patch) | |
| tree | 654bedd4409fb3298d042141cc3d23c130ab29f2 /routes | |
| parent | 33d67e431416ea8b69b424e7d043ef63953c355a (diff) | |
| download | coinos-server-ac63d9cb30690f335616aa046e2b6512b05ecb44.tar.gz coinos-server-ac63d9cb30690f335616aa046e2b6512b05ecb44.zip | |
update sample config
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/invoices.ts | 2 | ||||
| -rw-r--r-- | routes/payments.ts | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/routes/invoices.ts b/routes/invoices.ts index 5e786dd7..77ff2ac1 100644 --- a/routes/invoices.ts +++ b/routes/invoices.ts @@ -5,7 +5,7 @@ import { bail, pick } from "$lib/utils"; export default { async get(req, res) { let { - params: { id }, + params: { id }, } = req; let invoice = await g(`invoice:${id}`); if (typeof invoice === "string") invoice = await g(`invoice:${invoice}`); diff --git a/routes/payments.ts b/routes/payments.ts index 38215832..9ebc0062 100644 --- a/routes/payments.ts +++ b/routes/payments.ts @@ -4,7 +4,7 @@ import { generate } from "$lib/invoices"; import { v4 } from "uuid"; import { db, g, s, t } from "$lib/db"; import { l, err, warn } from "$lib/logging"; -import { bail, fail, getInvoice, btc, sats, SATS, getUser } from "$lib/utils"; +import { bail, fail, getInvoice, sats, SATS, getUser } from "$lib/utils"; import { requirePin } from "$lib/auth"; import { completePayment, @@ -253,7 +253,7 @@ export default { } = req; try { - let node = getNode(type); + let node = await getNode(type, wallet); if (wallet === config.bitcoin.wallet || wallet === config.liquid.wallet) { let { confirmations, details } = await node.getTransaction(txid); @@ -400,16 +400,16 @@ export default { await requirePin({ body, user }); let [username, domain] = lnaddress.split("@"); - let { minSendable, maxSendable, callback, metadata } = await got( + let { minSendable, maxSendable, callback, metadata } = (await got( `https://${domain}/.well-known/lnurlp/${username}`, - ).json(); + ).json()) as any; let memo = metadata["text/plain"] || ""; if (amount * 1000 < minSendable || amount * 1000 > maxSendable) fail("amount out of range"); - let r = await got(`${callback}?amount=${amount * 1000}`).json(); - if (r.reason) fail(r.rason); + let r: any = await got(`${callback}?amount=${amount * 1000}`).json(); + if (r.reason) fail(r.reason); let { pr } = r; let p = await sendLightning({ user, pr, amount, maxfee, memo }); @@ -445,9 +445,9 @@ export default { if (p.uid !== user.id) fail("unauthorized"); let { tx, type } = await decode(p.hex); - let node = getNode(type); + let node = await getNode(type); - let fees = await fetch(`${api[type]}/fees/recommended`).then((r) => + let fees: any = await fetch(`${api[type]}/fees/recommended`).then((r) => r.json(), ); |
