aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/nwc.ts36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/nwc.ts b/lib/nwc.ts
index 73b7decd..4055a9f4 100644
--- a/lib/nwc.ts
+++ b/lib/nwc.ts
@@ -101,26 +101,28 @@ const handle = (method, params, user, ev) =>
const invoice = await getInvoice(pr);
const recipient = await g(`user:${invoice.uid}`);
- const { id: preimage } = await sendInternal({
- amount,
- invoice,
- recipient,
- sender: user,
- });
+ if (recipient?.username !== "mint") {
+ const { id: preimage } = await sendInternal({
+ amount,
+ invoice,
+ recipient,
+ sender: user,
+ });
- if (invoice.memo?.includes("9734")) {
- const { invoices } = await ln.listinvoices({ invstring: pr });
- const inv = invoices[0];
- inv.payment_preimage = preimage;
- inv.paid_at = Math.floor(Date.now() / 1000);
- try {
- await handleZap(inv, user.pubkey);
- } catch (e) {
- console.log("zap receipt failed", e);
+ if (invoice.memo?.includes("9734")) {
+ const { invoices } = await ln.listinvoices({ invstring: pr });
+ const inv = invoices[0];
+ inv.payment_preimage = preimage;
+ inv.paid_at = Math.floor(Date.now() / 1000);
+ try {
+ await handleZap(inv, user.pubkey);
+ } catch (e) {
+ console.log("zap receipt failed", e);
+ }
}
- }
- return result({ preimage });
+ return result({ preimage });
+ }
}
await sendLightning({
amount,