aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-24 13:50:18 -0800
committerAdam Soltys <[email protected]>2022-11-24 13:50:18 -0800
commitc3f0689dc728b2ed86792ad180132165479c05d5 (patch)
tree5bb2778e60c411fe692190f03b960d5068024fd0 /routes
parent40e1723e0432d1656cbc5fbbd5e79a981d97809b (diff)
downloadcoinos-server-c3f0689dc728b2ed86792ad180132165479c05d5.tar.gz
coinos-server-c3f0689dc728b2ed86792ad180132165479c05d5.zip
remove lnd support
Diffstat (limited to 'routes')
-rw-r--r--routes/info.js4
-rw-r--r--routes/lightning/channel.js18
-rw-r--r--routes/lightning/invoice.js28
-rw-r--r--routes/lightning/receive.js4
-rw-r--r--routes/lnurl.js10
5 files changed, 10 insertions, 54 deletions
diff --git a/routes/info.js b/routes/info.js
index f3de8907..3cbb7c86 100644
--- a/routes/info.js
+++ b/routes/info.js
@@ -8,7 +8,6 @@ import lq from "$lib/liquid";
import lnd from "$lib/lnd";
import ln from "$lib/ln";
-import { getChannelBalance, getChainBalance } from "lightning";
import sequelize from "@sequelize/core";
import { SATS } from "$lib/utils";
@@ -58,9 +57,6 @@ app.get("/balances", async (req, res, next) => {
funds.channels.reduce((a, b) => a + b.channel_sat, 0)
);
lnwallet = parseInt(funds.outputs.reduce((a, b) => a + b.value, 0));
- } else {
- lnchannel = parseInt(await getChannelBalance({ lnd }).channel_balance);
- lnwallet = parseInt(await getChainBalance({ lnd }).chain_balance);
}
}
diff --git a/routes/lightning/channel.js b/routes/lightning/channel.js
index 107896f4..d5d5b7b2 100644
--- a/routes/lightning/channel.js
+++ b/routes/lightning/channel.js
@@ -1,6 +1,4 @@
import axios from "axios";
-import { addPeer, getIdentity } from "lightning";
-import lnd from "$lib/lnd";
import ln from "$lib/ln";
export default async (req, res) => {
@@ -9,27 +7,11 @@ export default async (req, res) => {
l("connecting to peer", req.user.username, public_key, socket);
let result;
- try {
- result = await addPeer({
- lnd,
- socket,
- public_key
- });
- } catch (e) {
- if (!e.message.includes("already connected")) {
- err("problem connecting to peer", e.message);
- return res.code(500).send(e.message);
- }
- }
const { callback, k1 } = params;
let remoteid;
try {
- if (config.lna.clightning) {
remoteid = (await ln.getinfo()).id;
- } else {
- remoteid = (await getIdentity({ lnd })).public_key;
- }
} catch (e) {
err("problem getting lightning node info", e.message);
return res.code(500).send(e.message);
diff --git a/routes/lightning/invoice.js b/routes/lightning/invoice.js
index a97697a8..b5d90faf 100644
--- a/routes/lightning/invoice.js
+++ b/routes/lightning/invoice.js
@@ -1,5 +1,4 @@
import config from "$config";
-import { createInvoice } from "lightning";
import { err } from "$lib/logging";
import lnd from "$lib/lnd";
import ln from "$lib/ln";
@@ -11,25 +10,16 @@ export default async (req, res) => {
let value = amount + tip;
try {
- if (config.lna.clightning) {
- if (!memo) memo = "coinos";
- const invoice = await ln.invoice(
- value ? `${value}sat` : "any",
- v4(),
- memo,
- 360
- );
- res.send({ text: invoice.bolt11 });
- } else {
- const invoice = await createInvoice({
- lnd,
- tokens: value,
- description: memo
- });
- res.send({ text: invoice.request });
- }
+ if (!memo) memo = "coinos";
+ const invoice = await ln.invoice(
+ value ? `${value}sat` : "any",
+ v4(),
+ memo,
+ 360
+ );
+ res.send({ text: invoice.bolt11 });
} catch (e) {
- console.log(e)
+ console.log(e);
err("problem creating invoice", e.message);
res.code(500).send(e.message);
}
diff --git a/routes/lightning/receive.js b/routes/lightning/receive.js
index f4a20a59..af8415f1 100644
--- a/routes/lightning/receive.js
+++ b/routes/lightning/receive.js
@@ -6,7 +6,6 @@ import { notify } from "$lib/notifications";
import { callWebhook } from "$lib/webhooks";
import { computeConversionFee } from "./conversionFee";
import { sendLiquid } from "$routes/liquid/send";
-import { subscribeToInvoices } from "lightning";
import lnd from "$lib/lnd";
import ln from "$lib/ln";
import { l, err, warn } from "$lib/logging";
@@ -163,7 +162,4 @@ if (config.lna.clightning) {
};
poll(ln);
-} else {
- const invoices = subscribeToInvoices({ lnd });
- invoices.on("invoice_updated", handlePayment);
}
diff --git a/routes/lnurl.js b/routes/lnurl.js
index 962a908c..171acbe5 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -16,7 +16,6 @@ import jwt from "jsonwebtoken";
import qs from "query-string";
import bolt11 from "bolt11";
-import { createInvoice, decodePaymentRequest, getPayments } from "lightning";
import {
computeConversionFee,
@@ -102,8 +101,6 @@ app.post("/withdraw", auth, async (req, res, next) => {
let desc = label;
invoice = await ln.invoice(`${value}sats`, label, desc);
- } else {
- invoice = await createInvoice({ lnd, value });
}
const { payment_request: pr } = invoice;
@@ -400,12 +397,7 @@ lnurlServer.bindToHook(
if (config.lna.clightning) {
let { msatoshi } = await ln.decodepay(pr);
amount = parseInt(msatoshi / 1000);
- } else {
- ({ num_satoshis: amount } = await decodePaymentRequest({
- lnd,
- request: pr
- }));
- }
+ }
let conversionFee = computeConversionFee(amount);
await db.transaction(async transaction => {