@@ -19,6 +19,7 @@ import {
1919 TransactionsByAddressesArgs ,
2020 TransactionsByIdsArgs
2121} from '@cardano-sdk/core' ;
22+ import { DB_MAX_SAFE_INTEGER } from '../DbSyncChainHistory/queries' ;
2223import { Responses } from '@blockfrost/blockfrost-js' ;
2324
2425type WithCertIndex < T > = T & { cert_index : number } ;
@@ -191,20 +192,15 @@ export class BlockfrostChainHistoryProvider extends BlockfrostProvider implement
191192 const { inputs, outputs, collaterals } = BlockfrostToCore . transactionUtxos ( utxos ) ;
192193
193194 const response = await this . blockfrost . txs ( hash . toString ( ) ) ;
194- const metadata = await this . fetchJsonMetadata ( hash ) ;
195+ // const metadata = await this.fetchJsonMetadata(hash);
195196 const certificates = await this . fetchCertificates ( response ) ;
196197 const withdrawals = await this . fetchWithdrawals ( response ) ;
197198 const inputSource : Cardano . InputSource = response . valid_contract
198199 ? Cardano . InputSource . inputs
199200 : Cardano . InputSource . collaterals ;
200201
201202 return {
202- auxiliaryData : metadata
203- ? {
204- blob : metadata
205- }
206- : undefined ,
207-
203+ auxiliaryData : undefined ,
208204 blockHeader : {
209205 blockNo : Cardano . BlockNo ( response . block_height ) ,
210206 hash : Cardano . BlockId ( response . block ) ,
@@ -303,10 +299,14 @@ export class BlockfrostChainHistoryProvider extends BlockfrostProvider implement
303299 const allTransactions = addressTransactions
304300 . flat ( 1 )
305301 . sort ( ( a , b ) => b . block_height - a . block_height || b . tx_index - a . tx_index ) ;
306- const addressTransactionsSinceBlock = blockRange ?. lowerBound
307- ? allTransactions . filter ( ( { block_height } ) => block_height >= blockRange ! . lowerBound ! )
308- : allTransactions ;
309- const ids = addressTransactionsSinceBlock . map ( ( { tx_hash } ) => Cardano . TransactionId ( tx_hash ) ) ;
302+
303+ const lowerBound = blockRange ?. lowerBound ?? 0 ;
304+ const upperBound = blockRange ?. upperBound ?? DB_MAX_SAFE_INTEGER ;
305+
306+ const ids = allTransactions
307+ . filter ( ( { block_height } ) => block_height >= lowerBound && block_height <= upperBound )
308+ . map ( ( { tx_hash } ) => Cardano . TransactionId ( tx_hash ) ) ;
309+
310310 const pageResults = await this . transactionsByHashes ( { ids } ) ;
311311
312312 return { pageResults, totalResultCount : allTransactions . length } ;
0 commit comments