Initial commit with 🏗️ create-eth @ 2.0.4

This commit is contained in:
han
2026-01-23 20:20:58 +07:00
commit b330aba2b4
185 changed files with 36981 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import { getConfig } from "../utils";
export const getRandomPrice = async (nodeAddress: string, currentPrice: number): Promise<number> => {
const config = getConfig();
const nodeConfig = config.NODE_CONFIGS[nodeAddress] || config.NODE_CONFIGS.default;
// Calculate variance range based on the node's PRICE_VARIANCE
// PRICE_VARIANCE of 0 means no variance, higher values mean wider range
const varianceRange = Math.floor(currentPrice * nodeConfig.PRICE_VARIANCE);
// Apply variance to the base price
const finalPrice = currentPrice + (Math.random() * 2 - 1) * varianceRange;
// Round to nearest integer
return Math.round(finalPrice);
};