fix wallet transactions ordering

This commit is contained in:
Mononaut 2024-12-22 10:47:36 +00:00
parent c248544fe8
commit 204d54b189
No known key found for this signature in database
GPG key ID: A3F058E41374C04E

View file

@ -302,7 +302,7 @@ export class WalletComponent implements OnInit, OnDestroy {
}),
map(transactions => {
// only confirmed transactions supported for now
return transactions.filter(tx => tx.status.confirmed);
return transactions.filter(tx => tx.status.confirmed).sort((a, b) => b.status.block_height - a.status.block_height);
}),
catchError((error) => {
console.log(error);
@ -329,7 +329,7 @@ export class WalletComponent implements OnInit, OnDestroy {
this.electrsApiService.getAddressesTransactions$(this.addressStrings, this.transactions[this.transactions.length - 1].txid)
.subscribe((transactions: Transaction[]) => {
if (transactions && transactions.length) {
this.transactions = this.transactions.concat(transactions);
this.transactions = this.transactions.concat(transactions.sort((a, b) => b.status.block_height - a.status.block_height));
} else {
this.fullyLoaded = true;
}