diff --git a/packages/api/.env.example b/packages/api/.env.example index 698a617525..ed85f208b3 100644 --- a/packages/api/.env.example +++ b/packages/api/.env.example @@ -6,7 +6,8 @@ METRICS_PORT=3005 COLLECT_DB_CONNECTION_POOL_METRICS_INTERVAL=10000 PORT=3020 LOG_LEVEL=debug -LIMITED_PAGINATION_MAX_ITEMS=100000 +LIMITED_PAGINATION_MAX_ITEMS=10000 +API_LIMITED_PAGINATION_MAX_ITEMS=1000 DISABLE_API_SCHEMA_DOCS=false DISABLE_BFF_API_SCHEMA_DOCS=false DISABLE_EXTERNAL_API=false diff --git a/packages/api/.env.test b/packages/api/.env.test index 3566e2364e..d4d855e2d6 100644 --- a/packages/api/.env.test +++ b/packages/api/.env.test @@ -2,4 +2,5 @@ DATABASE_URL='postgres://postgres:postgres@localhost:5432/block-explorer-e2e' METRICS_PORT=3005 PORT=3007 LIMITED_PAGINATION_MAX_ITEMS=15 +API_LIMITED_PAGINATION_MAX_ITEMS=15 CONTRACT_VERIFICATION_API_URL=http://verification.api diff --git a/packages/api/src/api/dtos/common/pagingOptions.dto.ts b/packages/api/src/api/dtos/common/pagingOptions.dto.ts index a046d25201..9a1934a2e3 100644 --- a/packages/api/src/api/dtos/common/pagingOptions.dto.ts +++ b/packages/api/src/api/dtos/common/pagingOptions.dto.ts @@ -19,7 +19,7 @@ export class PagingOptionsDto { @ApiPropertyOptional({ type: "integer", minimum: 1, - maximum: 10000, + maximum: 100, default: 10, description: "The number of items returned per page", example: 10, diff --git a/packages/api/src/api/dtos/common/pagingOptionsWithMaxItemsLimit.dto.ts b/packages/api/src/api/dtos/common/pagingOptionsWithMaxItemsLimit.dto.ts index 6341f34c2d..db85df611e 100644 --- a/packages/api/src/api/dtos/common/pagingOptionsWithMaxItemsLimit.dto.ts +++ b/packages/api/src/api/dtos/common/pagingOptionsWithMaxItemsLimit.dto.ts @@ -6,7 +6,7 @@ import { PagingOptionsDto } from "./pagingOptions.dto"; import { config } from "dotenv"; config(); -const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 10000; +const maxItemsLimit = parseInt(process.env.API_LIMITED_PAGINATION_MAX_ITEMS, 10) || 1000; export class PagingOptionsWithMaxItemsLimitDto extends PagingOptionsDto { @ApiPropertyOptional({ diff --git a/packages/api/src/api/dtos/contract/contractAbiResponse.dto.ts b/packages/api/src/api/dtos/contract/contractAbiResponse.dto.ts index 9a03db437b..fe4d6ede0d 100644 --- a/packages/api/src/api/dtos/contract/contractAbiResponse.dto.ts +++ b/packages/api/src/api/dtos/contract/contractAbiResponse.dto.ts @@ -66,5 +66,5 @@ export class ContractAbiResponseDto extends ResponseBaseDto { }, ]), }) - public readonly result: any; + public readonly result: string; } diff --git a/packages/api/src/api/dtos/transaction/transactionReceiptStatusResponse.dto.ts b/packages/api/src/api/dtos/transaction/transactionReceiptStatusResponse.dto.ts index 36efffbbb5..2afbcee077 100644 --- a/packages/api/src/api/dtos/transaction/transactionReceiptStatusResponse.dto.ts +++ b/packages/api/src/api/dtos/transaction/transactionReceiptStatusResponse.dto.ts @@ -8,5 +8,5 @@ export class TransactionReceiptStatusResponseDto extends ResponseBaseDto { status: "0", }, }) - public readonly result: { status: "0" | "1" | "" } | string; + public readonly result: { status: string } | string; } diff --git a/packages/api/src/api/transaction/transaction.controller.ts b/packages/api/src/api/transaction/transaction.controller.ts index 542074cda1..29d993b78d 100644 --- a/packages/api/src/api/transaction/transaction.controller.ts +++ b/packages/api/src/api/transaction/transaction.controller.ts @@ -5,7 +5,8 @@ import { TransactionReceiptService } from "../../transaction/transactionReceipt. import { TransactionStatus } from "../../transaction/entities/transaction.entity"; import { ParseTransactionHashPipe } from "../../common/pipes/parseTransactionHash.pipe"; import { ResponseStatus, ResponseMessage } from "../dtos/common/responseBase.dto"; -import { ContractAbiResponseDto } from "../dtos/contract/contractAbiResponse.dto"; +import { TransactionStatusResponseDto } from "../dtos/transaction/transactionStatusResponse.dto"; +import { TransactionReceiptStatusResponseDto } from "../dtos/transaction/transactionReceiptStatusResponse.dto"; import { ApiExceptionFilter } from "../exceptionFilter"; const entityName = "transaction"; @@ -27,7 +28,7 @@ export class TransactionController { @Get("/getstatus") public async getTransactionStatus( @Query("txhash", new ParseTransactionHashPipe()) transactionHash: string - ): Promise { + ): Promise { const transaction = await this.transactionService.findOne(transactionHash); const hasError = transaction?.status === TransactionStatus.Failed; return { @@ -43,7 +44,7 @@ export class TransactionController { @Get("/gettxreceiptstatus") public async getTransactionReceiptStatus( @Query("txhash", new ParseTransactionHashPipe()) transactionHash: string - ): Promise { + ): Promise { const transactionReceipt = await this.transactionReceiptService.findOne(transactionHash, ["status"]); const status = transactionReceipt?.status.toString() || ""; return { diff --git a/packages/api/src/common/dtos/pagingOptionsWithMaxItemsLimit.dto.ts b/packages/api/src/common/dtos/pagingOptionsWithMaxItemsLimit.dto.ts index a1ac934035..dd5f8607c8 100644 --- a/packages/api/src/common/dtos/pagingOptionsWithMaxItemsLimit.dto.ts +++ b/packages/api/src/common/dtos/pagingOptionsWithMaxItemsLimit.dto.ts @@ -6,7 +6,7 @@ import { PagingOptionsDto } from "./pagingOptions.dto"; import { config } from "dotenv"; config(); -const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 100000; +const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 10000; export class PagingOptionsWithMaxItemsLimitDto extends PagingOptionsDto { @ApiPropertyOptional({