Skip to content

Commit

Permalink
Hide pending transactions for accounts with missing historical txs
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Nov 7, 2024
1 parent 910b7f5 commit cd9e2c2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/state/account/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const selectPendingTransactionForAccount = createSelector(
export const hasAccountUnknownPendingTransactions = createSelector(
[selectAccountNonce, selectTransactions, selectAccountAddress],
(accountNonce, transactions, accountAddress) => {
if (!transactions.length && accountNonce && process.env.REACT_APP_BACKEND === 'oasisscanV2') {
// Don't bother when tx list is empty in this case. Oasis Scan v2 API is missing historical data.
// Account have nonce and 0 transactions due to last correctly indexed block 16817956 (2023-11-29)
return false
}
const noncesFromTxs = transactions
.filter(tx => !tx.runtimeId)
.filter(tx => tx.from !== undefined)
Expand All @@ -36,6 +41,8 @@ export const hasAccountUnknownPendingTransactions = createSelector(
if (noncesFromTxs.length <= 0) {
// TODO: last transaction that affected nonce is not in the initial page of account's transactions
if (transactions.length >= TRANSACTIONS_LIMIT) return false
// if we cannot find any noncesFromTxs this probably means that account is missing some part of historical data
if (!noncesFromTxs.length && process.env.REACT_APP_BACKEND === 'oasisscanV2') return false
// Waiting for first transactions
return BigInt(accountNonce) > 0n
}
Expand Down

0 comments on commit cd9e2c2

Please sign in to comment.