diff options
| author | Adam Soltys <[email protected]> | 2022-09-05 22:58:23 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-09-05 23:01:46 -0700 |
| commit | 412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65 (patch) | |
| tree | 209296b3a93bc89b025e8ad0dcf846c23bb82746 /routes/lightning/channel.js | |
| parent | 8a82c69419dc358fbaeab322c32d18ee84656feb (diff) | |
| download | coinos-server-412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65.tar.gz coinos-server-412df5f844de11b3fc71bb7ffaf9c8e1d9f19d65.zip | |
lightning api migration
Diffstat (limited to 'routes/lightning/channel.js')
| -rw-r--r-- | routes/lightning/channel.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/routes/lightning/channel.js b/routes/lightning/channel.js index 5e8ed441..1c7bab10 100644 --- a/routes/lightning/channel.js +++ b/routes/lightning/channel.js @@ -1,15 +1,18 @@ import axios from "axios"; +import { addPeer, getIdentity } from "lightning"; +import lnd from "$lib/lnd"; export default async (req, res) => { const { params } = req.body; - const [pubkey, host] = params.uri.split("@"); + const [public_key, socket] = params.uri.split("@"); - l("connecting to peer", req.user.username, pubkey, host); + l("connecting to peer", req.user.username, public_key, socket); let result; try { - result = await lnp.connectPeer({ - addr: { pubkey, host }, - perm: true + result = await addPeer({ + lnd, + socket, + public_key }); } catch (e) { if (!e.message.includes("already connected")) { @@ -21,7 +24,7 @@ export default async (req, res) => { const { callback, k1 } = params; let remoteid; try { - remoteid = (await lnp.getInfo({})).identity_pubkey; + remoteid = (await getIdentity({ lnd })).public_key; } catch (e) { err("problem getting lightning node info", e.message); return res.code(500).send(e.message); |
