aboutsummaryrefslogtreecommitdiffstats
path: root/routes/lightning/channelRequest.js
blob: 9ba740090681a2fdffb8bf987a772d719df0948d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
  }
};