From 7764413cb15da9f7d94089329e7ef4c517af02c2 Mon Sep 17 00:00:00 2001 From: Victor Yanev Date: Mon, 16 Dec 2024 10:09:32 +0200 Subject: [PATCH] chore: prepend 0x to operator address Signed-off-by: Victor Yanev --- packages/relay/src/lib/services/hbarLimitService/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/relay/src/lib/services/hbarLimitService/index.ts b/packages/relay/src/lib/services/hbarLimitService/index.ts index 3c78edfc8c..5cfa957a8c 100644 --- a/packages/relay/src/lib/services/hbarLimitService/index.ts +++ b/packages/relay/src/lib/services/hbarLimitService/index.ts @@ -23,6 +23,7 @@ import { AccountId, Hbar } from '@hashgraph/sdk'; import { Logger } from 'pino'; import { Counter, Gauge, Registry } from 'prom-client'; +import { prepend0x } from '../../../formatters'; import { Utils } from '../../../utils'; import constants from '../../constants'; import { EvmAddressHbarSpendingPlanRepository } from '../../db/repositories/hbarLimiter/evmAddressHbarSpendingPlanRepository'; @@ -101,9 +102,9 @@ export class HbarLimitService implements IHbarLimitService { const operatorId = ConfigService.get('OPERATOR_ID_MAIN'); const operatorKey = ConfigService.get('OPERATOR_KEY_MAIN'); if (operatorId) { - this.operatorAddress = AccountId.fromString(operatorId as string).toSolidityAddress(); + this.setOperatorAddress(AccountId.fromString(operatorId as string).toSolidityAddress()); } else if (operatorKey) { - this.operatorAddress = Utils.createPrivateKeyBasedOnFormat(operatorKey as string).publicKey.toEvmAddress(); + this.setOperatorAddress(Utils.createPrivateKeyBasedOnFormat(operatorKey as string).publicKey.toEvmAddress()); } const totalBudget = HbarLimitService.TIER_LIMITS[SubscriptionTier.OPERATOR]; @@ -176,7 +177,7 @@ export class HbarLimitService implements IHbarLimitService { * @param {string} operatorAddress - The EVM address of the operator. */ setOperatorAddress(operatorAddress: string) { - this.operatorAddress = operatorAddress; + this.operatorAddress = prepend0x(operatorAddress); } /**