From 3b013d3ba0f528a8489e124856abdeab94c01bb7 Mon Sep 17 00:00:00 2001 From: Noloquideus Date: Fri, 1 May 2026 20:38:06 +0300 Subject: [PATCH] feat: update settings for vault --- src/config.ts | 3 ++- src/secrets/VaultClient.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/config.ts b/src/config.ts index c5e56b7..8b544ec 100644 --- a/src/config.ts +++ b/src/config.ts @@ -2,6 +2,7 @@ import {parseUsdtAmount} from './domain/amount.js'; import type {EthereumSecret} from './secrets/VaultClient.js'; export const MAINNET_USDT_CONTRACT = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; +export const ETH_RPC_URL = 'https://ethereum-rpc.publicnode.com'; export interface AppConfig { port: number; @@ -22,7 +23,7 @@ export interface AppConfig { export function loadConfig(env: NodeJS.ProcessEnv = process.env): AppConfig { return { port: readInteger(env.PORT, 3000), - ethRpcUrl: env.ETH_RPC_URL, + ethRpcUrl: env.ETH_RPC_URL ?? ETH_RPC_URL, hotWalletPrivateKey: readOptionalPlaceholder(env.HOT_WALLET_PRIVATE_KEY, '0xYOUR_PRIVATE_KEY'), usdtContractAddress: env.USDT_CONTRACT_ADDRESS ?? MAINNET_USDT_CONTRACT, maxTransferAmountUnits: parseUsdtAmount(env.MAX_TRANSFER_USDT ?? '1000'), diff --git a/src/secrets/VaultClient.ts b/src/secrets/VaultClient.ts index b72eaac..63b9076 100644 --- a/src/secrets/VaultClient.ts +++ b/src/secrets/VaultClient.ts @@ -55,7 +55,7 @@ export class VaultClient { const [database, rabbitmq, ethereum] = await Promise.all([ this.readSecret('database'), this.readSecret('rabbitmq'), - this.readOptionalSecret('ethereum') + this.readOptionalSecret('crypto') ]); return { @@ -103,7 +103,7 @@ export class VaultClient { try { return await this.readSecret(path); } catch (error) { - if (error instanceof Error && error.message.includes('HTTP 404')) { + if (error instanceof Error && (error.message.includes('HTTP 404') || error.message.includes('HTTP 403'))) { return null; } throw error; @@ -152,8 +152,10 @@ function parseRabbitMqSecret(raw: Record): RabbitMqSecret { function parseEthereumSecret(raw: Record): EthereumSecret { return { rpcUrl: optionalString(raw, 'rpc_url', 'ethereum'), - hotWalletPrivateKey: optionalString(raw, 'hot_wallet_private_key', 'ethereum'), - usdtContractAddress: optionalString(raw, 'usdt_contract_address', 'ethereum') + hotWalletPrivateKey: optionalString(raw, 'hot_wallet_private_key', 'crypto'), + usdtContractAddress: + optionalString(raw, 'usdt_contract_address', 'crypto') ?? + optionalString(raw, 'usdt_contract_addres', 'crypto') }; }