-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abstract base controllers and refactoring
- Loading branch information
1 parent
4d2995f
commit d5c5c47
Showing
11 changed files
with
291 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 7 additions & 66 deletions
73
src/controller/eth/eth-evm-transaction-verifier.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,12 @@ | ||
/////////////////////////////////////////////////////////////// | ||
// THIS IS GENERATED CODE. DO NOT CHANGE THIS FILE MANUALLY .// | ||
/////////////////////////////////////////////////////////////// | ||
|
||
import { Body, Controller, HttpCode, Post, UseGuards } from "@nestjs/common"; | ||
import { ApiSecurity, ApiTags } from "@nestjs/swagger"; | ||
import { ApiKeyAuthGuard } from "../../auth/apikey.guard"; | ||
|
||
import { ApiTags } from "@nestjs/swagger"; | ||
import { ETHEVMTransactionVerifierService } from "../../service/eth/eth-evm-transaction-verifier.service"; | ||
import { AttestationResponseDTO_EVMTransaction_Response, EVMTransaction_RequestNoMic } from "../../dto/EVMTransaction.dto"; | ||
import { EncodedRequest, MicResponse, EncodedRequestResponse } from "../../dto/generic.dto"; | ||
import { AttestationResponseDTO_EVMTransaction_ResponseEncoded } from "../../dto/fdcTransactions.dto"; | ||
import { EVMTransactionVerifierControllerBase } from "../evm-transaction-verifier-base.controller"; | ||
import { Controller } from "@nestjs/common"; | ||
|
||
@ApiTags("EVMTransaction") | ||
@ApiTags("EVMTransaction", "ETH") | ||
@Controller("eth/EVMTransaction") | ||
@UseGuards(ApiKeyAuthGuard) | ||
@ApiSecurity("X-API-KEY") | ||
export class ETHEVMTransactionVerifierController { | ||
constructor(private readonly verifierService: ETHEVMTransactionVerifierService) {} | ||
|
||
/** | ||
* | ||
* Tries to verify encoded attestation request without checking message integrity code, and if successful it returns response. | ||
* @param verifierBody | ||
* @deprecated | ||
* @returns | ||
*/ | ||
@HttpCode(200) | ||
@Post() | ||
async verify(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.verifyEncodedRequest(body.abiEncodedRequest!); | ||
} | ||
|
||
@HttpCode(200) | ||
@Post("verifyFDC") | ||
async verifyFDC(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_ResponseEncoded> { | ||
return this.verifierService.verifyEncodedRequestFDC(body.abiEncodedRequest!); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful it returns response. | ||
* @param prepareResponseBody | ||
* @returns | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareResponse") | ||
async prepareResponse(@Body() body: EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.prepareResponse(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful, it returns the correct message integrity code. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("mic") | ||
async mic(@Body() body: EVMTransaction_RequestNoMic): Promise<MicResponse> { | ||
return this.verifierService.mic(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code. | ||
* If successful, it returns the encoding of the attestation request with the correct message integrity code, which can be directly submitted to the State Connector contract. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareRequest") | ||
async prepareRequest(@Body() body: EVMTransaction_RequestNoMic): Promise<EncodedRequestResponse> { | ||
return this.verifierService.prepareRequest(body); | ||
export class ETHEVMTransactionVerifierController extends EVMTransactionVerifierControllerBase { | ||
constructor(protected readonly verifierService: ETHEVMTransactionVerifierService) { | ||
super(); | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
src/controller/evm-transaction-verifier-base.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { Body, HttpCode, Post, UseGuards } from "@nestjs/common"; | ||
import { ApiSecurity, ApiTags } from "@nestjs/swagger"; | ||
import { ApiKeyAuthGuard } from "../auth/apikey.guard"; | ||
import { AttestationResponseDTO_EVMTransaction_Response, EVMTransaction_RequestNoMic } from "../dto/EVMTransaction.dto"; | ||
import { AttestationResponseDTO_EVMTransaction_ResponseEncoded } from "../dto/fdcTransactions.dto"; | ||
import { EncodedRequest, EncodedRequestResponse, MicResponse } from "../dto/generic.dto"; | ||
import { EVMTransactionVerifierServiceBase } from "../service/evm-transaction-verification-base.service"; | ||
|
||
@ApiTags("EVMTransaction") | ||
@UseGuards(ApiKeyAuthGuard) | ||
@ApiSecurity("X-API-KEY") | ||
export abstract class EVMTransactionVerifierControllerBase { | ||
protected readonly verifierService: EVMTransactionVerifierServiceBase; | ||
|
||
/** | ||
* | ||
* Tries to verify encoded attestation request without checking message integrity code, and if successful it returns response in json form. | ||
* @param body | ||
* @deprecated | ||
* @returns json of AttestationResponse | ||
*/ | ||
@HttpCode(200) | ||
@Post() | ||
async verify(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.verifyEncodedRequest(body.abiEncodedRequest!); | ||
} | ||
|
||
/** | ||
* Tries to verify encoded attestation request without checking message integrity code, and if successful it returns response in abi encoded form. | ||
* @param body | ||
* @returns abi encoded AttestationResponse | ||
*/ | ||
@HttpCode(200) | ||
@Post("verifyFDC") | ||
async verifyFDC(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_ResponseEncoded> { | ||
return this.verifierService.verifyEncodedRequestFDC(body.abiEncodedRequest!); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful it returns response. | ||
* @param prepareResponseBody | ||
* @returns | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareResponse") | ||
async prepareResponse(@Body() body: EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.prepareResponse(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful, it returns the correct message integrity code. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("mic") | ||
async mic(@Body() body: EVMTransaction_RequestNoMic): Promise<MicResponse> { | ||
return this.verifierService.mic(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code. | ||
* If successful, it returns the encoding of the attestation request with the correct message integrity code, which can be directly submitted to the State Connector contract. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareRequest") | ||
async prepareRequest(@Body() body: EVMTransaction_RequestNoMic): Promise<EncodedRequestResponse> { | ||
return this.verifierService.prepareRequest(body); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 7 additions & 65 deletions
72
src/controller/flr/flr-evm-transaction-verifier.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,12 @@ | ||
/////////////////////////////////////////////////////////////// | ||
// THIS IS GENERATED CODE. DO NOT CHANGE THIS FILE MANUALLY .// | ||
/////////////////////////////////////////////////////////////// | ||
|
||
import { Body, Controller, HttpCode, Post, UseGuards } from "@nestjs/common"; | ||
import { ApiSecurity, ApiTags } from "@nestjs/swagger"; | ||
import { ApiKeyAuthGuard } from "../../auth/apikey.guard"; | ||
|
||
import { Controller } from "@nestjs/common"; | ||
import { ApiTags } from "@nestjs/swagger"; | ||
import { FLREVMTransactionVerifierService } from "../../service/flr/flr-evm-transaction-verifier.service"; | ||
import { AttestationResponseDTO_EVMTransaction_Response, EVMTransaction_RequestNoMic } from "../../dto/EVMTransaction.dto"; | ||
import { EncodedRequest, MicResponse, EncodedRequestResponse } from "../../dto/generic.dto"; | ||
import { AttestationResponseDTO_EVMTransaction_ResponseEncoded } from "../../dto/fdcTransactions.dto"; | ||
import { EVMTransactionVerifierControllerBase } from "../evm-transaction-verifier-base.controller"; | ||
|
||
@ApiTags("EVMTransaction") | ||
@ApiTags("EVMTransaction", "FLR") | ||
@Controller("flr/EVMTransaction") | ||
@UseGuards(ApiKeyAuthGuard) | ||
@ApiSecurity("X-API-KEY") | ||
export class FLREVMTransactionVerifierController { | ||
constructor(private readonly verifierService: FLREVMTransactionVerifierService) {} | ||
|
||
/** | ||
* | ||
* Tries to verify encoded attestation request without checking message integrity code, and if successful it returns response. | ||
* @param verifierBody | ||
* @returns | ||
*/ | ||
@HttpCode(200) | ||
@Post() | ||
async verify(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.verifyEncodedRequest(body.abiEncodedRequest!); | ||
} | ||
|
||
@HttpCode(200) | ||
@Post("verifyFDC") | ||
async verifyFDC(@Body() body: EncodedRequest): Promise<AttestationResponseDTO_EVMTransaction_ResponseEncoded> { | ||
return this.verifierService.verifyEncodedRequestFDC(body.abiEncodedRequest!); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful it returns response. | ||
* @param prepareResponseBody | ||
* @returns | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareResponse") | ||
async prepareResponse(@Body() body: EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> { | ||
return this.verifierService.prepareResponse(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code, and if successful, it returns the correct message integrity code. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("mic") | ||
async mic(@Body() body: EVMTransaction_RequestNoMic): Promise<MicResponse> { | ||
return this.verifierService.mic(body); | ||
} | ||
|
||
/** | ||
* Tries to verify attestation request (given in JSON) without checking message integrity code. | ||
* If successful, it returns the encoding of the attestation request with the correct message integrity code, which can be directly submitted to the State Connector contract. | ||
* @param body | ||
*/ | ||
@HttpCode(200) | ||
@Post("prepareRequest") | ||
async prepareRequest(@Body() body: EVMTransaction_RequestNoMic): Promise<EncodedRequestResponse> { | ||
return this.verifierService.prepareRequest(body); | ||
export class FLREVMTransactionVerifierController extends EVMTransactionVerifierControllerBase { | ||
constructor(protected readonly verifierService: FLREVMTransactionVerifierService) { | ||
super(); | ||
} | ||
} |
Oops, something went wrong.