From 4785235fca203a57e7aa717a8239835542a9e788 Mon Sep 17 00:00:00 2001 From: Evan Kaloudis Date: Wed, 6 Sep 2023 12:59:00 -0400 Subject: [PATCH] LNDHub: fix display of Preimage and Hash --- models/Invoice.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/models/Invoice.ts b/models/Invoice.ts index 3e09717d4..0f4c10b77 100644 --- a/models/Invoice.ts +++ b/models/Invoice.ts @@ -47,7 +47,7 @@ export default class Invoice extends BaseModel { public private: boolean; public creation_date: string; public description_hash: string; - public r_preimage: string; + public r_preimage: any; public cltv_expiry: string; public htlcs: Array; // c-lightning, eclair @@ -77,7 +77,8 @@ export default class Invoice extends BaseModel { } @computed public get getRPreimage(): string { - const preimage = this.r_preimage; + if (!this.r_preimage) return ''; + const preimage = this.r_preimage.data || this.r_preimage; return typeof preimage === 'object' ? Base64Utils.bytesToHexString(preimage) : typeof preimage === 'string' @@ -88,7 +89,8 @@ export default class Invoice extends BaseModel { } @computed public get getRHash(): string { - const hash = this.r_hash; + if (!this.r_hash) return ''; + const hash = this.r_hash.data || this.r_hash; return typeof hash === 'object' ? Base64Utils.bytesToHexString(hash) : typeof hash === 'string'