@@ -16,7 +16,7 @@ import {
16
16
handleTransactionCache ,
17
17
} from '../controllers/cache-controller' ;
18
18
import { DbEventTypeId } from '../../datastore/common' ;
19
- import { has0xPrefix } from '@hirosystems/api-toolkit' ;
19
+ import { has0xPrefix , parseBoolean } from '@hirosystems/api-toolkit' ;
20
20
21
21
import { FastifyPluginAsync } from 'fastify' ;
22
22
import { Server } from 'node:http' ;
@@ -318,43 +318,46 @@ export const TxRoutes: FastifyPluginAsync<
318
318
}
319
319
) ;
320
320
321
- fastify . get (
322
- '/mempool/dropped' ,
323
- {
324
- preHandler : handleMempoolCache ,
325
- schema : {
326
- operationId : 'get_dropped_mempool_transaction_list' ,
327
- summary : 'Get dropped mempool transactions' ,
328
- description : `Retrieves all recently-broadcast transactions that have been dropped from the mempool.
329
-
330
- Transactions are dropped from the mempool if:
331
- * they were stale and awaiting garbage collection or,
332
- * were expensive, or
333
- * were replaced with a new fee` ,
334
- tags : [ 'Transactions' ] ,
335
- querystring : Type . Object ( {
336
- offset : OffsetParam ( ) ,
337
- limit : LimitParam ( ResourceType . Tx ) ,
338
- } ) ,
339
- response : {
340
- 200 : PaginatedResponse ( MempoolTransactionSchema , {
341
- description : 'List of dropped mempool transactions' ,
321
+ if ( parseBoolean ( process . env [ 'STACKS_API_ENABLE_LEGACY_ENDPOINTS' ] ) ) {
322
+ fastify . get (
323
+ '/mempool/dropped' ,
324
+ {
325
+ preHandler : handleMempoolCache ,
326
+ schema : {
327
+ deprecated : true ,
328
+ operationId : 'get_dropped_mempool_transaction_list' ,
329
+ summary : 'Get dropped mempool transactions' ,
330
+ description : `Retrieves all recently-broadcast transactions that have been dropped from the mempool.
331
+
332
+ Transactions are dropped from the mempool if:
333
+ * they were stale and awaiting garbage collection or,
334
+ * were expensive, or
335
+ * were replaced with a new fee` ,
336
+ tags : [ 'Transactions' ] ,
337
+ querystring : Type . Object ( {
338
+ offset : OffsetParam ( ) ,
339
+ limit : LimitParam ( ResourceType . Tx ) ,
342
340
} ) ,
341
+ response : {
342
+ 200 : PaginatedResponse ( MempoolTransactionSchema , {
343
+ description : 'List of dropped mempool transactions' ,
344
+ } ) ,
345
+ } ,
343
346
} ,
344
347
} ,
345
- } ,
346
- async ( req , reply ) => {
347
- const limit = getPagingQueryLimit ( ResourceType . Tx , req . query . limit ) ;
348
- const offset = parsePagingQueryInput ( req . query . offset ?? 0 ) ;
349
- const { results : txResults , total } = await fastify . db . getDroppedTxs ( {
350
- offset ,
351
- limit ,
352
- } ) ;
353
- const results = txResults . map ( tx => parseDbMempoolTx ( tx ) ) ;
354
- const response = { limit , offset , total , results } ;
355
- await reply . send ( response ) ;
356
- }
357
- ) ;
348
+ async ( req , reply ) => {
349
+ const limit = getPagingQueryLimit ( ResourceType . Tx , req . query . limit ) ;
350
+ const offset = parsePagingQueryInput ( req . query . offset ?? 0 ) ;
351
+ const { results : txResults , total } = await fastify . db . getDroppedTxs ( {
352
+ offset ,
353
+ limit ,
354
+ } ) ;
355
+ const results = txResults . map ( tx => parseDbMempoolTx ( tx ) ) ;
356
+ const response = { limit , offset , total , results } ;
357
+ await reply . send ( response ) ;
358
+ }
359
+ ) ;
360
+ }
358
361
359
362
fastify . get (
360
363
'/mempool/stats' ,
0 commit comments