Skip to content

Commit

Permalink
LNDHub: fix display of Preimage and Hash
Browse files Browse the repository at this point in the history
  • Loading branch information
kaloudis committed Sep 6, 2023
1 parent 2216ddc commit 4785235
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions models/Invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTLC>;
// c-lightning, eclair
Expand Down Expand Up @@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit 4785235

Please sign in to comment.