aboutsummaryrefslogtreecommitdiffstats
path: root/lib/webhooks.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-10-07 21:10:48 -0700
committerAdam Soltys <[email protected]>2022-10-07 21:10:48 -0700
commit756017c5bf6b1858c231d39670b217a606f4e454 (patch)
treed5eb774ac6c83ff2079766ba2a1f65ce3dd64c31 /lib/webhooks.js
parent0eb3dcabf63cda38dec86f9b3d4accac6c057f4d (diff)
downloadcoinos-server-756017c5bf6b1858c231d39670b217a606f4e454.tar.gz
coinos-server-756017c5bf6b1858c231d39670b217a606f4e454.zip
fix liquid asset receiving
Diffstat (limited to 'lib/webhooks.js')
-rw-r--r--lib/webhooks.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/webhooks.js b/lib/webhooks.js
index 901bd264..51a9a99e 100644
--- a/lib/webhooks.js
+++ b/lib/webhooks.js
@@ -2,7 +2,8 @@ import config from "$config";
import wretch from "./wretch";
import { l } from "$lib/logging";
-export const callWebhook = (invoice, payment) => {
+export const callWebhook = async (invoice, payment) => {
+ try {
if (!invoice || !payment) return;
let { address, received, text, webhook } = invoice;
@@ -13,7 +14,7 @@ export const callWebhook = (invoice, payment) => {
let secret = config.webhooks[webhook];
l("calling webhook", webhook, amount, hash, address, text);
- return wretch()
+ let res = await wretch()
.headers({ "x-webhook": secret })
.url(webhook)
.post({
@@ -28,6 +29,9 @@ export const callWebhook = (invoice, payment) => {
webhook
})
.res()
- .catch(console.log);
+ return res;
}
+ } catch(e) {
+ console.log("problem calling webhook", e)
+ }
};