Commit 42845ae4 authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

Merge pull request #1897 from blockscout/fe-1890

fix internal txs sorting
parents cc970931 de1427ab
...@@ -3,6 +3,7 @@ import React from 'react'; ...@@ -3,6 +3,7 @@ import React from 'react';
import type { InternalTransaction } from 'types/api/internalTransaction'; import type { InternalTransaction } from 'types/api/internalTransaction';
import compareBns from 'lib/bigint/compareBns';
// import { apos } from 'lib/html-entities'; // import { apos } from 'lib/html-entities';
import { INTERNAL_TX } from 'stubs/internalTx'; import { INTERNAL_TX } from 'stubs/internalTx';
import { generateListStub } from 'stubs/utils'; import { generateListStub } from 'stubs/utils';
...@@ -31,23 +32,20 @@ const getNextSortValue = (getNextSortValueShared<SortField, Sort>).bind(undefine ...@@ -31,23 +32,20 @@ const getNextSortValue = (getNextSortValueShared<SortField, Sort>).bind(undefine
const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalTransaction) => { const sortFn = (sort: Sort | undefined) => (a: InternalTransaction, b: InternalTransaction) => {
switch (sort) { switch (sort) {
case 'value-desc': { case 'value-desc': {
const result = a.value > b.value ? -1 : 1; return compareBns(b.value, a.value);
return a.value === b.value ? 0 : result;
} }
case 'value-asc': { case 'value-asc': {
const result = a.value > b.value ? 1 : -1; return compareBns(a.value, b.value);
return a.value === b.value ? 0 : result;
} }
case 'gas-limit-desc': { case 'gas-limit-desc': {
const result = a.gas_limit > b.gas_limit ? -1 : 1; return compareBns(b.gas_limit, a.gas_limit);
return a.gas_limit === b.gas_limit ? 0 : result;
} }
case 'gas-limit-asc': { case 'gas-limit-asc': {
const result = a.gas_limit > b.gas_limit ? 1 : -1; return compareBns(a.gas_limit, b.gas_limit);
return a.gas_limit === b.gas_limit ? 0 : result;
} }
default: default:
......
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