Skip to content

Commit

Permalink
Filter runtime txs when fetching detailed txs
Browse files Browse the repository at this point in the history
  • Loading branch information
lubej committed Jul 11, 2024
1 parent fafb9ca commit 756d0b8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/1999.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Filter runtime txs when fetching detailed txs
12 changes: 11 additions & 1 deletion src/app/state/account/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ export function* fetchAccount(action: PayloadAction<string>) {
})

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<Transaction>
Expand Down
2 changes: 1 addition & 1 deletion src/app/state/transaction/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 --- */
Expand Down

0 comments on commit 756d0b8

Please sign in to comment.