//#region extensions/crypto/src/services/gas-estimator.d.ts /** * Gas Estimation Service — real-time gas prices, cost estimation, and * gas-inclusive swap comparison. * * Provides: * - Multi-chain gas price tracking (fast/standard/slow) * - Transaction cost estimation in USD * - Gas-inclusive swap comparison (net output = output - gas cost) * - EIP-1559 priority fee estimation * - Historical gas trend tracking * * Uses on-chain RPC calls for accurate data, not third-party gas APIs. */ interface GasPrice { /** Base fee in gwei. */ baseFee: number; /** Slow priority fee in gwei (10th percentile). */ slow: number; /** Standard priority fee in gwei (50th percentile). */ standard: number; /** Fast priority fee in gwei (90th percentile). */ fast: number; /** Total gas price for slow/standard/fast (baseFee + priority). */ totalSlow: number; totalStandard: number; totalFast: number; /** Chain native token price in USD. */ nativeTokenPriceUsd: number; chain: string; chainId: number; timestamp: number; } interface GasCostEstimate { /** Gas units for this operation. */ gasUnits: number; /** Cost at slow speed in USD. */ costSlowUsd: number; /** Cost at standard speed in USD. */ costStandardUsd: number; /** Cost at fast speed in USD. */ costFastUsd: number; /** Cost in native token (standard speed). */ costNativeToken: number; operation: string; } interface SwapComparison { aggregator: string; outputAmount: string; outputValueUsd: number; gasCostUsd: number; netOutputUsd: number; rank: number; } interface GasEstimatorConfig { /** Number of recent blocks to sample for priority fees. Default: 5. */ blockSamples?: number; /** Cache TTL for gas prices in ms. Default: 12000 (12s, ~1 block). */ cacheTtlMs?: number; } /** Typical gas limits for common EVM operations. */ declare const GAS_LIMITS: Record; declare class GasEstimator { private config; private cache; constructor(config?: GasEstimatorConfig); /** * Get current gas prices for a chain (with caching). * Uses EIP-1559 fee history for accurate priority fee estimation. */ getGasPrice(chainId?: number): Promise; /** * Estimate the gas cost for a specific operation in USD. */ estimateCost(operation: keyof typeof GAS_LIMITS | number, chainId?: number): Promise; /** * Compare swap quotes with gas costs factored in. * Takes raw aggregator quotes and produces a gas-inclusive ranking. */ compareSwapsGasInclusive(quotes: Array<{ aggregator: string; buyAmount: string; buyTokenPriceUsd: number; buyTokenDecimals: number; gasEstimate?: string; }>, chainId?: number): Promise; /** * Get gas cost estimates for common operations on a chain. * Useful for the `/gas` command or a setup screen. */ getCommonCosts(chainId?: number): Promise<{ gasPrice: GasPrice; costs: GasCostEstimate[]; }>; /** Clear the gas price cache. */ clearCache(): void; private averageReward; private getNativeTokenPrice; } declare function getGasEstimator(config?: GasEstimatorConfig): GasEstimator; declare function resetGasEstimator(): void; //#endregion export { GAS_LIMITS, GasCostEstimate, GasEstimator, GasEstimatorConfig, GasPrice, SwapComparison, getGasEstimator, resetGasEstimator }; //# sourceMappingURL=gas-estimator.d.mts.map