aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webhooks.js
blob: f21607fbbc0dfc24e1758b0f56202c634ee4193f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const wretch = require("wretch");
const fetch = require("node-fetch");
wretch().polyfills({ fetch });

callWebhook = (invoice, payment) => {
  if (!invoice || !payment) return;

  let { address, text, webhook } = invoice;

  if (webhook) {
    let { amount, confirmed, hash, memo } = payment;

    l.info("calling webhook", webhook);
    return wretch()
      .url(webhook)
      .post({
        address,
        amount,
        hash,
        memo,
        confirmed,
        text,
        webhook
      })
      .json()
      .catch(console.log);
  }
};
me.Builtin.Pseudo */ .highlight .fm { color: #06B; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #369 } /* Name.Variable.Class */ .highlight .vg { color: #D70 } /* Name.Variable.Global */ .highlight .vi { color: #33B } /* Name.Variable.Instance */ .highlight .vm { color: #369 } /* Name.Variable.Magic */ .highlight .il { color: #00D; font-weight: bold } /* Literal.Number.Integer.Long */
FROM node:alpine

ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV

RUN apk add --update inotify-tools npm vips-dev
RUN npm i -g pnpm

COPY . /app
WORKDIR /app

RUN NODE_OPTIONS="" pnpm i

CMD ["pnpm", "start"]