@@ -40,8 +40,6 @@ import { newAndStoredMulticast } from './util/newAndStoredMulticast';
40
40
import chunk from 'lodash/chunk.js' ;
41
41
import sortBy from 'lodash/sortBy.js' ;
42
42
43
- const ONE_MONTH_BLOCK_TIME = 21_600 * 6 ;
44
-
45
43
export interface TransactionsTrackerProps {
46
44
chainHistoryProvider : ChainHistoryProvider ;
47
45
addresses$ : Observable < Cardano . PaymentAddress [ ] > ;
@@ -218,26 +216,18 @@ const fetchInitialTransactions = async (
218
216
addresses : Cardano . PaymentAddress [ ] ,
219
217
historicalTransactionsFetchLimit : number
220
218
) : Promise < Cardano . HydratedTx [ ] > => {
221
- const firstPassTxs = await allTransactionsByAddresses ( chainHistoryProvider , {
219
+ const transactions = await allTransactionsByAddresses ( chainHistoryProvider , {
222
220
addresses,
223
221
filterBy : { limit : historicalTransactionsFetchLimit , type : 'tip' }
224
222
} ) ;
225
223
226
- if ( firstPassTxs . length === 0 ) {
224
+ if ( transactions . length === 0 ) {
227
225
return [ ] ;
228
226
}
229
227
230
- if ( addresses . length === 1 ) {
231
- return firstPassTxs ;
232
- }
233
-
234
- const highBlockNo = Cardano . BlockNo ( Math . max ( ...firstPassTxs . map ( ( tx ) => tx . blockHeader . blockNo ) ) ) ;
235
- const onMonthBack = Cardano . BlockNo ( Math . max ( highBlockNo - ONE_MONTH_BLOCK_TIME , 0 ) ) ;
236
-
237
- return await allTransactionsByAddresses ( chainHistoryProvider , {
238
- addresses,
239
- filterBy : { blockRange : { lowerBound : onMonthBack } , type : 'blockRange' }
240
- } ) ;
228
+ return transactions
229
+ . sort ( ( lhs , rhs ) => rhs . blockHeader . slot - lhs . blockHeader . slot )
230
+ . slice ( 0 , historicalTransactionsFetchLimit ) ;
241
231
} ;
242
232
243
233
const findIntersectionAndUpdateTxStore = ( {
0 commit comments