From 4d0feabe0dc655f57d3d529eb90f2204a3c8fbc4 Mon Sep 17 00:00:00 2001 From: Vasyl Ivanchuk Date: Tue, 31 Oct 2023 09:25:51 +0200 Subject: [PATCH] fix: docs for txlistinternal api endpoint --- packages/api/src/api/api.controller.spec.ts | 14 +++++++++ packages/api/src/api/api.controller.ts | 35 +++++++++++++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/packages/api/src/api/api.controller.spec.ts b/packages/api/src/api/api.controller.spec.ts index 567eaa2876..d2dad27554 100644 --- a/packages/api/src/api/api.controller.spec.ts +++ b/packages/api/src/api/api.controller.spec.ts @@ -108,6 +108,20 @@ describe("ApiController", () => { }); }); + describe("getInternalTransactions", () => { + it("returns null as it is defined only to appear in docs and cannot be called", async () => { + const result = await controller.getInternalTransactions( + { + page: 1, + offset: 10, + maxLimit: 10000, + }, + { sort: SortingOrder.Desc } + ); + expect(result).toBe(null); + }); + }); + describe("getAccountInternalTransactions", () => { it("returns null as it is defined only to appear in docs and cannot be called", async () => { const result = await controller.getAccountInternalTransactions( diff --git a/packages/api/src/api/api.controller.ts b/packages/api/src/api/api.controller.ts index 7694f04c7d..09891c6463 100644 --- a/packages/api/src/api/api.controller.ts +++ b/packages/api/src/api/api.controller.ts @@ -232,6 +232,37 @@ export class ApiController { return null; } + @ApiTags("Account API") + @Get("api?module=account&action=txlistinternal") + @ApiOperation({ summary: "Retrieve internal transactions" }) + @ApiQuery({ + name: "startblock", + type: "integer", + description: "The block number to start searching for internal transactions", + example: 0, + required: false, + }) + @ApiQuery({ + name: "endblock", + type: "integer", + description: "The block number to stop searching for internal transactions", + example: 99999999, + required: false, + }) + @ApiExtraModels(AccountInternalTransactionDto) + @ApiOkResponse({ + description: "Internal transactions list", + type: AccountInternalTransactionsResponseDto, + }) + public async getInternalTransactions( + // eslint-disable-next-line @typescript-eslint/no-unused-vars + @Query() pagingOptions: PagingOptionsWithMaxItemsLimitDto, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + @Query() sortingOptions: SortingOptionsDto + ): Promise { + return null; + } + @ApiTags("Account API") @Get("api?module=account&action=txlistinternal&address=") @ApiOperation({ summary: "Retrieve internal transactions for a given address" }) @@ -239,7 +270,7 @@ export class ApiController { name: "address", description: "The address to filter internal transactions by", example: constants.addressWithInternalTx, - required: false, + required: true, }) @ApiQuery({ name: "startblock", @@ -276,7 +307,7 @@ export class ApiController { name: "txhash", description: "The transaction hash to filter internal transaction by", example: constants.addressTxWithInternalTransfers, - required: false, + required: true, }) @ApiQuery({ name: "startblock",