diff options
| -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", |
