Skip to content

Commit 0c7f9ea

Browse files
authored
Merge pull request #1626 from getAlby/fix/1625_lndhub-incoming-order
fix(connectors): lndhub incoming tx order #1625
2 parents 42ad835 + 3fbbca3 commit 0c7f9ea

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/extension/background-script/connectors/lnd.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ class Lnd implements Connector {
302302
type: "received",
303303
};
304304
})
305-
.reverse();
305+
.sort((a, b) => {
306+
return b.settleDate - a.settleDate;
307+
});
306308

307309
return {
308310
data: {

src/extension/background-script/connectors/lndhub.ts

+16-12
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,22 @@ export default class LndHub implements Connector {
8484
}[]
8585
>("GET", "/getuserinvoices", undefined);
8686

87-
const invoices: ConnectorInvoice[] = data.map(
88-
(invoice, index): ConnectorInvoice => ({
89-
custom_records: invoice.custom_records,
90-
id: `${invoice.payment_request}-${index}`,
91-
memo: invoice.description,
92-
preimage: "", // lndhub doesn't support preimage (yet)
93-
settled: invoice.ispaid,
94-
settleDate: invoice.timestamp * 1000,
95-
totalAmount: `${invoice.amt}`,
96-
type: "received",
97-
})
98-
);
87+
const invoices: ConnectorInvoice[] = data
88+
.map(
89+
(invoice, index): ConnectorInvoice => ({
90+
custom_records: invoice.custom_records,
91+
id: `${invoice.payment_request}-${index}`,
92+
memo: invoice.description,
93+
preimage: "", // lndhub doesn't support preimage (yet)
94+
settled: invoice.ispaid,
95+
settleDate: invoice.timestamp * 1000,
96+
totalAmount: `${invoice.amt}`,
97+
type: "received",
98+
})
99+
)
100+
.sort((a, b) => {
101+
return b.settleDate - a.settleDate;
102+
});
99103

100104
return {
101105
data: {

0 commit comments

Comments
 (0)