- Updates how the transactions are ordered, now orders by nonce and then by date (#640)
This commit is contained in:
parent
aaa480c2a5
commit
558b9f69f7
|
@ -74,13 +74,31 @@ const TxsTable = ({
|
||||||
const columns = generateColumns()
|
const columns = generateColumns()
|
||||||
const autoColumns = columns.filter(c => !c.custom)
|
const autoColumns = columns.filter(c => !c.custom)
|
||||||
const filteredData = getTxTableData(transactions, cancellationTransactions)
|
const filteredData = getTxTableData(transactions, cancellationTransactions)
|
||||||
.sort(({ dateOrder: a }, { dateOrder: b }) => {
|
.sort((tx1, tx2) => {
|
||||||
if (!a || !b) {
|
// First order by nonce
|
||||||
|
const aNonce = tx1.tx.nonce
|
||||||
|
const bNonce = tx1.tx.nonce
|
||||||
|
if (aNonce && bNonce) {
|
||||||
|
const difference = aNonce - bNonce
|
||||||
|
if (difference !== 0) {
|
||||||
|
return difference
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If can't be ordered by nonce, order by date
|
||||||
|
const aDateOrder = tx1.dateOrder
|
||||||
|
const bDateOrder = tx2.dateOrder
|
||||||
|
// Second by date
|
||||||
|
if (!aDateOrder || !bDateOrder) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return a - b
|
return aDateOrder - bDateOrder
|
||||||
|
})
|
||||||
|
.map((tx, id) => {
|
||||||
|
return {
|
||||||
|
...tx,
|
||||||
|
id,
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.map((tx, id) => ({ ...tx, id }))
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Block className={classes.container}>
|
<Block className={classes.container}>
|
||||||
|
|
Loading…
Reference in New Issue