diff options
author | Florian Dold <florian.dold@gmail.com> | 2020-05-15 23:52:58 +0530 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2020-05-15 23:52:58 +0530 |
commit | ff50526560880ef070f1f6ec5a0a7eb4ae3fee2e (patch) | |
tree | 5878ee36bc36e811fc8b08de8241e9bd7060b963 | |
parent | cf3aaee28acaa8d6aba8e0b1fe6dbcba5e4e67ae (diff) |
tx orderingv0.7.1-dev.6
-rw-r--r-- | src/operations/transactions.ts | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/operations/transactions.ts b/src/operations/transactions.ts index f016fb8c3..9a3d48bb3 100644 --- a/src/operations/transactions.ts +++ b/src/operations/transactions.ts @@ -18,7 +18,12 @@ * Imports. */ import { InternalWalletState } from "./state"; -import { Stores, ReserveRecordStatus, PurchaseRecord, WithdrawalSourceType } from "../types/dbTypes"; +import { + Stores, + ReserveRecordStatus, + PurchaseRecord, + WithdrawalSourceType, +} from "../types/dbTypes"; import { Amounts, AmountJson } from "../util/amounts"; import { timestampCmp } from "../util/time"; import { @@ -299,7 +304,11 @@ export async function getTransactions( }, ); - transactions.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp)); + const txPending = transactions.filter((x) => x.pending); + const txNotPending = transactions.filter((x) => !x.pending); + + txPending.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp)); + txNotPending.sort((h1, h2) => timestampCmp(h1.timestamp, h2.timestamp)); - return { transactions }; + return { transactions: [...txPending, ...txNotPending] }; } |