Skip to content

Commit

Permalink
fix: bumi PR remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwiidb committed Oct 26, 2022
1 parent 588c248 commit 34c29aa
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/extension/background-script/connectors/commando.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default class Commando implements Connector {
this.config = config;
this.ln = new LnMessage({
remoteNodePublicKey: this.config.pubkey,
wsProxy: this.config.wsProxy || "wss://lnwsproxy.regtest.getalby.com",
wsProxy: this.config.wsProxy,
ip: this.config.host,
port: this.config.port || 9735,
privateKey: this.config.privateKey,
Expand Down Expand Up @@ -177,10 +177,10 @@ export default class Commando implements Connector {
params: {},
rune: this.config.rune,
})) as CommandoListFundsResponse;
let lnBalance = 0;
for (let i = 0; i < response.channels.length; i++) {
lnBalance = lnBalance + response.channels[i].channel_sat;
}
const lnBalance = response.channels.reduce(
(balance, channel) => balance + channel.channel_sat,
0
);
return {
data: {
balance: lnBalance,
Expand Down Expand Up @@ -278,16 +278,9 @@ export default class Commando implements Connector {
})
.then((resp) => {
const parsed = resp as CommandoListInvoiceResponse;
if (parsed.invoices.length != 1) {
return {
data: {
paid: false,
},
};
}
return {
data: {
paid: parsed.invoices[0].status == "paid",
paid: parsed.invoices[0]?.status == "paid",
},
};
});
Expand Down

0 comments on commit 34c29aa

Please sign in to comment.