diff --git a/package.json b/package.json index df4968fd6..b324c02ff 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "@substrate/dev": "^0.9.0", "@types/argparse": "2.0.17", "@types/express": "^5.0.5", - "@types/express-serve-static-core": "^5.0.6", + "@types/express-serve-static-core": "^5.1.1", "@types/http-errors": "2.0.5", "@types/lru-cache": "^7.10.10", "@types/morgan": "1.9.10", diff --git a/src/controllers/blocks/BlocksExtrinsicsController.ts b/src/controllers/blocks/BlocksExtrinsicsController.ts index b9112df60..e14874b32 100644 --- a/src/controllers/blocks/BlocksExtrinsicsController.ts +++ b/src/controllers/blocks/BlocksExtrinsicsController.ts @@ -97,7 +97,7 @@ export default class BlocksExtrinsicsController extends AbstractController. -import { RequestHandler } from 'express-serve-static-core'; +import { RequestHandler } from 'express'; import { validateBoolean } from '../../middleware'; import { BlocksTraceService } from '../../services'; +import type { INumberParam } from '../../types/requests'; import AbstractController from '../AbstractController'; import BlocksController from './BlocksController'; @@ -39,19 +40,22 @@ export default class BlocksTraceController extends AbstractController => { + private getLatestBlockTraces: RequestHandler = async (_req, res): Promise => { const hash = await this.api.rpc.chain.getFinalizedHead(); BlocksController.sanitizedSend(res, await this.service.traces(hash)); }; - private getBlockTraces: RequestHandler = async ({ params: { number } }, res): Promise => { + private getBlockTraces: RequestHandler = async ({ params: { number } }, res): Promise => { const hash = await this.getHashForBlock(number); BlocksController.sanitizedSend(res, await this.service.traces(hash)); }; - private getLatestBlockOperations: RequestHandler = async ({ query: { actions } }, res): Promise => { + private getLatestBlockOperations: RequestHandler = async ( + { query: { actions } }, + res, + ): Promise => { const hash = await this.api.rpc.chain.getFinalizedHead(); const includeActions = actions === 'true'; const historicApi = await this.api.at(hash); @@ -59,7 +63,7 @@ export default class BlocksTraceController extends AbstractController = async ( { params: { number }, query: { actions } }, res, ): Promise => { diff --git a/src/services/blocks/BlocksService.spec.ts b/src/services/blocks/BlocksService.spec.ts index 38476e3af..3d071662c 100644 --- a/src/services/blocks/BlocksService.spec.ts +++ b/src/services/blocks/BlocksService.spec.ts @@ -405,8 +405,8 @@ describe('BlocksService', () => { it('Throw an error when param `extrinsicIndex` is less than 0', () => { expect(() => { - parseNumberOrThrow('-5', '`exstrinsicIndex` path param is not a number'); - }).toThrow(new BadRequest('`exstrinsicIndex` path param is not a number')); + parseNumberOrThrow('-5', '`extrinsicIndex` path param is not a number'); + }).toThrow(new BadRequest('`extrinsicIndex` path param is not a number')); }); }); diff --git a/yarn.lock b/yarn.lock index d650f6803..259765257 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2476,7 +2476,7 @@ __metadata: "@substrate/dev": "npm:^0.9.0" "@types/argparse": "npm:2.0.17" "@types/express": "npm:^5.0.5" - "@types/express-serve-static-core": "npm:^5.0.6" + "@types/express-serve-static-core": "npm:^5.1.1" "@types/http-errors": "npm:2.0.5" "@types/lru-cache": "npm:^7.10.10" "@types/morgan": "npm:1.9.10" @@ -2708,7 +2708,7 @@ __metadata: languageName: node linkType: hard -"@types/express-serve-static-core@npm:^5.0.0, @types/express-serve-static-core@npm:^5.0.6": +"@types/express-serve-static-core@npm:^5.0.0": version: 5.0.6 resolution: "@types/express-serve-static-core@npm:5.0.6" dependencies: @@ -2720,6 +2720,18 @@ __metadata: languageName: node linkType: hard +"@types/express-serve-static-core@npm:^5.1.1": + version: 5.1.1 + resolution: "@types/express-serve-static-core@npm:5.1.1" + dependencies: + "@types/node": "npm:*" + "@types/qs": "npm:*" + "@types/range-parser": "npm:*" + "@types/send": "npm:*" + checksum: 10/7f3d8cf7e68764c9f3e8f6a12825b69ccf5287347fc1c20b29803d4f08a4abc1153ae11d7258852c61aad50f62ef72d4c1b9c97092b0a90462c3dddec2f6026c + languageName: node + linkType: hard + "@types/express@npm:^5.0.5": version: 5.0.5 resolution: "@types/express@npm:5.0.5"