Commit f4d0eadf authored by tom's avatar tom

fix sorting by block number on transactions page

parent 5b4bdff9
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment