games_app/backend/dist/safety/networkGuard.d.ts
2026-07-25 22:48:54 +02:00

38 lines
1.6 KiB
TypeScript

/**
* Blockchain network safety guards.
* - Non-production: blocks accidental mainnet usage when testnet is expected.
* - Production: blocks testnet endpoints/contracts so fake test USDT cannot be credited.
*/
/** Official mainnet USDT TRC20 (Tether). */
export declare const MAINNET_USDT_TRC20_CONTRACT = "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t";
/** Shasta testnet USDT TRC20 — must never be used in production. */
export declare const SHASTA_USDT_TRC20_CONTRACT = "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs";
export type NetworkGuardConfig = {
env: string;
networkMode: string;
tronNodeUrl: string;
usdtTrc20Contract: string | null;
};
/**
* Validates production blockchain settings (testable with explicit config).
* @throws When production would use testnet TRON or Shasta USDT contract
*/
export declare function assertProductionMainnetConfig(cfg: NetworkGuardConfig): void;
/**
* Validates that non-production runs use testnet endpoints and contracts.
*
* For the expected testnet setup:
* - TRON: Shasta (TRON_NODE_URL should include "shasta")
* - Asset: USDT TRC20 on Shasta
*
* Skipped in production or when NETWORK_MODE=mainnet.
* @throws When a configured URL or contract points at mainnet while testnet is required
*/
export declare function validateTestnetSafetyOrThrow(): void;
/**
* Validates that production runs use mainnet TRON and never the Shasta USDT contract.
* Skipped when NODE_ENV is not production.
* @throws When TRON_NODE_URL or USDT_TRC20_CONTRACT targets testnet
*/
export declare function validateProductionMainnetOrThrow(): void;
//# sourceMappingURL=networkGuard.d.ts.map