From 756d0b8ea5226a5005aa991d7157a4196705a88b Mon Sep 17 00:00:00 2001 From: Matej Lubej Date: Thu, 11 Jul 2024 17:09:03 +0200 Subject: [PATCH] Filter runtime txs when fetching detailed txs --- .changelog/1999.internal.md | 1 + src/app/state/account/saga.ts | 12 +++++++++++- src/app/state/transaction/types.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changelog/1999.internal.md diff --git a/.changelog/1999.internal.md b/.changelog/1999.internal.md new file mode 100644 index 0000000000..d61106ac00 --- /dev/null +++ b/.changelog/1999.internal.md @@ -0,0 +1 @@ +Filter runtime txs when fetching detailed txs diff --git a/src/app/state/account/saga.ts b/src/app/state/account/saga.ts index 811f5a9fe6..7888c62574 100644 --- a/src/app/state/account/saga.ts +++ b/src/app/state/account/saga.ts @@ -57,7 +57,17 @@ export function* fetchAccount(action: PayloadAction) { }) const detailedTransactions = yield* call(() => - Promise.allSettled(transactions.map(({ hash }) => getTransaction({ hash }))), + Promise.allSettled( + transactions.map(tx => { + const { hash, runtimeId, runtimeName, round } = tx + + if (!!runtimeId || !!runtimeName || !!round) { + return Promise.reject() + } + + return getTransaction({ hash }) + }), + ), ) const transactionsWithUpdatedNonce = transactions.map((t, i) => { const { status, value } = detailedTransactions[i] as PromiseFulfilledResult diff --git a/src/app/state/transaction/types.ts b/src/app/state/transaction/types.ts index e10bd512b6..ca9a509903 100644 --- a/src/app/state/transaction/types.ts +++ b/src/app/state/transaction/types.ts @@ -49,12 +49,12 @@ export interface Transaction { timestamp: number | undefined to: string | undefined type: TransactionType + nonce: StringifiedBigInt | undefined // These are undefined on consensus transaction // Only appear on ParaTime transaction runtimeName: string | undefined runtimeId: string | undefined round: number | undefined - nonce: StringifiedBigInt | undefined } /* --- STATE --- */