aboutsummaryrefslogtreecommitdiffstats
path: root/routes/bitcoin/receive.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-09-02 15:06:43 -0700
committerAdam Soltys <[email protected]>2022-09-02 15:06:43 -0700
commitd1cc66d1a02b75f90fbf0c05910777c76228259a (patch)
tree7b93dc6a2fc0ec9d03676d6b4093fedf9733f128 /routes/bitcoin/receive.js
parent3161dd7ee95b6c7d70f8341298dd4fab84cda8b0 (diff)
downloadcoinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.tar.gz
coinos-server-d1cc66d1a02b75f90fbf0c05910777c76228259a.zip
es6 migration
Diffstat (limited to 'routes/bitcoin/receive.js')
-rw-r--r--routes/bitcoin/receive.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/routes/bitcoin/receive.js b/routes/bitcoin/receive.js
index 65e96883..1d12bd9b 100644
--- a/routes/bitcoin/receive.js
+++ b/routes/bitcoin/receive.js
@@ -1,3 +1,4 @@
+import { rates } from "../../lib/store.js";
import { notify } from "../lib/notifications.js";
import { callWebhook } from "../lib/webhooks.js";
import reverse from 'buffer-reverse';
@@ -77,7 +78,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
const currency = invoice ? invoice.currency : user.currency;
const rate = invoice
? invoice.rate
- : app.get("rates")[user.currency];
+ : rates[user.currency];
const tip = invoice ? invoice.tip : 0;
const memo = invoice ? invoice.memo : "";
@@ -139,7 +140,7 @@ zmqRawTx.on("message", async (topic, message, sequence) => {
emit(user.username, "account", account);
emit(user.username, "payment", payment);
- l.info("bitcoin detected", user.username, value);
+ l("bitcoin detected", user.username, value);
notify(user, `${value} SAT payment detected`);
callWebhook(invoice, payment);
});
@@ -220,13 +221,13 @@ setInterval(async () => {
emit(user.username, "account", account);
emit(user.username, "payment", p);
- l.info("bitcoin confirmed", user.username, p.amount, p.tip);
+ l("bitcoin confirmed", user.username, p.amount, p.tip);
notify(user, `${total} SAT payment confirmed`);
callWebhook(p.invoice, p);
let c = convert[address];
if (address && c) {
- l.info(
+ l(
"bitcoin detected to conversion address",
address,
c.address,
@@ -242,7 +243,7 @@ setInterval(async () => {
});
}
} else {
- l.warn("couldn't find bitcoin payment", hash);
+ warn("couldn't find bitcoin payment", hash);
}
}
@@ -250,7 +251,7 @@ setInterval(async () => {
});
}
} catch (e) {
- l.error(
+ err(
"problem processing queued bitcoin transaction",
e.message,
e.stack