From 8474006f933465ef2beb0cc8fee6ae7ff6b45fa7 Mon Sep 17 00:00:00 2001 From: pavanjoshi914 Date: Mon, 11 Mar 2024 11:03:13 +0530 Subject: [PATCH] feat: optional payment_hash for lndhub --- src/extension/background-script/connectors/lndhub.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/extension/background-script/connectors/lndhub.ts b/src/extension/background-script/connectors/lndhub.ts index 9d2da17f9e..27f5a2cdfa 100644 --- a/src/extension/background-script/connectors/lndhub.ts +++ b/src/extension/background-script/connectors/lndhub.ts @@ -100,7 +100,7 @@ export default class LndHub implements Connector { ispaid: boolean; keysend: boolean; pay_req: string; - payment_hash: string; + payment_hash?: string; payment_request: string; timestamp: number; type: "user_invoice"; @@ -114,7 +114,7 @@ export default class LndHub implements Connector { id: `${invoice.payment_request}-${index}`, memo: invoice.description, preimage: "", // lndhub doesn't support preimage (yet) - payment_hash: invoice.payment_hash, + payment_hash: invoice.payment_hash ? invoice.payment_hash : "", settled: invoice.ispaid, settleDate: invoice.timestamp * 1000, totalAmount: invoice.amt, @@ -151,7 +151,7 @@ export default class LndHub implements Connector { fee: string; keysend: boolean; memo: string; - payment_hash: { + payment_hash?: { type: string; data: ArrayBuffer; }; @@ -172,9 +172,9 @@ export default class LndHub implements Connector { id: `${index}`, memo: transaction.memo, preimage: transaction.payment_preimage, - payment_hash: Buffer.from(transaction.payment_hash.data).toString( - "hex" - ), + payment_hash: transaction.payment_hash + ? Buffer.from(transaction.payment_hash.data).toString("hex") + : "", settled: true, settleDate: transaction.timestamp * 1000, totalAmount: transaction.value,