File tree 3 files changed +18
-2
lines changed
3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -429,7 +429,7 @@ export class DebugImpl implements Debug {
429
429
transactionHash : string ,
430
430
tracerConfig : ICallTracerConfig ,
431
431
requestDetails : RequestDetails ,
432
- ) : Promise < CallTracerResult > {
432
+ ) : Promise < CallTracerResult | null > {
433
433
try {
434
434
const [ actionsResponse , transactionsResponse ] = await Promise . all ( [
435
435
this . mirrorNodeClient . getContractsResultsActions ( transactionHash , requestDetails ) ,
@@ -444,6 +444,9 @@ export class DebugImpl implements Debug {
444
444
throw predefined . RESOURCE_NOT_FOUND ( `Failed to retrieve contract results for transaction ${ transactionHash } ` ) ;
445
445
}
446
446
447
+ // return empty array if no actions
448
+ if ( actionsResponse . length === 0 ) return null ;
449
+
447
450
const { call_type : type } = actionsResponse [ 0 ] ;
448
451
const formattedActions = await this . formatActionsResult ( actionsResponse , requestDetails ) ;
449
452
Original file line number Diff line number Diff line change @@ -73,5 +73,5 @@ export interface TraceBlockByNumberTxResult {
73
73
/**
74
74
* The result of the trace, which can be either a {@link CallTracerResult} or an {@link EntityTraceStateMap}.
75
75
*/
76
- result : CallTracerResult | EntityTraceStateMap ;
76
+ result : CallTracerResult | EntityTraceStateMap | null ;
77
77
}
Original file line number Diff line number Diff line change @@ -422,6 +422,19 @@ describe('Debug API Test Suite', async function () {
422
422
423
423
expect ( result ) . to . deep . equal ( expectedResult ) ;
424
424
} ) ;
425
+
426
+ it ( 'Should return empty array if no actions found' , async function ( ) {
427
+ restMock . onGet ( CONTARCTS_RESULTS_ACTIONS ) . reply ( 200 , JSON . stringify ( { actions : [ ] } ) ) ;
428
+
429
+ const result = await debugService . traceTransaction (
430
+ transactionHash ,
431
+ callTracer ,
432
+ tracerConfigFalse ,
433
+ requestDetails ,
434
+ ) ;
435
+
436
+ expect ( result ) . to . be . null ;
437
+ } ) ;
425
438
} ) ;
426
439
427
440
describe ( 'opcodeLogger' , async function ( ) {
You can’t perform that action at this time.
0 commit comments