import { E as EVMClient, a as EVMClientConfig } from '../../EVMClient-Bmy9czkE.mjs'; import '../../types.mjs'; import 'ethers'; import '../../types-DP2CQT8p.mjs'; /** * Veridex Protocol SDK — Avalanche Chain Client * * Extends the standard EVMClient with Avalanche-native capabilities: * - ACP-204 precompile detection (native secp256r1 at 0x0100, 6,900 gas) * - ICM / Teleporter routing awareness for intra-Avalanche L1 messaging * - Chainlink AVAX/USD price feeds for USD-denominated session limits * * @example * ```typescript * import { AvalancheClient } from '@veridex/sdk/chains/avalanche'; * * const client = new AvalancheClient({ * chainId: 43113, * wormholeChainId: 6, * rpcUrl: 'https://api.avax-test.network/ext/bc/C/rpc', * hubContractAddress: '0x...', * wormholeCoreBridge: '0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C', * }); * * // Check ACP-204 precompile * const available = await client.isACP204Available(); * * // Get AVAX price for budget calculations * const price = await client.getAvaxPriceUSD(); * ``` */ interface AvalancheClientConfig extends EVMClientConfig { /** ACP-204 P256 verifier wrapper contract address */ p256VerifierAddress?: string; /** ICM Spoke contract address for cross-L1 session bridging */ icmSpokeAddress?: string; /** Chainlink AVAX/USD price feed address */ chainlinkAvaxUsdFeed?: string; /** Chainlink USDC/USD price feed address */ chainlinkUsdcUsdFeed?: string; /** Chainlink USDT/USD price feed address */ chainlinkUsdtUsdFeed?: string; } /** * Avalanche-specific SDK chain client. * * Wraps the standard EVMClient and adds: * - ACP-204 precompile availability checks * - Chainlink AVAX/USD price queries (for USD-denominated budgets) * - ICM Spoke queries (cross-L1 session verification) * - ICM-aware message routing (Teleporter for intra-Avalanche, Wormhole for cross-ecosystem) */ declare class AvalancheClient extends EVMClient { private avaxProvider; private p256VerifierAddress; private icmSpokeAddress; private chainlinkAvaxUsdFeed; private chainlinkUsdcUsdFeed; private chainlinkUsdtUsdFeed; private priceCache; private readonly CACHE_TTL_MS; constructor(config: AvalancheClientConfig); /** * Check if the ACP-204 secp256r1 precompile is live on this chain. * Returns true on Avalanche C-Chain (mainnet + Fuji), false elsewhere. */ isACP204Available(): Promise; /** * Get the estimated gas cost (in wei) for a single P-256 verification. * Deterministic on Avalanche: 6,900 gas for precompile + ~300 staticcall overhead. */ estimatePasskeyVerificationGas(): Promise; /** * Get estimated USD cost for a passkey verification. */ estimatePasskeyVerificationCostUSD(): Promise; /** * Get current AVAX/USD price from Chainlink. * Cached for 30 seconds to avoid excessive RPC calls. */ getAvaxPriceUSD(): Promise; /** * Get USDC/USD price (for stablecoin verification). */ getUsdcPriceUSD(): Promise; /** * Get USDT/USD price. */ getUsdtPriceUSD(): Promise; /** * Convert a USD amount to AVAX wei using live Chainlink prices. */ convertUsdToAvax(usdAmount: number): Promise; /** * Convert AVAX wei to USD using live Chainlink prices. */ convertAvaxToUsd(avaxWei: bigint): Promise; /** * Verify a session is valid on the ICM Spoke (cross-L1 verification). */ verifyICMSession(sessionKeyHash: string, amount: bigint): Promise<{ valid: boolean; remainingBudget: bigint; }>; /** * Get status of the ICM Spoke (paused, message count, session count). */ getICMSpokeStatus(): Promise<{ paused: boolean; totalMessages: bigint; totalSessions: bigint; totalPayments: bigint; }>; /** * Check if a key is authorized for an identity on the ICM Spoke. */ isKeyAuthorizedOnSpoke(identityKeyHash: string, keyHash: string): Promise; /** * Determine whether a cross-chain message should use Teleporter (ICM) or Wormhole. * * Rule: If the target chain is within the Avalanche ecosystem (C-Chain ID or * an Avalanche L1), use ICM/Teleporter for lower latency and no guardian overhead. * Otherwise, fall back to Wormhole VAAs for cross-ecosystem messaging. * * @param targetWormholeChainId Wormhole chain ID of the destination * @returns 'icm' | 'wormhole' */ getRoutingStrategy(targetWormholeChainId: number): 'icm' | 'wormhole'; getP256VerifierAddress(): string; getICMSpokeAddress(): string; getChainlinkAvaxUsdFeed(): string; private _getChainlinkPrice; } export { AvalancheClient, type AvalancheClientConfig };