From 5eb8542fe071dfad97df3535c78e6ad8f04dd529 Mon Sep 17 00:00:00 2001 From: Derek Guenther Date: Thu, 19 Sep 2024 15:31:55 -0400 Subject: [PATCH] Run yarn build to fix Swagger types (#85) --- src/controllers/block.ts | 2 +- src/routes/routes.ts | 38 ++++++++++++++++++++++++++ src/swagger/swagger.json | 59 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 97 insertions(+), 2 deletions(-) diff --git a/src/controllers/block.ts b/src/controllers/block.ts index 6dccafb..c292026 100644 --- a/src/controllers/block.ts +++ b/src/controllers/block.ts @@ -78,7 +78,7 @@ export class BlockController { public async broadcastTransaction( @Body() transaction: string, @Res() err: TsoaResponse<400, { reason: string }>, - ) { + ): Promise<{ accepted: boolean; broadcasted: boolean; hash: string }> { const rpcClient = await ifClient.getClient(); const response = await rpcClient.chain.broadcastTransaction({ transaction, diff --git a/src/routes/routes.ts b/src/routes/routes.ts index b8a1745..923fa45 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -132,6 +132,44 @@ export function RegisterRoutes(app: Router) { }, ); // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + app.get( + "/fee-rates", + ...fetchMiddlewares(BlockController), + ...fetchMiddlewares(BlockController.prototype.feeRates), + + async function BlockController_feeRates( + request: ExRequest, + response: ExResponse, + next: any, + ) { + const args: Record = {}; + + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa + + let validatedArgs: any[] = []; + try { + validatedArgs = templateService.getValidatedArgs({ + args, + request, + response, + }); + + const controller = new BlockController(); + + await templateService.apiHandler({ + methodName: "feeRates", + controller, + response, + next, + validatedArgs, + successStatus: undefined, + }); + } catch (err) { + return next(err); + } + }, + ); + // WARNING: This file was auto-generated with tsoa. Please do not modify it. Re-run tsoa to re-generate this file: https://github.com/lukeautry/tsoa app.post( "/transaction", ...fetchMiddlewares(BlockController), diff --git a/src/swagger/swagger.json b/src/swagger/swagger.json index 532a798..1b9fbf1 100644 --- a/src/swagger/swagger.json +++ b/src/swagger/swagger.json @@ -159,6 +159,45 @@ ] } }, + "/fee-rates": { + "get": { + "operationId": "FeeRates", + "responses": { + "200": { + "description": "Ok", + "content": { + "application/json": { + "schema": { + "properties": { + "fast": { + "type": "string" + }, + "average": { + "type": "string" + }, + "slow": { + "type": "string" + } + }, + "required": [ + "fast", + "average", + "slow" + ], + "type": "object" + } + } + } + } + }, + "description": "Returns estimated fee rates for the network.", + "tags": [ + "Block Controller" + ], + "security": [], + "parameters": [] + } + }, "/transaction": { "post": { "operationId": "BroadcastTransaction", @@ -167,7 +206,25 @@ "description": "if the transaction was accepted, the hash of the transaction", "content": { "application/json": { - "schema": {} + "schema": { + "properties": { + "hash": { + "type": "string" + }, + "broadcasted": { + "type": "boolean" + }, + "accepted": { + "type": "boolean" + } + }, + "required": [ + "hash", + "broadcasted", + "accepted" + ], + "type": "object" + } } } },