Skip to content

Commit b748814

Browse files
committed
fix: allowed callTracer to return empty string if no call actions found
Signed-off-by: Logan Nguyen <logan.nguyen@swirldslabs.com>
1 parent fca86cc commit b748814

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

packages/relay/src/lib/debug.ts

+3
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ export class DebugImpl implements Debug {
444444
throw predefined.RESOURCE_NOT_FOUND(`Failed to retrieve contract results for transaction ${transactionHash}`);
445445
}
446446

447+
// return empty array if no actions
448+
if (actionsResponse.length === 0) return [];
449+
447450
const { call_type: type } = actionsResponse[0];
448451
const formattedActions = await this.formatActionsResult(actionsResponse, requestDetails);
449452

packages/relay/tests/lib/debug.spec.ts

+13
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,19 @@ describe('Debug API Test Suite', async function () {
422422

423423
expect(result).to.deep.equal(expectedResult);
424424
});
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.empty;
437+
});
425438
});
426439

427440
describe('opcodeLogger', async function () {

0 commit comments

Comments
 (0)