diff options
Diffstat (limited to 'routes/users.js')
| -rw-r--r-- | routes/users.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/routes/users.js b/routes/users.js index 471a4e5e..99dd6046 100644 --- a/routes/users.js +++ b/routes/users.js @@ -297,12 +297,27 @@ app.post( app.get( "/address", ah(async (req, res) => { + const { network, type } = req.query; + let address; + + if (network === 'bitcoin') { if (!config.bitcoin) return res.status(500).send("Bitcoin not configured"); if (config.bitcoin.walletpass) await bc.walletPassphrase(config.bitcoin.walletpass, 300); - res.send(await bc.getNewAddress("", req.query.type || "bech32")); + address = await bc.getNewAddress("", type || "bech32"); + } else if (network === 'liquid') { + + if (!config.liquid) return res.status(500).send("Liquid not configured"); + + if (config.liquid.walletpass) + await lq.walletPassphrase(config.liquid.walletpass, 300); + + address = await lq.getNewAddress("", type || "bech32"); + } + + res.send(address); }) ); |
