Skip to content

Commit

Permalink
fix sorting by block number on transactions page
Browse files Browse the repository at this point in the history
  • Loading branch information
tom2drum committed Dec 18, 2024
1 parent 5b4bdff commit f4d0ead
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/txs/sortTxs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export default function sortTxs(sorting: TransactionsSortingValue | undefined) {
return compareBns(tx2.fee.value || 0, tx1.fee.value || 0);
case 'fee-asc':
return compareBns(tx1.fee.value || 0, tx2.fee.value || 0);
case 'block_number-asc': {
if (tx1.block_number && tx2.block_number) {
return tx1.block_number - tx2.block_number;
}
return 0;
}
default:
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions ui/txs/useTxsSort.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const SORT_OPTIONS: Array<SelectOption<TransactionsSortingValue>> = [
{ label: 'Value descending', value: 'value-desc' },
{ label: 'Fee ascending', value: 'fee-asc' },
{ label: 'Fee descending', value: 'fee-desc' },
{ label: 'Block number ascending', value: 'block_number-asc' },
];

type SortingValue = TransactionsSortingValue | undefined;
Expand Down

0 comments on commit f4d0ead

Please sign in to comment.