@@ -2469,6 +2469,84 @@ describe('tx tests', () => {
24692469 ) ;
24702470 } ) ;
24712471
2472+ test ( 'tx list - filter by nonce' , async ( ) => {
2473+ const testSendertAddr = 'ST27W5M8BRKA7C5MZE2R1S1F4XTPHFWFRNHA9M04Y' ;
2474+ const block1 = new TestBlockBuilder ( {
2475+ block_height : 1 ,
2476+ index_block_hash : '0x01' ,
2477+ burn_block_time : 1710000000 ,
2478+ } )
2479+ . addTx ( {
2480+ tx_id : '0x1234' ,
2481+ fee_rate : 1n ,
2482+ sender_address : testSendertAddr ,
2483+ nonce : 1 ,
2484+ } )
2485+ . build ( ) ;
2486+
2487+ await db . update ( block1 ) ;
2488+
2489+ const block2 = new TestBlockBuilder ( {
2490+ block_height : 2 ,
2491+ index_block_hash : '0x02' ,
2492+ parent_block_hash : block1 . block . block_hash ,
2493+ parent_index_block_hash : block1 . block . index_block_hash ,
2494+ burn_block_time : 1720000000 ,
2495+ } )
2496+ . addTx ( {
2497+ tx_id : '0x2234' ,
2498+ fee_rate : 3n ,
2499+ sender_address : testSendertAddr ,
2500+ nonce : 2 ,
2501+ } )
2502+ . build ( ) ;
2503+ await db . update ( block2 ) ;
2504+
2505+ const block3 = new TestBlockBuilder ( {
2506+ block_height : 3 ,
2507+ index_block_hash : '0x03' ,
2508+ parent_block_hash : block2 . block . block_hash ,
2509+ parent_index_block_hash : block2 . block . index_block_hash ,
2510+ burn_block_time : 1730000000 ,
2511+ } )
2512+ . addTx ( {
2513+ tx_id : '0x3234' ,
2514+ fee_rate : 2n ,
2515+ sender_address : testSendertAddr ,
2516+ nonce : 3 ,
2517+ } )
2518+ . build ( ) ;
2519+ await db . update ( block3 ) ;
2520+
2521+ const txsReq1 = await supertest ( api . server ) . get (
2522+ `/extended/v1/tx?from_address=${ testSendertAddr } &nonce=${ 1 } `
2523+ ) ;
2524+ expect ( txsReq1 . status ) . toBe ( 200 ) ;
2525+ expect ( txsReq1 . body ) . toEqual (
2526+ expect . objectContaining ( {
2527+ results : [
2528+ expect . objectContaining ( {
2529+ tx_id : block1 . txs [ 0 ] . tx . tx_id ,
2530+ } ) ,
2531+ ] ,
2532+ } )
2533+ ) ;
2534+
2535+ const txsReq2 = await supertest ( api . server ) . get (
2536+ `/extended/v1/tx?from_address=${ testSendertAddr } &nonce=${ 2 } `
2537+ ) ;
2538+ expect ( txsReq2 . status ) . toBe ( 200 ) ;
2539+ expect ( txsReq2 . body ) . toEqual (
2540+ expect . objectContaining ( {
2541+ results : [
2542+ expect . objectContaining ( {
2543+ tx_id : block2 . txs [ 0 ] . tx . tx_id ,
2544+ } ) ,
2545+ ] ,
2546+ } )
2547+ ) ;
2548+ } ) ;
2549+
24722550 test ( 'fetch raw tx' , async ( ) => {
24732551 const block : DbBlock = {
24742552 block_hash : '0x1234' ,
0 commit comments