From de1427ab2c31412657e920cdc0e3a4985b0a2c35 Mon Sep 17 00:00:00 2001 From: isstuev Date: Wed, 8 May 2024 12:27:33 +0200 Subject: [PATCH] fix internal txs sorting --- ui/tx/TxInternals.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/tx/TxInternals.tsx b/ui/tx/TxInternals.tsx index 3f0396c155..2542ff96fc 100644 --- a/ui/tx/TxInternals.tsx +++ b/ui/tx/TxInternals.tsx @@ -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'; @@ -31,23 +32,20 @@ const getNextSortValue = (getNextSortValueShared).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: