@t402/smart-router 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pricing/types.ts","../src/pricing/gas.ts","../src/pricing/fees.ts"],"sourcesContent":["import { z } from 'zod';\nimport { ChainId, AssetId, ProtocolId } from '../routing/types.js';\n\n/**\n * Gas price data\n */\nexport const GasPrice = z.object({\n chain: ChainId,\n // Price in native token (wei for EVM)\n slow: z.string(),\n standard: z.string(),\n fast: z.string(),\n instant: z.string(),\n // EIP-1559 fields (for supported chains)\n baseFee: z.string().optional(),\n priorityFee: z.object({\n slow: z.string(),\n standard: z.string(),\n fast: z.string(),\n instant: z.string(),\n }).optional(),\n // Native token price in USD\n nativeTokenPriceUsd: z.string(),\n // Block info\n lastBlock: z.number(),\n timestamp: z.number(),\n});\nexport type GasPrice = z.infer<typeof GasPrice>;\n\n/**\n * Token price data\n */\nexport const TokenPrice = z.object({\n chain: ChainId,\n asset: AssetId,\n priceUsd: z.string(),\n price24hChange: z.string().optional(),\n volume24h: z.string().optional(),\n source: z.string(), // Price oracle source\n timestamp: z.number(),\n confidence: z.number().min(0).max(100),\n});\nexport type TokenPrice = z.infer<typeof TokenPrice>;\n\n/**\n * Protocol fee structure\n */\nexport const ProtocolFees = z.object({\n protocol: ProtocolId,\n chain: ChainId,\n // Fee types\n swapFee: z.string().optional(), // Percentage (e.g., \"0.3\" for 0.3%)\n bridgeFee: z.object({\n percentage: z.string(),\n minimum: z.string(),\n maximum: z.string().optional(),\n }).optional(),\n // Gas estimates for different operations\n gasEstimates: z.record(z.string(), z.string()), // Operation -> gas units\n timestamp: z.number(),\n});\nexport type ProtocolFees = z.infer<typeof ProtocolFees>;\n\n/**\n * Bridge quote\n */\nexport const BridgeQuote = z.object({\n bridge: ProtocolId,\n sourceChain: ChainId,\n destinationChain: ChainId,\n sourceAsset: AssetId,\n destinationAsset: AssetId,\n inputAmount: z.string(),\n outputAmount: z.string(),\n fee: z.string(),\n feeUsd: z.string(),\n estimatedTime: z.number(), // Seconds\n confidence: z.number().min(0).max(100),\n expiresAt: z.number(),\n});\nexport type BridgeQuote = z.infer<typeof BridgeQuote>;\n\n/**\n * Swap quote\n */\nexport const SwapQuote = z.object({\n dex: ProtocolId,\n chain: ChainId,\n inputAsset: AssetId,\n outputAsset: AssetId,\n inputAmount: z.string(),\n outputAmount: z.string(),\n minOutputAmount: z.string(),\n priceImpact: z.string(),\n fee: z.string(),\n feeUsd: z.string(),\n route: z.array(AssetId), // Token path\n estimatedGas: z.string(),\n expiresAt: z.number(),\n});\nexport type SwapQuote = z.infer<typeof SwapQuote>;\n\n/**\n * Fee estimation request\n */\nexport const FeeEstimateRequest = z.object({\n chain: ChainId,\n operation: z.enum(['transfer', 'swap', 'bridge', 'approve', 'wrap', 'unwrap']),\n protocol: ProtocolId.optional(),\n inputAsset: AssetId,\n outputAsset: AssetId.optional(),\n amount: z.string(),\n gasSpeed: z.enum(['slow', 'standard', 'fast', 'instant']).default('standard'),\n});\nexport type FeeEstimateRequest = z.infer<typeof FeeEstimateRequest>;\n\n/**\n * Fee estimation result\n */\nexport const FeeEstimate = z.object({\n // Gas\n gasUnits: z.string(),\n gasPriceWei: z.string(),\n gasCostNative: z.string(),\n gasCostUsd: z.string(),\n // Protocol fees\n protocolFee: z.string(),\n protocolFeeUsd: z.string(),\n // Total\n totalFeeUsd: z.string(),\n // Metadata\n confidence: z.number().min(0).max(100),\n breakdown: z.array(z.object({\n type: z.string(),\n amount: z.string(),\n amountUsd: z.string(),\n })),\n});\nexport type FeeEstimate = z.infer<typeof FeeEstimate>;\n\n/**\n * Price prediction (for ML-based forecasting)\n */\nexport const PricePrediction = z.object({\n chain: ChainId,\n asset: AssetId.optional(), // If not provided, predicts gas price\n currentPrice: z.string(),\n predictions: z.array(z.object({\n timestamp: z.number(),\n predictedPrice: z.string(),\n confidence: z.number(),\n lowerBound: z.string(),\n upperBound: z.string(),\n })),\n model: z.string(),\n lastUpdated: z.number(),\n});\nexport type PricePrediction = z.infer<typeof PricePrediction>;\n","import { GasPrice, PricePrediction } from './types.js';\nimport { ChainId } from '../routing/types.js';\n\n/**\n * Gas oracle configuration\n */\nexport interface GasOracleConfig {\n cacheTtl?: number; // ms\n refreshInterval?: number; // ms\n enablePrediction?: boolean;\n}\n\n/**\n * Gas data provider interface\n */\nexport interface IGasProvider {\n getGasPrice(chain: ChainId): Promise<GasPrice>;\n supportedChains(): ChainId[];\n}\n\n/**\n * Gas oracle for multi-chain gas price tracking\n */\nexport class GasOracle {\n private providers: Map<ChainId, IGasProvider> = new Map();\n private cache: Map<ChainId, { data: GasPrice; expiresAt: number }> = new Map();\n private config: Required<GasOracleConfig>;\n private history: Map<ChainId, GasPrice[]> = new Map();\n private maxHistorySize = 100;\n\n constructor(config: GasOracleConfig = {}) {\n this.config = {\n cacheTtl: config.cacheTtl ?? 15000, // 15 seconds\n refreshInterval: config.refreshInterval ?? 12000, // 12 seconds (block time)\n enablePrediction: config.enablePrediction ?? true,\n };\n }\n\n /**\n * Register a gas provider for a chain\n */\n registerProvider(chain: ChainId, provider: IGasProvider): void {\n this.providers.set(chain, provider);\n }\n\n /**\n * Get current gas price for a chain\n */\n async getGasPrice(chain: ChainId): Promise<GasPrice> {\n // Check cache\n const cached = this.cache.get(chain);\n if (cached && cached.expiresAt > Date.now()) {\n return cached.data;\n }\n\n // Get from provider or use mock\n const provider = this.providers.get(chain);\n let gasPrice: GasPrice;\n\n if (provider) {\n gasPrice = await provider.getGasPrice(chain);\n } else {\n gasPrice = this.getMockGasPrice(chain);\n }\n\n // Update cache and history\n this.cache.set(chain, {\n data: gasPrice,\n expiresAt: Date.now() + this.config.cacheTtl,\n });\n\n this.addToHistory(chain, gasPrice);\n\n return gasPrice;\n }\n\n /**\n * Get gas prices for multiple chains\n */\n async getMultiChainGasPrices(chains: ChainId[]): Promise<Map<ChainId, GasPrice>> {\n const results = new Map<ChainId, GasPrice>();\n\n await Promise.all(\n chains.map(async chain => {\n try {\n const price = await this.getGasPrice(chain);\n results.set(chain, price);\n } catch {\n // Skip failed chains\n }\n }),\n );\n\n return results;\n }\n\n /**\n * Calculate gas cost in USD\n */\n async calculateGasCostUsd(\n chain: ChainId,\n gasUnits: string,\n speed: 'slow' | 'standard' | 'fast' | 'instant' = 'standard',\n ): Promise<{ costNative: string; costUsd: string }> {\n const gasPrice = await this.getGasPrice(chain);\n const priceWei = BigInt(gasPrice[speed]);\n const units = BigInt(gasUnits);\n\n const costNative = (priceWei * units).toString();\n const nativePrice = parseFloat(gasPrice.nativeTokenPriceUsd);\n const costUsd = (Number(costNative) * nativePrice / 1e18).toFixed(6);\n\n return { costNative, costUsd };\n }\n\n /**\n * Predict future gas prices (simple moving average)\n */\n predictGasPrice(chain: ChainId, horizonMinutes: number = 5): PricePrediction | null {\n if (!this.config.enablePrediction) {\n return null;\n }\n\n const history = this.history.get(chain);\n if (!history || history.length < 5) {\n return null;\n }\n\n const currentPrice = history[history.length - 1];\n const recentPrices = history.slice(-20).map(h => BigInt(h.standard));\n\n // Simple moving average prediction\n const sum = recentPrices.reduce((a, b) => a + b, 0n);\n const avg = sum / BigInt(recentPrices.length);\n\n // Calculate variance for confidence intervals\n const variance = recentPrices.reduce(\n (acc, p) => acc + (p - avg) * (p - avg),\n 0n,\n ) / BigInt(recentPrices.length);\n\n const stdDev = BigInt(Math.floor(Math.sqrt(Number(variance))));\n\n // Generate predictions at different intervals\n const predictions: PricePrediction['predictions'] = [];\n const intervals = [1, 2, 5, 10, 15]; // minutes\n\n for (const mins of intervals) {\n if (mins > horizonMinutes) break;\n\n // Simple mean reversion model\n const decay = 0.9 ** mins;\n const predicted = avg + BigInt(Math.floor(Number(BigInt(currentPrice.standard) - avg) * decay));\n\n predictions.push({\n timestamp: Date.now() + mins * 60 * 1000,\n predictedPrice: predicted.toString(),\n confidence: Math.max(50, 95 - mins * 5),\n lowerBound: (predicted - stdDev * 2n).toString(),\n upperBound: (predicted + stdDev * 2n).toString(),\n });\n }\n\n return {\n chain,\n currentPrice: currentPrice.standard,\n predictions,\n model: 'simple_moving_average',\n lastUpdated: Date.now(),\n };\n }\n\n /**\n * Get recommended gas price based on urgency\n */\n async getRecommendedGasPrice(\n chain: ChainId,\n urgency: 'low' | 'medium' | 'high' | 'critical',\n ): Promise<{ price: string; estimatedTime: number }> {\n const gasPrice = await this.getGasPrice(chain);\n\n const mapping: Record<typeof urgency, { speed: keyof GasPrice; time: number }> = {\n low: { speed: 'slow', time: 300 },\n medium: { speed: 'standard', time: 60 },\n high: { speed: 'fast', time: 15 },\n critical: { speed: 'instant', time: 5 },\n };\n\n const { speed, time } = mapping[urgency];\n return {\n price: gasPrice[speed] as string,\n estimatedTime: time,\n };\n }\n\n /**\n * Get gas history for a chain\n */\n getHistory(chain: ChainId): GasPrice[] {\n return this.history.get(chain) ?? [];\n }\n\n /**\n * Clear cache\n */\n clearCache(): void {\n this.cache.clear();\n }\n\n private addToHistory(chain: ChainId, price: GasPrice): void {\n if (!this.history.has(chain)) {\n this.history.set(chain, []);\n }\n\n const history = this.history.get(chain)!;\n history.push(price);\n\n // Trim to max size\n if (history.length > this.maxHistorySize) {\n history.shift();\n }\n }\n\n private getMockGasPrice(chain: ChainId): GasPrice {\n // Default gas prices for different chains (mock data)\n const defaults: Record<string, Partial<GasPrice>> = {\n 'eip155:1': { // Ethereum\n slow: '15000000000', // 15 gwei\n standard: '25000000000', // 25 gwei\n fast: '40000000000', // 40 gwei\n instant: '60000000000', // 60 gwei\n nativeTokenPriceUsd: '2500',\n baseFee: '20000000000',\n priorityFee: {\n slow: '1000000000',\n standard: '2000000000',\n fast: '5000000000',\n instant: '10000000000',\n },\n },\n 'eip155:8453': { // Base\n slow: '100000000', // 0.1 gwei\n standard: '150000000', // 0.15 gwei\n fast: '250000000', // 0.25 gwei\n instant: '500000000', // 0.5 gwei\n nativeTokenPriceUsd: '2500',\n },\n 'eip155:42161': { // Arbitrum\n slow: '10000000', // 0.01 gwei\n standard: '100000000', // 0.1 gwei\n fast: '200000000', // 0.2 gwei\n instant: '500000000', // 0.5 gwei\n nativeTokenPriceUsd: '2500',\n },\n 'eip155:137': { // Polygon\n slow: '30000000000', // 30 gwei\n standard: '50000000000', // 50 gwei\n fast: '80000000000', // 80 gwei\n instant: '150000000000', // 150 gwei\n nativeTokenPriceUsd: '0.5',\n },\n 'solana:mainnet': {\n slow: '5000', // 5000 lamports\n standard: '10000', // 10000 lamports\n fast: '25000', // 25000 lamports\n instant: '50000', // 50000 lamports\n nativeTokenPriceUsd: '150',\n },\n };\n\n const chainDefault = defaults[chain] ?? {\n slow: '1000000000',\n standard: '2000000000',\n fast: '5000000000',\n instant: '10000000000',\n nativeTokenPriceUsd: '1',\n };\n\n return {\n chain,\n slow: chainDefault.slow!,\n standard: chainDefault.standard!,\n fast: chainDefault.fast!,\n instant: chainDefault.instant!,\n nativeTokenPriceUsd: chainDefault.nativeTokenPriceUsd!,\n baseFee: chainDefault.baseFee,\n priorityFee: chainDefault.priorityFee,\n lastBlock: 0,\n timestamp: Date.now(),\n };\n }\n}\n\n/**\n * Mock gas provider for testing\n */\nexport class MockGasProvider implements IGasProvider {\n private chains: ChainId[];\n private volatility: number;\n\n constructor(chains: ChainId[], volatility: number = 0.1) {\n this.chains = chains;\n this.volatility = volatility;\n }\n\n async getGasPrice(chain: ChainId): Promise<GasPrice> {\n // Add some random variance\n const variance = 1 + (Math.random() - 0.5) * this.volatility;\n\n const basePrice = 1000000000n; // 1 gwei\n const adjusted = BigInt(Math.floor(Number(basePrice) * variance));\n\n return {\n chain,\n slow: adjusted.toString(),\n standard: (adjusted * 2n).toString(),\n fast: (adjusted * 4n).toString(),\n instant: (adjusted * 8n).toString(),\n nativeTokenPriceUsd: '2500',\n lastBlock: Math.floor(Math.random() * 1000000),\n timestamp: Date.now(),\n };\n }\n\n supportedChains(): ChainId[] {\n return this.chains;\n }\n}\n","import {\n FeeEstimate,\n FeeEstimateRequest,\n ProtocolFees,\n TokenPrice,\n BridgeQuote,\n SwapQuote,\n} from './types.js';\nimport { GasOracle } from './gas.js';\nimport { ChainId, AssetId, ProtocolId } from '../routing/types.js';\n\n/**\n * Fee estimator configuration\n */\nexport interface FeeEstimatorConfig {\n defaultSlippage?: string;\n cacheTtl?: number;\n}\n\n/**\n * Fee estimator for calculating total transaction costs\n */\nexport class FeeEstimator {\n private gasOracle: GasOracle;\n private protocolFees: Map<string, ProtocolFees> = new Map();\n private tokenPrices: Map<string, TokenPrice> = new Map();\n private config: Required<FeeEstimatorConfig>;\n\n // Default gas estimates for different operations\n private readonly GAS_ESTIMATES: Record<string, string> = {\n transfer: '65000',\n approve: '46000',\n swap_simple: '150000',\n swap_complex: '300000',\n bridge: '200000',\n wrap: '45000',\n unwrap: '45000',\n deposit: '100000',\n withdraw: '100000',\n };\n\n constructor(gasOracle: GasOracle, config: FeeEstimatorConfig = {}) {\n this.gasOracle = gasOracle;\n this.config = {\n defaultSlippage: config.defaultSlippage ?? '0.5',\n cacheTtl: config.cacheTtl ?? 60000,\n };\n }\n\n /**\n * Estimate fees for an operation\n */\n async estimateFees(request: FeeEstimateRequest): Promise<FeeEstimate> {\n const parsedRequest = FeeEstimateRequest.parse(request);\n\n // Get gas estimate\n const gasUnits = this.getGasEstimate(\n parsedRequest.operation,\n parsedRequest.protocol,\n );\n\n // Calculate gas cost\n const { costNative, costUsd: gasCostUsd } = await this.gasOracle.calculateGasCostUsd(\n parsedRequest.chain,\n gasUnits,\n parsedRequest.gasSpeed,\n );\n\n // Calculate protocol fees\n const { fee: protocolFee, feeUsd: protocolFeeUsd } = await this.calculateProtocolFee(\n parsedRequest.chain,\n parsedRequest.protocol,\n parsedRequest.operation,\n parsedRequest.amount,\n );\n\n // Calculate total\n const totalFeeUsd = (parseFloat(gasCostUsd) + parseFloat(protocolFeeUsd)).toFixed(6);\n\n // Build breakdown\n const breakdown: FeeEstimate['breakdown'] = [\n { type: 'gas', amount: costNative, amountUsd: gasCostUsd },\n ];\n\n if (parseFloat(protocolFee) > 0) {\n breakdown.push({ type: 'protocol', amount: protocolFee, amountUsd: protocolFeeUsd });\n }\n\n return {\n gasUnits,\n gasPriceWei: (await this.gasOracle.getGasPrice(parsedRequest.chain))[parsedRequest.gasSpeed],\n gasCostNative: costNative,\n gasCostUsd,\n protocolFee,\n protocolFeeUsd,\n totalFeeUsd,\n confidence: 85, // Base confidence\n breakdown,\n };\n }\n\n /**\n * Estimate total route fees\n */\n async estimateRouteFees(\n steps: Array<{\n chain: ChainId;\n operation: string;\n protocol?: ProtocolId;\n amount: string;\n inputAsset: AssetId;\n outputAsset?: AssetId;\n }>,\n gasSpeed: 'slow' | 'standard' | 'fast' | 'instant' = 'standard',\n ): Promise<{\n totalGasUsd: string;\n totalProtocolFeesUsd: string;\n totalFeesUsd: string;\n stepEstimates: FeeEstimate[];\n }> {\n const stepEstimates: FeeEstimate[] = [];\n let totalGasUsd = 0;\n let totalProtocolFeesUsd = 0;\n\n for (const step of steps) {\n const estimate = await this.estimateFees({\n chain: step.chain,\n operation: step.operation as FeeEstimateRequest['operation'],\n protocol: step.protocol,\n inputAsset: step.inputAsset,\n outputAsset: step.outputAsset,\n amount: step.amount,\n gasSpeed,\n });\n\n stepEstimates.push(estimate);\n totalGasUsd += parseFloat(estimate.gasCostUsd);\n totalProtocolFeesUsd += parseFloat(estimate.protocolFeeUsd);\n }\n\n return {\n totalGasUsd: totalGasUsd.toFixed(6),\n totalProtocolFeesUsd: totalProtocolFeesUsd.toFixed(6),\n totalFeesUsd: (totalGasUsd + totalProtocolFeesUsd).toFixed(6),\n stepEstimates,\n };\n }\n\n /**\n * Get a swap quote\n */\n async getSwapQuote(\n chain: ChainId,\n dex: ProtocolId,\n inputAsset: AssetId,\n outputAsset: AssetId,\n inputAmount: string,\n slippage?: string,\n ): Promise<SwapQuote> {\n const slippagePercent = parseFloat(slippage ?? this.config.defaultSlippage) / 100;\n\n // Get prices\n const inputPrice = await this.getTokenPrice(chain, inputAsset);\n const outputPrice = await this.getTokenPrice(chain, outputAsset);\n\n // Calculate expected output (simplified)\n const inputValueUsd = parseFloat(inputAmount) * parseFloat(inputPrice.priceUsd);\n const feePercent = this.getProtocolFeePercent(dex);\n const outputValueUsd = inputValueUsd * (1 - feePercent);\n const outputAmount = (outputValueUsd / parseFloat(outputPrice.priceUsd)).toString();\n const minOutput = (parseFloat(outputAmount) * (1 - slippagePercent)).toFixed(0);\n\n // Calculate price impact (simplified)\n const priceImpact = (feePercent * 100).toFixed(4);\n\n // Estimate gas\n const gasEstimate = this.GAS_ESTIMATES.swap_simple;\n await this.gasOracle.calculateGasCostUsd(chain, gasEstimate);\n\n return {\n dex,\n chain,\n inputAsset,\n outputAsset,\n inputAmount,\n outputAmount,\n minOutputAmount: minOutput,\n priceImpact,\n fee: (parseFloat(inputAmount) * feePercent).toFixed(0),\n feeUsd: (inputValueUsd * feePercent).toFixed(6),\n route: [inputAsset, outputAsset],\n estimatedGas: gasEstimate,\n expiresAt: Date.now() + 60000,\n };\n }\n\n /**\n * Get a bridge quote\n */\n async getBridgeQuote(\n bridge: ProtocolId,\n sourceChain: ChainId,\n destinationChain: ChainId,\n sourceAsset: AssetId,\n destinationAsset: AssetId,\n inputAmount: string,\n ): Promise<BridgeQuote> {\n // Get bridge fees\n const feePercent = 0.001; // 0.1%\n const minFee = 100000; // 0.1 USDT\n\n const fee = Math.max(\n minFee,\n Math.floor(parseFloat(inputAmount) * feePercent),\n );\n\n const outputAmount = (parseFloat(inputAmount) - fee).toFixed(0);\n\n // Get USD value\n const tokenPrice = await this.getTokenPrice(sourceChain, sourceAsset);\n const feeUsd = (fee * parseFloat(tokenPrice.priceUsd) / 1e6).toFixed(6);\n\n // Estimate time based on bridge type\n const estimatedTime = this.getBridgeEstimatedTime(bridge, sourceChain, destinationChain);\n\n return {\n bridge,\n sourceChain,\n destinationChain,\n sourceAsset,\n destinationAsset,\n inputAmount,\n outputAmount,\n fee: fee.toString(),\n feeUsd,\n estimatedTime,\n confidence: 90,\n expiresAt: Date.now() + 120000,\n };\n }\n\n /**\n * Register protocol fee structure\n */\n registerProtocolFees(fees: ProtocolFees): void {\n const key = `${fees.protocol}:${fees.chain}`;\n this.protocolFees.set(key, fees);\n }\n\n /**\n * Update token price\n */\n updateTokenPrice(price: TokenPrice): void {\n const key = `${price.chain}:${price.asset}`;\n this.tokenPrices.set(key, price);\n }\n\n private getGasEstimate(\n operation: string,\n _protocol?: ProtocolId,\n ): string {\n const key = operation.toLowerCase();\n return this.GAS_ESTIMATES[key] ?? this.GAS_ESTIMATES.transfer;\n }\n\n private async calculateProtocolFee(\n _chain: ChainId,\n protocol: ProtocolId | undefined,\n operation: string,\n amount: string,\n ): Promise<{ fee: string; feeUsd: string }> {\n if (!protocol) {\n return { fee: '0', feeUsd: '0' };\n }\n\n const feePercent = this.getProtocolFeePercent(protocol);\n\n if (operation === 'transfer' || operation === 'approve') {\n return { fee: '0', feeUsd: '0' };\n }\n\n const fee = Math.floor(parseFloat(amount) * feePercent);\n\n // Simplified USD conversion (assumes stablecoin)\n const feeUsd = (fee / 1e6).toFixed(6);\n\n return { fee: fee.toString(), feeUsd };\n }\n\n private getProtocolFeePercent(protocol: ProtocolId): number {\n // Default fee percentages for known protocols\n const fees: Record<string, number> = {\n uniswap: 0.003,\n sushiswap: 0.003,\n curve: 0.0004,\n balancer: 0.002,\n '1inch': 0,\n paraswap: 0,\n layerzero: 0.001,\n wormhole: 0.001,\n stargate: 0.0006,\n };\n\n return fees[protocol.toLowerCase()] ?? 0.003;\n }\n\n private async getTokenPrice(chain: ChainId, asset: AssetId): Promise<TokenPrice> {\n const key = `${chain}:${asset}`;\n const cached = this.tokenPrices.get(key);\n\n if (cached && cached.timestamp > Date.now() - this.config.cacheTtl) {\n return cached;\n }\n\n // Return mock price for stablecoins\n const isStablecoin = asset.toLowerCase().includes('usdt') ||\n asset.toLowerCase().includes('usdc') ||\n asset.toLowerCase().includes('dai');\n\n const price: TokenPrice = {\n chain,\n asset,\n priceUsd: isStablecoin ? '1.0' : '1.0',\n source: 'mock',\n timestamp: Date.now(),\n confidence: 95,\n };\n\n this.tokenPrices.set(key, price);\n return price;\n }\n\n private getBridgeEstimatedTime(\n bridge: ProtocolId,\n sourceChain: ChainId,\n destinationChain: ChainId,\n ): number {\n // Estimated times in seconds\n const bridgeTimes: Record<string, number> = {\n layerzero: 60,\n wormhole: 120,\n stargate: 30,\n hop: 300,\n across: 60,\n celer: 600,\n multichain: 600,\n };\n\n let baseTime = bridgeTimes[bridge.toLowerCase()] ?? 300;\n\n // Add time based on chain\n if (sourceChain.includes('eip155:1') || destinationChain.includes('eip155:1')) {\n baseTime += 120; // Ethereum mainnet is slower\n }\n\n return baseTime;\n }\n}\n\n/**\n * Calculate slippage-adjusted output\n */\nexport function calculateMinOutput(\n amount: string,\n slippagePercent: string,\n): string {\n const slippage = parseFloat(slippagePercent) / 100;\n const minOutput = BigInt(amount) * BigInt(Math.floor((1 - slippage) * 10000)) / 10000n;\n return minOutput.toString();\n}\n\n/**\n * Calculate price impact from liquidity\n */\nexport function calculatePriceImpact(\n amount: string,\n liquidity: string,\n): string {\n if (BigInt(liquidity) === 0n) {\n return '100';\n }\n\n const impact = (Number(BigInt(amount) * 10000n / BigInt(liquidity)) / 100);\n return impact.toFixed(4);\n}\n"],"mappings":";;;;;;;AAAA,SAAS,SAAS;AAMX,IAAM,WAAW,EAAE,OAAO;AAAA,EAC/B,OAAO;AAAA;AAAA,EAEP,MAAM,EAAE,OAAO;AAAA,EACf,UAAU,EAAE,OAAO;AAAA,EACnB,MAAM,EAAE,OAAO;AAAA,EACf,SAAS,EAAE,OAAO;AAAA;AAAA,EAElB,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO;AAAA,IACpB,MAAM,EAAE,OAAO;AAAA,IACf,UAAU,EAAE,OAAO;AAAA,IACnB,MAAM,EAAE,OAAO;AAAA,IACf,SAAS,EAAE,OAAO;AAAA,EACpB,CAAC,EAAE,SAAS;AAAA;AAAA,EAEZ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