diff options
| author | Adam Soltys <[email protected]> | 2023-08-09 00:31:12 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-08-09 00:32:18 -0700 |
| commit | 923947519e74e28ab57f600100ea6d540d3fd561 (patch) | |
| tree | d419516ffb7afd19d510b0ffe049277ce000db5c | |
| parent | 46c887e4ff34c9ff6082687c9cbf1d158a26ecac (diff) | |
| download | coinos-server-923947519e74e28ab57f600100ea6d540d3fd561.tar.gz coinos-server-923947519e74e28ab57f600100ea6d540d3fd561.zip | |
mqtt
| -rw-r--r-- | lib/payments.js | 6 | ||||
| -rw-r--r-- | package.json | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/payments.js b/lib/payments.js index 2d322a15..ee143a82 100644 --- a/lib/payments.js +++ b/lib/payments.js @@ -9,6 +9,7 @@ import { fail } from "$lib/utils"; import { callWebhook } from "$lib/webhooks"; import dollarsToWords from "dollars-to-words"; import got from "got"; +import mqtt from "mqtt"; export const types = { internal: "internal", @@ -186,6 +187,11 @@ export let credit = async (hash, amount, memo, ref, type = types.internal) => { } } + const client = mqtt.connect('mqtt://ln.coinos.io', config.mqtt); + client.on('connect', function () { + client.publish('payments', `${p.amount}:${p.tip}:${p.rate}:${p.created}:${p.id}`); + }); + return p; }; diff --git a/package.json b/package.json index a0cb82e9..98216258 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "got": "^12.5.3", "jsonwebtoken": "^9.0.0", "lnurl": "^0.24.2", + "mqtt": "^5.0.2", "nodemon": "^2.0.7", "nostr": "^0.2.7", "otplib": "^12.0.1", |
