aboutsummaryrefslogtreecommitdiffstats
path: root/git_hooks/pre-commit
blob: 78876285613c63f2be6d074bce0e2c833a408f87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write

# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add

exit 0
f='/coinos-server.git/blame/routes/lightning/invoice.js?h=base&id=72f3bc93357e74b71be0e3f1e621fb556f7fd088'>^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
                                         

                                       
                           
 
       
                                






                                        

                               
                                                            

                                        
               

                                                   
   
   
module.exports = ah(async (req, res) => {
  let { amount, memo, tip } = req.body;
  if (!tip) tip = 0;
  let value = amount + tip;

  try {
    if (config.lna.clightning) {
      if (!memo) memo = "coinos";
      const invoice = await lna.invoice(
        value ? `${value}sat` : "any",
        new Date(),
        memo,
        360
      );
      res.send(invoice.bolt11);
    } else {
      const invoice = await lna.addInvoice({ value, memo });
      res.send(invoice.payment_request);
    }
  } catch (e) {
    l.error("problem creating invoice", e.message);
    res.status(500).send(e.message);
  }
});