diff options
| author | Adam Soltys <[email protected]> | 2021-02-20 23:02:56 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2021-02-20 23:02:56 -0800 |
| commit | d3e0bb7ef5bd1dac383e1df34a312cbc65907cda (patch) | |
| tree | 64dffaaad65c4eb101d1ca5f40f20a28fb03bea6 /routes/invoices.js | |
| parent | c2af135c0459fa416be034e38914c879c620b990 (diff) | |
| download | coinos-server-d3e0bb7ef5bd1dac383e1df34a312cbc65907cda.tar.gz coinos-server-d3e0bb7ef5bd1dac383e1df34a312cbc65907cda.zip | |
btc to liquid conversion
Diffstat (limited to 'routes/invoices.js')
| -rw-r--r-- | routes/invoices.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/routes/invoices.js b/routes/invoices.js index 9a24a8c0..cdf8ca91 100644 --- a/routes/invoices.js +++ b/routes/invoices.js @@ -24,10 +24,10 @@ app.post( optionalAuth, ah(async (req, res, next) => { try { - let { liquidAddress, invoice, user } = req.body; + let { liquidAddress, invoice, user, tx } = req.body; let { blindkey } = invoice; - if (liquidAddress) convert[invoice.text] = liquidAddress; + if (liquidAddress) convert[invoice.text] = { address: liquidAddress, tx }; if (!user) ({ user } = req); else { @@ -39,6 +39,7 @@ app.post( } if (!user) throw new Error("user not provided"); if (!invoice.currency) invoice.currency = user.currency; + if (!invoice.rate) invoice.rate = app.get("rates")[invoice.currency]; invoice.user_id = user.id; invoice.account_id = user.account_id; @@ -73,6 +74,7 @@ app.post( addresses[invoice.unconfidential] = user.username; if (blindkey) await lq.importBlindingKey(invoice.address, blindkey); } + res.send(invoice); } catch (e) { l.error(e.message, e.stack); |
