Skip to content

Commit

Permalink
Merge pull request #1242 from kaloudis/zeus-1240
Browse files Browse the repository at this point in the history
bug fix: c-lightning-REST: keysends received show 0 amount
  • Loading branch information
kaloudis authored Dec 31, 2022
2 parents 9fba714 + 63e4a84 commit 136b2aa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions models/Invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export default class Invoice extends BaseModel {
public label: string;
public description: string;
public msatoshi: number;
public msatoshi_received: number;
@observable public payment_hash: string;
public paid_at: number;
public expires_at: number;
Expand Down Expand Up @@ -108,6 +109,10 @@ export default class Invoice extends BaseModel {

// return amount in satoshis
@computed public get getAmount(): number {
if (this.msatoshi_received) {
const msatoshi = this.msatoshi_received.toString();
return Number(msatoshi.replace('msat', '')) / 1000;
}
if (this.msatoshi) {
const msatoshi = this.msatoshi.toString();
return Number(msatoshi.replace('msat', '')) / 1000;
Expand Down

0 comments on commit 136b2aa

Please sign in to comment.