Skip to content

Commit

Permalink
Merge pull request #1897 from blockscout/fe-1890
Browse files Browse the repository at this point in the history
fix internal txs sorting
  • Loading branch information
isstuev authored May 8, 2024
2 parents cc97093 + de1427a commit 42845ae
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ui/tx/TxInternals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';

import type { InternalTransaction } from 'types/api/internalTransaction';

import compareBns from 'lib/bigint/compareBns';
// import { apos } from 'lib/html-entities';
import { INTERNAL_TX } from 'stubs/internalTx';
import { generateListStub } from 'stubs/utils';
Expand Down Expand Up @@ -31,23 +32,20 @@ const getNextSortValue = (getNextSortValueShared<SortField, Sort>).bind(undefine
const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalTransaction) => {
switch (sort) {
case 'value-desc': {
const result = a.value > b.value ? -1 : 1;
return a.value === b.value ? 0 : result;
return compareBns(b.value, a.value);
}

case 'value-asc': {
const result = a.value > b.value ? 1 : -1;
return a.value === b.value ? 0 : result;
return compareBns(a.value, b.value);
}

case 'gas-limit-desc': {
const result = a.gas_limit > b.gas_limit ? -1 : 1;
return a.gas_limit === b.gas_limit ? 0 : result;
return compareBns(b.gas_limit, a.gas_limit);
}

case 'gas-limit-asc': {
const result = a.gas_limit > b.gas_limit ? 1 : -1;
return a.gas_limit === b.gas_limit ? 0 : result;
return compareBns(a.gas_limit, b.gas_limit);

}

default:
Expand Down

0 comments on commit 42845ae

Please sign in to comment.