Skip to content

Commit

Permalink
fix string comparison for env var
Browse files Browse the repository at this point in the history
  • Loading branch information
zelje committed May 22, 2024
1 parent 09e1f98 commit 9223d50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/service/eth/eth-evm-transaction-verifier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ export class ETHEVMTransactionVerifierService {
async verifyRequestInternal(request: EVMTransaction_Request | EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> {
if (
request.attestationType !== encodeAttestationName("EVMTransaction") ||
request.sourceId !== encodeAttestationName((process.env.TESTNET ? "test" : "") + "ETH")
request.sourceId !== encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "ETH")
) {
throw new HttpException(
{
status: HttpStatus.BAD_REQUEST,
error: `Attestation type and source id combination not supported: (${request.attestationType}, ${
request.sourceId
}). This source supports attestation type 'EVMTransaction' (${encodeAttestationName("EVMTransaction")}) and source id '${
(process.env.TESTNET ? "test" : "") + "ETH"
}' (${encodeAttestationName((process.env.TESTNET ? "test" : "") + "ETH")}).`,
(process.env.TESTNET == "true" ? "test" : "") + "ETH"
}' (${encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "ETH")}).`,
},
HttpStatus.BAD_REQUEST,
);
Expand Down
6 changes: 3 additions & 3 deletions src/service/flr/flr-evm-transaction-verifier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ export class FLREVMTransactionVerifierService {
async verifyRequestInternal(request: EVMTransaction_Request | EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> {
if (
request.attestationType !== encodeAttestationName("EVMTransaction") ||
request.sourceId !== encodeAttestationName((process.env.TESTNET ? "test" : "") + "FLR")
request.sourceId !== encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "FLR")
) {
throw new HttpException(
{
status: HttpStatus.BAD_REQUEST,
error: `Attestation type and source id combination not supported: (${request.attestationType}, ${
request.sourceId
}). This source supports attestation type 'EVMTransaction' (${encodeAttestationName("EVMTransaction")}) and source id '${
(process.env.TESTNET ? "test" : "") + "FLR"
}' (${encodeAttestationName((process.env.TESTNET ? "test" : "") + "FLR")}).`,
(process.env.TESTNET == "true" ? "test" : "") + "FLR"
}' (${encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "FLR")}).`,
},
HttpStatus.BAD_REQUEST,
);
Expand Down
6 changes: 3 additions & 3 deletions src/service/sgb/sgb-evm-transaction-verifier.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ export class SGBEVMTransactionVerifierService {
async verifyRequestInternal(request: EVMTransaction_Request | EVMTransaction_RequestNoMic): Promise<AttestationResponseDTO_EVMTransaction_Response> {
if (
request.attestationType !== encodeAttestationName("EVMTransaction") ||
request.sourceId !== encodeAttestationName((process.env.TESTNET ? "test" : "") + "SGB")
request.sourceId !== encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "SGB")
) {
throw new HttpException(
{
status: HttpStatus.BAD_REQUEST,
error: `Attestation type and source id combination not supported: (${request.attestationType}, ${
request.sourceId
}). This source supports attestation type 'EVMTransaction' (${encodeAttestationName("EVMTransaction")}) and source id '${
(process.env.TESTNET ? "test" : "") + "SGB"
}' (${encodeAttestationName((process.env.TESTNET ? "test" : "") + "SGB")}).`,
(process.env.TESTNET == "true" ? "test" : "") + "SGB"
}' (${encodeAttestationName((process.env.TESTNET == "true" ? "test" : "") + "SGB")}).`,
},
HttpStatus.BAD_REQUEST,
);
Expand Down

0 comments on commit 9223d50

Please sign in to comment.