From 445a3823f1accb61941d86f5b602639989025255 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 12 Oct 2020 15:57:46 -0700 Subject: return confidentialAddress as well --- routes/invoices.js | 20 -------------------- routes/users.js | 8 ++++---- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/routes/invoices.js b/routes/invoices.js index a4fb7be1..3ef0b4e3 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -47,26 +47,6 @@ app.post( invoice.currency ); - if (invoice.network === "liquid" && !invoice.unconfidential) { - try { - const { username, password, port, wallet } = config.liquid; - const { data: { result } }= await axios.post( - `http://${username}:${password}@127.0.0.1:${port}/wallet/${wallet}`, - { - jsonrpc: "1.0", - id: "curltext", - method: "getaddressinfo", - params: [invoice.address] - } - ); - - invoice.unconfidential = result.unconfidential; - } catch(e) { - l.error("problem getting confidential address info", e.message); - return res.status(500).send("Problem getting confidential address"); - } - } - if (!invoice.tip) invoice.tip = 0; const exists = await db.Invoice.findOne({ diff --git a/routes/users.js b/routes/users.js index 6e9678fe..becd8d40 100644 --- a/routes/users.js +++ b/routes/users.js @@ -399,7 +399,7 @@ app.get( "/address", ah(async (req, res) => { let { network, type } = req.query; - let address; + let address, confidentialAddress; type = { bech32: "p2wpkh", @@ -460,13 +460,13 @@ app.get( n ); - ({ confidentialAddress: address } = p[type]({ + ({ confidentialAddress } = p[type]({ redeem: p2wpkh, network: n, blindkey: blindkey.publicKey })); - lq.importBlindingKey(address, blindkey.privateKey.toString('hex')); + lq.importBlindingKey(confidentialAddress, blindkey.privateKey.toString('hex')); } else { ({ address } = p[type]({ redeem: p.p2wpkh({ @@ -478,7 +478,7 @@ app.get( } } - res.send(address); + res.send({ address, confidentialAddress }); }) ); -- cgit v1.2.3