diff options
| author | Adam Soltys <[email protected]> | 2020-06-17 11:04:18 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-06-17 11:04:18 -0700 |
| commit | 139000e710e7cd5f76bc272fb8940305dc6475f1 (patch) | |
| tree | b5dd5964eb5d5e4fc02d122da8d995d2ae9947e3 /routes/lightning/channelRequest.js | |
| parent | ed0da89c7d98195294ced6d71812183a04e24c76 (diff) | |
| download | coinos-server-139000e710e7cd5f76bc272fb8940305dc6475f1.tar.gz coinos-server-139000e710e7cd5f76bc272fb8940305dc6475f1.zip | |
lnurl channel flow
Diffstat (limited to 'routes/lightning/channelRequest.js')
| -rw-r--r-- | routes/lightning/channelRequest.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/routes/lightning/channelRequest.js b/routes/lightning/channelRequest.js new file mode 100644 index 00000000..9ba74009 --- /dev/null +++ b/routes/lightning/channelRequest.js @@ -0,0 +1,20 @@ +module.exports = async (req, res) => { + let { localAmt, pushAmt } = req.body; + + pushAmt = 0; + + try { + if (localAmt < 20000) throw new Error("amount must be greater than 20000 SAT"); + if (localAmt > 1000000) throw new Error("amount must be <= 1000000"); + + const result = await lnurlServer.generateNewUrl("channelRequest", { + localAmt, + pushAmt + }); + + res.send(result); + } catch (e) { + l.error("problem generating channel request", e.message); + res.status(500).send(e.message); + } +}; |
