/** * Copyright (c) 2026, Circle Internet Group, Inc. All rights reserved. * * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { Abi } from 'abitype'; import { TransactionInstruction, Signer, AddressLookupTableAccount } from '@solana/web3.js'; import { CCTPXRouteToken, CCTPXBridgingProvider } from '@circle-fin/provider-cctpx'; export { CCTPXBridgingProvider, CCTPXBridgingProviderConfig, CCTPXRouteToken, CCTPXTokenId, KNOWN_TOKEN_SYMBOLS, KnownTokenSymbol } from '@circle-fin/provider-cctpx'; import { CCTPV2BridgingProvider } from '@circle-fin/provider-cctp-v2'; import { z } from '/home/runner/_work/stablecoin-kits-private/stablecoin-kits-private/node_modules/zod/dist/types/index.d.ts'; /** * @packageDocumentation * @module ChainDefinitions * * This module provides a complete type system for blockchain chain definitions. * It supports both EVM and non‑EVM chains, token configurations, and multiple * versions of the Cross-Chain Transfer Protocol (CCTP). Additionally, utility types * are provided to extract subsets of chains (e.g. chains supporting USDC, EURC, or specific * CCTP versions) from a provided collection. * * All types are fully documented with TSDoc to maximize developer experience. */ /** * Represents basic information about a currency or token. * @category Types * @description Provides the essential properties of a cryptocurrency or token. * @example * ```typescript * const ethCurrency: Currency = { * name: "Ether", * symbol: "ETH", * decimals: 18 * }; * ``` */ interface Currency { /** * The full name of the currency. * @example "Ether", "USDC" */ name: string; /** * The symbol or ticker of the currency. * @example "ETH", "USDC" */ symbol: string; /** * The number of decimal places for the currency. * @description Defines the divisibility of the currency (e.g., 1 ETH = 10^18 wei). * @example 18 for ETH, 6 for USDC */ decimals: number; } /** * Base information that all chain definitions must include. * @category Types * @description Provides the common properties shared by all blockchain definitions. * @example * ```typescript * const baseChain: BaseChainDefinition = { * chain: Blockchain.Ethereum, * name: "Ethereum", * nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, * isTestnet: false * }; * ``` */ interface BaseChainDefinition { /** * The blockchain identifier from the {@link Blockchain} enum. */ chain: Blockchain; /** * The display name of the blockchain. * @example "Ethereum", "Solana", "Avalanche" */ name: string; /** * Optional title or alternative name for the blockchain. * @example "Ethereum Mainnet", "Solana Mainnet" */ title?: string; /** * Information about the native currency of the blockchain. */ nativeCurrency: Currency; /** * Indicates whether this is a testnet or mainnet. * @description Used to differentiate between production and testing environments. */ isTestnet: boolean; /** * Template URL for the blockchain explorer to view transactions. * @description URL template with a `\{hash\}` placeholder for transaction hash. * @example "https://etherscan.io/tx/\{hash\}", "https://sepolia.etherscan.io/tx/\{hash\}" */ explorerUrl: string; /** * Default RPC endpoints for connecting to the blockchain network. * @description Array of reliable public RPC endpoints that can be used for read and write operations. * The first endpoint in the array is considered the primary endpoint. * @example ["https://cloudflare-eth.com", "https://ethereum.publicnode.com"] */ rpcEndpoints: readonly string[]; /** * The contract address for EURC. * @description Its presence indicates that EURC is supported. */ eurcAddress: string | null; /** * The contract address for USDC. * @description Its presence indicates that USDC is supported. */ usdcAddress: string | null; /** * The contract address for USDT. * @description Its presence indicates that USDT is supported. */ usdtAddress: string | null; /** * Optional CCTP configuration. * @description If provided, the chain supports CCTP. */ cctp: CCTPConfig | null; /** * Optional kit-specific contract addresses for enhanced chain functionality. * * @description When provided, the chain supports additional kit-specific logic in addition * to standard CCTP. This enables hybrid flows where both standard approve/burn/mint * and enhanced custom features are available. When undefined, the chain uses only * the standard CCTP flow. * * The address format varies by blockchain: * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...") * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...") * - Other chains: Platform-specific address formats * * @example * ```typescript * // EVM chain with bridge contract * const evmChain: ChainDefinition = { * // ... other properties * kitContracts: { * bridge: "0x1234567890abcdef1234567890abcdef12345678" * } * } * * // Solana chain with bridge contract * const solanaChain: ChainDefinition = { * // ... other properties * kitContracts: { * bridge: "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" * } * } * ``` */ kitContracts?: KitContracts; /** * Optional CCTPx configuration. * * @description When provided, the chain supports CCTPx (Cross-Chain Token Service). * CCTPx is a service-level protocol layered on top of CCTP v2's message-passing layer * that enables cross-chain transfers of registered tokens (Circle-issued or otherwise). * * The CCTS contract is deployed via CREATE3 so its address is deterministic and may * be committed to chain config ahead of the on-chain deployment. * * Use the {@link isCCTPXSupported} type guard to check if a chain has CCTPx support * before accessing this property. * * @example * ```typescript * if (isCCTPXSupported(chain)) { * console.log('CCTS address:', chain.cctpx.serviceAddress) * } * ``` * * @see {@link CCTPXChainConfig} for the structure of CCTPx configuration. * @see {@link isCCTPXSupported} for checking CCTPx support. */ cctpx?: CCTPXChainConfig; /** * Optional Gateway contract configuration for Gateway protocol support. * * @description When provided, the chain supports the Gateway protocol for * cross-chain transfers. Gateway provides an alternative bridging mechanism * with its own set of smart contracts (GatewayWallet and GatewayMinter). * * Use the {@link isGatewayV1Supported} type guard to check if a chain * supports Gateway v1 before accessing these properties. * * @example * ```typescript * // Chain with Gateway v1 support * const chainWithGateway: ChainDefinition = { * // ... other properties * gateway: { * domain: 6, * forwarderSupported: { source: true, destination: true }, * contracts: { * v1: { * wallet: '0x1234567890abcdef1234567890abcdef12345678', * minter: '0xabcdef1234567890abcdef1234567890abcdef12' * } * } * } * } * * // Check Gateway support * if (isGatewayV1Supported(chainWithGateway)) { * console.log('Gateway wallet:', chainWithGateway.gateway.contracts.v1.wallet) * } * ``` * * @see {@link GatewayConfig} for the structure of Gateway configuration. * @see {@link isGatewayV1Supported} for checking Gateway v1 support. */ gateway?: GatewayConfig; } /** * Represents chain definitions for Ethereum Virtual Machine (EVM) compatible blockchains. * @extends BaseChainDefinition * @category Types * @description Adds properties specific to EVM chains. * @example * ```typescript * const ethereum: EVMChainDefinition = { * type: 'evm', * chain: Blockchain.Ethereum, * chainId: 1, * name: 'Ethereum', * title: 'Ethereum Mainnet', * nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, * isTestnet: false * }; * ``` */ interface EVMChainDefinition extends BaseChainDefinition { /** * Discriminator for EVM chains. * @description Used for type narrowing when handling different chain types. */ type: 'evm'; /** * The unique identifier for the blockchain. * @description Standard EVM chain ID as defined in EIP-155. * @example 1 for Ethereum Mainnet, 137 for Polygon. */ chainId: number; } /** * Represents chain definitions for non-EVM blockchains. * @extends BaseChainDefinition * @category Types * @description Contains properties for blockchains that do not use the EVM. * @example * ```typescript * const solana: NonEVMChainDefinition = { * type: 'solana', * chain: Blockchain.Solana, * name: 'Solana', * nativeCurrency: { name: 'Solana', symbol: 'SOL', decimals: 9 }, * isTestnet: false * }; * ``` */ interface NonEVMChainDefinition extends BaseChainDefinition { /** * Discriminator for non-EVM chains. * @description Identifies the specific blockchain platform. */ type: 'algorand' | 'avalanche' | 'solana' | 'aptos' | 'near' | 'stellar' | 'sui' | 'hedera' | 'noble' | 'polkadot'; } /** * The type of chain. * @alias ChainType * @category Types * @description Represents the type of chain. * @example * ```typescript * const chainType: ChainType = 'evm' * ``` */ type ChainType = EVMChainDefinition['type'] | NonEVMChainDefinition['type']; /** * Public chain definition type. * @alias ChainDefinition * @category Types * @description Represents either an EVM-based or non-EVM-based blockchain definition. * This type is used by developers to define chain configurations. * @example * ```typescript * // Standard chain with CCTP support only * const ethereumChain: ChainDefinition = { * type: 'evm', * chain: Blockchain.Ethereum, * chainId: 1, * name: 'Ethereum', * nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, * isTestnet: false, * explorerUrl: 'https://etherscan.io/tx/{hash}', * rpcEndpoints: ['https://eth.example.com'], * eurcAddress: null, * usdcAddress: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', * usdtAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', * cctp: { * domain: 0, * contracts: { * v2: { * type: 'split', * tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d', * messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64', * confirmations: 65, * fastConfirmations: 2 * } * } * }, * kitContracts: undefined * }; * * // Chain with custom contract support (hybrid flow) * const customChain: ChainDefinition = { * ...ethereumChain, * kitContracts: { * bridge: '0x1234567890abcdef1234567890abcdef12345678' * } * }; * ``` */ type ChainDefinition = EVMChainDefinition | NonEVMChainDefinition; /** * Chain definition with CCTPv2 configuration. * @alias ChainDefinitionWithCCTPv2 * @extends ChainDefinition * @category Types * @description Represents a chain definition that includes CCTPv2 configuration. This is useful for typescript consumers to narrow down the type of chain definition to a chain that supports CCTPv2. * @example * ```typescript * const ethereumWithCCTPv2: ChainDefinitionWithCCTPv2 = { * ...ethereum, * cctp: { * domain: 0, * contracts: { * v2: { * type: 'merged', * contract: '0x123...' * } * } * } * }; * ``` */ type ChainDefinitionWithCCTPv2 = ChainDefinition & { cctp: CCTPConfig & { contracts: { v2: VersionConfig; }; }; usdcAddress: string; }; /** * Chain identifier that can be used in transfer parameters and factory functions. * This can be either: * - A ChainDefinition object * - A Blockchain enum value (e.g., Blockchain.Ethereum) * - A string literal of the blockchain value (e.g., "Ethereum") */ type ChainIdentifier$1 = ChainDefinition | Blockchain | `${Blockchain}`; /** * Split CCTP contract configuration. * * Used by chains that deploy separate TokenMessenger and MessageTransmitter contracts. * This is the traditional CCTP architecture used by most EVM chains. * * @example * ```typescript * const splitConfig: CCTPSplitConfig = { * type: 'split', * tokenMessenger: '0x1234567890abcdef1234567890abcdef12345678', * messageTransmitter: '0xabcdef1234567890abcdef1234567890abcdef12', * confirmations: 12 * } * ``` */ interface CCTPSplitConfig { type: 'split'; tokenMessenger: string; messageTransmitter: string; /** * Address of the `TokenMessengerWithFees` wrapper, when deployed on this chain. * * Optional. Present only on chains that support the prepaid FORWARD path * (source-chain fee collection via `depositForBurnWithHookAndFees`). Resolve * it with `resolveCCTPV2ContractAddress(chain, 'tokenMessengerWithFees')`. */ tokenMessengerWithFees?: string; confirmations: number; } /** * Merged CCTP contract configuration. * * Used by chains that deploy a single unified CCTP contract. * This simplified architecture is used by newer chain integrations. * * @example * ```typescript * const mergedConfig: CCTPMergedConfig = { * type: 'merged', * contract: '0x9876543210fedcba9876543210fedcba98765432', * confirmations: 1 * } * ``` */ interface CCTPMergedConfig { type: 'merged'; contract: string; /** * Address of the `TokenMessengerWithFees` wrapper, when deployed on this chain. * * Optional. Present only on chains that support the prepaid FORWARD path * (source-chain fee collection via `depositForBurnWithHookAndFees`). Resolve * it with `resolveCCTPV2ContractAddress(chain, 'tokenMessengerWithFees')`. */ tokenMessengerWithFees?: string; confirmations: number; } /** * Version configuration for CCTP contracts. * * Defines whether the chain uses split or merged CCTP contract architecture. * Split configuration uses separate TokenMessenger and MessageTransmitter contracts, * while merged configuration uses a single unified contract. * * @example Split configuration (most EVM chains) * ```typescript * const splitConfig: VersionConfig = { * type: 'split', * tokenMessenger: '0x1234567890abcdef1234567890abcdef12345678', * messageTransmitter: '0xabcdef1234567890abcdef1234567890abcdef12', * confirmations: 12 * } * ``` * * @example Merged configuration (newer chains) * ```typescript * const mergedConfig: VersionConfig = { * type: 'merged', * contract: '0x9876543210fedcba9876543210fedcba98765432', * confirmations: 1 * } * ``` */ type VersionConfig = CCTPSplitConfig | CCTPMergedConfig; type CCTPContracts = Partial<{ v1: VersionConfig; v2: VersionConfig & { fastConfirmations: number; }; }>; /** * Configuration for the Cross-Chain Transfer Protocol (CCTP). * @category Types * @description Contains the domain and required contract addresses for CCTP support. * @example * ``` * const cctpConfig: CCTPConfig = { * domain: 0, * contracts: { * TokenMessenger: '0xabc', * MessageReceiver: '0xdef' * } * }; * ``` */ interface CCTPConfig { /** * The CCTP domain identifier. */ domain: number; /** * The contracts required for CCTP. */ contracts: CCTPContracts; /** * Indicates whether the chain supports forwarder for source and destination. * @example * ```typescript * const chainWithForwarderSupported: ChainDefinition = { * forwarderSupported: { * source: true, * destination: true, * }, * } * ``` */ forwarderSupported: { source: boolean; destination: boolean; }; } /** * Configuration for Circle's Cross-Chain Token Service (CCTS) — the CCTPx protocol. * * @category Types * * @description Contains the CCTS proxy contract address on a given chain. The CCTS * contract is the service-level entry point for CCTPx cross-chain transfers of * registered tokens (Circle-issued or otherwise). Addresses are deterministic via CREATE3 * and may be committed to chain config ahead of the on-chain deploy. * * @example * ```typescript * const cctpxConfig: CCTPXChainConfig = { * serviceAddress: '0x1234567890abcdef1234567890abcdef12345678' * } * ``` */ interface CCTPXChainConfig { /** * The CrossChainTokenService (CCTS) proxy contract address on this chain. * * @description Deterministic CREATE3 address. Used by the SDK as the `to` field * when calling `crossChainTransfer` and `resolveTokenManager`. * * @example "0x1234567890abcdef1234567890abcdef12345678" */ serviceAddress: string; } /** * Chain definition with CCTPx configuration. * * @alias ChainDefinitionWithCCTPX * @extends ChainDefinition * @category Types * * @description Represents a chain definition that includes CCTPx configuration. * Use this type to narrow `ChainDefinition` to chains where the CCTS contract is * deployed, allowing safe access to `chain.cctpx.serviceAddress` without optional * chaining. * * @example * ```typescript * import type { ChainDefinitionWithCCTPX } from '@core/chains' * import { isCCTPXSupported } from '@core/chains' * * function getServiceAddress(chain: ChainDefinition): string | null { * if (isCCTPXSupported(chain)) { * // TypeScript knows chain.cctpx is defined here * return chain.cctpx.serviceAddress * } * return null * } * ``` * * @see {@link CCTPXChainConfig} for the structure of CCTPx configuration. * @see {@link isCCTPXSupported} for the type guard. */ type ChainDefinitionWithCCTPX = ChainDefinition & { cctpx: CCTPXChainConfig; }; /** * Available kit contract types for enhanced chain functionality. * * @description Defines the valid contract types that can be deployed on chains * to provide additional features beyond standard CCTP functionality. * * @example * ```typescript * import type { KitContractType } from '@core/chains' * * const contractType: KitContractType = 'bridge' // Valid * const invalidType: KitContractType = 'invalid' // TypeScript error * ``` */ type KitContractType = 'bridge' | 'adapter'; /** * Configuration for Gateway v1 contracts. * * @description Contains the addresses for the GatewayWallet and GatewayMinter * smart contracts that enable Gateway functionality on a chain. * * @example * ```typescript * import type { GatewayV1Contracts } from '@core/chains' * * const v1Contracts: GatewayV1Contracts = { * wallet: '0x1234567890abcdef1234567890abcdef12345678', * minter: '0xabcdef1234567890abcdef1234567890abcdef12' * } * ``` */ interface GatewayV1Contracts { /** * The address of the GatewayWallet smart contract. * * @description The GatewayWallet contract manages wallet operations * for Gateway transactions. * * Address format varies by blockchain: * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...") * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...") * * @example "0x1234567890abcdef1234567890abcdef12345678" */ wallet: string; /** * The address of the GatewayMinter smart contract. * * @description The GatewayMinter contract handles minting operations * for Gateway transactions. * * Address format varies by blockchain: * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...") * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...") * * @example "0xabcdef1234567890abcdef1234567890abcdef12" */ minter: string; /** * The address of the `DepositForHandler` contract. * * @description Optional. The handler the GenericExecutor calls on this chain * to run a fast cross-chain deposit into the {@link GatewayV1Contracts.wallet}. * Present only on chains that are fast-deposit destinations; other Gateway * chains omit it. * * Address format varies by blockchain: * - EVM chains: 40-character hexadecimal with 0x prefix (e.g., "0x1234...") * - Solana: Base58-encoded 32-byte address (e.g., "9WzDX...") * * @example "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48" */ depositForHandler?: string; /** * The address of the `GenericExecutor` contract. * * @description Optional. The contract that acts as `mintRecipient` and * `destinationCaller` for the CCTP v2 prepaid FORWARD path. It receives the * CCTP mint and calls {@link GatewayV1Contracts.depositForHandler} to * complete the fast deposit into the {@link GatewayV1Contracts.wallet}. * Present only on chains that are fast-deposit destinations; other Gateway * chains omit it. * * @example "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7" */ genericExecutor?: string; } /** * Versioned map of Gateway contract configurations. * * @description Maps protocol versions to their contract addresses, following * the same pattern as {@link CCTPContracts}. Each version is optional so that * chains can support any combination of Gateway protocol versions. * * @example * ```typescript * import type { GatewayContracts } from '@core/chains' * * const contracts: GatewayContracts = { * v1: { * wallet: '0x1234567890abcdef1234567890abcdef12345678', * minter: '0xabcdef1234567890abcdef1234567890abcdef12' * } * } * ``` */ type GatewayContracts = Partial<{ v1: GatewayV1Contracts; }>; /** * Configuration for the Gateway protocol on a blockchain. * * @description Contains the Gateway domain identifier and version-specific * contract configurations. Follows the same structure as {@link CCTPConfig}: * a domain number plus a versioned contracts map. * * @example * ```typescript * import type { GatewayConfig } from '@core/chains' * * const gatewayConfig: GatewayConfig = { * domain: 0, * forwarderSupported: { source: true, destination: true }, * contracts: { * v1: { * wallet: '0x1234567890abcdef1234567890abcdef12345678', * minter: '0xabcdef1234567890abcdef1234567890abcdef12' * } * } * } * ``` */ interface GatewayConfig { /** * The Gateway domain identifier for this chain. * * @description Similar to CCTP domains, this number uniquely identifies * the chain within the Gateway protocol. * * @example 0 for Ethereum, 6 for Base */ domain: number; /** * Version-specific Gateway contract addresses. * * @description Contains the addresses for each supported Gateway protocol * version, following the same pattern as {@link CCTPContracts}. */ contracts: GatewayContracts; /** * Indicate whether the chain supports the Forwarding Service as a source * and/or destination within the Gateway protocol. * * @example * ```typescript * forwarderSupported: { source: true, destination: true } * ``` */ forwarderSupported: { /** Whether this chain can be used as a source in forwarded transfers. */ source: boolean; /** Whether this chain can be used as a destination in forwarded transfers. */ destination: boolean; }; } /** * Kit-specific contract addresses for enhanced chain functionality. * * @description Maps contract types to their addresses on a specific chain. * All contract types are optional, allowing chains to selectively support * specific kit features. * * @example * ```typescript * import type { KitContracts } from '@core/chains' * * const contracts: KitContracts = { * bridge: "0x1234567890abcdef1234567890abcdef12345678" * } * * // Future example with multiple contract types: * const futureContracts: KitContracts = { * bridge: "0x1234567890abcdef1234567890abcdef12345678", * // Note: other contract types would be added to KitContractType union * // customType: "0xabcdef1234567890abcdef1234567890abcdef12" * } * ``` */ type KitContracts = Partial>; /** * Enumeration of all blockchains known to this library. * * This enum contains every blockchain that has a chain definition, regardless * of whether bridging is currently supported. For chains that support bridging * via CCTPv2, see {@link BridgeChain}. * * @enum * @category Enums * @description Provides string identifiers for each blockchain with a definition. * @see {@link BridgeChain} for the subset of chains that support CCTPv2 bridging. */ declare enum Blockchain { Algorand = "Algorand", Algorand_Testnet = "Algorand_Testnet", Aptos = "Aptos", Aptos_Testnet = "Aptos_Testnet", Arbitrum = "Arbitrum", Arbitrum_Sepolia = "Arbitrum_Sepolia", Arc = "Arc", Arc_Testnet = "Arc_Testnet", Avalanche = "Avalanche", Avalanche_Fuji = "Avalanche_Fuji", Base = "Base", Base_Sepolia = "Base_Sepolia", Celo = "Celo", Celo_Alfajores_Testnet = "Celo_Alfajores_Testnet", Codex = "Codex", Codex_Testnet = "Codex_Testnet", Cronos = "Cronos", Cronos_Testnet = "Cronos_Testnet", Edge = "Edge", Edge_Testnet = "Edge_Testnet", Ethereum = "Ethereum", Ethereum_Sepolia = "Ethereum_Sepolia", Hedera = "Hedera", Hedera_Testnet = "Hedera_Testnet", HyperEVM = "HyperEVM", HyperEVM_Testnet = "HyperEVM_Testnet", Injective = "Injective", Injective_Testnet = "Injective_Testnet", Ink = "Ink", Ink_Testnet = "Ink_Testnet", Linea = "Linea", Linea_Sepolia = "Linea_Sepolia", Monad = "Monad", Monad_Testnet = "Monad_Testnet", Morph = "Morph", Morph_Testnet = "Morph_Testnet", NEAR = "NEAR", NEAR_Testnet = "NEAR_Testnet", Noble = "Noble", Noble_Testnet = "Noble_Testnet", Optimism = "Optimism", Optimism_Sepolia = "Optimism_Sepolia", Pharos = "Pharos", Pharos_Testnet = "Pharos_Testnet", Plasma = "Plasma", Plasma_Testnet = "Plasma_Testnet", Polkadot_Asset_Hub = "Polkadot_Asset_Hub", Polkadot_Westmint = "Polkadot_Westmint", Plume = "Plume", Plume_Testnet = "Plume_Testnet", Polygon = "Polygon", Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet", Sei = "Sei", Sei_Testnet = "Sei_Testnet", Solana = "Solana", Solana_Devnet = "Solana_Devnet", Sonic = "Sonic", Sonic_Testnet = "Sonic_Testnet", Stellar = "Stellar", Stellar_Testnet = "Stellar_Testnet", Sui = "Sui", Sui_Testnet = "Sui_Testnet", Unichain = "Unichain", Unichain_Sepolia = "Unichain_Sepolia", World_Chain = "World_Chain", World_Chain_Sepolia = "World_Chain_Sepolia", XDC = "XDC", XDC_Apothem = "XDC_Apothem", X_Layer = "X_Layer", X_Layer_Testnet = "X_Layer_Testnet", ZKSync_Era = "ZKSync_Era", ZKSync_Sepolia = "ZKSync_Sepolia" } /** * Enumeration of blockchains that support cross-chain bridging via CCTPv2. * * The enum is derived from the full {@link Blockchain} enum but filtered to only * include chains with active CCTPv2 support. When new chains gain CCTPv2 support, * they are added to this enum. * * @enum * @category Enums * * @remarks * - This enum is the **canonical source** of bridging-supported chains. * - Use this enum (or its string literals) in `kit.bridge()` calls for type safety. * - Attempting to use a chain not in this enum will produce a TypeScript compile error. * * @example * ```typescript * import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * // ✅ Valid - autocomplete suggests only supported chains * await kit.bridge({ * from: { adapter, chain: BridgeChain.Ethereum }, * to: { adapter, chain: BridgeChain.Base }, * amount: '100' * }) * * // ✅ Also valid - string literals work with autocomplete * await kit.bridge({ * from: { adapter, chain: 'Ethereum_Sepolia' }, * to: { adapter, chain: 'Base_Sepolia' }, * amount: '100' * }) * * // ❌ Compile error - Algorand is not in BridgeChain * await kit.bridge({ * from: { adapter, chain: 'Algorand' }, // TypeScript error! * to: { adapter, chain: 'Base' }, * amount: '100' * }) * ``` * * @see {@link Blockchain} for the complete list of all known blockchains. * @see {@link BridgeChainIdentifier} for the type that accepts these values. */ declare enum BridgeChain { Arbitrum = "Arbitrum", Arc = "Arc", Avalanche = "Avalanche", Base = "Base", Codex = "Codex", Cronos = "Cronos", Edge = "Edge", Ethereum = "Ethereum", HyperEVM = "HyperEVM", Injective = "Injective", Ink = "Ink", Linea = "Linea", Monad = "Monad", Morph = "Morph", Optimism = "Optimism", Pharos = "Pharos", Plasma = "Plasma", Plume = "Plume", Polygon = "Polygon", Sei = "Sei", Solana = "Solana", Sonic = "Sonic", Unichain = "Unichain", World_Chain = "World_Chain", XDC = "XDC", X_Layer = "X_Layer", Arc_Testnet = "Arc_Testnet", Arbitrum_Sepolia = "Arbitrum_Sepolia", Avalanche_Fuji = "Avalanche_Fuji", Base_Sepolia = "Base_Sepolia", Codex_Testnet = "Codex_Testnet", Cronos_Testnet = "Cronos_Testnet", Edge_Testnet = "Edge_Testnet", Ethereum_Sepolia = "Ethereum_Sepolia", HyperEVM_Testnet = "HyperEVM_Testnet", Injective_Testnet = "Injective_Testnet", Ink_Testnet = "Ink_Testnet", Linea_Sepolia = "Linea_Sepolia", Monad_Testnet = "Monad_Testnet", Morph_Testnet = "Morph_Testnet", Optimism_Sepolia = "Optimism_Sepolia", Pharos_Testnet = "Pharos_Testnet", Plasma_Testnet = "Plasma_Testnet", Plume_Testnet = "Plume_Testnet", Polygon_Amoy_Testnet = "Polygon_Amoy_Testnet", Sei_Testnet = "Sei_Testnet", Solana_Devnet = "Solana_Devnet", Sonic_Testnet = "Sonic_Testnet", Unichain_Sepolia = "Unichain_Sepolia", World_Chain_Sepolia = "World_Chain_Sepolia", XDC_Apothem = "XDC_Apothem", X_Layer_Testnet = "X_Layer_Testnet" } /** * Type representing valid bridge chain identifiers. * * This type constrains chain parameters to only accept chains that support CCTPv2 bridging * * Accepts: * - A {@link BridgeChain} enum value (e.g., `BridgeChain.Ethereum`) * - A string literal matching a BridgeChain value (e.g., `'Ethereum'`) * - A {@link ChainDefinition} object for a supported chain * * @example * ```typescript * import type { BridgeChainIdentifier } from '@circle-fin/bridge-kit' * import { BridgeChain } from '@circle-fin/bridge-kit' * import { Solana } from '@circle-fin/bridge-kit/chains' * * // All of these are valid BridgeChainIdentifier values: * const chain1: BridgeChainIdentifier = BridgeChain.Ethereum * const chain2: BridgeChainIdentifier = 'Base_Sepolia' * const chain3: BridgeChainIdentifier = Solana // ChainDefinition * * // This will cause a TypeScript error: * const chain4: BridgeChainIdentifier = 'Algorand' // Error! * ``` * * @see {@link BridgeChain} for the enum of supported chains. * @see {@link ChainIdentifier} for the less restrictive type accepting all chains. */ type BridgeChainIdentifier = ChainDefinition | BridgeChain | `${BridgeChain}`; /** * Algorand Mainnet chain definition * @remarks * This represents the official production network for the Algorand blockchain. */ declare const Algorand: { readonly type: "algorand"; readonly chain: Blockchain.Algorand; readonly name: "Algorand"; readonly title: "Algorand Mainnet"; readonly nativeCurrency: { readonly name: "Algo"; readonly symbol: "ALGO"; readonly decimals: 6; }; readonly isTestnet: false; readonly explorerUrl: "https://explorer.perawallet.app/tx/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet-api.algonode.cloud"]; readonly eurcAddress: null; readonly usdcAddress: "31566704"; readonly usdtAddress: null; readonly cctp: null; }; /** * Algorand Testnet chain definition * @remarks * This represents the official testnet for the Algorand blockchain. */ declare const AlgorandTestnet: { readonly type: "algorand"; readonly chain: Blockchain.Algorand_Testnet; readonly name: "Algorand Testnet"; readonly title: "Algorand Test Network"; readonly nativeCurrency: { readonly name: "Algo"; readonly symbol: "ALGO"; readonly decimals: 6; }; readonly isTestnet: true; readonly explorerUrl: "https://testnet.explorer.perawallet.app/tx/{hash}"; readonly rpcEndpoints: readonly ["https://testnet-api.algonode.cloud"]; readonly eurcAddress: null; readonly usdcAddress: "10458941"; readonly usdtAddress: null; readonly cctp: null; }; /** * Aptos Mainnet chain definition * @remarks * This represents the official production network for the Aptos blockchain. */ declare const Aptos: { readonly type: "aptos"; readonly chain: Blockchain.Aptos; readonly name: "Aptos"; readonly title: "Aptos Mainnet"; readonly nativeCurrency: { readonly name: "Aptos"; readonly symbol: "APT"; readonly decimals: 8; }; readonly isTestnet: false; readonly explorerUrl: "https://explorer.aptoslabs.com/txn/{hash}?network=mainnet"; readonly rpcEndpoints: readonly ["https://fullnode.mainnet.aptoslabs.com/v1"]; readonly eurcAddress: null; readonly usdcAddress: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"; readonly usdtAddress: "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b"; readonly cctp: { readonly domain: 9; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9bce6734f7b63e835108e3bd8c36743d4709fe435f44791918801d0989640a9d"; readonly messageTransmitter: "0x177e17751820e4b4371873ca8c30279be63bdea63b88ed0f2239c2eea10f1772"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Aptos Testnet chain definition * @remarks * This represents the official test network for the Aptos blockchain. */ declare const AptosTestnet: { readonly type: "aptos"; readonly chain: Blockchain.Aptos_Testnet; readonly name: "Aptos Testnet"; readonly title: "Aptos Test Network"; readonly nativeCurrency: { readonly name: "Aptos"; readonly symbol: "APT"; readonly decimals: 8; }; readonly isTestnet: true; readonly explorerUrl: "https://explorer.aptoslabs.com/txn/{hash}?network=testnet"; readonly rpcEndpoints: readonly ["https://fullnode.testnet.aptoslabs.com/v1"]; readonly eurcAddress: null; readonly usdcAddress: "0x69091fbab5f7d635ee7ac5098cf0c1efbe31d68fec0f2cd565e8d168daf52832"; readonly usdtAddress: null; readonly cctp: { readonly domain: 9; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x5f9b937419dda90aa06c1836b7847f65bbbe3f1217567758dc2488be31a477b9"; readonly messageTransmitter: "0x081e86cebf457a0c6004f35bd648a2794698f52e0dde09a48619dcd3d4cc23d9"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Arc Mainnet chain definition * @remarks * This represents the official production network for the Arc blockchain, * Circle's EVM-compatible Layer-1 designed for stablecoin finance * and asset tokenization. Arc uses USDC as the native gas token and * features the Malachite Byzantine Fault Tolerant (BFT) consensus * engine for sub-second finality. */ declare const Arc: { readonly type: "evm"; readonly chain: Blockchain.Arc; readonly name: "Arc"; readonly title: "Arc Mainnet"; readonly nativeCurrency: { readonly name: "USDC"; readonly symbol: "USDC"; readonly decimals: 18; }; readonly chainId: 5042; readonly isTestnet: false; readonly explorerUrl: "https://explorer.arc.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.mainnet.arc.io/"]; readonly eurcAddress: "0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1"; readonly usdcAddress: "0x3600000000000000000000000000000000000000"; readonly usdtAddress: null; readonly cctp: { readonly domain: 26; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 26; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; readonly depositForHandler: "0x16529813203f77E036576666336554a1210dce4D"; readonly genericExecutor: "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Arc Testnet chain definition * @remarks * This represents the test network for the Arc blockchain, * Circle's EVM-compatible Layer-1 designed for stablecoin finance * and asset tokenization. Arc uses USDC as the native gas token and * features the Malachite Byzantine Fault Tolerant (BFT) consensus * engine for sub-second finality. */ declare const ArcTestnet: { readonly type: "evm"; readonly chain: Blockchain.Arc_Testnet; readonly name: "Arc Testnet"; readonly title: "ArcTestnet"; readonly nativeCurrency: { readonly name: "USDC"; readonly symbol: "USDC"; readonly decimals: 18; }; readonly chainId: 5042002; readonly isTestnet: true; readonly explorerUrl: "https://testnet.arcscan.app/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.testnet.arc.network/"]; readonly eurcAddress: "0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a"; readonly usdcAddress: "0x3600000000000000000000000000000000000000"; readonly usdtAddress: null; readonly cctp: { readonly domain: 26; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b"; }; readonly gateway: { readonly domain: 26; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; readonly depositForHandler: "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"; readonly genericExecutor: "0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Arbitrum Mainnet chain definition * @remarks * This represents the official production network for the Arbitrum blockchain. */ declare const Arbitrum: { readonly type: "evm"; readonly chain: Blockchain.Arbitrum; readonly name: "Arbitrum"; readonly title: "Arbitrum Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 42161; readonly isTestnet: false; readonly explorerUrl: "https://arbiscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://arb1.arbitrum.io/rpc"]; readonly eurcAddress: null; readonly usdcAddress: "0xaf88d065e77c8cc2239327c5edb3a432268e5831"; readonly usdtAddress: null; readonly cctp: { readonly domain: 3; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x19330d10D9Cc8751218eaf51E8885D058642E08A"; readonly messageTransmitter: "0xC30362313FBBA5cf9163F0bb16a0e01f01A896ca"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 3; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Arbitrum Sepolia Testnet chain definition * @remarks * This represents the official test network for the Arbitrum blockchain on Sepolia. */ declare const ArbitrumSepolia: { readonly type: "evm"; readonly chain: Blockchain.Arbitrum_Sepolia; readonly name: "Arbitrum Sepolia"; readonly title: "Arbitrum Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 421614; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.arbiscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://sepolia-rollup.arbitrum.io/rpc"]; readonly eurcAddress: null; readonly usdcAddress: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"; readonly usdtAddress: null; readonly cctp: { readonly domain: 3; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"; readonly messageTransmitter: "0xaCF1ceeF35caAc005e15888dDb8A3515C41B4872"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b"; }; readonly gateway: { readonly domain: 3; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Avalanche Mainnet chain definition * @remarks * This represents the official production network for the Avalanche blockchain. */ declare const Avalanche: { readonly type: "evm"; readonly chain: Blockchain.Avalanche; readonly name: "Avalanche"; readonly title: "Avalanche Mainnet"; readonly nativeCurrency: { readonly name: "Avalanche"; readonly symbol: "AVAX"; readonly decimals: 18; }; readonly chainId: 43114; readonly isTestnet: false; readonly explorerUrl: "https://subnets.avax.network/c-chain/tx/{hash}"; readonly rpcEndpoints: readonly ["https://api.avax.network/ext/bc/C/rpc"]; readonly eurcAddress: "0xc891eb4cbdeff6e073e859e987815ed1505c2acd"; readonly usdcAddress: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"; readonly usdtAddress: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"; readonly cctp: { readonly domain: 1; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x6b25532e1060ce10cc3b0a99e5683b91bfde6982"; readonly messageTransmitter: "0x8186359af5f57fbb40c6b14a588d2a59c0c29880"; readonly confirmations: 1; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 1; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; readonly depositForHandler: "0x16529813203f77E036576666336554a1210dce4D"; readonly genericExecutor: "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Avalanche Fuji Testnet chain definition * @remarks * This represents the official test network for the Avalanche blockchain. */ declare const AvalancheFuji: { readonly type: "evm"; readonly chain: Blockchain.Avalanche_Fuji; readonly name: "Avalanche Fuji"; readonly title: "Avalanche Fuji Testnet"; readonly nativeCurrency: { readonly name: "Avalanche"; readonly symbol: "AVAX"; readonly decimals: 18; }; readonly chainId: 43113; readonly isTestnet: true; readonly explorerUrl: "https://subnets-test.avax.network/c-chain/tx/{hash}"; readonly eurcAddress: "0x5e44db7996c682e92a960b65ac713a54ad815c6b"; readonly usdcAddress: "0x5425890298aed601595a70ab815c96711a31bc65"; readonly usdtAddress: null; readonly cctp: { readonly domain: 1; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0xeb08f243e5d3fcff26a9e38ae5520a669f4019d0"; readonly messageTransmitter: "0xa9fb1b3009dcb79e2fe346c16a604b8fa8ae0a79"; readonly confirmations: 1; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly rpcEndpoints: readonly ["https://api.avax-test.network/ext/bc/C/rpc"]; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 1; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; readonly depositForHandler: "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"; readonly genericExecutor: "0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Base chain definition * @remarks * This represents the official production network for the Base blockchain. */ declare const Base: { readonly type: "evm"; readonly chain: Blockchain.Base; readonly name: "Base"; readonly title: "Base Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 8453; readonly isTestnet: false; readonly explorerUrl: "https://basescan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet.base.org", "https://base.publicnode.com"]; readonly eurcAddress: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"; readonly usdcAddress: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; readonly usdtAddress: null; readonly cctp: { readonly domain: 6; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x1682Ae6375C4E4A97e4B583BC394c861A46D8962"; readonly messageTransmitter: "0xAD09780d193884d503182aD4588450C416D6F9D4"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 6; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Base Sepolia Testnet chain definition * @remarks * This represents the official test network for the Base blockchain on Sepolia. */ declare const BaseSepolia: { readonly type: "evm"; readonly chain: Blockchain.Base_Sepolia; readonly name: "Base Sepolia"; readonly title: "Base Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 84532; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.basescan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://sepolia.base.org"]; readonly eurcAddress: "0x808456652fdb597867f38412077A9182bf77359F"; readonly usdcAddress: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"; readonly usdtAddress: null; readonly cctp: { readonly domain: 6; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"; readonly messageTransmitter: "0x7865fAfC2db2093669d92c0F33AeEF291086BEFD"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b"; }; readonly gateway: { readonly domain: 6; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Celo Mainnet chain definition * @remarks * This represents the official production network for the Celo blockchain. */ declare const Celo: { readonly type: "evm"; readonly chain: Blockchain.Celo; readonly name: "Celo"; readonly title: "Celo Mainnet"; readonly nativeCurrency: { readonly name: "Celo"; readonly symbol: "CELO"; readonly decimals: 18; }; readonly chainId: 42220; readonly isTestnet: false; readonly explorerUrl: "https://celoscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://forno.celo.org"]; readonly eurcAddress: null; readonly usdcAddress: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C"; readonly usdtAddress: "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e"; readonly cctp: null; }; /** * Celo Alfajores Testnet chain definition * @remarks * This represents the official test network for the Celo blockchain. */ declare const CeloAlfajoresTestnet: { readonly type: "evm"; readonly chain: Blockchain.Celo_Alfajores_Testnet; readonly name: "Celo Alfajores"; readonly title: "Celo Alfajores Testnet"; readonly nativeCurrency: { readonly name: "Celo"; readonly symbol: "CELO"; readonly decimals: 18; }; readonly chainId: 44787; readonly isTestnet: true; readonly explorerUrl: "https://alfajores.celoscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://alfajores-forno.celo-testnet.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B"; readonly usdtAddress: null; readonly cctp: null; }; /** * Codex Mainnet chain definition * @remarks * This represents the main network for the Codex blockchain. */ declare const Codex: { readonly type: "evm"; readonly chain: Blockchain.Codex; readonly name: "Codex Mainnet"; readonly title: "Codex Mainnet"; readonly nativeCurrency: { readonly name: "ETH"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 81224; readonly isTestnet: false; readonly explorerUrl: "https://explorer.codex.xyz/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.codex.xyz"]; readonly eurcAddress: null; readonly usdcAddress: "0xd996633a415985DBd7D6D12f4A4343E31f5037cf"; readonly usdtAddress: null; readonly cctp: { readonly domain: 12; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Codex Testnet chain definition * @remarks * This represents the test network for the Codex blockchain. */ declare const CodexTestnet: { readonly type: "evm"; readonly chain: Blockchain.Codex_Testnet; readonly name: "Codex Testnet"; readonly title: "Codex Testnet"; readonly nativeCurrency: { readonly name: "ETH"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 812242; readonly isTestnet: true; readonly explorerUrl: "https://explorer.codex-stg.xyz/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.codex-stg.xyz"]; readonly eurcAddress: null; readonly usdcAddress: "0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f"; readonly usdtAddress: null; readonly cctp: { readonly domain: 12; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Cronos Mainnet chain definition * @remarks * This represents the official production network for the Cronos blockchain. * Cronos is an EVM-compatible blockchain. */ declare const Cronos: { readonly type: "evm"; readonly chain: Blockchain.Cronos; readonly name: "Cronos"; readonly title: "Cronos Mainnet"; readonly nativeCurrency: { readonly name: "Cronos"; readonly symbol: "CRO"; readonly decimals: 18; }; readonly chainId: 25; readonly isTestnet: false; readonly explorerUrl: "https://cronoscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://evm.cronos.org"]; readonly eurcAddress: "0xA6dE01a2d62C6B5f3525d768f34d276652C554c8"; readonly usdcAddress: "0x3D7F2C478aAfdB65542BCB44bCeeC05849999d2D"; readonly usdtAddress: null; readonly cctp: { readonly domain: 32; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Cronos Testnet chain definition * @remarks * This represents the official test network for the Cronos blockchain. * Cronos is an EVM-compatible blockchain. */ declare const CronosTestnet: { readonly type: "evm"; readonly chain: Blockchain.Cronos_Testnet; readonly name: "Cronos Testnet"; readonly title: "Cronos Testnet"; readonly nativeCurrency: { readonly name: "CRO"; readonly symbol: "tCRO"; readonly decimals: 18; }; readonly chainId: 338; readonly isTestnet: true; readonly explorerUrl: "https://explorer.cronos.org/testnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://evm-t3.cronos.org"]; readonly eurcAddress: "0x31f7538adb53cF16350e6B0c89d03D91b7D12c46"; readonly usdcAddress: "0xEb33dc5fac03833e132593659e1dE7256aB59794"; readonly usdtAddress: null; readonly cctp: { readonly domain: 32; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Edge Mainnet chain definition * @remarks * This represents the official production network for the Edge blockchain. * Edge is an EVM-compatible blockchain. */ declare const Edge: { readonly type: "evm"; readonly chain: Blockchain.Edge; readonly name: "Edge"; readonly title: "Edge Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 3343; readonly isTestnet: false; readonly explorerUrl: "https://pro.edgex.exchange/en-US/explorer/tx/{hash}"; readonly rpcEndpoints: readonly ["https://edge-mainnet.g.alchemy.com/public"]; readonly eurcAddress: null; readonly usdcAddress: "0x98d2919b9A214E6Fa5384AC81E6864bA686Ad74c"; readonly usdtAddress: null; readonly cctp: { readonly domain: 28; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x98706A006bc632Df31CAdFCBD43F38887ce2ca5c"; readonly tokenMessengerWithFees: "0x3Ac96675F9a3E6922713e041645D82f3561d3686"; readonly messageTransmitter: "0x5b61381Fc9e58E70EfC13a4A97516997019198ee"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0x6D1AaE1c34Aeb582022916a67f2A655C6f4eDFF2"; }; }; /** * Edge Testnet chain definition * @remarks * This represents the official test network for the Edge blockchain. * Edge is an EVM-compatible blockchain. */ declare const EdgeTestnet: { readonly type: "evm"; readonly chain: Blockchain.Edge_Testnet; readonly name: "Edge Testnet"; readonly title: "Edge Testnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 33431; readonly isTestnet: true; readonly explorerUrl: "https://edge-testnet.explorer.alchemy.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://edge-testnet.g.alchemy.com/public"]; readonly eurcAddress: null; readonly usdcAddress: "0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B"; readonly usdtAddress: null; readonly cctp: { readonly domain: 28; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Ethereum Mainnet chain definition * @remarks * This represents the official production network for the Ethereum blockchain. */ declare const Ethereum: { readonly type: "evm"; readonly chain: Blockchain.Ethereum; readonly name: "Ethereum"; readonly title: "Ethereum Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 1; readonly isTestnet: false; readonly explorerUrl: "https://etherscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://ethereum-rpc.publicnode.com", "https://ethereum.publicnode.com"]; readonly eurcAddress: "0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c"; readonly usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; readonly usdtAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7"; readonly cctp: { readonly domain: 0; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0xbd3fa81b58ba92a82136038b25adec7066af3155"; readonly messageTransmitter: "0x0a992d191deec32afe36203ad87d7d289a738f81"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 2; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 0; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Ethereum Sepolia Testnet chain definition * @remarks * This represents the official test network for the Ethereum blockchain on Sepolia. */ declare const EthereumSepolia: { readonly type: "evm"; readonly chain: Blockchain.Ethereum_Sepolia; readonly name: "Ethereum Sepolia"; readonly title: "Ethereum Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 11155111; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.etherscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://ethereum-sepolia-rpc.publicnode.com"]; readonly eurcAddress: "0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4"; readonly usdcAddress: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"; readonly usdtAddress: null; readonly cctp: { readonly domain: 0; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"; readonly messageTransmitter: "0x7865fAfC2db2093669d92c0F33AeEF291086BEFD"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 65; readonly fastConfirmations: 2; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b"; }; readonly gateway: { readonly domain: 0; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Hedera Mainnet chain definition * @remarks * This represents the official production network for the Hedera blockchain. */ declare const Hedera: { readonly type: "hedera"; readonly chain: Blockchain.Hedera; readonly name: "Hedera"; readonly title: "Hedera Mainnet"; readonly nativeCurrency: { readonly name: "HBAR"; readonly symbol: "HBAR"; readonly decimals: 18; }; readonly isTestnet: false; readonly explorerUrl: "https://hashscan.io/mainnet/transaction/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet.hashio.io/api"]; readonly eurcAddress: null; readonly usdcAddress: "0.0.456858"; readonly usdtAddress: null; readonly cctp: null; }; /** * Hedera Testnet chain definition * @remarks * This represents the official test network for the Hedera blockchain. */ declare const HederaTestnet: { readonly type: "hedera"; readonly chain: Blockchain.Hedera_Testnet; readonly name: "Hedera Testnet"; readonly title: "Hedera Test Network"; readonly nativeCurrency: { readonly name: "HBAR"; readonly symbol: "HBAR"; readonly decimals: 18; }; readonly isTestnet: true; readonly explorerUrl: "https://hashscan.io/testnet/transaction/{hash}"; readonly rpcEndpoints: readonly ["https://testnet.hashio.io/api"]; readonly eurcAddress: null; readonly usdcAddress: "0.0.429274"; readonly usdtAddress: null; readonly cctp: null; }; /** * HyperEVM Mainnet chain definition * @remarks * This represents the official production network for the HyperEVM blockchain. * HyperEVM is a Layer 1 blockchain specialized for DeFi and trading applications * with native orderbook and matching engine. */ declare const HyperEVM: { readonly type: "evm"; readonly chain: Blockchain.HyperEVM; readonly name: "HyperEVM"; readonly title: "HyperEVM Mainnet"; readonly nativeCurrency: { readonly name: "Hype"; readonly symbol: "HYPE"; readonly decimals: 18; }; readonly chainId: 999; readonly isTestnet: false; readonly explorerUrl: "https://hyperevmscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.hyperliquid.xyz/evm"]; readonly eurcAddress: null; readonly usdcAddress: "0xb88339CB7199b77E23DB6E890353E22632Ba630f"; readonly usdtAddress: null; readonly cctp: { readonly domain: 19; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 19; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * HyperEVM Testnet chain definition * @remarks * This represents the official testnet for the HyperEVM blockchain. * Used for development and testing purposes before deploying to mainnet. */ declare const HyperEVMTestnet: { readonly type: "evm"; readonly chain: Blockchain.HyperEVM_Testnet; readonly name: "HyperEVM Testnet"; readonly title: "HyperEVM Test Network"; readonly nativeCurrency: { readonly name: "Hype"; readonly symbol: "HYPE"; readonly decimals: 18; }; readonly chainId: 998; readonly isTestnet: true; readonly explorerUrl: "https://app.hyperliquid-testnet.xyz/explorer/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.hyperliquid-testnet.xyz/evm"]; readonly eurcAddress: null; readonly usdcAddress: "0x2B3370eE501B4a559b57D449569354196457D8Ab"; readonly usdtAddress: null; readonly cctp: { readonly domain: 19; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 19; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Injective Mainnet chain definition * @remarks * This represents the official production network for the Injective blockchain. * Injective is a high-performance, interoperable Layer-1 blockchain built for * finance, with an EVM execution layer on top of a Cosmos SDK base and * sub-second block finality. */ declare const Injective: { readonly type: "evm"; readonly chain: Blockchain.Injective; readonly name: "Injective"; readonly title: "Injective Mainnet"; readonly nativeCurrency: { readonly name: "Injective"; readonly symbol: "INJ"; readonly decimals: 18; }; readonly chainId: 1776; readonly isTestnet: false; readonly explorerUrl: "https://injscan.com/transaction/{hash}"; readonly rpcEndpoints: readonly ["https://sentry.evm-rpc.injective.network"]; readonly eurcAddress: null; readonly usdcAddress: "0xa00C59fF5a080D2b954d0c75e46E22a0c371235a"; readonly usdtAddress: null; readonly cctp: { readonly domain: 29; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Injective Testnet chain definition * @remarks * This represents the official test network for the Injective blockchain. * Injective is a high-performance, interoperable Layer-1 blockchain built for * finance, with an EVM execution layer on top of a Cosmos SDK base and * sub-second block finality. */ declare const InjectiveTestnet: { readonly type: "evm"; readonly chain: Blockchain.Injective_Testnet; readonly name: "Injective Testnet"; readonly title: "Injective Testnet"; readonly nativeCurrency: { readonly name: "Injective"; readonly symbol: "INJ"; readonly decimals: 18; }; readonly chainId: 1439; readonly isTestnet: true; readonly explorerUrl: "https://testnet.explorer.injective.network/transaction/{hash}"; readonly rpcEndpoints: readonly ["https://k8s.testnet.json-rpc.injective.network"]; readonly eurcAddress: null; readonly usdcAddress: "0x0C382e685bbeeFE5d3d9C29e29E341fEE8E84C5d"; readonly usdtAddress: null; readonly cctp: { readonly domain: 29; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Ink Mainnet chain definition * @remarks * This represents the official production network for the Ink blockchain. * Ink is a Layer 1 blockchain specialized for DeFi and trading applications * with native orderbook and matching engine. */ declare const Ink: { readonly type: "evm"; readonly chain: Blockchain.Ink; readonly name: "Ink"; readonly title: "Ink Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 57073; readonly isTestnet: false; readonly explorerUrl: "https://explorer.inkonchain.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc-gel.inkonchain.com", "https://rpc-qnd.inkonchain.com"]; readonly eurcAddress: null; readonly usdcAddress: "0x2D270e6886d130D724215A266106e6832161EAEd"; readonly usdtAddress: null; readonly cctp: { readonly domain: 21; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; }; /** * Ink Testnet chain definition * @remarks * This represents the official testnet for the Ink blockchain. * Used for development and testing purposes before deploying to mainnet. */ declare const InkTestnet: { readonly type: "evm"; readonly chain: Blockchain.Ink_Testnet; readonly name: "Ink Sepolia"; readonly title: "Ink Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 763373; readonly isTestnet: true; readonly explorerUrl: "https://explorer-sepolia.inkonchain.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc-gel-sepolia.inkonchain.com", "https://rpc-qnd-sepolia.inkonchain.com"]; readonly eurcAddress: null; readonly usdcAddress: "0xFabab97dCE620294D2B0b0e46C68964e326300Ac"; readonly usdtAddress: null; readonly cctp: { readonly domain: 21; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Linea Mainnet chain definition * @remarks * This represents the official production network for the Linea blockchain. */ declare const Linea: { readonly type: "evm"; readonly chain: Blockchain.Linea; readonly name: "Linea"; readonly title: "Linea Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 59144; readonly isTestnet: false; readonly explorerUrl: "https://lineascan.build/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.linea.build"]; readonly eurcAddress: null; readonly usdcAddress: "0x176211869ca2b568f2a7d4ee941e073a821ee1ff"; readonly usdtAddress: null; readonly cctp: { readonly domain: 11; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; }; /** * Linea Sepolia Testnet chain definition * @remarks * This represents the official test network for the Linea blockchain on Sepolia. */ declare const LineaSepolia: { readonly type: "evm"; readonly chain: Blockchain.Linea_Sepolia; readonly name: "Linea Sepolia"; readonly title: "Linea Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 59141; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.lineascan.build/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.sepolia.linea.build"]; readonly eurcAddress: null; readonly usdcAddress: "0xfece4462d57bd51a6a552365a011b95f0e16d9b7"; readonly usdtAddress: null; readonly cctp: { readonly domain: 11; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Monad Mainnet chain definition * @remarks * This represents the official production network for the Monad blockchain. * Monad is a high-performance EVM-compatible Layer-1 blockchain featuring * over 10,000 TPS, sub-second finality, and near-zero gas fees. */ declare const Monad: { readonly type: "evm"; readonly chain: Blockchain.Monad; readonly name: "Monad"; readonly title: "Monad Mainnet"; readonly nativeCurrency: { readonly name: "Monad"; readonly symbol: "MON"; readonly decimals: 18; }; readonly chainId: 143; readonly isTestnet: false; readonly explorerUrl: "https://monadscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.monad.xyz"]; readonly eurcAddress: null; readonly usdcAddress: "0x754704Bc059F8C67012fEd69BC8A327a5aafb603"; readonly usdtAddress: null; readonly cctp: { readonly domain: 15; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; }; /** * Monad Testnet chain definition * @remarks * This represents the official test network for the Monad blockchain. * Monad is a high-performance EVM-compatible Layer-1 blockchain featuring * over 10,000 TPS, sub-second finality, and near-zero gas fees. */ declare const MonadTestnet: { readonly type: "evm"; readonly chain: Blockchain.Monad_Testnet; readonly name: "Monad Testnet"; readonly title: "Monad Testnet"; readonly nativeCurrency: { readonly name: "Monad"; readonly symbol: "MON"; readonly decimals: 18; }; readonly chainId: 10143; readonly isTestnet: true; readonly explorerUrl: "https://testnet.monadscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://testnet-rpc.monad.xyz"]; readonly eurcAddress: null; readonly usdcAddress: "0x534b2f3A21130d7a60830c2Df862319e593943A3"; readonly usdtAddress: null; readonly cctp: { readonly domain: 15; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Morph Mainnet chain definition * @remarks * This represents the official production network for the Morph blockchain. * Morph is an EVM-compatible Layer-2 blockchain built on the OP Stack. */ declare const Morph: { readonly type: "evm"; readonly chain: Blockchain.Morph; readonly name: "Morph"; readonly title: "Morph Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 2818; readonly isTestnet: false; readonly explorerUrl: "https://explorer.morph.network/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.morphl2.io"]; readonly eurcAddress: null; readonly usdcAddress: "0xCfb1186F4e93D60E60a8bDd997427D1F33bc372B"; readonly usdtAddress: null; readonly cctp: { readonly domain: 30; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 64; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Morph Hoodi Testnet chain definition * @remarks * This represents the official test network for the Morph blockchain. * Morph is an EVM-compatible Layer-2 blockchain built on the OP Stack. */ declare const MorphTestnet: { readonly type: "evm"; readonly chain: Blockchain.Morph_Testnet; readonly name: "Morph Hoodi"; readonly title: "Morph Hoodi Testnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 2910; readonly isTestnet: true; readonly explorerUrl: "https://explorer-hoodi.morphl2.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc-hoodi.morphl2.io"]; readonly eurcAddress: null; readonly usdcAddress: "0x7433b41C6c5e1d58D4Da99483609520255ab661B"; readonly usdtAddress: null; readonly cctp: { readonly domain: 30; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 64; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * NEAR Protocol Mainnet chain definition * @remarks * This represents the official production network for the NEAR Protocol blockchain. */ declare const NEAR: { readonly type: "near"; readonly chain: Blockchain.NEAR; readonly name: "NEAR Protocol"; readonly title: "NEAR Mainnet"; readonly nativeCurrency: { readonly name: "NEAR"; readonly symbol: "NEAR"; readonly decimals: 24; }; readonly isTestnet: false; readonly explorerUrl: "https://nearblocks.io/txns/{hash}"; readonly rpcEndpoints: readonly ["https://eth-rpc.mainnet.near.org"]; readonly eurcAddress: null; readonly usdcAddress: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1"; readonly usdtAddress: "usdt.tether-token.near"; readonly cctp: null; }; /** * NEAR Testnet chain definition * @remarks * This represents the official test network for the NEAR Protocol blockchain. */ declare const NEARTestnet: { readonly type: "near"; readonly chain: Blockchain.NEAR_Testnet; readonly name: "NEAR Protocol Testnet"; readonly title: "NEAR Test Network"; readonly nativeCurrency: { readonly name: "NEAR"; readonly symbol: "NEAR"; readonly decimals: 24; }; readonly isTestnet: true; readonly explorerUrl: "https://testnet.nearblocks.io/txns/{hash}"; readonly rpcEndpoints: readonly ["https://eth-rpc.testnet.near.org"]; readonly eurcAddress: null; readonly usdcAddress: "3e2210e1184b45b64c8a434c0a7e7b23cc04ea7eb7a6c3c32520d03d4afcb8af"; readonly usdtAddress: null; readonly cctp: null; }; /** * Noble Mainnet chain definition * @remarks * This represents the official production network for the Noble blockchain. */ declare const Noble: { readonly type: "noble"; readonly chain: Blockchain.Noble; readonly name: "Noble"; readonly title: "Noble Mainnet"; readonly nativeCurrency: { readonly name: "Noble USDC"; readonly symbol: "USDC"; readonly decimals: 6; }; readonly isTestnet: false; readonly explorerUrl: "https://www.mintscan.io/noble/tx/{hash}"; readonly rpcEndpoints: readonly ["https://noble-rpc.polkachu.com"]; readonly eurcAddress: null; readonly usdcAddress: "uusdc"; readonly usdtAddress: null; readonly cctp: { readonly domain: 4; readonly contracts: { readonly v1: { readonly type: "merged"; readonly contract: "noble12l2w4ugfz4m6dd73yysz477jszqnfughxvkss5"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Noble Testnet chain definition * @remarks * This represents the official test network for the Noble blockchain. */ declare const NobleTestnet: { readonly type: "noble"; readonly chain: Blockchain.Noble_Testnet; readonly name: "Noble Testnet"; readonly title: "Noble Test Network"; readonly nativeCurrency: { readonly name: "Noble USDC"; readonly symbol: "USDC"; readonly decimals: 6; }; readonly isTestnet: true; readonly explorerUrl: "https://www.mintscan.io/noble-testnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://noble-testnet-rpc.polkachu.com"]; readonly eurcAddress: null; readonly usdcAddress: "uusdc"; readonly usdtAddress: null; readonly cctp: { readonly domain: 4; readonly contracts: { readonly v1: { readonly type: "merged"; readonly contract: "noble12l2w4ugfz4m6dd73yysz477jszqnfughxvkss5"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Optimism Mainnet chain definition * @remarks * This represents the official production network for the Optimism blockchain. */ declare const Optimism: { readonly type: "evm"; readonly chain: Blockchain.Optimism; readonly name: "Optimism"; readonly title: "Optimism Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 10; readonly isTestnet: false; readonly explorerUrl: "https://optimistic.etherscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet.optimism.io"]; readonly eurcAddress: null; readonly usdcAddress: "0x0b2c639c533813f4aa9d7837caf62653d097ff85"; readonly usdtAddress: null; readonly cctp: { readonly domain: 2; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x2B4069517957735bE00ceE0fadAE88a26365528f"; readonly messageTransmitter: "0x0a992d191deec32afe36203ad87d7d289a738f81"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 2; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Optimism Sepolia Testnet chain definition * @remarks * This represents the official test network for the Optimism blockchain on Sepolia. */ declare const OptimismSepolia: { readonly type: "evm"; readonly chain: Blockchain.Optimism_Sepolia; readonly name: "Optimism Sepolia"; readonly title: "Optimism Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 11155420; readonly isTestnet: true; readonly explorerUrl: "https://sepolia-optimistic.etherscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://sepolia.optimism.io"]; readonly eurcAddress: null; readonly usdcAddress: "0x5fd84259d66Cd46123540766Be93DFE6D43130D7"; readonly usdtAddress: null; readonly cctp: { readonly domain: 2; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"; readonly messageTransmitter: "0x7865fAfC2db2093669d92c0F33AeEF291086BEFD"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 2; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Pharos Mainnet chain definition * @remarks * This represents the official production network for the Pharos blockchain. * Pharos is a modular, full-stack parallel Layer 1 blockchain with * sub-second finality and EVM compatibility. */ declare const Pharos: { readonly type: "evm"; readonly chain: Blockchain.Pharos; readonly name: "Pharos"; readonly title: "Pharos Mainnet"; readonly nativeCurrency: { readonly name: "Pharos"; readonly symbol: "PHAROS"; readonly decimals: 18; }; readonly chainId: 1672; readonly isTestnet: false; readonly explorerUrl: "https://pharos.socialscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.pharos.xyz"]; readonly eurcAddress: null; readonly usdcAddress: "0xC879C018dB60520F4355C26eD1a6D572cdAC1815"; readonly usdtAddress: null; readonly cctp: { readonly domain: 31; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Pharos Atlantic Testnet chain definition * @remarks * This represents the official test network for the Pharos blockchain. * Pharos is a modular, full-stack parallel Layer 1 blockchain with * sub-second finality and EVM compatibility. */ declare const PharosTestnet: { readonly type: "evm"; readonly chain: Blockchain.Pharos_Testnet; readonly name: "Pharos Atlantic"; readonly title: "Pharos Atlantic Testnet"; readonly nativeCurrency: { readonly name: "Pharos"; readonly symbol: "PHAROS"; readonly decimals: 18; }; readonly chainId: 688689; readonly isTestnet: true; readonly explorerUrl: "https://atlantic.pharosscan.xyz/tx/{hash}"; readonly rpcEndpoints: readonly ["https://atlantic.dplabs-internal.com"]; readonly eurcAddress: null; readonly usdcAddress: "0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B"; readonly usdtAddress: null; readonly cctp: { readonly domain: 31; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Plasma Mainnet chain definition * @remarks * This represents the official production network for the Plasma blockchain. * Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global * stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff). */ declare const Plasma: { readonly type: "evm"; readonly chain: Blockchain.Plasma; readonly name: "Plasma"; readonly title: "Plasma Mainnet"; readonly nativeCurrency: { readonly name: "Plasma"; readonly symbol: "XPL"; readonly decimals: 18; }; readonly chainId: 9745; readonly isTestnet: false; readonly explorerUrl: "https://plasmascan.to/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.plasma.to"]; readonly eurcAddress: "0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C"; readonly usdcAddress: "0x2d661C89D812261039AF9764eceaAee884f5F67F"; readonly usdtAddress: null; readonly cctp: { readonly domain: 33; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 3; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * Plasma Testnet chain definition * @remarks * This represents the official test network for the Plasma blockchain. * Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global * stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff). */ declare const PlasmaTestnet: { readonly type: "evm"; readonly chain: Blockchain.Plasma_Testnet; readonly name: "Plasma Testnet"; readonly title: "Plasma Testnet"; readonly nativeCurrency: { readonly name: "Plasma"; readonly symbol: "XPL"; readonly decimals: 18; }; readonly chainId: 9746; readonly isTestnet: true; readonly explorerUrl: "https://testnet.plasmascan.to/tx/{hash}"; readonly rpcEndpoints: readonly ["https://testnet-rpc.plasma.to"]; readonly eurcAddress: "0x98AfA0F93Dd993B736399f9074eDcEBD1985A330"; readonly usdcAddress: "0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D"; readonly usdtAddress: null; readonly cctp: { readonly domain: 33; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 3; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Plume Mainnet chain definition * @remarks * This represents the official production network for the Plume blockchain. * Plume is a Layer 1 blockchain specialized for DeFi and trading applications * with native orderbook and matching engine. */ declare const Plume: { readonly type: "evm"; readonly chain: Blockchain.Plume; readonly name: "Plume"; readonly title: "Plume Mainnet"; readonly nativeCurrency: { readonly name: "Plume"; readonly symbol: "PLUME"; readonly decimals: 18; }; readonly chainId: 98866; readonly isTestnet: false; readonly explorerUrl: "https://explorer.plume.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.plume.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x222365EF19F7947e5484218551B56bb3965Aa7aF"; readonly usdtAddress: null; readonly cctp: { readonly domain: 22; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; }; /** * Plume Testnet chain definition * @remarks * This represents the official testnet for the Plume blockchain. * Used for development and testing purposes before deploying to mainnet. */ declare const PlumeTestnet: { readonly type: "evm"; readonly chain: Blockchain.Plume_Testnet; readonly name: "Plume Testnet"; readonly title: "Plume Test Network"; readonly nativeCurrency: { readonly name: "Plume"; readonly symbol: "PLUME"; readonly decimals: 18; }; readonly chainId: 98867; readonly isTestnet: true; readonly explorerUrl: "https://testnet-explorer.plume.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://testnet-rpc.plume.org"]; readonly eurcAddress: null; readonly usdcAddress: "0xcB5f30e335672893c7eb944B374c196392C19D18"; readonly usdtAddress: null; readonly cctp: { readonly domain: 22; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * Polkadot Asset Hub chain definition * @remarks * This represents the official asset management parachain for the Polkadot blockchain. */ declare const PolkadotAssetHub: { readonly type: "polkadot"; readonly chain: Blockchain.Polkadot_Asset_Hub; readonly name: "Polkadot Asset Hub"; readonly title: "Polkadot Asset Hub"; readonly nativeCurrency: { readonly name: "Polkadot"; readonly symbol: "DOT"; readonly decimals: 10; }; readonly isTestnet: false; readonly explorerUrl: "https://polkadot.subscan.io/extrinsic/{hash}"; readonly rpcEndpoints: readonly ["https://asset-hub-polkadot-rpc.n.dwellir.com"]; readonly eurcAddress: null; readonly usdcAddress: "1337"; readonly usdtAddress: "1984"; readonly cctp: null; }; /** * Polkadot Westmint chain definition * @remarks * This represents an asset management parachain in the Polkadot ecosystem. */ declare const PolkadotWestmint: { readonly type: "polkadot"; readonly chain: Blockchain.Polkadot_Westmint; readonly name: "Polkadot Westmint"; readonly title: "Polkadot Westmint"; readonly nativeCurrency: { readonly name: "Polkadot"; readonly symbol: "DOT"; readonly decimals: 10; }; readonly isTestnet: false; readonly explorerUrl: "https://assethub-polkadot.subscan.io/extrinsic/{hash}"; readonly rpcEndpoints: readonly ["https://westmint-rpc.polkadot.io"]; readonly eurcAddress: null; readonly usdcAddress: "Asset ID 31337"; readonly usdtAddress: null; readonly cctp: null; }; /** * Polygon Mainnet chain definition * @remarks * This represents the official production network for the Polygon blockchain. */ declare const Polygon: { readonly type: "evm"; readonly chain: Blockchain.Polygon; readonly name: "Polygon"; readonly title: "Polygon Mainnet"; readonly nativeCurrency: { readonly name: "POL"; readonly symbol: "POL"; readonly decimals: 18; }; readonly chainId: 137; readonly isTestnet: false; readonly explorerUrl: "https://polygonscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://polygon.publicnode.com", "https://polygon.drpc.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"; readonly usdtAddress: null; readonly cctp: { readonly domain: 7; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9daF8c91AEFAE50b9c0E69629D3F6Ca40cA3B3FE"; readonly messageTransmitter: "0xF3be9355363857F3e001be68856A2f96b4C39Ba9"; readonly confirmations: 200; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 33; readonly fastConfirmations: 13; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x431871229103b780868f8C6BB820cd16ECf942BC"; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 7; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; readonly depositForHandler: "0x16529813203f77E036576666336554a1210dce4D"; readonly genericExecutor: "0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Polygon Amoy Testnet chain definition * @remarks * This represents the official test network for the Polygon blockchain. */ declare const PolygonAmoy: { readonly type: "evm"; readonly chain: Blockchain.Polygon_Amoy_Testnet; readonly name: "Polygon Amoy"; readonly title: "Polygon Amoy Testnet"; readonly nativeCurrency: { readonly name: "POL"; readonly symbol: "POL"; readonly decimals: 18; }; readonly chainId: 80002; readonly isTestnet: true; readonly explorerUrl: "https://amoy.polygonscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://polygon-amoy-bor-rpc.publicnode.com", "https://polygon-amoy.drpc.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582"; readonly usdtAddress: null; readonly cctp: { readonly domain: 7; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x9f3B8679c73C2Fef8b59B4f3444d4e156fb70AA5"; readonly messageTransmitter: "0x7865fAfC2db2093669d92c0F33AeEF291086BEFD"; readonly confirmations: 200; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 33; readonly fastConfirmations: 13; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly cctpx: { readonly serviceAddress: "0x63753E722bd2C2A5DF6EE19C5106662208B81077"; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 7; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; readonly depositForHandler: "0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48"; readonly genericExecutor: "0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Sei Mainnet chain definition * @remarks * This represents the official production network for the Sei blockchain. * Sei is a Layer 1 blockchain specialized for DeFi and trading applications * with native orderbook and matching engine. */ declare const Sei: { readonly type: "evm"; readonly chain: Blockchain.Sei; readonly name: "Sei"; readonly title: "Sei Mainnet"; readonly nativeCurrency: { readonly name: "Sei"; readonly symbol: "SEI"; readonly decimals: 18; }; readonly chainId: 1329; readonly isTestnet: false; readonly explorerUrl: "https://seiscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://evm-rpc.sei-apis.com"]; readonly eurcAddress: null; readonly usdcAddress: "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392"; readonly usdtAddress: null; readonly cctp: { readonly domain: 16; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 16; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Sei Testnet chain definition * @remarks * This represents the official testnet for the Sei blockchain. * Used for development and testing purposes before deploying to mainnet. */ declare const SeiTestnet: { readonly type: "evm"; readonly chain: Blockchain.Sei_Testnet; readonly name: "Sei Testnet"; readonly title: "Sei Test Network"; readonly nativeCurrency: { readonly name: "Sei"; readonly symbol: "SEI"; readonly decimals: 18; }; readonly chainId: 1328; readonly isTestnet: true; readonly explorerUrl: "https://testnet.seiscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://evm-rpc-testnet.sei-apis.com"]; readonly eurcAddress: null; readonly usdcAddress: "0x4fCF1784B31630811181f670Aea7A7bEF803eaED"; readonly usdtAddress: null; readonly cctp: { readonly domain: 16; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 16; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Sonic Mainnet chain definition * @remarks * This represents the official production network for the Sonic blockchain. */ declare const Sonic: { readonly type: "evm"; readonly chain: Blockchain.Sonic; readonly name: "Sonic"; readonly title: "Sonic Mainnet"; readonly nativeCurrency: { readonly name: "Sonic"; readonly symbol: "S"; readonly decimals: 18; }; readonly chainId: 146; readonly isTestnet: false; readonly explorerUrl: "https://sonicscan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.soniclabs.com"]; readonly eurcAddress: null; readonly usdcAddress: "0x29219dd400f2Bf60E5a23d13Be72B486D4038894"; readonly usdtAddress: null; readonly cctp: { readonly domain: 13; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 13; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Sonic Testnet chain definition * @remarks * This represents the official test network for the Sonic blockchain. */ declare const SonicTestnet: { readonly type: "evm"; readonly chain: Blockchain.Sonic_Testnet; readonly name: "Sonic Testnet"; readonly title: "Sonic Testnet"; readonly nativeCurrency: { readonly name: "Sonic"; readonly symbol: "S"; readonly decimals: 18; }; readonly chainId: 14601; readonly isTestnet: true; readonly explorerUrl: "https://testnet.sonicscan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://rpc.testnet.soniclabs.com"]; readonly eurcAddress: null; readonly usdcAddress: "0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51"; readonly usdtAddress: null; readonly cctp: { readonly domain: 13; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 1; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 13; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Solana Mainnet chain definition * @remarks * This represents the official production network for the Solana blockchain. */ declare const Solana: { readonly type: "solana"; readonly chain: Blockchain.Solana; readonly name: "Solana"; readonly title: "Solana Mainnet"; readonly nativeCurrency: { readonly name: "Solana"; readonly symbol: "SOL"; readonly decimals: 9; }; readonly isTestnet: false; readonly explorerUrl: "https://solscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://api.mainnet-beta.solana.com"]; readonly eurcAddress: "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"; readonly usdcAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"; readonly usdtAddress: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"; readonly cctp: { readonly domain: 5; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3"; readonly messageTransmitter: "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd"; readonly confirmations: 32; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "CCTPV2vPZJS2u2BBsUoscuikbYjnpFmbFsvVuJdgUMQe"; readonly messageTransmitter: "CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC"; readonly confirmations: 32; readonly fastConfirmations: 3; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "DFaauJEjmiHkPs1JG89A4p95hDWi9m9SAEERY1LQJiC3"; }; readonly gateway: { readonly domain: 5; readonly contracts: { readonly v1: { readonly wallet: "GATEwy4YxeiEbRJLwB6dXgg7q61e6zBPrMzYj5h1pRXQ"; readonly minter: "GATEm5SoBJiSw1v2Pz1iPBgUYkXzCUJ27XSXhDfSyzVZ"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Solana Devnet chain definition * @remarks * This represents the development test network for the Solana blockchain. */ declare const SolanaDevnet: { readonly type: "solana"; readonly chain: Blockchain.Solana_Devnet; readonly name: "Solana Devnet"; readonly title: "Solana Development Network"; readonly nativeCurrency: { readonly name: "Solana"; readonly symbol: "SOL"; readonly decimals: 9; }; readonly isTestnet: true; readonly explorerUrl: "https://solscan.io/tx/{hash}?cluster=devnet"; readonly eurcAddress: "HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr"; readonly usdcAddress: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU"; readonly usdtAddress: null; readonly cctp: { readonly domain: 5; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3"; readonly messageTransmitter: "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd"; readonly confirmations: 32; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "CCTPV2vPZJS2u2BBsUoscuikbYjnpFmbFsvVuJdgUMQe"; readonly messageTransmitter: "CCTPV2Sm4AdWt5296sk4P66VBZ7bEhcARwFaaS9YPbeC"; readonly confirmations: 32; readonly fastConfirmations: 3; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "DFaauJEjmiHkPs1JG89A4p95hDWi9m9SAEERY1LQJiC3"; }; readonly rpcEndpoints: readonly ["https://api.devnet.solana.com"]; readonly gateway: { readonly domain: 5; readonly contracts: { readonly v1: { readonly wallet: "GATEwdfmYNELfp5wDmmR6noSr2vHnAfBPMm2PvCzX5vu"; readonly minter: "GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Stellar Mainnet chain definition * @remarks * This represents the official production network for the Stellar blockchain. */ declare const Stellar: { readonly type: "stellar"; readonly chain: Blockchain.Stellar; readonly name: "Stellar"; readonly title: "Stellar Mainnet"; readonly nativeCurrency: { readonly name: "Stellar Lumens"; readonly symbol: "XLM"; readonly decimals: 7; }; readonly isTestnet: false; readonly explorerUrl: "https://stellar.expert/explorer/public/tx/{hash}"; readonly rpcEndpoints: readonly ["https://horizon.stellar.org"]; readonly eurcAddress: "EURC-GDHU6WRG4IEQXM5NZ4BMPKOXHW76MZM4Y2IEMFDVXBSDP6SJY4ITNPP2"; readonly usdcAddress: "USDC-GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN"; readonly usdtAddress: null; readonly cctp: null; }; /** * Stellar Testnet chain definition * @remarks * This represents the official test network for the Stellar blockchain. */ declare const StellarTestnet: { readonly type: "stellar"; readonly chain: Blockchain.Stellar_Testnet; readonly name: "Stellar Testnet"; readonly title: "Stellar Test Network"; readonly nativeCurrency: { readonly name: "Stellar Lumens"; readonly symbol: "XLM"; readonly decimals: 7; }; readonly isTestnet: true; readonly explorerUrl: "https://stellar.expert/explorer/testnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://horizon-testnet.stellar.org"]; readonly eurcAddress: "EURC-GB3Q6QDZYTHWT7E5PVS3W7FUT5GVAFC5KSZFFLPU25GO7VTC3NM2ZTVO"; readonly usdcAddress: "USDC-GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5"; readonly usdtAddress: null; readonly cctp: null; }; /** * Sui Mainnet chain definition * @remarks * This represents the official production network for the Sui blockchain. */ declare const Sui: { readonly type: "sui"; readonly chain: Blockchain.Sui; readonly name: "Sui"; readonly title: "Sui Mainnet"; readonly nativeCurrency: { readonly name: "Sui"; readonly symbol: "SUI"; readonly decimals: 9; }; readonly isTestnet: false; readonly explorerUrl: "https://suiscan.xyz/mainnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://fullnode.mainnet.sui.io"]; readonly eurcAddress: null; readonly usdcAddress: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC"; readonly usdtAddress: null; readonly cctp: { readonly domain: 8; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x2aa6c5d56376c371f88a6cc42e852824994993cb9bab8d3e6450cbe3cb32b94e"; readonly messageTransmitter: "0x08d87d37ba49e785dde270a83f8e979605b03dc552b5548f26fdf2f49bf7ed1b"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Sui Testnet chain definition * @remarks * This represents the official test network for the Sui blockchain. */ declare const SuiTestnet: { readonly type: "sui"; readonly chain: Blockchain.Sui_Testnet; readonly name: "Sui Testnet"; readonly title: "Sui Test Network"; readonly nativeCurrency: { readonly name: "Sui"; readonly symbol: "SUI"; readonly decimals: 9; }; readonly isTestnet: true; readonly explorerUrl: "https://suiscan.xyz/testnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://fullnode.testnet.sui.io"]; readonly eurcAddress: null; readonly usdcAddress: "0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC"; readonly usdtAddress: null; readonly cctp: { readonly domain: 8; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x31cc14d80c175ae39777c0238f20594c6d4869cfab199f40b69f3319956b8beb"; readonly messageTransmitter: "0x4931e06dce648b3931f890035bd196920770e913e43e45990b383f6486fdd0a5"; readonly confirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; }; /** * Unichain Mainnet chain definition * @remarks * This represents the official production network for the Unichain blockchain. */ declare const Unichain: { readonly type: "evm"; readonly chain: Blockchain.Unichain; readonly name: "Unichain"; readonly title: "Unichain Mainnet"; readonly nativeCurrency: { readonly name: "Uni"; readonly symbol: "UNI"; readonly decimals: 18; }; readonly chainId: 130; readonly isTestnet: false; readonly explorerUrl: "https://unichain.blockscout.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet.unichain.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x078D782b760474a361dDA0AF3839290b0EF57AD6"; readonly usdtAddress: null; readonly cctp: { readonly domain: 10; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x4e744b28E787c3aD0e810eD65A24461D4ac5a762"; readonly messageTransmitter: "0x353bE9E2E38AB1D19104534e4edC21c643Df86f4"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 10; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * Unichain Sepolia Testnet chain definition * @remarks * This represents the official test network for the Unichain blockchain. */ declare const UnichainSepolia: { readonly type: "evm"; readonly chain: Blockchain.Unichain_Sepolia; readonly name: "Unichain Sepolia"; readonly title: "Unichain Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Uni"; readonly symbol: "UNI"; readonly decimals: 18; }; readonly chainId: 1301; readonly isTestnet: true; readonly explorerUrl: "https://unichain-sepolia.blockscout.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://sepolia.unichain.org"]; readonly eurcAddress: null; readonly usdcAddress: "0x31d0220469e10c4E71834a79b1f276d740d3768F"; readonly usdtAddress: null; readonly cctp: { readonly domain: 10; readonly contracts: { readonly v1: { readonly type: "split"; readonly tokenMessenger: "0x8ed94B8dAd2Dc5453862ea5e316A8e71AAed9782"; readonly messageTransmitter: "0xbc498c326533d675cf571B90A2Ced265ACb7d086"; readonly confirmations: 65; }; readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 10; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * World Chain chain definition * @remarks * This represents the main network for the World Chain blockchain. */ declare const WorldChain: { readonly type: "evm"; readonly chain: Blockchain.World_Chain; readonly name: "World Chain"; readonly title: "World Chain"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 480; readonly isTestnet: false; readonly explorerUrl: "https://worldscan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://worldchain-mainnet.g.alchemy.com/public"]; readonly eurcAddress: null; readonly usdcAddress: "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"; readonly usdtAddress: null; readonly cctp: { readonly domain: 14; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cF5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; readonly gateway: { readonly domain: 14; readonly contracts: { readonly v1: { readonly wallet: "0x77777777Dcc4d5A8B6E418Fd04D8997ef11000eE"; readonly minter: "0x2222222d7164433c4C09B0b0D809a9b52C04C205"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * World Chain Sepolia chain definition * @remarks * This represents the test network for the World Chain blockchain. */ declare const WorldChainSepolia: { readonly type: "evm"; readonly chain: Blockchain.World_Chain_Sepolia; readonly name: "World Chain Sepolia"; readonly title: "World Chain Sepolia"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 4801; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.worldscan.org/tx/{hash}"; readonly rpcEndpoints: readonly ["https://worldchain-sepolia.drpc.org", "https://worldchain-sepolia.g.alchemy.com/public"]; readonly eurcAddress: null; readonly usdcAddress: "0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88"; readonly usdtAddress: null; readonly cctp: { readonly domain: 14; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xe737e5cebeeba77efe34d4aa090756590b1ce275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; readonly gateway: { readonly domain: 14; readonly contracts: { readonly v1: { readonly wallet: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9"; readonly minter: "0x0022222ABE238Cc2C7Bb1f21003F0a260052475B"; }; }; readonly forwarderSupported: { readonly source: true; readonly destination: true; }; }; }; /** * XDC Mainnet chain definition * @remarks * This represents the official production network for the XDC blockchain. * XDC is a Layer 1 blockchain specialized for DeFi and trading applications * with native orderbook and matching engine. */ declare const XDC: { readonly type: "evm"; readonly chain: Blockchain.XDC; readonly name: "XDC"; readonly title: "XDC Mainnet"; readonly nativeCurrency: { readonly name: "XDC"; readonly symbol: "XDC"; readonly decimals: 18; }; readonly chainId: 50; readonly isTestnet: false; readonly explorerUrl: "https://xdcscan.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://erpc.xdcrpc.com", "https://erpc.xinfin.network"]; readonly eurcAddress: null; readonly usdcAddress: "0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1"; readonly usdtAddress: null; readonly cctp: { readonly domain: 18; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly tokenMessengerWithFees: "0x71f54F818671cD0D7ea140Da213e5C8b5C92a408"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 3; readonly fastConfirmations: 3; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; readonly adapter: "0x7FB8c7260b63934d8da38aF902f87ae6e284a845"; }; }; /** * XDC Apothem Testnet chain definition * @remarks * This represents the official test network for the XDC Network, known as Apothem. */ declare const XDCApothem: { readonly type: "evm"; readonly chain: Blockchain.XDC_Apothem; readonly name: "Apothem Network"; readonly title: "Apothem Network"; readonly nativeCurrency: { readonly name: "TXDC"; readonly symbol: "TXDC"; readonly decimals: 18; }; readonly chainId: 51; readonly isTestnet: true; readonly explorerUrl: "https://testnet.xdcscan.com/tx/{hash}"; readonly rpcEndpoints: readonly ["https://erpc.apothem.network"]; readonly eurcAddress: null; readonly usdcAddress: "0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4"; readonly usdtAddress: null; readonly cctp: { readonly domain: 18; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly tokenMessengerWithFees: "0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 3; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: true; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * X Layer Mainnet chain definition * @remarks * This represents the official production network for the X Layer blockchain. * X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX, * using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the * OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.) */ declare const XLayer: { readonly type: "evm"; readonly chain: Blockchain.X_Layer; readonly name: "X Layer"; readonly title: "X Layer Mainnet"; readonly nativeCurrency: { readonly name: "OKB"; readonly symbol: "OKB"; readonly decimals: 18; }; readonly chainId: 196; readonly isTestnet: false; readonly explorerUrl: "https://www.oklink.com/xlayer/tx/{hash}"; readonly rpcEndpoints: readonly ["https://xlayerrpc.okx.com"]; readonly eurcAddress: null; readonly usdcAddress: "0xB6CEceAB302E2E4948951eE7843FC24E92933061"; readonly usdtAddress: null; readonly cctp: { readonly domain: 37; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d"; readonly messageTransmitter: "0x81D40F21F12A8F0E3252Bccb954D722d4c464B64"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0"; }; }; /** * X Layer Testnet chain definition * @remarks * This represents the official test network for the X Layer blockchain. * X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX, * using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the * OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.) */ declare const XLayerTestnet: { readonly type: "evm"; readonly chain: Blockchain.X_Layer_Testnet; readonly name: "X Layer Testnet"; readonly title: "X Layer Testnet"; readonly nativeCurrency: { readonly name: "OKB"; readonly symbol: "OKB"; readonly decimals: 18; }; readonly chainId: 1952; readonly isTestnet: true; readonly explorerUrl: "https://web3.okx.com/explorer/x-layer-testnet/tx/{hash}"; readonly rpcEndpoints: readonly ["https://testrpc.xlayer.tech"]; readonly eurcAddress: null; readonly usdcAddress: "0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3"; readonly usdtAddress: null; readonly cctp: { readonly domain: 37; readonly contracts: { readonly v2: { readonly type: "split"; readonly tokenMessenger: "0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA"; readonly messageTransmitter: "0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275"; readonly confirmations: 65; readonly fastConfirmations: 1; }; }; readonly forwarderSupported: { readonly source: false; readonly destination: false; }; }; readonly kitContracts: { readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d"; }; }; /** * ZKSync Era Mainnet chain definition * @remarks * This represents the official production network for the ZKSync Era blockchain. */ declare const ZKSyncEra: { readonly type: "evm"; readonly chain: Blockchain.ZKSync_Era; readonly name: "ZKSync Era"; readonly title: "ZKSync Era Mainnet"; readonly nativeCurrency: { readonly name: "Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 324; readonly isTestnet: false; readonly explorerUrl: "https://explorer.zksync.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://mainnet.era.zksync.io"]; readonly eurcAddress: null; readonly usdcAddress: "0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4"; readonly usdtAddress: null; readonly cctp: null; }; /** * ZKSync Era Sepolia Testnet chain definition * @remarks * This represents the official test network for the ZKSync Era blockchain on Sepolia. */ declare const ZKSyncEraSepolia: { readonly type: "evm"; readonly chain: Blockchain.ZKSync_Sepolia; readonly name: "ZKSync Era Sepolia"; readonly title: "ZKSync Era Sepolia Testnet"; readonly nativeCurrency: { readonly name: "Sepolia Ether"; readonly symbol: "ETH"; readonly decimals: 18; }; readonly chainId: 300; readonly isTestnet: true; readonly explorerUrl: "https://sepolia.explorer.zksync.io/tx/{hash}"; readonly rpcEndpoints: readonly ["https://sepolia.era.zksync.dev"]; readonly eurcAddress: null; readonly usdcAddress: "0xAe045DE5638162fa134807Cb558E15A3F5A7F853"; readonly usdtAddress: null; readonly cctp: null; }; declare const Chains_Algorand: typeof Algorand; declare const Chains_AlgorandTestnet: typeof AlgorandTestnet; declare const Chains_Aptos: typeof Aptos; declare const Chains_AptosTestnet: typeof AptosTestnet; declare const Chains_Arbitrum: typeof Arbitrum; declare const Chains_ArbitrumSepolia: typeof ArbitrumSepolia; declare const Chains_Arc: typeof Arc; declare const Chains_ArcTestnet: typeof ArcTestnet; declare const Chains_Avalanche: typeof Avalanche; declare const Chains_AvalancheFuji: typeof AvalancheFuji; declare const Chains_Base: typeof Base; declare const Chains_BaseSepolia: typeof BaseSepolia; declare const Chains_Celo: typeof Celo; declare const Chains_CeloAlfajoresTestnet: typeof CeloAlfajoresTestnet; declare const Chains_Codex: typeof Codex; declare const Chains_CodexTestnet: typeof CodexTestnet; declare const Chains_Cronos: typeof Cronos; declare const Chains_CronosTestnet: typeof CronosTestnet; declare const Chains_Edge: typeof Edge; declare const Chains_EdgeTestnet: typeof EdgeTestnet; declare const Chains_Ethereum: typeof Ethereum; declare const Chains_EthereumSepolia: typeof EthereumSepolia; declare const Chains_Hedera: typeof Hedera; declare const Chains_HederaTestnet: typeof HederaTestnet; declare const Chains_HyperEVM: typeof HyperEVM; declare const Chains_HyperEVMTestnet: typeof HyperEVMTestnet; declare const Chains_Injective: typeof Injective; declare const Chains_InjectiveTestnet: typeof InjectiveTestnet; declare const Chains_Ink: typeof Ink; declare const Chains_InkTestnet: typeof InkTestnet; declare const Chains_Linea: typeof Linea; declare const Chains_LineaSepolia: typeof LineaSepolia; declare const Chains_Monad: typeof Monad; declare const Chains_MonadTestnet: typeof MonadTestnet; declare const Chains_Morph: typeof Morph; declare const Chains_MorphTestnet: typeof MorphTestnet; declare const Chains_NEAR: typeof NEAR; declare const Chains_NEARTestnet: typeof NEARTestnet; declare const Chains_Noble: typeof Noble; declare const Chains_NobleTestnet: typeof NobleTestnet; declare const Chains_Optimism: typeof Optimism; declare const Chains_OptimismSepolia: typeof OptimismSepolia; declare const Chains_Pharos: typeof Pharos; declare const Chains_PharosTestnet: typeof PharosTestnet; declare const Chains_Plasma: typeof Plasma; declare const Chains_PlasmaTestnet: typeof PlasmaTestnet; declare const Chains_Plume: typeof Plume; declare const Chains_PlumeTestnet: typeof PlumeTestnet; declare const Chains_PolkadotAssetHub: typeof PolkadotAssetHub; declare const Chains_PolkadotWestmint: typeof PolkadotWestmint; declare const Chains_Polygon: typeof Polygon; declare const Chains_PolygonAmoy: typeof PolygonAmoy; declare const Chains_Sei: typeof Sei; declare const Chains_SeiTestnet: typeof SeiTestnet; declare const Chains_Solana: typeof Solana; declare const Chains_SolanaDevnet: typeof SolanaDevnet; declare const Chains_Sonic: typeof Sonic; declare const Chains_SonicTestnet: typeof SonicTestnet; declare const Chains_Stellar: typeof Stellar; declare const Chains_StellarTestnet: typeof StellarTestnet; declare const Chains_Sui: typeof Sui; declare const Chains_SuiTestnet: typeof SuiTestnet; declare const Chains_Unichain: typeof Unichain; declare const Chains_UnichainSepolia: typeof UnichainSepolia; declare const Chains_WorldChain: typeof WorldChain; declare const Chains_WorldChainSepolia: typeof WorldChainSepolia; declare const Chains_XDC: typeof XDC; declare const Chains_XDCApothem: typeof XDCApothem; declare const Chains_XLayer: typeof XLayer; declare const Chains_XLayerTestnet: typeof XLayerTestnet; declare const Chains_ZKSyncEra: typeof ZKSyncEra; declare const Chains_ZKSyncEraSepolia: typeof ZKSyncEraSepolia; declare namespace Chains { export { Chains_Algorand as Algorand, Chains_AlgorandTestnet as AlgorandTestnet, Chains_Aptos as Aptos, Chains_AptosTestnet as AptosTestnet, Chains_Arbitrum as Arbitrum, Chains_ArbitrumSepolia as ArbitrumSepolia, Chains_Arc as Arc, Chains_ArcTestnet as ArcTestnet, Chains_Avalanche as Avalanche, Chains_AvalancheFuji as AvalancheFuji, Chains_Base as Base, Chains_BaseSepolia as BaseSepolia, Chains_Celo as Celo, Chains_CeloAlfajoresTestnet as CeloAlfajoresTestnet, Chains_Codex as Codex, Chains_CodexTestnet as CodexTestnet, Chains_Cronos as Cronos, Chains_CronosTestnet as CronosTestnet, Chains_Edge as Edge, Chains_EdgeTestnet as EdgeTestnet, Chains_Ethereum as Ethereum, Chains_EthereumSepolia as EthereumSepolia, Chains_Hedera as Hedera, Chains_HederaTestnet as HederaTestnet, Chains_HyperEVM as HyperEVM, Chains_HyperEVMTestnet as HyperEVMTestnet, Chains_Injective as Injective, Chains_InjectiveTestnet as InjectiveTestnet, Chains_Ink as Ink, Chains_InkTestnet as InkTestnet, Chains_Linea as Linea, Chains_LineaSepolia as LineaSepolia, Chains_Monad as Monad, Chains_MonadTestnet as MonadTestnet, Chains_Morph as Morph, Chains_MorphTestnet as MorphTestnet, Chains_NEAR as NEAR, Chains_NEARTestnet as NEARTestnet, Chains_Noble as Noble, Chains_NobleTestnet as NobleTestnet, Chains_Optimism as Optimism, Chains_OptimismSepolia as OptimismSepolia, Chains_Pharos as Pharos, Chains_PharosTestnet as PharosTestnet, Chains_Plasma as Plasma, Chains_PlasmaTestnet as PlasmaTestnet, Chains_Plume as Plume, Chains_PlumeTestnet as PlumeTestnet, Chains_PolkadotAssetHub as PolkadotAssetHub, Chains_PolkadotWestmint as PolkadotWestmint, Chains_Polygon as Polygon, Chains_PolygonAmoy as PolygonAmoy, Chains_Sei as Sei, Chains_SeiTestnet as SeiTestnet, Chains_Solana as Solana, Chains_SolanaDevnet as SolanaDevnet, Chains_Sonic as Sonic, Chains_SonicTestnet as SonicTestnet, Chains_Stellar as Stellar, Chains_StellarTestnet as StellarTestnet, Chains_Sui as Sui, Chains_SuiTestnet as SuiTestnet, Chains_Unichain as Unichain, Chains_UnichainSepolia as UnichainSepolia, Chains_WorldChain as WorldChain, Chains_WorldChainSepolia as WorldChainSepolia, Chains_XDC as XDC, Chains_XDCApothem as XDCApothem, Chains_XLayer as XLayer, Chains_XLayerTestnet as XLayerTestnet, Chains_ZKSyncEra as ZKSyncEra, Chains_ZKSyncEraSepolia as ZKSyncEraSepolia, }; } /** * Resolves a flexible chain identifier to a ChainDefinition. * * This function handles all three supported formats: * - ChainDefinition objects (passed through unchanged) * - Blockchain enum values (resolved via getChainByEnum) * - String literals of blockchain values (resolved via getChainByEnum) * * @param chainIdentifier - The chain identifier to resolve * @returns The resolved ChainDefinition object * @throws Error if the chain identifier cannot be resolved * * @example * ```typescript * import { resolveChainIdentifier } from '@core/chains' * import { Blockchain, Ethereum } from '@core/chains' * * // All of these resolve to the same ChainDefinition: * const chain1 = resolveChainIdentifier(Ethereum) * const chain2 = resolveChainIdentifier(Blockchain.Ethereum) * const chain3 = resolveChainIdentifier('Ethereum') * ``` */ declare function resolveChainIdentifier(chainIdentifier: ChainIdentifier$1): ChainDefinition; /** * Core type definitions for blockchain transaction execution and gas estimation. * * This module provides TypeScript interfaces and types for handling blockchain * transactions across different networks, with a focus on EVM-compatible chains * and gas estimation. * * @module types */ /** * Estimated gas information for a blockchain transaction. * * This interface provides a unified way to represent gas costs across different * blockchain networks, supporting both EVM-style gas calculations and other * fee models. * * @interface EstimatedGas * @category Types * @example * ```typescript * // EVM chain example * const evmGas: EstimatedGas = { * gas: 21000n, * gasPrice: 1000000000n, // 1 Gwei * fee: (21000n * 1000000000n).toString() // Total fee in wei * }; * * // Solana example * const solanaGas: EstimatedGas = { * gas: 5000n, // Lamports for compute units * fee: '5000' // Total fee in Lamports * }; * ``` */ interface EstimatedGas { /** * The amount of gas estimated for the transaction. * For EVM chains, this represents the gas units. * For other chains, this might represent compute units or similar metrics. * * @example 21000n, 5000n */ gas: bigint; /** * The estimated price per unit of gas. * This is primarily used in EVM chains where gas price is a separate metric. * * @example 1000000000n */ gasPrice: bigint; /** * The total estimated fee as a string. * This field is useful for chains where gas/gasPrice isn't the whole story * or when the total fee needs to be represented in a different format. * For EVM chains, this is the total fee in wei (gas * gasPrice). * * @example "21000000000000", "5000" */ fee: string; } /** * Override parameters for EVM gas estimation. * * These parameters allow customization of gas estimation behavior * for EVM-compatible chains. * * @interface EvmEstimateOverrides */ interface EvmEstimateOverrides { /** * The sender's address for the transaction. * @example "0x742d35Cc6634C0532925a3b844Bc454e4438f44e" */ from?: string; /** * The value to be sent with the transaction in wei. * @example 1000000000000000000n // 1 ETH */ value?: bigint; /** * The block tag to use for estimation. * @example "latest", "safe", "finalized" */ blockTag?: 'latest' | 'earliest' | 'pending' | 'safe' | 'finalized'; /** * The maximum gas limit for the transaction. * @example 3000000 */ gasLimit?: number; /** * The maximum fee per gas unit (EIP-1559). * @example 20000000000n // 20 Gwei */ maxFeePerGas?: bigint; /** * The maximum priority fee per gas unit (EIP-1559). * @example 1500000000n // 1.5 Gwei */ maxPriorityFeePerGas?: bigint; } /** * Extended override parameters for EVM transaction execution. * * Includes all estimation overrides plus additional parameters * specific to transaction execution. * * @interface EvmExecuteOverrides * @extends EvmEstimateOverrides */ interface EvmExecuteOverrides extends EvmEstimateOverrides { /** * The nonce to use for the transaction. * If not provided, the current nonce of the sender will be used. * @example 42 */ nonce?: number; } /** * Raw EVM call data tuple for a single contract interaction. * * Represents the minimal data needed to submit an EVM transaction: * the target contract address, the ABI-encoded calldata, and an * optional native token value. Used by EIP-5792 batched execution * to compose multiple calls into a single `wallet_sendCalls` request. * * @interface EvmCallData * * @example * ```typescript * const callData: EvmCallData = { * to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', * data: '0x095ea7b3000000000000000000000000...', * } * ``` */ interface EvmCallData { /** The target contract address. */ to: `0x${string}`; /** The ABI-encoded function calldata. */ data: `0x${string}`; /** Optional native token value to send with the call. */ value?: bigint | undefined; } /** * Prepared contract execution for EVM chains. * * Represents a prepared contract execution that can be estimated * and executed on EVM-compatible chains. * * @interface EvmPreparedChainRequest */ interface EvmPreparedChainRequest { /** The type of the prepared execution. */ type: 'evm'; /** * Estimate the gas cost for the contract execution. * * @param overrides - Optional parameters to override the default estimation behavior * @param fallback - Optional fallback gas information to use if the estimation fails * @returns A promise that resolves to the estimated gas information * @throws If the estimation fails */ estimate(overrides?: EvmEstimateOverrides, fallback?: EstimatedGas): Promise; /** * Execute the prepared contract call. * * @param overrides - Optional parameters to override the default execution behavior * @returns A promise that resolves to the transaction hash * @throws If the execution fails */ execute(overrides?: EvmExecuteOverrides): Promise; /** * Return the raw call tuple without executing or estimating. * * Expose the `{ to, data, value }` triple that would be sent on-chain so * callers can feed it into EIP-5792 `wallet_sendCalls` or other batching * mechanisms. This method is optional -- adapters that do not support * calldata extraction (e.g. Ethers v6) may omit it. * * @returns The raw EVM call data for this prepared request. * @throws Never — synchronous accessor with no failure path. * @since 2.0.0 * * @example * ```typescript * const prepared = await adapter.prepare(params, ctx) * if (prepared.getCallData) { * const { to, data, value } = prepared.getCallData() * console.log('Target:', to, 'Data:', data) * } * ``` */ getCallData?(): EvmCallData; } /** * Union type for all supported prepared contract executions. * Currently only supports EVM chains, but can be extended for other chains. */ type PreparedChainRequest = EvmPreparedChainRequest | SolanaPreparedChainRequest | NoopPreparedChainRequest; /** * Parameters for preparing an EVM contract execution. */ type EvmPreparedChainRequestParams = { /** The type of the prepared execution. */ type: 'evm'; /** The ABI of the contract. */ abi: Abi | string[]; /** The address of the contract. */ address: `0x${string}`; /** The name of the function to call. */ functionName: string; /** The arguments to pass to the function. */ args: unknown[]; /** * Specific block number to read contract state at (read-only calls only). * Used for historical reads, e.g. checking delegate status at Gateway's * processed height rather than the latest block. Ignored for write * operations (transactions). */ blockNumber?: bigint; } & Partial; /** * Parameters for preparing an EIP-712 typed data signing request (EVM). * When executed, returns the signature hex string. */ interface EvmSignTypedDataPreparedChainRequestParams { type: 'evm-sign-typed-data'; typedData: { types: Record; domain: Record; primaryType: string; message: Record; }; } /** * Solana-specific parameters for preparing a transaction. * * @example * ```typescript * import type { SolanaPreparedChainRequestParams } from '@core/adapter' * * const params: SolanaPreparedChainRequestParams = { * instructions: [transferInstruction], * addressLookupTables: [], * } * ``` */ interface SolanaPreparedChainRequestParams { /** * The array of instructions to include in the transaction. * * @remarks * Used for instruction-based transaction building. Mutually exclusive with * `serializedTransaction`. */ instructions?: TransactionInstruction[]; /** * A pre-serialized transaction as a Uint8Array (e.g., from a service like Jupiter). * * @remarks * Used for executing pre-built transactions from external services. * The transaction may be partially signed. Mutually exclusive with `instructions`. */ serializedTransaction?: Uint8Array; /** * Additional signers besides the Adapter's wallet (e.g. program-derived authorities). */ signers?: Signer[]; /** * Optional override for how many compute units this transaction may consume. * If omitted, the network's default compute budget applies. */ computeUnitLimit?: number; /** * Optional Address Lookup Table accounts for transaction compression. * Used to reduce transaction size by compressing frequently-used addresses. * This is used by @solana/web3.js adapters that have already fetched the ALT data. */ addressLookupTableAccounts?: AddressLookupTableAccount[]; /** * Optional Address Lookup Table addresses for transaction compression. * Used by adapters that need to fetch ALT data themselves (e.g., @solana/kit adapters). * These are base58-encoded addresses of ALT accounts to use for compression. */ addressLookupTableAddresses?: string[]; } /** * Parameters for preparing a message signing request (Solana). * When executed, returns the signature. * * @example * ```typescript * import type { SolanaSignMessagePreparedChainRequestParams } from '@core/adapter' * * const params: SolanaSignMessagePreparedChainRequestParams = { * type: 'solana-sign-message', * message: new TextEncoder().encode('Sign this message'), * } * ``` */ interface SolanaSignMessagePreparedChainRequestParams { type: 'solana-sign-message'; message: Uint8Array; } /** * Solana-specific configuration for transaction estimation. * @interface SolanaEstimateOverrides */ interface SolanaEstimateOverrides { /** Optional compute unit limit for the transaction. */ computeUnitLimit?: number; } /** * Solana-specific configuration for transaction execution. * @interface SolanaExecuteOverrides * @extends SolanaEstimateOverrides */ interface SolanaExecuteOverrides extends SolanaEstimateOverrides { /** The commitment level for the transaction. */ preflightCommitment?: 'processed' | 'confirmed' | 'finalized'; /** The maximum number of retries for the transaction. */ maxRetries?: number; /** Whether to skip the preflight check. */ skipPreflight?: boolean; } /** * Solana-specific prepared chain request. * @interface SolanaPreparedChainRequest */ interface SolanaPreparedChainRequest { /** The type of the chain request. */ type: 'solana'; /** Estimate the compute units and fee for the transaction. */ estimate(overrides?: SolanaEstimateOverrides, fallback?: EstimatedGas): Promise; /** Execute the prepared transaction. */ execute(overrides?: SolanaExecuteOverrides): Promise; } /** * No-op prepared chain request for unsupported operations. * * This interface represents a prepared chain request that performs no operation. * It is returned when an action is not supported by the target chain or when * no actual blockchain interaction is required. * * @remarks * The estimate and execute methods return placeholder values since no actual * transaction is performed. This allows the calling code to handle unsupported * operations gracefully without breaking the expected interface contract. * * @example * ```typescript * const noopRequest: NoopPreparedChainRequest = { * type: 'noop', * estimate: async () => ({ gasLimit: 0n, gasPrice: 0n, totalFee: 0n }), * execute: async () => '0x0000000000000000000000000000000000000000000000000000000000000000' * } * ``` */ interface NoopPreparedChainRequest { /** The type of the prepared request. */ type: 'noop'; /** * Placeholder for the estimate method. * @returns The estimated gas cost. */ estimate: (overrides?: EvmEstimateOverrides | SolanaEstimateOverrides, fallback?: EstimatedGas) => Promise; /** * Placeholder for the execute method. * @returns The transaction hash. */ execute: () => Promise; } /** * Union type for all supported contract execution parameters. * Currently only supports EVM chains, but can be extended for other chains. */ type PreparedChainRequestParams = EvmPreparedChainRequestParams | EvmSignTypedDataPreparedChainRequestParams | SolanaPreparedChainRequestParams | SolanaSignMessagePreparedChainRequestParams; /** * Response from waiting for a transaction to be mined and confirmed on the blockchain. * * @interface WaitForTransactionResponse */ interface WaitForTransactionResponse { /** * The transaction hash identifier. * @example "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef" */ txHash: string; /** * The final status of the transaction execution. * Indicates whether the transaction was successfully executed or reverted. * @example "success", "reverted" */ status: 'success' | 'reverted'; /** * The total amount of gas used by all transactions in the block up to and including this transaction. * Represents the cumulative gas consumption within the block. * @example 2100000n */ cumulativeGasUsed?: bigint; /** * The amount of gas actually consumed by this specific transaction. * This value is always less than or equal to the gas limit set for the transaction. * @example 21000n */ gasUsed?: bigint; /** * The block number where the transaction was mined. * Represents the sequential position of the block in the blockchain. * @example 18500000n */ blockNumber?: bigint; /** * The hash of the block containing this transaction. * Provides a unique identifier for the block where the transaction was included. * @example "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890" */ blockHash?: string; /** * The zero-based index position of the transaction within the block. * Indicates the order in which this transaction appears in the block. * @example 5 */ transactionIndex?: number; /** * The actual gas price paid per unit of gas for this transaction. * For EIP-1559 transactions, this reflects the base fee plus priority fee. * @example 15000000000n // 15 Gwei */ effectiveGasPrice?: bigint; } interface WaitForTransactionConfig { /** * The timeout for the transaction to be mined and confirmed on the blockchain. * @example 10000 */ timeout?: number | undefined; /** * The number of confirmations to wait for the transaction to be mined and confirmed on the blockchain. * @example 1 */ confirmations?: number; /** * The maximum supported transaction version for getTransaction. * Defaults to 0 if not provided. * @example 0 */ maxSupportedTransactionVersion?: number; } /** * Type utility to extract the address context from adapter capabilities. * * @typeParam TAdapterCapabilities - The adapter capabilities type * @returns The address context type or never if capabilities are undefined */ type ExtractAddressContext = TAdapterCapabilities extends { addressContext: infer TContext; } ? TContext : never; type AddressField = TAddressContext extends 'user-controlled' ? { /** * ℹ️ Address is forbidden for user-controlled adapters. * * User-controlled adapters (like browser wallets or private key adapters) * automatically resolve the address from the connected wallet or signer. * Providing an explicit address would conflict with this behavior. * * @example * ```typescript * // ℹ️ This will cause a TypeScript error: * const context: AdapterContext<{ addressContext: 'user-controlled' }> = { * adapter: userAdapter, * chain: 'Ethereum', * address: '0x123...' // Error: Address is forbidden for user-controlled adapters * } * ``` */ address?: never; } : TAddressContext extends 'developer-controlled' ? { /** * ℹ️ Address is required for developer-controlled adapters. * * Developer-controlled adapters (like enterprise providers or server-side adapters) * require an explicit address for each operation since they don't have a single * connected wallet. The address must be provided for every operation. * * @example * ```typescript * // ℹ️ This is required: * const context: AdapterContext<{ addressContext: 'developer-controlled' }> = { * adapter: devAdapter, * chain: 'Ethereum', * address: '0x123...' // Required for developer-controlled adapters * } * * // ℹ️ This will cause a TypeScript error: * const context: AdapterContext<{ addressContext: 'developer-controlled' }> = { * adapter: devAdapter, * chain: 'Ethereum' * // Error: Address is required for developer-controlled adapters * } * ``` */ address: string; } : { /** * Address is optional for legacy adapters. * * Legacy adapters without defined capabilities maintain backward compatibility * by allowing optional address specification. */ address?: string; }; /** * Generic operation context for adapter methods with compile-time address validation. * * This type provides compile-time enforcement of address requirements based on the * adapter's capabilities. The address field behavior is determined by the adapter's * address control model: * * - **User-controlled adapters** (default): The `address` field is forbidden (never) because * the address is automatically resolved from the connected wallet or signer. * - **Developer-controlled adapters**: The `address` field is required (string) because * each operation must explicitly specify which address to use. * - **Legacy adapters**: The `address` field remains optional for backward compatibility. * * @typeParam TAdapterCapabilities - The adapter capabilities type to derive address requirements from * * @example * ```typescript * import { OperationContext } from '@core/adapter' * * // User-controlled adapter context (default - address forbidden) * type UserContext = OperationContext<{ addressContext: 'user-controlled', supportedChains: [] }> * const userCtx: UserContext = { * chain: 'Ethereum' * // address: '0x123...' // ❌ TypeScript error: address not allowed * } * * // Developer-controlled adapter context (explicit - address required) * type DevContext = OperationContext<{ addressContext: 'developer-controlled', supportedChains: [] }> * const devCtx: DevContext = { * chain: 'Ethereum', * address: '0x123...' // ✅ Required for developer-controlled * } * ``` */ type OperationContext = { /** * The blockchain network to use for this operation. */ chain: ChainIdentifier$1; } & AddressField>; /** * Fully resolved context for an adapter operation, with concrete chain and address. * * This interface guarantees that both the blockchain network (`chain`) and the account * address (`address`) are present and valid. It is produced by resolving an {@link OperationContext}, * which may have optional or conditional fields, into a form suitable for internal logic and action handlers. * * - `chain`: A fully resolved {@link ChainDefinition}, either explicitly provided or inferred from the adapter. * - `address`: A string representing the resolved account address, determined by the context or adapter, * depending on the address control model (developer- or user-controlled). * * Use this type when an operation requires both the chain and address to be unambiguous and available. * * @example * ```ts * import { ResolvedOperationContext} from "@core/adapter" * import { Solana, ChainDefinition } from '@core/chains'; * * const context: ResolvedOperationContext = { * chain: Solana, * address: '7Gk1v...abc123', // a valid Solana address * }; * * // Use context.chain and context.address in adapter operations * ``` */ interface ResolvedOperationContext { /** * The chain identifier for this operation. * Guaranteed to be defined - either from context or adapter default. */ chain: ChainDefinition; /** * The address for this operation. * Guaranteed to be defined - either specified (developer-controlled) or resolved (user-controlled). */ address: string; } /** * Base interface for all action parameter objects. * * Provide a compile-time marker to explicitly identify objects that represent * action parameters (leaf nodes) versus namespace containers that should be * traversed during type recursion. * * @remarks * This marker property exists only at the type level and is stripped away * during compilation. It serves as a deterministic way to identify action * parameter objects without relying on property name heuristics. * * All action parameter objects must extend this interface to be properly * recognized by the recursive utility types in the action system. */ interface ActionParameters { /** * Compile-time marker identifying this as an action parameter object. * * This property is used by the type system to distinguish between * namespace containers and action parameter definitions. It does not * exist at runtime and is purely for TypeScript's type checking. */ readonly __isActionParams: true; } /** * EIP-2612 permit signature parameters for gasless token approvals. * * Contains the signature components and deadline required for permit-based * token spending authorization without requiring separate approval transactions. * * @example * ```typescript * const permitParams: PermitParams = { * deadline: BigInt(Math.floor(Date.now() / 1000) + 3600), // 1 hour from now * v: 27, * r: '0x1234567890abcdef...', * s: '0xfedcba0987654321...' * } * ``` */ interface PermitParams { /** * Permit expiration timestamp (Unix timestamp in seconds). * * The permit signature becomes invalid after this timestamp. * Must be greater than the current block timestamp. */ deadline: bigint; /** * Recovery parameter of the ECDSA signature (27 or 28). * * Used to recover the public key from the signature components. */ v: number; /** * R component of the ECDSA signature. * * First 32 bytes of the signature as a hex string. */ r: string; /** * S component of the ECDSA signature. * * Second 32 bytes of the signature as a hex string. */ s: string; } /** * Action map for Circle's Cross-Chain Transfer Protocol (CCTP) version 2 operations. * * Define the parameter schemas for CCTP v2 actions that enable native USDC * transfers between supported blockchain networks. Use Circle's attestation * service to verify and complete cross-chain transactions with cryptographic * proof of burn and mint operations. * * @remarks * CCTP v2 represents Circle's native cross-chain transfer protocol that allows * USDC to move between chains without traditional lock-and-mint bridging. * Instead, USDC is burned on the source chain and minted natively on the * destination chain using cryptographic attestations. * * The protocol supports both "slow" (free) and "fast" (fee-based) transfer * modes, with configurable finality thresholds and destination execution * parameters for advanced use cases. * * @example * ```typescript * import type { CCTPv2ActionMap } from '@core/adapter/actions/cctp/v2' * import { mainnet, polygon } from '@core/chains' * * // Deposit and burn USDC for cross-chain transfer * const burnParams: CCTPv2ActionMap['depositForBurn'] = { * amount: '1000000', // 1 USDC (6 decimals) * mintRecipient: '0x742d35Cc6634C0532925a3b8D8E5e8d8D8e5e8d8D8e5e8', * maxFee: '1000', // 0.001 USDC fast fee * minFinalityThreshold: 65, * fromChain: mainnet, * toChain: polygon * } * * // Receive and mint USDC on destination chain * const receiveParams: CCTPv2ActionMap['receiveMessage'] = { * eventNonce: '0x123abc...', * attestation: '0xdef456...', * message: '0x789012...', * fromChain: mainnet, * toChain: polygon * } * ``` * * @see {@link ChainDefinitionWithCCTPv2} for supported chain definitions */ interface CCTPv2ActionMap { /** * Initiate a cross-chain USDC transfer by depositing and burning tokens on the source chain. * * Burn USDC tokens on the source chain and generate a message for attestation * by Circle's infrastructure. The burned tokens will be minted on the destination * chain once the attestation is obtained and the receive message is executed. * * @remarks * This action represents the first step in a CCTP cross-chain transfer. After * execution, you must wait for Circle's attestation service to observe the burn * event and provide a cryptographic attestation that can be used to mint the * equivalent amount on the destination chain. * * The `maxFee` parameter enables fast transfers through Circle's fast liquidity * network, where liquidity providers can fulfill transfers immediately in exchange * for a fee. Set to "0" for slower, free transfers that wait for full finality. */ depositForBurn: ActionParameters & { /** * Amount of USDC to deposit and burn (in token's smallest unit). * * Specify the amount in the token's atomic units (e.g., for USDC with * 6 decimals, "1000000" represents 1 USDC). This amount will be burned * on the source chain and minted on the destination chain. */ amount: bigint; /** * Address of the recipient who will receive minted tokens on the destination chain. * * Provide the destination address as a 32-byte hex string (bytes32 format). */ mintRecipient: string; /** * Address authorized to call receiveMessage on the destination chain. * * Restrict who can execute the final minting step on the destination chain. * If not specified or set to bytes32(0), any address can call receiveMessage. * Use this for advanced integrations requiring specific execution control. * * @defaultValue bytes32(0) - allows any address to complete the transfer */ destinationCaller?: string; /** * Maximum fee to pay for fast transfer fulfillment. * * Specify the maximum amount (in the same units as `amount`) you're willing * to pay for immediate liquidity. Set to "0" for free transfers that wait * for full chain finality. Higher fees increase the likelihood of fast * fulfillment. */ maxFee: bigint; /** * Minimum finality threshold for attestation eligibility. * * Set the number of confirmations required before Circle's attestation * service will observe and attest to the burn event. Higher values * provide stronger finality guarantees but increase transfer time. * Typical values: 1000 for fast transfers, 2000 for maximum security. */ minFinalityThreshold: number; /** * Source chain definition where tokens will be burned. */ fromChain: ChainDefinitionWithCCTPv2; /** * Destination chain definition where tokens will be minted. */ toChain: ChainDefinitionWithCCTPv2; }; /** * Complete a cross-chain transfer by receiving and processing an attested message. * * Execute the final step of a CCTP transfer by submitting Circle's attestation * and the original message to mint USDC tokens on the destination chain. * This action consumes the attestation and delivers tokens to the specified * recipient from the original burn operation. * * @remarks * This action must be called after obtaining a valid attestation from Circle's * API for a corresponding `depositForBurn` operation. The attestation proves * that tokens were burned on the source chain and authorizes minting the * equivalent amount on the destination chain. * * The message parameter contains the original burn message data, while the * attestation provides the cryptographic proof. Both must match exactly * with Circle's records for the transaction to succeed. */ receiveMessage: ActionParameters & { /** * Unique nonce identifying the specific burn event. * * Provide the event nonce from the MessageSent event emitted by the * depositForBurn transaction. This must be a 0x-prefixed 64-character * hex string representing the 32-byte nonce value. */ readonly eventNonce: string; /** * Cryptographic attestation from Circle's infrastructure. * * Submit the attestation obtained from Circle's API that proves the * corresponding burn event occurred and was observed. This must be * a valid 0x-prefixed hex string containing Circle's signature data. */ readonly attestation: string; /** * Original message bytes from the source chain burn event. * * Provide the raw message data emitted in the MessageSent event from * the depositForBurn transaction. This 0x-prefixed hex string contains * the encoded transfer details that will be verified against the attestation. */ readonly message: string; /** * Source chain definition where the original burn occurred. */ readonly fromChain: ChainDefinitionWithCCTPv2; /** * Destination chain definition where tokens will be minted. */ readonly toChain: ChainDefinitionWithCCTPv2; /** * Optional destination wallet address on the destination chain to receive minted USDC. * * When provided (e.g., for Solana), the mint instruction will derive the * recipient's Associated Token Account (ATA) from this address instead of * the adapter's default address. */ readonly destinationAddress?: string; /** * The mint recipient address from the decoded CCTP message. * * This is the actual address encoded in the burn message where tokens will be minted. * For Solana, this is already the Associated Token Account (ATA) address, not the owner. * For EVM chains, this is the recipient's wallet address. */ readonly mintRecipient?: string; }; /** * Initiate a cross-chain USDC transfer using a custom bridge contract with preapproval funnel. * * This action combines token approval and burning into a single transaction using * a custom bridge contract that supports preapproval functionality. It provides * enhanced gas efficiency by eliminating separate approval transactions while * maintaining the same developer interface as standard CCTP transfers. * * @remarks * This action is only available on chains that support custom bridge contracts, * as determined by `hasCustomContractSupport(chain, 'bridge')`. The custom bridge * handles token approval internally and supports advanced features like protocol * fees and custom routing logic. * * For basic use cases, this provides the same interface as `depositForBurn`. * For advanced use cases, optional protocol fee parameters enable custom fee * collection and revenue sharing models. * * @example * ```typescript * // Basic usage (same as depositForBurn) * await adapter.action('cctp.v2.customBurn', { * amount: BigInt('1000000'), * mintRecipient: '0x...', * maxFee: BigInt('1000'), * minFinalityThreshold: 65 * }) * * // Advanced usage with protocol fees * await adapter.action('cctp.v2.customBurn', { * amount: BigInt('1000000'), * mintRecipient: '0x...', * maxFee: BigInt('1000'), * minFinalityThreshold: 65, * protocolFee: BigInt('100'), * feeRecipient: '0xFeeRecipientAddress' * }) * ``` */ customBurn: ActionParameters & { /** * Amount of USDC to burn (in token's smallest unit). * * Specify the amount in the token's atomic units (e.g., for USDC with * 6 decimals, 1000000n represents 1 USDC). This amount will be burned * on the source chain and minted on the destination chain. */ amount: bigint; /** * Address of the recipient who will receive minted tokens on the destination chain. * * Provide the destination address as a 32-byte hex string (bytes32 format). */ mintRecipient: string; /** * Address authorized to call receiveMessage on the destination chain. * * Restrict who can execute the final minting step on the destination chain. * If not specified or set to bytes32(0), any address can call receiveMessage. * Use this for advanced integrations requiring specific execution control. * * @defaultValue bytes32(0) - allows any address to complete the transfer */ destinationCaller?: string; /** * Maximum fee to pay for fast transfer fulfillment. * * Specify the maximum amount (in the same units as `amount`) you're willing * to pay for immediate liquidity. Set to "0" for free transfers that wait * for full chain finality. Higher fees increase the likelihood of fast * fulfillment. */ maxFee: bigint; /** * Minimum finality threshold for attestation eligibility. * * Set the number of confirmations required before Circle's attestation * service will observe and attest to the burn event. Higher values * provide stronger finality guarantees but increase transfer time. * Typical values: 65 for standard transfers, 2000 for maximum security. */ minFinalityThreshold: number; /** * Protocol fee amount (in token's smallest unit). * * Additional fee charged by the custom bridge for enhanced functionality. * This fee is separate from the Circle fast transfer fee and is paid to * the specified fee recipient. Enables custom fee collection and revenue * sharing models for bridge operators. * * @defaultValue 0n - no protocol fee for basic usage */ protocolFee?: bigint | undefined; /** * Address to receive the protocol fee. * * Wallet address where the protocol fee will be sent. This enables * custom fee collection and revenue sharing models for bridge operators. * Only relevant when protocolFee is greater than 0. * * @defaultValue bridge contract address - safe fallback for zero fees */ feeRecipient?: string | undefined; /** * Source chain definition where tokens will be burned. */ fromChain: ChainDefinitionWithCCTPv2; /** * Destination chain definition where tokens will be minted. */ toChain: ChainDefinitionWithCCTPv2; /** * Permit parameters for the custom bridge contract. */ permitParams?: PermitParams; }; /** * Initiate a cross-chain USDC transfer using a custom bridge contract with hook data for CCTP forwarding. * * This action combines the custom bridge functionality with CCTP forwarding hookData. * It uses either `bridgeWithPreapprovalAndHook` or `bridgeWithPermitAndHook` contract * functions depending on whether permit parameters are provided. * * @remarks * When CCTP forwarding is enabled with custom burn, Circle's relay infrastructure will: * 1. Watch for the burn transaction with forwarding hookData * 2. Fetch the attestation automatically * 3. Submit the destination mint transaction on behalf of the user * 4. Deduct the relay fee from the minted USDC * * The hookData must be formatted with the CCTP forwarding magic bytes prefix * followed by version and length fields. Use the `buildForwardingHookData` * utility to construct properly formatted hookData. * * @example * ```typescript * import { buildForwardingHookData } from '@core/utils' * import { hasCustomContractSupport } from '@core/chains' * * if (hasCustomContractSupport(sourceChain, 'bridge')) { * await adapter.action('cctp.v2.customBurnWithHook', { * amount: BigInt('1000000'), * mintRecipient: '0x...', * maxFee: BigInt('50000'), * minFinalityThreshold: 1000, * fromChain: ethereum, * toChain: base, * hookData: buildForwardingHookData() * }) * } * ``` */ customBurnWithHook: CCTPv2ActionMap['customBurn'] & { /** * Hex-encoded hook data for CCTP forwarding. * * The hookData signals to Circle's Orbit relayer that forwarding is requested. * Must be formatted with the CCTP forwarding magic bytes prefix ("cctp-forward" * right-padded to 24 bytes) followed by uint32 version and uint32 length fields. * * Use the `buildForwardingHookData` utility to construct properly formatted hookData. */ hookData: string; }; /** * Initiate a cross-chain USDC transfer with hook data for CCTP forwarding. * * This action extends the standard `depositForBurn` with an additional `hookData` * parameter that signals to Circle's Orbit relayer that the user wants automated * attestation fetching and destination mint execution. * * @remarks * When CCTP forwarding is enabled, Circle's relay infrastructure will: * 1. Watch for the burn transaction with forwarding hookData * 2. Fetch the attestation automatically * 3. Submit the destination mint transaction on behalf of the user * 4. Deduct the relay fee from the minted USDC * * The hookData must be formatted with the CCTP forwarding magic bytes prefix * followed by version and length fields. Use the `buildForwardingHookData` * utility to construct properly formatted hookData. * * @example * ```typescript * import { buildForwardingHookData } from '@core/utils' * * await adapter.action('cctp.v2.depositForBurnWithHook', { * amount: BigInt('1000000'), * mintRecipient: '0x...', * maxFee: BigInt('50000'), // Must cover burn fee + forwarding fee * minFinalityThreshold: 1000, * fromChain: ethereum, * toChain: base, * hookData: buildForwardingHookData() * }) * ``` */ depositForBurnWithHook: CCTPv2ActionMap['depositForBurn'] & { /** * Hex-encoded hook data for CCTP forwarding. * * The hookData signals to Circle's Orbit relayer that forwarding is requested. * Must be formatted with the CCTP forwarding magic bytes prefix ("cctp-forward" * right-padded to 24 bytes) followed by uint32 version and uint32 length fields. * * Use the `buildForwardingHookData` utility to construct properly formatted hookData. */ hookData: string; }; /** * Initiate a prepaid cross-chain USDC transfer through the `TokenMessengerWithFees` wrapper. * * Burn USDC on the source chain while collecting all fees up front against a * signed quote. The wrapper collects the fee via `FeeManager`, then delegates * to the unmodified `TokenMessengerV2`. When `hookData` is provided (the * GenericExecutor FORWARD path) the wrapper's `depositForBurnWithHookAndFees` * contract method is used; otherwise `depositForBurnWithFees` is used. * * @remarks * SDK/contract naming: this SDK action is `depositForBurnWithFees` but, when a * `hookData` is present, it dispatches to the `depositForBurnWithHookAndFees` * contract method on `TokenMessengerWithFees` (NOT on `TokenMessengerV2`). * * Fee payment channel (must match the quote's `feeToken`): * - Native fee (`feeToken` is the zero address): exactly `feeTotalAmount` is * attached as `msg.value`. * - ERC-20 fee (e.g. USDC): no value is attached; the caller must first approve * the wrapper for `feeTotalAmount` (see the provider's fee approval helper). * * @remarks * Unlike `depositForBurn`, the `TokenMessengerWithFees` contract methods do NOT * take `maxFee` or `minFinalityThreshold` — fee and finality behavior are * derived from the signed quote — so those fields are omitted from this action. * * @example * ```typescript * await adapter.action('cctp.v2.depositForBurnWithFees', { * amount: BigInt('1000000'), * mintRecipient: executorAddress, // GenericExecutor (bytes32) * destinationCaller: executorAddress, // GenericExecutor (bytes32) * fromChain: ethereum, * toChain: arc, * hookData: geForwardHookData, // cctp-forward-wrapped GenericExecutor blob * claim: { signedQuote: '0x...', refundAddress: '0x...' }, * feeToken: '0x0000000000000000000000000000000000000000', // native * feeTotalAmount: 3500000n, * }) * ``` */ depositForBurnWithFees: Omit & { /** * Optional hex-encoded hook data for the GenericExecutor FORWARD path. * * When present, the `depositForBurnWithHookAndFees` contract method is used * and the blob must be wrapped in the `cctp-forward` envelope (the wrapper * rejects a FORWARD fee quote whose hook lacks it). When omitted, the plain * `depositForBurnWithFees` contract method is used. */ hookData?: string; /** * Signed fee quote claim passed to the `TokenMessengerWithFees` wrapper. * * `signedQuote` is the `[uint8 0x01][abi.encode(Quote)]` blob returned by the * Fee Quote service; `refundAddress` receives any fee overpayment refund. */ claim: QuoteClaim; /** * Fee token from the signed quote. * * The zero address (`0x000…0`) means the fee is paid in native currency and * is attached as `msg.value`. Any other address (e.g. USDC) means an ERC-20 * fee that must be approved to the wrapper beforehand. This is independent of * `burnToken`, which is always USDC. */ feeToken: string; /** * Total fee amount from the signed quote, in `feeToken` minor units. * * Firm only until the quote's `expiresAt`. For a native fee this is the exact * `msg.value`; for an ERC-20 fee this is the amount approved to the wrapper. */ feeTotalAmount: bigint; }; } /** * Signed fee quote claim consumed by the `TokenMessengerWithFees` wrapper. * * Mirrors the on-chain `IFeeManager.QuoteClaim` struct. * * @example * ```typescript * const claim: QuoteClaim = { * signedQuote: '0x01...', // [uint8 0x01][abi.encode(Quote)] * refundAddress: '0xUserWallet...', * } * ``` */ interface QuoteClaim { /** * Opaque signed quote bytes (`0x` hex) from the fee-quote service * (`SignedFeeQuote.signedQuote` returned by `fetchFeeQuote`). Pass verbatim; * do not decode. * * The quote binds the FORWARD fee item to the on-chain call via `argsHash`; * passing a quote that does not match the burn args reverts `QuoteArgsMismatch`. */ signedQuote: string; /** * Address that receives any refund of overpaid fees. * * Typically the user wallet that authorized the burn. */ refundAddress: string; } /** * Central registry for Cross-Chain Transfer Protocol (CCTP) action namespaces. * * Define versioned action maps for CCTP operations across different protocol * versions. Each version key represents a specific CCTP implementation with * its own parameter schemas and operational requirements. * * @remarks * CCTP actions enable cross-chain USDC transfers through Circle's native * bridging protocol. Each version namespace contains actions specific to * that protocol iteration, allowing for protocol upgrades while maintaining * backward compatibility in the action system. * * This interface follows the same pattern as other action namespaces but * is organized by protocol version rather than token type. * * @see {@link CCTPv2ActionMap} for version 2 action definitions */ interface CCTPActionMap { /** CCTP version 2 operations for cross-chain USDC transfers. */ readonly v2: CCTPv2ActionMap; } /** * Action map for Circle's CCTPx protocol operations. * * Define the parameter schemas for CCTPx actions that enable cross-chain transfers * of registered tokens (Circle-issued or otherwise) through Circle's `CrossChainTokenService` * (CCTS) contract. * * @remarks * CCTPx is a service-level protocol layered on top of CCTP v2's message-passing layer. * The CCTS contract coordinates token locking/burning, fee collection, and cross-chain * message dispatch. The SDK obtains a signed fee quote from IRIS, then calls * `crossChainTransfer` on CCTS with the quote bytes verbatim and the native fee as * `msg.value`. The auto-relay flow handled by Circle's Orbit relayer (paid for via the * `FORWARD` fee component included in the signed quote) means no separate * `receiveMessage` step is required on the destination. * * USDC and EURC bridging continues to use CCTP v2 (`cctp.v2.*`) actions, not CCTPx. * * @example * ```typescript * import type { ActionPayload } from '@core/adapter' * * const transferParams: ActionPayload<'cctpx.crossChainTransfer'> = { * tokenId: '0xabc123...', * amount: 1_000_000n, * destinationDomain: 1, * destinationAddress: '0xRecipient', * destinationCaller: '0x0000000000000000000000000000000000000000000000000000000000000000', * minFinalityThreshold: 1000, * claim: { signedQuote: '0xdeadbeef...', refundAddress: '0xSenderEOA...' }, * autoExecuteHookData: false, * hookData: '0x', * serviceAddress: '0xCCTSProxy...', * nativeFeeAmount: 100_000n, * fromChain, * } * ``` */ interface CCTPXActionMap { /** * Initiate a CCTPx cross-chain transfer through the `CrossChainTokenService` contract. * * Encode and submit a `crossChainTransfer(...)` call to the CCTS proxy on the source * chain, passing the IRIS-signed fee quote bytes verbatim and the native fee as * `msg.value`. The contract emits CCTP v2's `MessageSent` event, which IRIS attests * to before Circle's Orbit relayer auto-executes the destination mint. * * @remarks * The caller (typically `CCTPXBridgingProvider`) is responsible for: * - Resolving `tokenId` and the per-chain `tokenAddress` from the IRIS token registry * - Approving the per-token `TokenManager` for `amount` before this call * - Fetching `claim.signedQuote` and computing `nativeFeeAmount` from IRIS * * This action only encodes and submits the on-chain call; it does not perform any * off-chain orchestration. */ crossChainTransfer: ActionParameters & { /** * The CCTPx tokenId for the asset being transferred. * * Provided as a 32-byte hex string assigned by CCTPx at registration time. * The same `tokenId` is used across all chains for a given token; per-chain * `tokenAddress` is resolved from the IRIS token registry separately. */ tokenId: string; /** * Amount of the token to transfer, in the token's smallest units. */ amount: bigint; /** * CCTP domain identifier of the destination chain. * * CCTPx reuses CCTP v2 domain numbering; pass `dstChain.cctp.domain`. */ destinationDomain: number; /** * Recipient address on the destination chain, encoded as bytes. * * For EVM destinations this is a 20-byte address encoded as a hex string. */ destinationAddress: string; /** * `bytes32` value restricting which address may execute on the destination. * * Omit (or pass the 32-byte zero hash) to allow permissionless relay — the * default for auto-relayed CCTPx transfers. When omitted, the handler * substitutes the zero hash. * * @defaultValue `ZERO_HASH` — permissionless relay */ destinationCaller?: string; /** * Minimum finality threshold for attestation eligibility. * * Use `1000` for FAST transfers (pre-finality) or `2000` for SLOW transfers * (full finality). For FAST, the `claim.signedQuote` must include a * `PRE_FINALITY` item; otherwise the on-chain call reverts. */ minFinalityThreshold: number; /** * The CCTS fee-quote claim — maps 1:1 to the on-chain * `IFeeManager.QuoteClaim` tuple. * * The contract requires a tuple here, not a flat bytes blob. Encoding the * signed quote without the tuple wrapper produces a different function * selector and the call will revert. */ claim: { /** * IRIS-signed fee quote bytes, passed verbatim to the contract. * * Obtained from `POST /v1/quote/cctpx/{tokenId}/{src}/{dst}`. Contains the * version-prefixed ABI-encoded `Quote` struct and Circle's signature; the * `FeeManager` contract validates the signature against the quote items. */ signedQuote: string; /** * Address that receives any native-fee refund from `FeeManager`. * * Forwarded verbatim to `FeeManager` for refund attribution. The contract * accepts `address(0)` (the zero address) to disable refunds, so omitting * this field is safe; the handler will substitute the zero address. * * @defaultValue `ZERO_ADDRESS` — refunds disabled */ refundAddress?: string; }; /** * Whether the destination chain should auto-execute the hook data. * * For basic transfers this is `false`. Reserved for advanced integrations * that bundle a post-mint hook on the destination. */ autoExecuteHookData: boolean; /** * Optional hook data bytes passed through to the destination handler. * * Pass `'0x'` (empty bytes) for basic transfers. */ hookData: string; /** * The `CrossChainTokenService` proxy address on the source chain. * * Used as the transaction `to` field. Typically sourced from * `srcChain.cctpx.serviceAddress` — but is passed as an explicit parameter * so the action does not depend on chain-config narrowing at the call site. */ serviceAddress: string; /** * Native gas amount to send as `msg.value`. * * Must exactly equal `sum(quote.items[].amount)` when `feeToken` is the * native currency (the P0 default). The contract verifies the value against * the signed quote; do not over-send. */ nativeFeeAmount: bigint; /** * Source chain definition. * * Provides the adapter with chain context (chainId, RPC, etc.) for the call. */ fromChain: ChainDefinition; }; } /** * Permit signature standards for gasless token approvals. * * Defines the permit types that can be used to approve token spending * without requiring a separate approval transaction. * * @remarks * - NONE: No permit, tokens must be pre-approved via separate transaction * - EIP2612: Standard ERC-20 permit (USDC, DAI v2, and most modern tokens) */ declare enum PermitType { /** No permit required - tokens must be pre-approved */ NONE = 0, /** EIP-2612 standard permit */ EIP2612 = 1 } /** * Token input with permit signature for gasless approval. * * The Adapter Contract uses this to pull tokens from the user's wallet * using permit signatures instead of requiring separate approval transactions. * * Shared by the `swap.*` and `earn.*` action namespaces because both forward * `tokenInputs` unchanged to the adapter contract's `execute` call. * * @example * ```typescript * const tokenInput: TokenInput = { * permitType: PermitType.EIP2612, * token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC * amount: 1000000n, // 1 USDC * permitCalldata: '0x...' // Encoded permit(value, deadline, v, r, s) * } * ``` */ interface TokenInput { /** * Type of permit to execute. */ permitType: PermitType; /** * Token contract address to pull from user. */ token: `0x${string}`; /** * Amount of tokens to pull via permit. */ amount: bigint; /** * ABI-encoded permit calldata. * * For EIP-2612: encode(value, deadline, v, r, s) * * @example '0x0000000000000000000000000000000000000000000000000000000000989680...' */ permitCalldata: `0x${string}`; } /** * Parameters for executing a service-signed earn operation via the Adapter * smart contract on EVM chains. * * Shared across earn action keys: `earn.deposit`, `earn.withdraw`, and * `earn.claimRewards`. Each operation forwards the same `executeParams`, * `tokenInputs`, and `signature` triple to the adapter contract's `execute` * function. The service signs `executeParams` off-chain; the contract verifies * the signature on-chain. * * @example * ```typescript * import type { ActionPayload } from '@core/adapter' * * const params: ActionPayload<'earn.deposit'> = { * executeParams: { instructions: [], tokens: [], execId: 1n, deadline: 0n, metadata: '0x' }, * tokenInputs: [], * signature: '0x...', * } * * const prepared = await adapter.prepareAction('earn.deposit', params, { chain, address }) * const txHash = await prepared.execute() * ``` */ interface ExecuteEarnEVMParams extends ActionParameters { /** * Execution parameters returned by the earn service. * * Kept as an opaque record so the adapter forwards the service-signed struct * unchanged. The adapter contract ABI decodes it on-chain. */ executeParams: Record; /** * Token inputs with permit signatures for gasless approvals. * * Populated by the earn provider after it decides how token spending is * authorised. Today deposit uses a separate `token.approve` transaction and * passes `PermitType.NONE`; a future permit-enabled path can populate this * field without a breaking change. */ tokenInputs: TokenInput[]; /** * EIP-712 signature from the earn service proxy. * * The adapter contract verifies this signature on-chain. Passed through * unchanged. */ signature: `0x${string}`; } /** * Parameters for earn execute actions across supported ecosystems. * * EVM-only today; becomes a union when a non-EVM adapter implementation * lands. Action handlers narrow via a property-based type guard, same * pattern as {@link ExecuteSwapParams}. */ type ExecuteEarnParams = ExecuteEarnEVMParams; /** * Action map for earn operations. * * Each action key forwards the same `(executeParams, tokenInputs, signature)` * triple to the adapter contract. Provider-side orchestration performs any * required token approval; this action only prepares the adapter execute call. */ interface EarnActionMap { /** * Execute a service-signed deposit against the adapter contract. */ readonly deposit: ExecuteEarnParams; /** * Execute a service-signed withdraw against the adapter contract. */ readonly withdraw: ExecuteEarnParams; /** * Execute a service-signed claim rewards against the adapter contract. */ readonly claimRewards: ExecuteEarnParams; } /** * Single instruction to execute within the Adapter Contract. * * Each instruction represents a contract call (swap, fee collection, etc.) * with pre-execution approval and post-execution validation. * * @example * ```typescript * const swapInstruction: Instruction = { * target: '0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE', // LiFi Diamond * data: '0x...', // LiFi swap calldata * value: 0n, * tokenIn: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC * amountToApprove: 1000000000n, // 1000 USDC to approve * tokenOut: '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT * minTokenOut: 995000000n // 995 USDT minimum (0.5% slippage) * } * ``` */ interface Instruction { /** * Target contract address to call. * * Can be a DEX router, fee taker contract, or token contract. */ target: `0x${string}`; /** * ABI-encoded calldata for the target contract. */ data: `0x${string}`; /** * ETH value to send with the call (for native token operations). * * @defaultValue 0n */ value: bigint; /** * Token to approve to target before executing instruction. * * Set to zero address (0x00...00) to disable pre-approval. */ tokenIn: `0x${string}`; /** * Amount of tokenIn to approve to target before executing instruction. * * @remarks * Field name matches the adapter contract's `amountToApprove` parameter exactly. * * @defaultValue 0n if tokenIn is zero address */ amountToApprove: bigint; /** * Token to validate minimum balance after instruction. * * Set to zero address (0x00...00) to disable post-validation. */ tokenOut: `0x${string}`; /** * Minimum required balance of tokenOut after instruction. * * @defaultValue 0n if tokenOut is zero address */ minTokenOut: bigint; } /** * Token recipient for residual sweep. * * After all instructions complete, the Adapter Contract sweeps * any remaining balances to the specified beneficiaries. */ interface TokenRecipient { /** * Token contract address to sweep. */ token: `0x${string}`; /** * Address to receive swept tokens. */ beneficiary: `0x${string}`; } /** * Execution parameters for the Adapter Contract. * * This struct is signed via EIP-712 by the Circle proxy and verified * on-chain to ensure the execution is authorized. * * @remarks * The executeParams are provided by the stablecoin-service and must be * passed to the Adapter Contract exactly as received (no modification). * * @example * ```typescript * const executeParams: ExecuteParams = { * instructions: [ * { target: dexRouter, data: swapCalldata, ... } * ], * tokens: [ * { token: USDC, beneficiary: userAddress }, * { token: USDT, beneficiary: userAddress } * ], * execId: 123456789n, * deadline: BigInt(Math.floor(Date.now() / 1000) + 1800), * metadata: '0x' * } * ``` */ interface ExecuteParams { /** * Array of instructions to execute sequentially. * * Each instruction can be a swap, fee collection, or other contract call. */ instructions: Instruction[]; /** * Token recipients for residual sweep. * * Typically a 2-tuple: [tokenIn recipient, tokenOut recipient] */ tokens: TokenRecipient[]; /** * Unique execution identifier for replay protection. * * Must be globally unique and is marked as used after execution. */ execId: bigint; /** * Execution deadline timestamp (Unix seconds). * * Transaction reverts if block.timestamp is greater than deadline. */ deadline: bigint; /** * Optional metadata for tracking and analytics. */ metadata: `0x${string}`; } /** * Parameters for executing a swap transaction via the Adapter smart contract. * * This action executes swap transactions through the Adapter Contract, which * handles token approvals via permits (EIP-2612, Permit2, etc.) and executes * multi-step swap instructions atomically on-chain. * * @remarks * The swap flow uses the Adapter Contract pattern: * 1. Service provides `executeParams` and `signature` (proxy-signed EIP-712) * 2. SDK builds `tokenInputs` with permit signatures for gasless approvals * 3. SDK calls AdapterContract.execute(executeParams, tokenInputs, signature) * 4. Adapter Contract pulls tokens via permits, executes swaps, validates outputs * * This enables: * - Single atomic transaction (permit + swap in one tx) * - Gasless approvals via EIP-2612/Permit2 * - Slippage protection enforced on-chain * - Multi-step instructions (swap + fees) atomically * * **Permit Support**: The SDK constructs `TokenInput` with `permitCalldata` * containing the encoded permit signature. The Adapter Contract executes * the permit on-chain before pulling tokens. * * @example * ```typescript * import type { ExecuteSwapParams } from '@core/adapter' * import { createSwap } from '@core/service-client' * import { PermitType } from '@core/adapter' * * // Get swap transaction from service * const swapResponse = await createSwap({ * tokenInAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', * tokenOutAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', * tokenInChain: 'Ethereum', * fromAddress: '0x...', * toAddress: '0x...', * amount: '1000000', * apiKey: 'TEST_API_KEY:...', * }) * * // Build token inputs with permit * const tokenInputs: TokenInput[] = [{ * permitType: PermitType.EIP2612, * token: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', * amount: 1000000n, * permitCalldata: '0x...' // Encoded permit signature * }] * * // Prepare action parameters * const params: ExecuteSwapParams = { * executeParams: swapResponse.transaction.executeParams, * tokenInputs, * signature: swapResponse.transaction.signature, * inputAmount: BigInt(swapResponse.amount), * tokenInAddress: swapResponse.tokenInAddress as `0x${string}` * } * ``` */ interface ExecuteSwapEVMParams extends ActionParameters { /** * Execution parameters from the stablecoin-service. * * Contains instructions, token recipients, execution ID, deadline, and metadata. * This is an EIP-712 signed struct that the Adapter Contract validates. * * Provided by the service - do not modify. */ executeParams: ExecuteParams; /** * Token inputs with permit signatures for gasless approvals. * * The SDK constructs this array with permit data for each token that needs * to be pulled from the user's wallet. The Adapter Contract executes these * permits on-chain before executing swap instructions. * * @remarks * For EIP-2612 permits, the SDK must: * 1. Build typed data with token, spender (Adapter), amount, nonce, deadline * 2. Get user signature via `adapter.signTypedData()` * 3. Encode as permitCalldata: encode(value, deadline, v, r, s) * * @example * ```typescript * [{ * permitType: PermitType.EIP2612, * token: '0xUSDC', * amount: 1000000n, * permitCalldata: '0x...' * }] * ``` */ tokenInputs: TokenInput[]; /** * EIP-712 signature from the Circle proxy service. * * The service signs the executeParams to authorize the execution. * The Adapter Contract verifies this signature on-chain. * * Provided by the service - do not modify. */ signature: `0x${string}`; /** * Swap input amount in base units. * * @remarks * The amount of tokens being swapped, provided in the token's base units (e.g., wei for ETH, * smallest denomination for ERC20 tokens). This value should be extracted from the service * response, as it represents the authoritative swap amount for the operation. * * For native currency swaps (ETH → USDC), this amount is sent as the transaction `value`. * For ERC20 swaps (USDC → USDT), this amount determines the permit or approval quantity. * * @see CreateSwapResponse.amount - Service response field containing this value * * @example * ```typescript * import { createSwap } from '@core/service-client' * * // Get swap transaction from service * const response = await createSwap({ * tokenInAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', * amount: '1000000', // 1 USDC (6 decimals) * ... * }) * * // Prepare swap execution using service response amount * await adapter.prepareAction('swap.execute', { * executeParams: response.transaction.executeParams, * tokenInputs, * signature: response.transaction.signature, * inputAmount: BigInt(response.amount), * tokenInAddress: response.tokenInAddress, * }, context) * ``` */ inputAmount: bigint; /** * Token address being swapped from. * * @remarks * Used to determine if the swap involves native currency (ETH, MATIC, etc.) or ERC20 tokens. * When tokenInAddress is NATIVE_TOKEN_ADDRESS (0xEeee...), the inputAmount is sent as tx.value. * * @see CreateSwapResponse.tokenInAddress - Service response field containing this value * * @example '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' for ETH * @example '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' for USDC */ tokenInAddress: `0x${string}`; } /** * Parameters for executing a swap transaction on Solana. * * This action executes swap transactions on Solana chains by deserializing * and executing a pre-built transaction provided by the stablecoin-service. * * @remarks * Unlike EVM chains that use the Adapter Contract pattern, Solana swaps * execute a fully serialized transaction provided by the service. The * transaction is base64-encoded and contains all necessary instructions * for the swap operation. * * The service handles: * - DEX aggregator routing (Jupiter, etc.) * - Fee collection * - Slippage protection * - Token account management * * @example * ```typescript * import type { ExecuteSwapSolanaParams } from '@core/adapter' * import { createSwap } from '@core/service-client' * * // Get swap transaction from service * const swapResponse = await createSwap({ * tokenInAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', * tokenOutAddress: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr', * tokenInChain: 'Solana', * fromAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP', * toAddress: 'YubQzu18FDqJRyNfG8JqHmsdbxhnoQqcKUHBdUkN6tP', * amount: '1000000', * apiKey: 'TEST_API_KEY:...', * }) * * // Prepare action parameters * const params: ExecuteSwapSolanaParams = { * serializedTransaction: swapResponse.transaction.data * } * ``` */ interface ExecuteSwapSolanaParams extends ActionParameters { /** * Base64-encoded serialized Solana transaction. * * This transaction is fully constructed by the stablecoin-service and * contains all swap instructions, fee payments, and token account setup. * The transaction must be deserialized, signed, and submitted to the network. * * Provided by the service - do not modify. * * @example 'AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAJFQg...' */ serializedTransaction: string; } /** * Parameters accepted by the swap.execute action, supporting both EVM and Solana chains. * * @remarks * This union type covers all chain-specific swap execution parameter interfaces * currently supported by the App Kit. Extend this union to support * additional blockchains as needed. Each member provides all fields required * to prepare and execute a pre-built swap transaction on its respective chain. * * **Type Narrowing**: The correct parameter type is inferred from the chain type * in the `OperationContext` passed to `adapter.prepareAction()`. Action handlers * use property-based type guards (checking for `executeParams`/`tokenInputs` for EVM * or `serializedTransaction` for Solana) to narrow the union type at runtime. * * - {@link ExecuteSwapEVMParams} - For EVM chains (has `executeParams` and `tokenInputs`) * - {@link ExecuteSwapSolanaParams} - For Solana chains (has `serializedTransaction`) */ type ExecuteSwapParams = ExecuteSwapEVMParams | ExecuteSwapSolanaParams; /** * Action map for swap operations on EVM chains. * * This namespace contains actions related to token swapping operations. * These actions handle the execution of pre-built swap transactions from * DEX aggregators and routing services. * * @remarks * The swap namespace is designed to be extensible for future swap-related * operations such as multi-hop swaps, batched swaps, or swap-and-bridge * compositions. */ interface SwapActionMap { /** * Execute a pre-built swap transaction. * * This action prepares and executes swap transactions constructed by the * stablecoin-service API. It accepts transaction parameters (to, data, value) * and returns a prepared chain request suitable for gas estimation or execution. */ readonly execute: ExecuteSwapParams; } interface TokenActionMap { /** * Set an allowance for a delegate to spend tokens on behalf of the wallet. * * On chains without native allowance support, this may return a noop result * indicating the step can be safely skipped. */ approve: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; /** * The address that will be approved to spend the tokens. */ delegate: string; /** * The amount of tokens to approve for spending (in token's smallest unit). */ amount: bigint; }; /** * Check the current allowance between an owner and spender for any token. * * On chains without allowance support, this typically returns the maximum * possible value to indicate unlimited spending capability. */ allowance: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; /** * The address of the wallet that owns the tokens. If not provided, it will be * automatically derived from the adapter context. */ walletAddress?: string | undefined; /** * The address to check the allowance for. */ delegate: string; }; /** * Transfer tokens directly from the wallet to another address. */ transfer: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; /** * The address to send the tokens to. */ to: string; /** * The amount of tokens to transfer (in token's smallest unit). */ amount: bigint; }; /** * Transfer tokens from one address to another using a pre-approved allowance. * * On chains without allowance support, this may behave differently or throw * an error if the operation is not supported. */ transferFrom: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; /** * The address to transfer tokens from (must have given allowance to the caller). */ from: string; /** * The address to send the tokens to. */ to: string; /** * The amount of tokens to transfer (in token's smallest unit). */ amount: bigint; }; /** * Get the current token balance for a wallet address. */ balanceOf: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; /** * The address to check the balance for. If not provided, it will be * automatically derived from the adapter context. */ walletAddress?: string | undefined; }; /** * Get the on-chain name of the token contract. * * This is a read-only operation. For USDC the value is also the EIP-712 * domain name, which permit and authorize signing flows need. */ name: ActionParameters & { /** * The contract address of the token. */ tokenAddress: string; }; } /** * USDC-specific operations that automatically resolve the token address. * * These include all standard ERC20 operations plus additional safety functions * that USDC supports. The interface provides the same core operations as * {@link TokenActionMap} but without requiring a `tokenAddress` parameter, * plus additional USDC-specific extensions. * * @example * ```typescript * // USDC operations (address auto-resolved) * await adapter.action('usdc.approve', { * delegate: '0x1234...', * amount: '1000000' // 1 USDC * }) * * // USDC-specific safe allowance functions * await adapter.action('usdc.increaseAllowance', { * delegate: '0x1234...', * amount: '500000' // increase by 0.5 USDC * }) * * // vs. general token operations (address required) * await adapter.action('token.approve', { * tokenAddress: '0xA0b86a33E6441c8C1c7C16e4c5e3e5b5e4c5e3e5b5e4c5e', * delegate: '0x1234...', * amount: '1000000' * }) * ``` */ type BaseUSDCActions = { [K in keyof TokenActionMap]: Omit; }; /** * USDC action map with both standard ERC20 operations and USDC-specific extensions. * * This provides all standard token operations plus additional safety functions * that USDC implements beyond the base ERC20 standard. */ interface USDCActionMap { /** * Set an allowance for a delegate to spend USDC tokens on behalf of the wallet. * * Automatically uses the USDC contract address for the current chain. * On chains without native allowance support, this may return a noop result. */ approve: BaseUSDCActions['approve']; /** * Check the current allowance between an owner and spender for USDC tokens. * * Automatically uses the USDC contract address for the current chain. * This is a read-only operation. */ allowance: BaseUSDCActions['allowance']; /** * Safely increase the allowance for a delegate to spend USDC tokens. * * This is a USDC-specific function that provides safer allowance management * compared to direct approve() calls. Automatically uses the USDC contract * address for the current chain. */ increaseAllowance: ActionParameters & { /** * The address that will have their allowance increased. */ delegate: string; /** * The amount to increase the allowance by (in USDC's smallest unit). */ amount: bigint; /** * The chain definition for the current chain. */ chain?: ChainDefinition; }; /** * Safely decrease the allowance for a delegate to spend USDC tokens. * * This is a USDC-specific function that provides safer allowance management. * Automatically uses the USDC contract address for the current chain. */ decreaseAllowance: ActionParameters & { /** * The address that will have their allowance decreased. */ delegate: string; /** * The amount to decrease the allowance by (in USDC's smallest unit). */ amount: bigint; }; /** * Transfer USDC tokens directly from the wallet to another address. * * Automatically uses the USDC contract address for the current chain. */ transfer: BaseUSDCActions['transfer']; /** * Transfer USDC tokens from one address to another using a pre-approved allowance. * * Automatically uses the USDC contract address for the current chain. * The caller must have sufficient allowance from the 'from' address. */ transferFrom: BaseUSDCActions['transferFrom']; /** * Get the current USDC balance for a wallet address. * * Automatically uses the USDC contract address for the current chain. * This is a read-only operation. */ balanceOf: Omit; /** * Get the EIP-712 domain name of the USDC contract on the current chain. * * Automatically uses the USDC contract address for the current chain. * This is a read-only operation with no parameters. */ name: ActionParameters & { /** * Optional chain override; defaults to the operation context chain. */ chain?: ChainDefinition; }; } /** * USDT-specific operations that automatically resolve the token address. * * These include standard ERC20 operations. The interface provides the same core * operations as {@link TokenActionMap} but without requiring a `tokenAddress` * parameter. * * @example * ```typescript * // USDT operations (address auto-resolved) * await adapter.action('usdt.transfer', { * to: '0x1234...', * amount: '1000000' // 1 USDT * }) * * // vs. general token operations (address required) * await adapter.action('token.transfer', { * tokenAddress: '0xdAC17F958D2ee523a2206206994597C13D831ec7', * to: '0x1234...', * amount: '1000000' * }) * ``` */ type BaseUSDTActions = { [K in keyof TokenActionMap]: Omit; }; /** * USDT action map with standard ERC20 operations. * * This provides standard token operations for USDT transfers. */ interface USDTActionMap { /** * Transfer USDT tokens directly from the wallet to another address. * * Automatically uses the USDT contract address for the current chain. */ transfer: BaseUSDTActions['transfer']; } /** * Versioned wrapper for Gateway action namespaces. * * Follows the same pattern as {@link CCTPActionMap}: each version is a * nested namespace so that action keys read `gateway.v1.deposit`, etc. * * @see {@link GatewayV1ActionMap} for v1 action definitions */ interface GatewayActionMap { /** Gateway protocol v1 operations. */ readonly v1: GatewayV1ActionMap; } /** * Action map for Circle Gateway Wallet v1 contract operations. * * Mirrors the GatewayWallet interface: deposit variants, delegate management, * and balance queries. * * @see https://developers.circle.com/gateway/references/contract-interfaces-and-events * @see https://developers.circle.com/gateway/references/solana-programs */ interface GatewayV1ActionMap { /** * Deposit tokens after approving the Gateway contract. Balance is credited to the caller. * * Corresponds to `deposit(address token, uint256 value)`. */ deposit: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** Amount in token's smallest unit. */ value: bigint; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Deposit tokens on behalf of another address after approving. Balance is credited to `depositor`. * * Corresponds to `depositFor(address token, address depositor, uint256 value)`. */ depositFor: ActionParameters & { /** Token contract address. */ token: string; /** Address that will own the resulting balance. */ depositor: string; /** Amount in token's smallest unit. */ value: bigint; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Deposit with EIP-2612 permit (gasless approval via signature). * * Corresponds to `depositWithPermit(token, owner, value, deadline, signature)` (bytes) * or the overload with (v, r, s). Use `signature` for EIP-7597 (SCA); use (v, r, s) for EOA. */ depositWithPermit: ActionParameters & { /** Token contract address. */ token: string; /** Depositor's address (owner in permit). */ owner: string; /** Amount in token's smallest unit. */ value: bigint; /** Permit deadline (Unix timestamp) or max uint256 for no expiration. */ deadline: bigint; /** Signature as bytes (EIP-7597) or omit and use v, r, s. */ signature?: `0x${string}`; /** ECDSA v (when not using signature bytes). */ v?: number; /** ECDSA r (when not using signature bytes). */ r?: `0x${string}`; /** ECDSA s (when not using signature bytes). */ s?: `0x${string}`; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Deposit with EIP-3009 transferWithAuthorization (receiveWithAuthorization). * * Corresponds to `depositWithAuthorization(token, from, value, validAfter, validBefore, nonce, signature)` * or the overload with (v, r, s). */ depositWithAuthorization: ActionParameters & { /** Token contract address. */ token: string; /** Depositor's address (from in authorization). */ from: string; /** Amount in token's smallest unit. */ value: bigint; /** Unix timestamp after which the authorization is valid. */ validAfter: bigint; /** Unix timestamp before which the authorization is valid. */ validBefore: bigint; /** Unique nonce (bytes32). */ nonce: `0x${string}`; /** Signature as bytes (EIP-7598) or omit and use v, r, s. */ signature?: `0x${string}`; /** ECDSA v (when not using signature bytes). */ v?: number; /** ECDSA r (when not using signature bytes). */ r?: `0x${string}`; /** ECDSA s (when not using signature bytes). */ s?: `0x${string}`; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Grant spending rights to a delegate on the caller's Gateway account. * * Corresponds to `addDelegate(address token, address delegate)`. */ addDelegate: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** Address to authorize as a delegate. */ delegate: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Revoke spending rights from a delegate on the caller's Gateway account. * * Corresponds to `removeDelegate(address token, address delegate)`. */ removeDelegate: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** Address to revoke as a delegate. */ delegate: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Check whether an address is authorized as a delegate for a depositor's balance. * * Corresponds to `isAuthorizedForBalance(address token, address depositor, address addr)`. */ isDelegate: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** The depositor (balance owner) address. */ depositor: string; /** The address to check for delegate status. */ delegate: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; /** EVM: specific block number to read state at (for finality-aware checks). */ blockNumber?: bigint; /** Solana: commitment level for the account read. */ commitment?: 'confirmed' | 'finalized'; }; /** * Start a delayed fund removal from a Gateway account. * * Corresponds to `initiateWithdrawal(address token, uint256 value)` (EVM) * or the `initiate_withdrawal` instruction (Solana). */ initiateWithdrawal: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** Amount in token's smallest unit. */ value: bigint; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Complete a fund removal after the withdrawal delay has elapsed. * * Corresponds to `withdraw(address token)` (EVM) or the `withdraw` * instruction (Solana). No amount parameter -- the contract returns the * full pending withdrawal balance. */ withdraw: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Read the pending withdrawal balance for a depositor. * * Corresponds to `withdrawingBalance(address token, address depositor)` (EVM) * or reading `withdrawing_amount` from the `GatewayDeposit` PDA (Solana). */ withdrawingBalance: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** The depositor whose pending withdrawal to query. */ depositor: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Read the block number at which a pending withdrawal can be completed. * * Corresponds to `withdrawalBlock(address token, address depositor)` (EVM) * or reading `withdrawal_block` from the `GatewayDeposit` PDA (Solana). */ withdrawalBlock: ActionParameters & { /** Token contract address (e.g. USDC). */ token: string; /** The depositor whose withdrawal block to query. */ depositor: string; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Execute gatewayBurn on the Gateway Wallet contract. * Burns tokens from a source chain as part of a cross-chain spend. * * Corresponds to `gatewayBurn(bytes calldataBytes, bytes signature)`. */ gatewayBurn: ActionParameters & { /** ABI-encoded burn intent calldata. */ calldataBytes: `0x${string}`; /** Signature over the burn intent(s). */ signature: `0x${string}`; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Execute gatewayMint on the Gateway Minter contract. * Mints tokens on the destination chain to complete a cross-chain spend. * * Corresponds to `gatewayMint(bytes attestationPayload, bytes signature)`. */ gatewayMint: ActionParameters & { /** Attestation payload from the Gateway API. */ attestation: `0x${string}`; /** Signature over the attestation. */ signature: `0x${string}`; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; /** * Sign burn intents using EIP-712 typed data (EVM) or binary encoding (Solana). * Returns the signature needed for the Gateway API transfer call. */ signBurnIntents: ActionParameters & { /** EIP-712 typed data for EVM, or binary-encoded data for Solana. */ typedData: unknown; /** Chain with Gateway v1 (optional; defaults to operation context chain). */ chain?: ChainDefinition; }; } /** * Native token-related action maps for the bridge kit. * * This module provides action definitions for native token operations. */ interface NativeActionMap { /** * Transfer native tokens directly from the wallet to another address. */ transfer: ActionParameters & { /** * The chain to transfer the native tokens on. */ chain?: ChainIdentifier$1; /** * The address to send the native tokens to. */ to: string; /** * The amount of native tokens to transfer. */ amount: bigint; }; /** * Get the native token balance (SOL, ETH, etc.) for a wallet address. */ balanceOf: ActionParameters & { /** * The address to check the native balance for. If not provided, it will be * automatically derived from the adapter context. */ walletAddress?: string | undefined; }; } /** * Central registry of all available action namespaces and their operations. * * Define the complete action map structure used throughout the bridge kit. * Each top-level key represents a namespace (e.g., 'token', 'usdc') containing * related operations. The structure supports arbitrary nesting depth through * the recursive utility types provided in this module. * * @remarks * This interface serves as the foundation for type-safe action dispatching * and provides compile-time validation of action keys and payload types. * All action-related utility types derive from this central definition. * * @see {@link ActionKeys} for dot-notation action paths * @see {@link ActionPayload} for extracting payload types */ interface ActionMap { /** CCTP-specific operations with automatic address resolution. */ readonly cctp: CCTPActionMap; /** CCTPx operations (CrossChainTokenService) for cross-chain transfers of registered tokens (Circle-issued or otherwise). */ readonly cctpx: CCTPXActionMap; /** Gateway Wallet operations, versioned (e.g. gateway.v1.deposit). */ readonly gateway: GatewayActionMap; /** Native token operations (ETH, SOL, MATIC, etc.). */ readonly native: NativeActionMap; /** General token operations requiring explicit token addresses. */ readonly token: TokenActionMap; /** USDC-specific operations with automatic address resolution. */ readonly usdc: USDCActionMap; /** USDT-specific operations with automatic address resolution. */ readonly usdt: USDTActionMap; /** Swap operations for DEX aggregator integrations. */ readonly swap: SwapActionMap; /** Earn operations that execute service-signed payloads via the adapter contract. */ readonly earn: EarnActionMap; } /** * Determine if a type represents an action parameter object (leaf node). * * Check whether a type extends the ActionParameters interface, which provides * an explicit marker for identifying action parameter objects versus namespace * containers that should be traversed during type recursion. * * @typeParam T - The type to examine for parameter object characteristics * * @remarks * This utility type provides deterministic leaf detection for the recursive * type system. By requiring all action parameter objects to extend the * ActionParameters interface, we eliminate the need for property name * heuristics and make the system more maintainable. * * @see {@link ActionParameters} for the base interface * @see {@link NestedKeys} for usage in path extraction */ type IsActionParameterObject = T extends ActionParameters ? true : false; /** * Recursively extract all nested keys from an object type as dot-notation string literals. * * Traverse object structures of arbitrary depth and generate string literal * types representing all possible paths through the structure using dot * notation. Stop recursion when encountering action parameter objects (leaves). * * @typeParam T - The object type to extract nested keys from * * @remarks * This type is the foundation for generating type-safe action paths in * dot notation. It automatically adapts to changes in the ActionMap * structure and supports unlimited nesting depth for future extensibility. * * The recursion stops when it encounters objects that match the * {@link IsActionParameterObject} criteria, ensuring that only valid * action paths are generated. * * @see {@link ActionKeys} for ActionMap-specific paths * @see {@link NestedValue} for extracting types at specific paths * @see {@link IsActionParameterObject} for leaf detection logic */ type NestedKeys = { [K in Extract]: IsActionParameterObject extends true ? K : T[K] extends object ? `${K}.${NestedKeys}` : never; }[Extract]; /** * Recursively extract the value type at a given dot-notation path. * * Navigate through nested object types using a dot-notation string path * and return the type of the value at that location. Parse the path * recursively by splitting on dots and traversing the object structure. * * @typeParam T - The object type to navigate through * @typeParam K - The dot-notation path as a string literal type * * @remarks * This utility type enables type-safe access to deeply nested object * properties using dot notation paths. It forms the foundation for * extracting payload types from action paths in the ActionMap. * * @see {@link ActionPayload} for ActionMap-specific value extraction * @see {@link NestedKeys} for generating valid path types */ type NestedValue = K extends `${infer First}.${infer Rest}` ? First extends keyof T ? NestedValue : never : K extends keyof T ? T[K] : never; /** * Union type of all nested action keys in dot notation. * * Generate string literal types for all possible action paths in the * ActionMap structure. Automatically adapt to changes in the ActionMap * and support arbitrary levels of nesting for future extensibility. * * @remarks * This type serves as the canonical source for all valid action identifiers * in the bridge kit. It ensures compile-time validation of action keys * and enables type-safe action dispatching throughout the application. * * @see {@link ActionPayload} for extracting parameter types * @see {@link NamespaceActions} for namespace-specific actions * @see {@link ActionMap} for the underlying structure */ type ActionKeys = NestedKeys; /** * Extract the payload type for a specific action based on its dot-notation key. * * Resolve the parameter type for any action by providing its complete path * in dot notation. Leverage the recursive NestedValue type to navigate to * the correct payload type regardless of nesting depth. The internal * ActionParameters marker is automatically removed from the result. * * @typeParam T - The action key in dot notation (must extend ActionKeys) * * @remarks * This utility type enables type-safe parameter passing for action * dispatching. It automatically infers the correct parameter shape * based on the action key, providing compile-time validation and * excellent IntelliSense support. * * The internal `__isActionParams` marker used for type system recursion * is automatically omitted from the resulting type, providing clean * parameter objects for consumers. * * @see {@link ActionKeys} for available action identifiers * @see {@link NestedValue} for the underlying path resolution logic */ type ActionPayload = Omit, '__isActionParams'>; /** * Type-safe action handler function signature for specific action types. * * Defines the contract for functions that process action payloads and return * prepared chain requests. Each handler is strongly typed to accept only the * payload structure corresponding to its specific action key. * * @typeParam TActionKey - The specific action key this handler processes. * @param params - The action payload matching the specified action key. * @param context - The resolved operation context with concrete chain and address values. * @returns A promise resolving to a prepared chain request. * * @example * ```typescript * import type { ActionHandler } from '@core/adapter' * * const depositHandler: ActionHandler<'cctp.v2.depositForBurn'> = async (params, context) => { * // context is always defined and has concrete chain and address values * console.log(context.chain.name); * console.log(context.address); * // ... handler logic ... * return preparedRequest; * } * ``` */ type ActionHandler$1 = (params: ActionPayload, context: ResolvedOperationContext) => Promise; /** * Type-safe mapping of all available action keys to their corresponding handlers. * * This type defines a registry object where each key is a valid action key * (as defined by {@link ActionKeys}) and each value is an {@link ActionHandler} * capable of processing the payload for that action. This enables strongly-typed * handler registration and lookup for all supported actions in the App Kits. * * @remarks * Each handler is typed as {@link ActionHandler}, which means the handler * must accept the payload type for the specific action key it is registered under. * This provides type safety for handler registration and execution, but does not * enforce per-key handler parameterization at the type level. For stricter per-key * typing, consider using mapped types or generic registry patterns. * * @example * ```typescript * import type { ActionHandlers } from '@core/adapter' * import type { ActionHandler } from '@core/adapter' * * const handlers: ActionHandlers = { * 'cctp.v2.depositForBurn': async (params, resolved) => { * // params is correctly typed for 'cctp.v2.depositForBurn' * // resolved has concrete chain and address values * // ...handler logic... * }, * 'usdc.approve': async (params, resolved) => { * // params is correctly typed for 'usdc.approve' * // resolved has concrete chain and address values * // ...handler logic... * } * } * ``` */ type ActionHandlers = { [K in ActionKeys]?: ActionHandler$1; }; /** * Type-safe registry for managing and executing blockchain action handlers. * * Provides a centralized system for registering action handlers with full * TypeScript type safety, ensuring that handlers can only be registered * with compatible action keys and payload types. Supports both individual * handler registration and batch registration operations. * * @remarks * The registry uses a Map internally for O(1) lookups and maintains type * safety through generic constraints and careful type assertions. All * type assertions are validated at registration time to ensure runtime * type safety matches compile-time guarantees. */ declare class ActionRegistry { readonly actionHandlers: Map>; /** * Register a type-safe action handler for a specific action key. * * Associates an action handler function with its corresponding action key, * ensuring compile-time type safety between the action and its expected * payload structure. The handler will be available for execution via * {@link executeAction}. * * @typeParam TActionKey - The specific action key being registered. * @param action - The action key to register the handler for. * @param handler - The handler function for processing this action type. * @returns Void. * * @throws Error When action parameter is not a valid string. * @throws TypeError When handler parameter is not a function. * * @example * ```typescript * import { ActionRegistry } from '@core/adapter' * import type { ActionHandler } from '@core/adapter' * * const registry = new ActionRegistry() * * // Register a CCTP deposit handler * const depositHandler: ActionHandler<'cctp.v2.depositForBurn'> = async (params, resolved) => { * console.log('Processing deposit:', params.amount) * return { * chainId: params.chainId, * data: '0x...', * to: '0x...', * value: '0' * } * } * * registry.registerHandler('cctp.v2.depositForBurn', depositHandler) * ``` */ registerHandler(action: TActionKey, handler: ActionHandler$1): void; /** * Register multiple action handlers in a single operation. * * Efficiently register multiple handlers from a record object, where keys * are action identifiers and values are their corresponding handler * functions. Provides a convenient way to bulk-register handlers while * maintaining type safety. * * @param handlers - A record mapping action keys to their handler functions. * @returns Void. * * @throws {Error} When handlers parameter is not a valid object. * @throws {Error} When any individual handler registration fails. * * @example * ```typescript * import { ActionRegistry } from '@core/adapter' * import type { ActionHandler, ActionHandlers } from '@core/adapter' * * const registry = new ActionRegistry() * * // Register multiple handlers at once * const tokenHandlers: ActionHandlers = { * 'token.approve': async (params, resolved) => ({ * chainId: resolved.chain, * data: '0x095ea7b3...', * to: params.tokenAddress, * value: '0' * }), * 'token.transfer': async (params, resolved) => ({ * chainId: resolved.chain, * data: '0xa9059cbb...', * to: params.tokenAddress, * value: '0' * }) * } * * registry.registerHandlers(tokenHandlers) * console.log('Registered multiple token handlers') * ``` */ registerHandlers(handlers: ActionHandlers): void; /** * Check whether a specific action is supported by this registry. * * Determine if a handler has been registered for the given action key. * Use this method to conditionally execute actions or provide appropriate * error messages when actions are not available. * * @param action - The action key to check for support. * @returns True if the action is supported, false otherwise. * * @throws {Error} When action parameter is not a valid string. * * @example * ```typescript * import { ActionRegistry } from '@core/adapter' * * const registry = new ActionRegistry() * * // Check if actions are supported before attempting to use them * if (registry.supportsAction('token.approve')) { * console.log('Token approval is supported') * } else { * console.log('Token approval not available') * } * * // Conditional logic based on support * const action = 'cctp.v2.depositForBurn' * if (registry.supportsAction(action)) { * // Safe to execute * console.log(`${action} is available`) * } else { * console.warn(`${action} is not registered`) * } * ``` */ supportsAction(action: ActionKeys): boolean; /** * Execute a registered action handler with type-safe parameters. * * Look up and execute the handler associated with the given action key, * passing the provided parameters and context, returning the resulting prepared * chain request. TypeScript ensures the parameters match the expected * structure for the specified action. * * @typeParam TActionKey - The specific action key being executed. * @param action - The action key identifying which handler to execute. * @param params - The parameters to pass to the action handler. * @param context - The resolved operation context with concrete chain and address values. * @returns A promise resolving to the prepared chain request. * @throws {KitError} When the handler execution fails with a structured error. * @throws {Error} When no handler is registered for the specified action. * @throws {Error} When the handler execution fails with an unstructured error. * * @example * ```typescript * import { ActionRegistry } from '@core/adapter' * import type { ChainEnum } from '@core/chains' * * const registry = new ActionRegistry() * * // First register a handler * registry.registerHandler('token.approve', async (params, context) => ({ * chainId: context.chain, // Always defined * data: '0x095ea7b3...', * to: params.tokenAddress, * value: '0' * })) * * // Execute the action with resolved context (typically called from adapter.prepareAction) * const resolvedContext = { chain: 'Base', address: '0x123...' } * const result = await registry.executeAction('token.approve', { * chainId: ChainEnum.Ethereum, * tokenAddress: '0xA0b86a33E6441c8C1c7C16e4c5e3e5b5e4c5e3e5b5e4c5e', * delegate: '0x1234567890123456789012345678901234567890', * amount: '1000000' * }, resolvedContext) * * console.log('Transaction prepared:', result.data) * ``` */ executeAction(action: TActionKey, params: ActionPayload, context: ResolvedOperationContext): Promise; } /** * Canonical list of actions that do not prepare or submit transactions. * * @internal */ declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"]; /** * Action keys that execute without preparing or submitting a transaction. * * @remarks * Derive this type from the canonical runtime list so compile-time and runtime * classification cannot drift. `gateway.v1.signBurnIntents` is included * because the action system models off-chain signing as a read action: it does * not prepare a chain request. * * @example * ```typescript * import type { ReadActionKey } from '@core/adapter' * * const action: ReadActionKey = 'token.allowance' * ``` */ type ReadActionKey = (typeof READ_ACTION_KEYS)[number]; /** * Defines the capabilities of an adapter, including address handling patterns and supported chains. * * @interface TAdapterCapabilities * @category Types * @description * This interface specifies how an adapter manages address control and which blockchain networks it supports. * It is used for capability discovery, validation, and to inform consumers about the adapter's operational model. * * The `addressContext` property determines both address selection behavior and bridge API requirements: * - `'user-controlled'`: User controls addresses through wallet UI, address optional in operations * - `'developer-controlled'`: Service manages addresses programmatically, address required in operations * * @example * ```typescript * // Browser wallet adapter (user-controlled) * const capabilities: AdapterCapabilities = { * addressContext: 'user-controlled', // User selects address in wallet UI * supportedChains: [Ethereum, Base, Polygon] * } * * // Enterprise provider adapter (developer-controlled) * const capabilities: AdapterCapabilities = { * addressContext: 'developer-controlled', // Address must be specified per operation * supportedChains: [Ethereum, Base, Solana] * } * ``` */ interface AdapterCapabilities { /** * Defines who controls address selection for wallet operations. * * - `'user-controlled'`: User controls addresses through wallet UI (browser wallets, hardware wallets) * - Address is implicit in bridge operations (uses wallet's current address) * - Adapter may listen for accountsChanged/chainChanged events * - Suitable for MetaMask, Coinbase Wallet, WalletConnect, private keys, etc. * * - `'developer-controlled'`: Service manages addresses programmatically (enterprise providers) * - Address must be explicitly provided in bridge operations * - No event listening (addresses controlled programmatically) * - Suitable for Fireblocks, Circle Wallets, institutional custody, etc. */ addressContext: 'user-controlled' | 'developer-controlled'; /** * The set of blockchain networks this adapter supports. * Used for validation, capability discovery, and to restrict operations to supported chains. * * @remarks * Typed `readonly` to match the `@core/adapter-base` `AdapterCapabilities` * shape, so the /next adapters (which preserve `readonly` capabilities per * PR #853 A1) remain structurally assignable to this legacy `Adapter` * contract. The collection is only ever read, never mutated. */ supportedChains: readonly ChainDefinition[]; } /** * Abstract class defining the standard interface for an adapter that interacts with a specific blockchain. * * An `Adapter` is responsible for encapsulating chain-specific logic necessary to * perform operations like sending transactions, querying balances, or interacting with smart contracts. * Implementations of this class will provide concrete logic for a particular blockchain protocol. * * This abstraction allows the App Kit to work with multiple blockchains in a uniform way. * * @typeParam TAdapterCapabilities - The adapter capabilities type for compile-time address validation. * When provided, enables strict typing of operation context based on the adapter's address control model. */ declare abstract class Adapter { /** * The type of the chain for this adapter. * * - For concrete adapters, this should be a real chain type (e.g., `'evm'`, `'solana'`, etc.) from the ChainType union. * - For hybrid adapters (adapters that route to concrete adapters supporting multiple ecosystems), * set this property to the string literal `'hybrid'`. * * Note: `'hybrid'` is not a legal ChainType and should only be used as a marker for multi-ecosystem adapters. * Hybrid adapters do not interact directly with any chain, but instead route requests to a concrete underlying adapter. * * @example * // For an EVM-only adapter: * chainType = 'evm' * * // For a hybrid adapter: * chainType = 'hybrid' */ abstract chainType: ChainType | 'hybrid'; /** * Capabilities of this adapter, defining address control model and supported chains. * * This property determines how the adapter behaves, especially for address selection * and bridge API requirements. The `addressContext` must match the adapter's type parameter. * * @remarks * The `addressContext` value must align with the adapter's generic type parameter for proper * type safety in bridge operations. * * @example * ```typescript * // User-controlled adapter (private key, browser wallet) * capabilities = { * addressContext: 'user-controlled', // Address implicit in bridge operations * supportedChains: [Ethereum, Base, Polygon] * } * * // Developer-controlled adapter (enterprise provider) * capabilities = { * addressContext: 'developer-controlled', // Address required in bridge operations * supportedChains: [Ethereum, Base, Solana] * } * ``` */ capabilities?: TAdapterCapabilities; /** * Registry of available actions for this adapter. * * The {@link ActionRegistry} provides a catalog of supported operations * (such as token transfers, approvals, etc.) that can be performed by this adapter * on the connected blockchain. This enables dynamic discovery and invocation * of chain-specific or cross-chain actions in a type-safe manner. * * @readonly */ readonly actionRegistry: ActionRegistry; /** * Prepares (but does not execute) an action for the connected blockchain. * * This method looks up the appropriate action handler for the given action key * and prepares the transaction request using the provided parameters. The returned * {@link PreparedChainRequest} allows developers to estimate gas costs and execute * the transaction at a later time, enabling pre-flight simulation and deferred execution. * * **Compile-time Address Validation**: When used with typed adapters that have capabilities, * this method enforces address requirements at compile time: * - **User-controlled adapters**: The `address` field is forbidden in the context * - **Developer-controlled adapters**: The `address` field is required in the context * - **Legacy adapters**: The `address` field remains optional for backward compatibility * * @remarks * This method does not send any transaction to the network. Instead, it returns a * prepared request object with `estimate()` and `execute()` methods, allowing * developers to inspect, simulate, or submit the transaction as needed. * * @param action - The action key identifying which handler to use for preparation. * @param params - The parameters to pass to the action handler. * @param ctx - Operation context with compile-time validated address requirements based on adapter capabilities. * @returns A promise that resolves to a {@link PreparedChainRequest} for estimation and execution. * @throws Error If the specified action key does not correspond to a registered handler. * @throws Error If the provided parameters are invalid for the action. * @throws Error If the operation context cannot be resolved. * * @example * ```typescript * // User-controlled adapter (address forbidden) * const userAdapter: Adapter<{ addressContext: 'user-controlled', supportedChains: [] }> * await userAdapter.prepareAction('token.approve', params, { * chain: 'Ethereum' * // address: '0x123...' // ❌ TypeScript error: address not allowed * }) * * // Developer-controlled adapter (address required) * const devAdapter: Adapter<{ addressContext: 'developer-controlled', supportedChains: [] }> * await devAdapter.prepareAction('token.approve', params, { * chain: 'Ethereum', * address: '0x123...' // ✅ Required for developer-controlled * }) * ``` */ prepareAction(action: TActionKey, params: ActionPayload, ctx: OperationContext): Promise; /** * Execute a non-transaction action without routing through transaction preparation. * * @remarks * Use this seam for balance, allowance, contract-state, and other actions * classified as reads. It never calls {@link Adapter.prepareAction}, so * transaction authorization wrappers only observe actions that can produce a * signable chain request. * * @typeParam TActionKey - The read action key. * @param action - The read action to execute. * @param params - The parameters for the read action. * @param ctx - The operation context. * @returns The raw action response. * @throws {KitError} When the key is not a read action or no handler is registered. * @throws Error When the operation context or action handler fails. * * @example * ```typescript * import { Ethereum } from '@core/chains' * * const balance = await adapter.readAction( * 'token.balanceOf', * { tokenAddress, walletAddress }, * { chain: Ethereum }, * ) * ``` * * @internal */ readAction(action: TActionKey, params: ActionPayload, ctx: OperationContext): Promise; /** * Read the current token allowance a delegate holds over an owner's tokens. * * @remarks * Perform a network read through {@link Adapter.readAction}. This method * never routes through {@link Adapter.prepareAction}. On chains without an * allowance model, such as Solana, return the maximum uint256 value. * * @param params - The token to query and the delegate whose allowance is being read. * @param ctx - Operation context with compile-time validated address requirements. * @returns A promise resolving to the current allowance in the token's base units. * @throws {KitError} When the adapter does not register a `token.allowance` handler. * @throws Error When the operation context or action handler fails. * * @example * ```typescript * import type { Adapter } from '@core/adapter' * import { Ethereum } from '@core/chains' * * declare const adapter: Adapter * * const allowance = await adapter.getTokenAllowance( * { * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', * delegate: '0x1111111111111111111111111111111111111111', * }, * { chain: Ethereum }, * ) * console.log(allowance) // 1000000n * ``` */ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext): Promise; /** * Prepares a transaction for future gas estimation and execution. * * This method should handle any preliminary steps required before a transaction * can be estimated or sent. This might include things like serializing transaction * data, but it should NOT yet send anything to the network. * * The returned object contains two functions: * - `estimate()`: Asynchronously calculates and returns the {@link EstimatedGas} for the prepared transaction. * - `execute()`: Asynchronously executes the prepared transaction and returns a promise that resolves * with the transaction result (e.g., a transaction hash, receipt, or other chain-specific response). * * **Compile-time Address Validation**: When used with typed adapters that have capabilities, * this method enforces address requirements at compile time: * - **User-controlled adapters**: The `address` field is forbidden in the context * - **Developer-controlled adapters**: The `address` field is required in the context * - **Legacy adapters**: The `address` field remains optional for backward compatibility * * @remarks * The specific parameters for `prepare` might vary greatly between chain implementations. * Consider defining a generic type or a base type for `transactionRequest` if common patterns emerge, * or allow `...args: any[]` if extreme flexibility is needed by implementers. * For this abstract definition, we keep it parameter-less, assuming implementations will add specific * parameters as needed for their `prepare` method (e.g. `prepare(txDetails: MyChainTxDetails)`). * * @param params - The prepared chain request parameters for the specific blockchain. * @param ctx - Operation context with compile-time validated address requirements based on adapter capabilities. * @returns An object containing `estimate` and `execute` methods for the prepared transaction. * * @example * ```typescript * // User-controlled adapter (address forbidden) * const userAdapter: Adapter<{ addressContext: 'user-controlled', supportedChains: [] }> * await userAdapter.prepare(params, { * chain: 'Ethereum' * // address: '0x123...' // ❌ TypeScript error: address not allowed * }) * * // Developer-controlled adapter (address required) * const devAdapter: Adapter<{ addressContext: 'developer-controlled', supportedChains: [] }> * await devAdapter.prepare(params, { * chain: 'Ethereum', * address: '0x123...' // ✅ Required for developer-controlled * }) * ``` */ abstract prepare(params: PreparedChainRequestParams, ctx: OperationContext): Promise; /** * Retrieves the public address of the connected wallet. * * This address is used as the default sender for transactions * and interactions initiated by this adapter. * * @param chain - The chain to use for address resolution. * @returns A promise that resolves to the blockchain address as a string. */ abstract getAddress(chain: ChainDefinition): Promise; /** * Switches the adapter to operate on the specified chain. * * This abstract method must be implemented by concrete adapters to handle their specific * chain switching logic. The behavior varies by adapter type: * - **Private key adapters**: Recreate clients with new RPC endpoints * - **Browser wallet adapters**: Request chain switch via EIP-1193 or equivalent * - **Multi-entity adapters**: Typically a no-op (operations are contextual) * * @param chain - The target chain to switch to. * @returns A promise that resolves when the chain switch is complete. * @throws When the chain switching fails or is not supported. * * @remarks * This method is called by `ensureChain()` after validation is complete. * Implementations should focus only on the actual switching logic, not validation. * * @example * ```typescript * // EVM adapter implementation * protected async switchToChain(chain: ChainDefinition): Promise { * if (chain.type !== 'evm') { * throw new Error('Only EVM chains supported') * } * await this.recreateWalletClient(chain) * } * * // Multi-entity adapter implementation * protected async switchToChain(chain: ChainDefinition): Promise { * // No-op - operations are contextual * return * } * ``` */ abstract switchToChain(chain: ChainDefinition): Promise; /** * Ensures the adapter is operating on the specified chain, switching if necessary. * * This method provides a unified interface for establishing chain preconditions across different adapter types. * The behavior varies based on the adapter's capabilities: * - **Private key adapters**: Recreate clients with new RPC endpoints * - **Browser wallet adapters**: Request chain switch via EIP-1193 or equivalent * - **Multi-entity adapters**: Validate chain support (operations are contextual) * * @param chain - The target chain for operations. * @returns A promise that resolves when the adapter is operating on the specified chain. * @throws When the target chain is not supported or chain switching fails. * * @remarks * This method always calls `switchToChain()` to ensure consistency across all adapter types. * The underlying implementations handle idempotent switching efficiently (e.g., browser wallets * gracefully handle switching to the current chain, private key adapters recreate lightweight clients). * * @example * ```typescript * // Private key adapter - switches chains seamlessly * await privateKeyAdapter.ensureChain(Base) * * // Browser wallet - requests user to switch chains * await metamaskAdapter.ensureChain(Polygon) * * // Multi-entity adapter - validates chain is supported * await circleWalletsAdapter.ensureChain(Ethereum) * ``` */ ensureChain(targetChain: ChainDefinition): Promise; /** * Validate that the target chain is supported by this adapter. * * @param targetChain - The chain to validate. * @throws KitError with INVALID_CHAIN code if the chain is not supported by this adapter. */ validateChainSupport(targetChain: ChainDefinition): void; /** * Waits for a transaction to be mined and confirmed on the blockchain. * * This method should block until the transaction is confirmed on the blockchain. * The response includes comprehensive transaction details for the confirmed transaction. * * @param txHash - The hash of the transaction to wait for. * @param config - Optional configuration for waiting behavior including timeout and confirmations. * @param chain - The chain definition where the transaction was submitted. * @returns Promise resolving to comprehensive transaction details. */ abstract waitForTransaction(txHash: string, config: WaitForTransactionConfig | undefined, chain: ChainDefinition): Promise; /** * Calculate the total transaction fee including compute cost and buffer for the configured chain. * * This method computes the fee by multiplying the base compute units by the current * fee rate, then adds a configurable buffer to account for fee fluctuations and ensure * transaction success. The buffer is specified in basis points (1 basis point = 0.01%). * * @param baseComputeUnits - The base compute units for the transaction (gas for EVM, compute units for Solana, etc.). * @param bufferBasisPoints - The buffer to add as basis points (e.g., 500 = 5%). Defaults to implementation-specific value. * @param chain - The chain definition to calculate fees for. * @returns A promise that resolves to the total transaction fee as a bigint. */ abstract calculateTransactionFee(baseComputeUnits: bigint, bufferBasisPoints: bigint | undefined, chain: ChainDefinition): Promise; /** * Get the decimal places for a token address on a given chain. * * This method fetches the number of decimal places from a token contract. * Different chain types implement this differently: * - EVM: Calls the `decimals()` function on ERC-20 contracts * - Solana: Reads the `decimals` field from the SPL token mint account * * @param tokenAddress - The token contract address (EVM) or mint address (Solana) * @param chain - The chain definition where the token is deployed * @returns Promise resolving to the number of decimal places for the token * @throws Error when the token contract doesn't exist or decimals cannot be fetched * * @example * ```typescript * import { EthersAdapter } from '@circle-fin/adapter-ethers-v6' * import { Ethereum } from '@core/chains' * * const adapter = new EthersAdapter({ signer }) * * // Fetch decimals for DAI token * const decimals = await adapter.getTokenDecimals( * '0x6B175474E89094C44Da98b954EedeAC495271d0F', * Ethereum * ) * console.log(decimals) // 18 * ``` */ abstract getTokenDecimals(tokenAddress: string, chain: ChainDefinition): Promise; } /** * Valid recoverability values for error handling strategies. * * - FATAL errors are thrown immediately (invalid inputs, insufficient funds) * - RETRYABLE errors are returned when a flow fails to start but could work later * - RESUMABLE errors are returned when a flow fails mid-execution but can be continued */ declare const RECOVERABILITY_VALUES: readonly ["RETRYABLE", "RESUMABLE", "FATAL"]; /** * Error handling strategy for different types of failures. * * - FATAL errors are thrown immediately (invalid inputs, insufficient funds) * - RETRYABLE errors are returned when a flow fails to start but could work later * - RESUMABLE errors are returned when a flow fails mid-execution but can be continued */ type Recoverability = (typeof RECOVERABILITY_VALUES)[number]; /** * Array of valid error type values for validation. * Derived from ERROR_TYPES const object. */ declare const ERROR_TYPE_VALUES: ("INPUT" | "BALANCE" | "ONCHAIN" | "RPC" | "NETWORK" | "RATE_LIMIT" | "SERVICE" | "LIQUIDITY" | "UNKNOWN")[]; /** * Error type indicating the category of the error. */ type ErrorType = (typeof ERROR_TYPE_VALUES)[number]; /** * Structured error details with consistent properties for programmatic handling. * * This interface provides a standardized format for all errors in the * App Kits system, enabling developers to handle different error * types consistently and provide appropriate user feedback. * * @example * ```typescript * const error: ErrorDetails = { * code: 1001, * name: "INPUT_NETWORK_MISMATCH", * type: "INPUT", * recoverability: "FATAL", * message: "Source and destination networks must be different", * cause: { * trace: { sourceChain: "ethereum", destChain: "ethereum" } * } * } * ``` * * @example * ```typescript * const error: ErrorDetails = { * code: 9001, * name: "BALANCE_INSUFFICIENT_TOKEN", * type: "BALANCE", * recoverability: "FATAL", * message: "Insufficient USDC balance on Ethereum", * cause: { * trace: { token: "USDC", chain: "Ethereum" } * } * } * ``` */ interface ErrorDetails { /** Numeric identifier following standardized ranges (see error code registry) */ code: number; /** Human-readable ID (e.g., "INPUT_NETWORK_MISMATCH", "BALANCE_INSUFFICIENT_TOKEN") */ name: string; /** Error category indicating where the error originated */ type: ErrorType; /** Error handling strategy */ recoverability: Recoverability; /** User-friendly explanation with context */ message: string; /** Raw error details, context, or the original error that caused this one. */ cause?: { /** * Free-form error payload from the underlying system. * * The shape is **not uniform across error codes**: most codes set `trace` * to the raw underlying error, while a few set a structured wrapper object * `{ rawError, ...extras }` (e.g. `INPUT_AMOUNT_OUT_OF_RANGE` and * `LIQUIDITY_INSUFFICIENT` add `minAmount` / `maxAmount` / `token`). * Consumers must branch on `error.code` before reading structured fields off * `trace`, and should treat the raw error as the fallback for all other codes. */ trace?: unknown; }; } declare class KitError extends Error implements ErrorDetails { /** Numeric identifier following standardized ranges (1000+ for INPUT errors) */ readonly code: number; /** Human-readable ID (e.g., "NETWORK_MISMATCH") */ readonly name: string; /** Error category indicating where the error originated */ readonly type: ErrorType; /** Error handling strategy */ readonly recoverability: Recoverability; /** Raw error details, context, or the original error that caused this one. */ readonly cause?: { /** Free-form error payload from underlying system */ trace?: unknown; }; /** * Create a new KitError instance. * * @param details - The error details object containing all required properties. * @throws \{TypeError\} When details parameter is missing or invalid. */ constructor(details: ErrorDetails); } /** * Standardized error code ranges for consistent categorization: * * - 0: UNKNOWN - Catch-all for unrecognized errors * - 1000-1999: INPUT errors - Parameter validation, input format errors * - 3000-3999: NETWORK errors - Internet connectivity, DNS, connection issues * - 4000-4999: RPC errors - Blockchain provider issues, gas estimation, nonce errors * - 5000-5999: ONCHAIN errors - Transaction/simulation failures, gas exhaustion, reverts * - 6000-6999: LIQUIDITY errors - Upstream provider/AMM liquidity unavailable * - 7000-7999: RATE_LIMIT errors - API throttling, request frequency limits * - 8000-8999: SERVICE errors - Internal service errors, server failures * - 9000-9999: BALANCE errors - Insufficient funds, token balance, allowance */ /** * Standardized error definitions for INPUT type errors. * * Each entry combines the numeric error code, string name, and type * to ensure consistency when creating error instances. * * Error codes follow a hierarchical numbering scheme where the first digit * indicates the error category (1 = INPUT) and subsequent digits provide * specific error identification within that category. * * * @example * ```typescript * import { InputError } from '@core/errors' * * const error = new KitError({ * ...InputError.NETWORK_MISMATCH, * recoverability: 'FATAL', * message: 'Source and destination networks must be different' * }) * * // Access code, name, and type individually if needed * console.log(InputError.NETWORK_MISMATCH.code) // 1001 * console.log(InputError.NETWORK_MISMATCH.name) // 'INPUT_NETWORK_MISMATCH' * console.log(InputError.NETWORK_MISMATCH.type) // 'INPUT' * ``` */ declare const InputError: { /** Network type mismatch between chains (mainnet vs testnet) */ readonly NETWORK_MISMATCH: { readonly code: 1001; readonly name: "INPUT_NETWORK_MISMATCH"; readonly type: ErrorType; }; /** Invalid amount format or value (negative, zero, or malformed) */ readonly INVALID_AMOUNT: { readonly code: 1002; readonly name: "INPUT_INVALID_AMOUNT"; readonly type: ErrorType; }; /** Unsupported or invalid bridge route configuration */ readonly UNSUPPORTED_ROUTE: { readonly code: 1003; readonly name: "INPUT_UNSUPPORTED_ROUTE"; readonly type: ErrorType; }; /** Invalid wallet or contract address format */ readonly INVALID_ADDRESS: { readonly code: 1004; readonly name: "INPUT_INVALID_ADDRESS"; readonly type: ErrorType; }; /** Invalid or unsupported chain identifier */ readonly INVALID_CHAIN: { readonly code: 1005; readonly name: "INPUT_INVALID_CHAIN"; readonly type: ErrorType; }; /** Unsupported token for chain */ readonly UNSUPPORTED_TOKEN: { readonly code: 1006; readonly name: "INPUT_UNSUPPORTED_TOKEN"; readonly type: ErrorType; }; /** Insufficient swap amount for the token pair */ readonly INSUFFICIENT_SWAP_AMOUNT: { readonly code: 1007; readonly name: "INPUT_INSUFFICIENT_SWAP_AMOUNT"; readonly type: ErrorType; }; /** Action not supported by this adapter / ecosystem */ readonly UNSUPPORTED_ACTION: { readonly code: 1008; readonly name: "INPUT_UNSUPPORTED_ACTION"; readonly type: ErrorType; }; /** No route satisfies the slippage or minimum-output constraint */ readonly SLIPPAGE_CONSTRAINT_NOT_MET: { readonly code: 1009; readonly name: "INPUT_SLIPPAGE_CONSTRAINT_NOT_MET"; readonly type: ErrorType; }; /** Wallet is on a different chain than the operation targets */ readonly CHAIN_MISMATCH: { readonly code: 1010; readonly name: "INPUT_CHAIN_MISMATCH"; readonly type: ErrorType; }; /** User rejected a chain-switch or add-chain prompt */ readonly CHAIN_SWITCH_REJECTED: { readonly code: 1011; readonly name: "INPUT_CHAIN_SWITCH_REJECTED"; readonly type: ErrorType; }; /** Wallet does not recognise the target chain and cannot add it */ readonly UNRECOGNIZED_CHAIN: { readonly code: 1012; readonly name: "INPUT_UNRECOGNIZED_CHAIN"; readonly type: ErrorType; }; /** Swap amount is outside the upstream provider's accepted bounds */ readonly AMOUNT_OUT_OF_RANGE: { readonly code: 1013; readonly name: "INPUT_AMOUNT_OUT_OF_RANGE"; readonly type: ErrorType; }; /** * Protocol fee is denominated in a token that is not supported for the * route (only the native gas token and the route's supported fee tokens, * such as USDC, are accepted). */ readonly UNSUPPORTED_FEE_TOKEN: { readonly code: 1014; readonly name: "INPUT_UNSUPPORTED_FEE_TOKEN"; readonly type: ErrorType; }; /** Retry / resume is not supported by this provider for the given result */ readonly RETRY_NOT_SUPPORTED: { readonly code: 1015; readonly name: "INPUT_RETRY_NOT_SUPPORTED"; readonly type: ErrorType; }; /** Bridge-step analysis for retry is not supported by this provider */ readonly STEP_ANALYSIS_NOT_SUPPORTED: { readonly code: 1016; readonly name: "INPUT_STEP_ANALYSIS_NOT_SUPPORTED"; readonly type: ErrorType; }; /** * A kit operation name collides with a reserved event-subscription * method (`on` / `off`) at kit construction. */ readonly RESERVED_OPERATION_NAME: { readonly code: 1000; readonly name: "INPUT_RESERVED_OPERATION_NAME"; readonly type: ErrorType; }; /** A kit was constructed with a missing / undefined operation factory */ readonly MISSING_OPERATION: { readonly code: 1017; readonly name: "INPUT_MISSING_OPERATION"; readonly type: ErrorType; }; /** General validation failure for complex validation rules */ readonly VALIDATION_FAILED: { readonly code: 1098; readonly name: "INPUT_VALIDATION_FAILED"; readonly type: ErrorType; }; /** User cancelled wallet interaction (signature, transaction, connection) */ readonly USER_CANCELLED: { readonly code: 1099; readonly name: "INPUT_USER_CANCELLED"; readonly type: ErrorType; }; }; /** * Standardized error definitions for BALANCE type errors. * * BALANCE errors indicate insufficient funds or allowance issues * that prevent transaction execution. * * @example * ```typescript * import { BalanceError } from '@core/errors' * * const error = new KitError({ * ...BalanceError.INSUFFICIENT_TOKEN, * recoverability: 'FATAL', * message: 'Insufficient USDC balance on Ethereum', * cause: { trace: { required: '100', available: '50' } } * }) * ``` */ declare const BalanceError: { /** Insufficient token balance for transaction */ readonly INSUFFICIENT_TOKEN: { readonly code: 9001; readonly name: "BALANCE_INSUFFICIENT_TOKEN"; readonly type: ErrorType; }; /** Insufficient native token (ETH/SOL/etc) for gas fees */ readonly INSUFFICIENT_GAS: { readonly code: 9002; readonly name: "BALANCE_INSUFFICIENT_GAS"; readonly type: ErrorType; }; /** Insufficient allowance for token transfer */ readonly INSUFFICIENT_ALLOWANCE: { readonly code: 9003; readonly name: "BALANCE_INSUFFICIENT_ALLOWANCE"; readonly type: ErrorType; }; }; /** * Standardized error definitions for ONCHAIN type errors. * * ONCHAIN errors occur during transaction execution, simulation, * or interaction with smart contracts on the blockchain. * * @example * ```typescript * import { OnchainError } from '@core/errors' * * const error = new KitError({ * ...OnchainError.SIMULATION_FAILED, * recoverability: 'FATAL', * message: 'Simulation failed: ERC20 transfer amount exceeds balance', * cause: { trace: { reason: 'ERC20: transfer amount exceeds balance' } } * }) * ``` */ declare const OnchainError: { /** Transaction reverted on-chain after execution */ readonly TRANSACTION_REVERTED: { readonly code: 5001; readonly name: "ONCHAIN_TRANSACTION_REVERTED"; readonly type: ErrorType; }; /** Pre-flight transaction simulation failed */ readonly SIMULATION_FAILED: { readonly code: 5002; readonly name: "ONCHAIN_SIMULATION_FAILED"; readonly type: ErrorType; }; /** Transaction ran out of gas during execution */ readonly OUT_OF_GAS: { readonly code: 5003; readonly name: "ONCHAIN_OUT_OF_GAS"; readonly type: ErrorType; }; /** Transaction exceeds block gas limit */ readonly GAS_LIMIT_EXCEEDED: { readonly code: 5004; readonly name: "ONCHAIN_GAS_LIMIT_EXCEEDED"; readonly type: ErrorType; }; /** Transaction size exceeds blockchain limit */ readonly TRANSACTION_TOO_LARGE: { readonly code: 5005; readonly name: "ONCHAIN_TRANSACTION_TOO_LARGE"; readonly type: ErrorType; }; /** Unknown blockchain error that cannot be categorized */ readonly UNKNOWN_BLOCKCHAIN_ERROR: { readonly code: 5099; readonly name: "ONCHAIN_UNKNOWN_BLOCKCHAIN_ERROR"; readonly type: ErrorType; }; }; /** * Standardized error definitions for RPC type errors. * * RPC errors occur when communicating with blockchain RPC providers, * including endpoint failures, invalid responses, and provider-specific issues. * * @example * ```typescript * import { RpcError } from '@core/errors' * * const error = new KitError({ * ...RpcError.ENDPOINT_ERROR, * recoverability: 'RETRYABLE', * message: 'RPC endpoint unavailable on Ethereum', * cause: { trace: { endpoint: 'https://mainnet.infura.io' } } * }) * ``` */ declare const RpcError: { /** RPC endpoint returned error or is unavailable */ readonly ENDPOINT_ERROR: { readonly code: 4001; readonly name: "RPC_ENDPOINT_ERROR"; readonly type: ErrorType; }; /** Invalid or unexpected RPC response format */ readonly INVALID_RESPONSE: { readonly code: 4002; readonly name: "RPC_INVALID_RESPONSE"; readonly type: ErrorType; }; /** Nonce-related errors from RPC provider */ readonly NONCE_ERROR: { readonly code: 4003; readonly name: "RPC_NONCE_ERROR"; readonly type: ErrorType; }; }; /** * Standardized error definitions for NETWORK type errors. * * NETWORK errors indicate connectivity issues at the network layer, * including DNS failures, connection timeouts, and unreachable endpoints. * * @example * ```typescript * import { NetworkError } from '@core/errors' * * const error = new KitError({ * ...NetworkError.CONNECTION_FAILED, * recoverability: 'RETRYABLE', * message: 'Failed to connect to Ethereum network', * cause: { trace: { error: 'ECONNREFUSED' } } * }) * ``` */ declare const NetworkError: { /** Network connection failed or unreachable */ readonly CONNECTION_FAILED: { readonly code: 3001; readonly name: "NETWORK_CONNECTION_FAILED"; readonly type: ErrorType; }; /** Network request timeout */ readonly TIMEOUT: { readonly code: 3002; readonly name: "NETWORK_TIMEOUT"; readonly type: ErrorType; }; /** Circle relayer failed to process the forwarding/mint transaction */ readonly RELAYER_FORWARD_FAILED: { readonly code: 3003; readonly name: "NETWORK_RELAYER_FORWARD_FAILED"; readonly type: ErrorType; }; /** Relayer mint is pending - waiting for confirmation */ readonly RELAYER_PENDING: { readonly code: 3004; readonly name: "NETWORK_RELAYER_PENDING"; readonly type: ErrorType; }; /** LI.FI swap status is pending — waiting for indexing or completion */ readonly LIFI_STATUS_PENDING: { readonly code: 3005; readonly name: "NETWORK_LIFI_STATUS_PENDING"; readonly type: ErrorType; }; /** LI.FI swap status returned a terminal failure */ readonly LIFI_STATUS_FAILED: { readonly code: 3006; readonly name: "NETWORK_LIFI_STATUS_FAILED"; readonly type: ErrorType; }; /** Gateway API returned an error response or an unexpected response shape */ readonly GATEWAY_API_ERROR: { readonly code: 3007; readonly name: "NETWORK_GATEWAY_API_ERROR"; readonly type: ErrorType; }; /** * A long-running operation was aborted via its `AbortSignal` before it * could complete (e.g. a caller cancelled `waitForTransaction`). For * post-broadcast waits this stops the local wait only — the transaction * may still settle on-chain. */ readonly ABORTED: { readonly code: 3008; readonly name: "NETWORK_ABORTED"; readonly type: ErrorType; }; }; /** * Standardized error definitions for RATE_LIMIT type errors. * * RATE_LIMIT errors indicate API throttling, request frequency limits errors. * * @example * ```typescript * import { RateLimitError } from '@core/errors' * * const error = new KitError({ * ...RateLimitError.RATE_LIMIT_EXCEEDED, * recoverability: 'RETRYABLE', * message: 'Rate limit exceeded, please retry later', * cause: { trace: { error: '429 Too Many Requests' } } * }) * ``` */ declare const RateLimitError: { /** Rate limit exceeded */ readonly RATE_LIMIT_EXCEEDED: { readonly code: 7001; readonly name: "RATE_LIMIT_EXCEEDED"; readonly type: ErrorType; }; }; /** * Standardized error definitions for SERVICE type errors. * * SERVICE errors indicate internal service failures, HTTP 5xx errors, * or backend processing issues that are retryable. * * @example * ```typescript * import { ServiceError } from '@core/errors' * * const error = new KitError({ * ...ServiceError.INTERNAL_ERROR, * recoverability: 'RETRYABLE', * message: 'Service encountered an internal error (500)', * cause: { trace: { statusCode: 500 } } * }) * ``` */ declare const ServiceError: { /** Internal server error (HTTP 5xx) */ readonly INTERNAL_ERROR: { readonly code: 8001; readonly name: "SERVICE_INTERNAL_ERROR"; readonly type: ErrorType; }; /** Unknown or unclassified error that cannot be categorized */ readonly UNKNOWN_ERROR: { readonly code: 8002; readonly name: "SERVICE_UNKNOWN_ERROR"; readonly type: ErrorType; }; /** * Route support could not be determined because a provider's route check * failed transiently (e.g. the token registry was unreachable), as opposed * to the route being definitively unsupported. Retryable. */ readonly ROUTE_CHECK_UNAVAILABLE: { readonly code: 8003; readonly name: "SERVICE_ROUTE_CHECK_UNAVAILABLE"; readonly type: ErrorType; }; }; /** * Type guard to check if an error is a KitError instance. * * This guard enables TypeScript to narrow the type from `unknown` to * `KitError`, providing access to structured error properties like * code, name, and recoverability. * * @remarks * **Cross-bundle safety.** Each `dist/*` bundle that depends on * `@core/errors` ships its own compiled `KitError` class, so a bare * `instanceof KitError` check returns `false` for errors thrown by * code in a *different* bundle even though both classes are * structurally identical. This guard works across bundles by * checking the registry-symbol brand * (`Symbol.for('circle.KitError')`) the canonical * {@link KitError} constructor stamps onto every instance. * `instanceof` is kept as a fast first check for the common * single-bundle case. * * @param error - Unknown error to check * @returns True if error is KitError with proper type narrowing * * @example * ```typescript * import { isKitError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isKitError(error)) { * // TypeScript knows this is KitError * console.log(`Structured error: ${error.name} (${error.code})`) * } else { * console.log('Regular error:', error) * } * } * ``` */ declare function isKitError(error: unknown): error is KitError; /** * Checks if an error is a KitError with FATAL recoverability. * * FATAL errors indicate issues that cannot be resolved through retries, * such as invalid inputs, configuration problems, or business rule * violations. These errors require user intervention to fix. * * @param error - Unknown error to check * @returns True if error is a KitError with FATAL recoverability * * @example * ```typescript * import { isFatalError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isFatalError(error)) { * // Show user-friendly error message - don't retry * showUserError(error.message) * } * } * ``` */ declare function isFatalError(error: unknown): boolean; /** * Checks if an error is retryable. * * @remarks * Check order for KitError instances: * 1. If `recoverability === 'RETRYABLE'` or `recoverability === 'RESUMABLE'`, * return `true` immediately (priority check). * 2. Otherwise, check if `error.code` is in `DEFAULT_RETRYABLE_ERROR_CODES` (fallback check). * 3. Non-KitError instances always return `false`. * * This two-tier approach allows both explicit recoverability control and * backward-compatible code-based retry logic. * * RETRYABLE errors indicate transient failures that may succeed on * subsequent attempts, such as network timeouts or temporary service * unavailability. These errors are safe to retry after a delay. * * RESUMABLE errors indicate a multi-phase operation that completed some phases * before failing (for example, a token approval landed but the execution * transaction failed). They are also retryable — re-running the operation is * safe — but callers that have a kit-level `retry()` should prefer it so that * already-completed phases are skipped. * * @param error - Unknown error to check * @returns True if error is retryable * * @example * ```typescript * import { isRetryableError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isRetryableError(error)) { * // Implement retry logic with exponential backoff * setTimeout(() => retryOperation(), 5000) * } * } * ``` * * @example * ```typescript * import { isRetryableError, createNetworkConnectionError, KitError } from '@core/errors' * * // KitError with RETRYABLE recoverability (priority check) * const error1 = createNetworkConnectionError('Ethereum') * isRetryableError(error1) // true * * // KitError with default retryable code (fallback check) * const error2 = new KitError({ * code: 3002, // NETWORK_TIMEOUT - in DEFAULT_RETRYABLE_ERROR_CODES * name: 'NETWORK_TIMEOUT', * type: 'NETWORK', * recoverability: 'FATAL', // Not RETRYABLE * message: 'Timeout', * }) * isRetryableError(error2) // true (code 3002 is in default list) * * // KitError with non-retryable code and FATAL recoverability * const error3 = new KitError({ * code: 1001, * name: 'INPUT_NETWORK_MISMATCH', * type: 'INPUT', * recoverability: 'FATAL', * message: 'Invalid input', * }) * isRetryableError(error3) // false * * // KitError with RESUMABLE recoverability (partially-completed operation) * const error4 = new KitError({ * code: 8101, * name: 'EARN_EXECUTION_FAILED', * type: 'SERVICE', * recoverability: 'RESUMABLE', * message: 'Execution failed after approval', * }) * isRetryableError(error4) // true * * // Non-KitError * const error5 = new Error('Standard error') * isRetryableError(error5) // false * ``` */ declare function isRetryableError(error: unknown): boolean; /** * Type guard to check if error is KitError with INPUT type. * * INPUT errors represent validation failures, invalid parameters, * or user input problems. These errors are always FATAL and require * the user to correct their input before retrying. * * @param error - Unknown error to check * @returns True if error is KitError with INPUT type * * @example * ```typescript * import { isInputError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isInputError(error)) { * console.log('Validation error:', error.message) * showValidationUI() * } * } * ``` */ declare function isInputError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with BALANCE type. * * BALANCE errors indicate insufficient funds or allowance issues * that prevent transaction execution. These errors are always FATAL * and require the user to add funds or approve more tokens. * * @param error - Unknown error to check * @returns True if error is KitError with BALANCE type * * @example * ```typescript * import { isBalanceError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isBalanceError(error)) { * console.log('Insufficient funds:', error.message) * showAddFundsUI() * } * } * ``` */ declare function isBalanceError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with ONCHAIN type. * * ONCHAIN errors occur during transaction execution or simulation, * including reverts, gas issues, and smart contract failures. * These errors are typically FATAL. * * @param error - Unknown error to check * @returns True if error is KitError with ONCHAIN type * * @example * ```typescript * import { isOnchainError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isOnchainError(error)) { * console.log('Transaction failed:', error.message) * showTransactionErrorUI() * } * } * ``` */ declare function isOnchainError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with RPC type. * * RPC errors occur when communicating with blockchain RPC providers. * These errors are typically RETRYABLE as they often indicate * temporary provider issues. * * @param error - Unknown error to check * @returns True if error is KitError with RPC type * * @example * ```typescript * import { isRpcError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isRpcError(error)) { * console.log('RPC error:', error.message) * retryWithBackoff() * } * } * ``` */ declare function isRpcError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with NETWORK type. * * NETWORK errors indicate connectivity issues at the network layer. * These errors are typically RETRYABLE as they often indicate * temporary network problems. * * @param error - Unknown error to check * @returns True if error is KitError with NETWORK type * * @example * ```typescript * import { isNetworkError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isNetworkError(error)) { * console.log('Network issue:', error.message) * retryWithBackoff() * } * } * ``` */ declare function isNetworkError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with RATE_LIMIT type. * * RATE_LIMIT errors indicate API throttling or request frequency limits. * These errors are typically RETRYABLE after a delay. * * @param error - Unknown error to check * @returns True if error is KitError with RATE_LIMIT type * * @example * ```typescript * import { isRateLimitError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isRateLimitError(error)) { * console.log('Rate limited, retrying in 60s') * await sleep(60000) * retry() * } * } * ``` */ declare function isRateLimitError(error: unknown): error is KitError; /** * Type guard to check if error is KitError with SERVICE type. * * SERVICE errors indicate internal service failures or HTTP 5xx errors. * These errors are typically RETRYABLE as they indicate temporary * backend issues. * * @param error - Unknown error to check * @returns True if error is KitError with SERVICE type * * @example * ```typescript * import { isServiceError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * if (isServiceError(error)) { * console.log('Service error:', error.message) * retryWithBackoff() * } * } * ``` */ declare function isServiceError(error: unknown): error is KitError; /** * Safely extracts error message from any error type. * * This utility handles different error types gracefully, extracting * meaningful messages from Error instances, string errors, or providing * a fallback for unknown error types. Never throws. * * @param error - Unknown error to extract message from * @returns Error message string, or fallback message * * @example * ```typescript * import { getErrorMessage } from '@core/errors' * * try { * await riskyOperation() * } catch (error) { * const message = getErrorMessage(error) * console.log('Error occurred:', message) * // Works with Error, KitError, string, or any other type * } * ``` */ declare function getErrorMessage(error: unknown): string; /** * Gets the error code from a KitError, or null if not applicable. * * This utility safely extracts the numeric error code from KitError * instances, returning null for non-KitError types. Useful for * programmatic error handling based on specific error codes. * * @param error - Unknown error to extract code from * @returns Error code number, or null if not a KitError * * @example * ```typescript * import { getErrorCode, InputError } from '@core/errors' * * try { * await kit.bridge(params) * } catch (error) { * const code = getErrorCode(error) * if (code === InputError.NETWORK_MISMATCH.code) { * // Handle network mismatch specifically * showNetworkMismatchHelp() * } * } * ``` */ declare function getErrorCode(error: unknown): number | null; /** * A type-safe event emitter for managing action-based event subscriptions. * * Actionable provides a strongly-typed publish/subscribe pattern for events, * where each event (action) has its own specific payload type. Handlers can * subscribe to specific events or use a wildcard to receive all events. * * @typeParam AllActions - A record mapping action names to their payload types. * * @example * ```typescript * import { Actionable } from '@circle-fin/bridge-kit/utils'; * * // Define your action types * type TransferActions = { * started: { txHash: string; amount: string }; * completed: { txHash: string; destinationTxHash: string }; * failed: { error: Error }; * }; * * // Create an actionable instance * const transferEvents = new Actionable(); * * // Subscribe to a specific event * transferEvents.on('completed', (payload) => { * console.log(`Transfer completed with hash: ${payload.destinationTxHash}`); * }); * * // Subscribe to all events * transferEvents.on('*', (payload) => { * console.log('Event received:', payload); * }); * * // Dispatch an event * transferEvents.dispatch('completed', { * txHash: '0x123', * destinationTxHash: '0xabc' * }); * ``` */ declare class Actionable { private readonly handlers; private readonly wildcard; /** * Register a handler for a specific action. * * @param action - The specific action key to listen for. * @param handler - The callback function to execute when the action occurs. * * @example * ```typescript * const events = new Actionable<{ dataReceived: string }>(); * * events.on('dataReceived', (data) => { * console.log(`Received: ${data}`); * }); * ``` */ on(action: Action, handler: (payload: AllActions[Action]) => void): void; /** * Register a handler for all actions using the wildcard '*'. * * @param action - The wildcard '*' signifying interest in all actions. * @param handler - The callback function to execute for any action. * * @example * ```typescript * const events = new Actionable<{ started: boolean; completed: string }>(); * * events.on('*', (payload) => { * console.log('Action occurred:', payload); * }); * ``` */ on(action: '*', handler: (payload: AllActions[keyof AllActions]) => void): void; /** * Remove a previously registered handler for a specific action. * * @param action - The specific action key to unregister from. * @param handler - The callback function to remove. * * @example * ```typescript * const events = new Actionable<{ dataReceived: string }>(); * * const handler = (data: string) => console.log(data); * events.on('dataReceived', handler); * * // Later, to remove the handler: * events.off('dataReceived', handler); * ``` */ off(action: Action, handler: (payload: AllActions[Action]) => void): void; /** * Remove a previously registered wildcard handler. * * @param action - The wildcard '*' signifying removal from all actions. * @param handler - The callback function to remove. * * @example * ```typescript * const events = new Actionable<{ started: boolean; completed: string }>(); * * const globalHandler = (payload: any) => console.log(payload); * events.on('*', globalHandler); * * // Later, to remove the handler: * events.off('*', globalHandler); * ``` */ off(action: '*', handler: (payload: AllActions[keyof AllActions]) => void): void; /** * Dispatch an action with its payload to all registered handlers. * * This method notifies both: * - Handlers registered specifically for this action * - Wildcard handlers registered for all actions * * @param action - The action key identifying the event type. * @param payload - The data associated with the action. * * @example * ```typescript * type Actions = { * transferStarted: { amount: string; destination: string }; * transferComplete: { txHash: string }; * }; * * const events = new Actionable(); * * // Dispatch an event * events.dispatch('transferStarted', { * amount: '100', * destination: '0xABC123' * }); * ``` */ dispatch(action: K, payload: AllActions[K]): void; } /** * Set an application-level identifier prefix for all HTTP requests. * * This allows applications to identify themselves in the user agent string, * which is useful for tracking and analytics at the application level. * * @param prefix - Application identifier with version, e.g., "my-app/1.0.0" * * @example * ```typescript * import { setExternalPrefix } from '\@circle-fin/bridge-kit' * * setExternalPrefix('my-dapp/2.1.0') * // All subsequent HTTP requests will include this prefix * ``` */ declare const setExternalPrefix: (prefix: string) => void; /** * Module augmentation to register known token symbols. * * @remarks * This file augments the `TokenSymbolRegistry` interface to provide * type-safe autocomplete for built-in tokens. * * When imported, TypeScript will recognize 'USDC' as a valid * `TokenSymbol` value with autocomplete support. * * Other packages or applications can create their own augmentations * to add additional tokens. * * @example * ```typescript * import '@core/tokens' // Automatically includes this augmentation * * const symbol: TokenSymbol = 'USDC' // ✓ Autocomplete shows USDC * ``` */ declare module './types' { /** * Module augmentation: Adds known token symbols as valid keys * to the TokenSymbolRegistry interface. * * Keys are explicitly listed to ensure IDE autocomplete works properly. */ interface TokenSymbolRegistry { USDC: true; USDT: true; EURC: true; DAI: true; USDE: true; PYUSD: true; WETH: true; WBTC: true; WSOL: true; WAVAX: true; WPOL: true; ETH: true; POL: true; PLUME: true; MON: true; cirBTC: true; } } /** * Module augmentation to register Blockchain enum values as ChainIdentifiers. * * @remarks * This file augments the `ChainRegistry` interface to provide type-safe * autocomplete for all `Blockchain` enum values from `@core/chains`. * * When this augmentation is imported (via `@core/tokens`), TypeScript will * recognize all blockchain identifiers as valid `ChainIdentifier` values * with IDE autocomplete support. * * The `Blockchain` enum values are converted to their string representations, * enabling both enum values and string literals to be accepted as chain identifiers. * * @example * ```typescript * import { Blockchain } from '@core/chains' * import type { ChainIdentifier } from '@core/tokens' * * // Using enum value * const chain1: ChainIdentifier = Blockchain.Ethereum * * // Using string literal (with autocomplete!) * const chain2: ChainIdentifier = 'Base' * * // Arbitrary strings also work (escape hatch for custom chains) * const chain3: ChainIdentifier = 'my-custom-chain' * ``` */ declare module './types' { /** * Module augmentation: Adds all Blockchain enum values as valid keys * to the ChainRegistry interface for type-safe chain identifier support. * * This ensures both enum property access (e.g., Blockchain.Ethereum) and plain * string literals (e.g., 'Ethereum') are accepted by TypeScript as chain keys, * providing robust autocomplete and error checking. * * NOTE: * - This interface intentionally has no body. It merges a mapped Record type * into ChainRegistry solely for type augmentation. * - This empty-body construct is a necessary TypeScript idiom for module * augmentation with Record types—directly listing mapped keys is not * feasible in interface extensions. * * eslint-disable-next-line directives below suppress linter complaints about * the empty interface/mapping, which are benign and required for this pattern. */ interface ChainRegistry extends Record<`${Blockchain}`, true> { } } /** * Creates a union type that preserves IDE autocomplete for known literals * while still accepting any string at runtime. * * @remarks * This pattern uses `Record` (an empty record type) to prevent * TypeScript from widening string literals to just `string`. This gives us * the best of both worlds: autocomplete for known values and flexibility * for arbitrary strings. * * @typeParam T - The known string literal union to preserve. */ type LiteralUnion = T | (string & Record); /** * Registry for known chain identifiers (augmentation target). * * @remarks * This empty interface exists solely for module augmentation. Extend it to * register chain identifiers for type-safe token definitions. * * **Why an interface?** TypeScript only allows module augmentation on * interfaces, not type aliases. * * **Note:** This is NOT the EVM "chain ID" (numeric like 1 for Ethereum). * It's a human-readable identifier like "Ethereum", "Solana", "Base". * * **Usage** * * Without augmentation, `ChainIdentifier` defaults to `string`. * With `@core/chains` imported, you get autocomplete for all `Blockchain` values. * * **Custom Chains** * * ```typescript * declare module '@core/tokens' { * interface ChainRegistry { * MyChain: true * MyTestnet: true * } * } * // Now ChainIdentifier includes 'MyChain' | 'MyTestnet' | ... * ``` * * The value (`true`) is a placeholder—only the keys matter. * * NOTE: The eslint-disable below suppresses warnings about empty interfaces. * This is intentional—the interface exists solely as an augmentation target. */ interface ChainRegistry { } /** * Union of all registered chain identifiers. * * @remarks * Derived from `ChainRegistry` keys: * - Without augmentation: `string` * - With `@core/chains`: `'Ethereum' | 'Solana' | ...` plus any string * * Uses `LiteralUnion` to preserve IDE autocomplete while allowing * arbitrary strings at runtime. * * @example * ```typescript * const chain: ChainIdentifier = 'Ethereum' // Autocomplete works * const custom: ChainIdentifier = 'my-chain' // Also valid * ``` */ type ChainIdentifier = keyof ChainRegistry extends never ? string : LiteralUnion>; /** * Maps chain identifiers to their token locators. * * @remarks * The key is a chain identifier (type-safe when `KnownChainIdentifiers` is * augmented). This enables a single token definition to work across chains. * * When `@core/chains` is imported, you get autocomplete for known chains * like `Ethereum`, `Base`, `Solana`, etc. * * @example * ```typescript * import { Blockchain } from '@core/chains' * * const usdcLocators: ChainLocatorMap = { * [Blockchain.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', * [Blockchain.Solana]: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', * [Blockchain.Base]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913', * } * * // Or with string keys (always works) * const locators: ChainLocatorMap = { * 'ethereum': '0xa0b86991...', * 'my-custom-chain': '0x1234...', * } * ``` */ type ChainLocatorMap = Record; /** * Complete definition of a token including metadata and chain locators. * * @remarks * This is the canonical representation of a token in the registry. * It includes the symbol, decimals, and chain-specific locators. * * @example * ```typescript * const usdc: TokenDefinition = { * symbol: 'USDC', * decimals: 6, * locators: { * [Blockchain.Ethereum]: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', * [Blockchain.Solana]: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', * }, * } * ``` */ interface TokenDefinition { /** * The token symbol (e.g., "USDC", "EURC"). */ readonly symbol: string; /** * The default number of decimal places for the token. * Used when no chain-specific override exists in {@link chainDecimals}. * @example 6 for USDC, 18 for most ERC20 tokens */ readonly decimals: number; /** * Chain-specific locators for the token. * Keys are chain identifiers, values are the token address/locator on that chain. * Not all chains need to be present - tokens may only exist on a subset of chains. */ readonly locators: Partial; /** * Optional per-chain decimal overrides. * * Some tokens have different decimal places on different chains * (e.g., USDe is 18 decimals on EVM but 9 decimals on Solana). * When present, the value for a specific chain takes precedence * over the default {@link decimals}. */ readonly chainDecimals?: Partial>; } /** * A raw token locator selector with explicit decimals. * * @remarks * Use this form when working with arbitrary tokens not in the registry. * The `locator` is the chain-specific address, and `decimals` is required * unless using lenient mode. * * @example * ```typescript * // Selecting a custom token by address * const selector: RawTokenSelector = { * locator: '0x1234567890abcdef1234567890abcdef12345678', * decimals: 18, * } * ``` */ interface RawTokenSelector { /** * The chain-specific token locator (address, program ID, etc.). */ readonly locator: string; /** * The number of decimal places. * Required in strict mode, optional in lenient mode. */ readonly decimals?: number; } /** * Registry for known token symbols (augmentation target). * * @remarks * This empty interface exists solely for module augmentation. Extend it to * register token symbols for type-safe selection. * * **Why an interface?** TypeScript only allows module augmentation on * interfaces, not type aliases. * * **Usage** * * Without augmentation, `TokenSymbol` defaults to `string`. * * ```typescript * declare module '@core/tokens' { * interface TokenSymbolRegistry { * USDC: true * EURC: true * } * } * // Now TokenSymbol includes 'USDC' | 'EURC' | ... * ``` * * NOTE: The eslint-disable below suppresses warnings about empty interfaces. * This is intentional—the interface exists solely as an augmentation target. */ interface TokenSymbolRegistry { } /** * Union type of all registered token symbols. * * @remarks * This type is derived from the keys of `TokenSymbolRegistry`: * - **Without augmentation** — Simply `string` (any value) * - **With augmentation** — `'USDC' | 'USDT' | ...` plus any string * * Uses `LiteralUnion` to preserve autocomplete for known values while * still accepting any string at runtime. * * @example * ```typescript * // With symbols.augment imported - autocomplete works * const symbol: TokenSymbol = 'USDC' * * // Custom strings still accepted * const symbol: TokenSymbol = 'MY_TOKEN' * ``` */ type TokenSymbol = keyof TokenSymbolRegistry extends never ? string : LiteralUnion>; /** * Token selector accepted by adapters and the static * {@link TokenRegistry.resolve} method. * * @remarks * Keep this alias at adapter and registry boundaries so their accepted token * forms remain explicit even when other product surfaces define narrower * token inputs. */ type RegistryTokenSelector = TokenSymbol | RawTokenSelector; /** * The resolved token information after registry lookup. * * @remarks * This is the result of resolving a `TokenSelector` against a chain. * It always contains the locator and decimals, and optionally the symbol * if the token was resolved from the registry. */ interface ResolvedToken { /** * The token symbol, if known. * Present when resolved from registry, absent for raw locators. */ readonly symbol?: string; /** * The number of decimal places for the token. */ readonly decimals: number; /** * The chain-specific token locator (address, program ID, etc.). */ readonly locator: string; } /** * Options for creating a token registry. * * @remarks * The registry always includes built-in tokens (USDC, etc.) by default. * Use `tokens` to add custom token definitions that will be merged with * the built-ins. Custom tokens with the same symbol as a built-in will * override it. * * @example * ```typescript * // Add custom tokens (USDC is still available) * const registry = createTokenRegistry({ * tokens: [myCustomToken], * }) * * // Override USDC with custom definition * const registry = createTokenRegistry({ * tokens: [customUsdcDefinition], * }) * ``` */ interface TokenRegistryOptions { /** * Additional token definitions to register. * These are merged with built-in tokens (DEFAULT_TOKENS). * Tokens with the same symbol as a built-in will override it. */ readonly tokens?: readonly TokenDefinition[]; /** * Require decimals when using raw locator selectors. * When true, raw selectors without decimals will throw. * @defaultValue false */ readonly requireDecimals?: boolean; } /** * Interface for the token registry. * * @remarks * The registry is the sole source of truth for token information. * It supports both symbol-based and raw locator-based token selection. * * @example * ```typescript * import { createTokenRegistry } from '@core/tokens' * * // Create registry (includes built-in tokens like USDC) * const registry = createTokenRegistry() * * // Resolve by symbol * const usdc = registry.resolve('USDC', 'Ethereum') * console.log(usdc.locator) // '0xa0b86991...' * * // Resolve raw locator * const custom = registry.resolve({ locator: '0x...', decimals: 18 }, 'Ethereum') * ``` */ interface TokenRegistry { /** * Resolve a token selector to concrete token information for a chain. * * @param selector - The token to resolve. Accepts a symbol or raw locator. * @param chainId - The chain identifier to resolve for. * @returns The resolved token information. * @throws When the token cannot be resolved (unknown symbol, missing decimals, etc.). */ resolve(selector: RegistryTokenSelector, chainId: ChainIdentifier): ResolvedToken; /** * Resolve a token by chain-specific locator (address/program ID). * * @param address - The token locator to resolve. * @param chainId - The chain identifier to resolve for. * @returns The resolved token information. * @throws When no registry token matches the locator on the chain. */ resolveByAddress(address: string, chainId: ChainIdentifier): ResolvedToken; /** * Get a token definition by symbol. * * @param symbol - The token symbol (e.g., "USDC"). * @returns The token definition, or undefined if not found. */ get(symbol: string): TokenDefinition | undefined; /** * Check if a symbol is registered. * * @param symbol - The token symbol to check. * @returns True if the symbol is in the registry. */ has(symbol: string): boolean; /** * Get all registered token symbols. * * @returns An array of registered symbol strings. */ symbols(): string[]; /** * Get all registered token definitions. * * @returns An array of all TokenDefinition objects in the registry. */ entries(): TokenDefinition[]; } /** * Create a token registry with built-in tokens and optional extensions. * * @remarks * The registry always includes built-in tokens (DEFAULT_TOKENS) like USDC. * Custom tokens are merged on top - use this to add new tokens or override * built-in definitions. * * @param options - Configuration options for the registry. * @returns A token registry instance. * * @example * ```typescript * import { createTokenRegistry } from '@core/tokens' * * // Create registry with built-in tokens (USDC, etc.) * const registry = createTokenRegistry() * * // Resolve USDC on Ethereum * const usdc = registry.resolve('USDC', 'Ethereum') * console.log(usdc.locator) // '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48' * console.log(usdc.decimals) // 6 * ``` * * @example * ```typescript * // Add custom tokens (built-ins are still included) * const myToken: TokenDefinition = { * symbol: 'MY', * decimals: 18, * locators: { Ethereum: '0x...' }, * } * * const registry = createTokenRegistry({ tokens: [myToken] }) * registry.resolve('USDC', 'Ethereum') // Still works! * registry.resolve('MY', 'Ethereum') // Also works * ``` * * @example * ```typescript * // Override a built-in token * const customUsdc: TokenDefinition = { * symbol: 'USDC', * decimals: 6, * locators: { MyChain: '0xCustomAddress' }, * } * * const registry = createTokenRegistry({ tokens: [customUsdc] }) * // Now USDC resolves to customUsdc definition * ``` * * @example * ```typescript * // Resolve arbitrary tokens by raw locator * const registry = createTokenRegistry() * const token = registry.resolve( * { locator: '0x1234...', decimals: 18 }, * 'Ethereum' * ) * ``` */ declare function createTokenRegistry(options?: TokenRegistryOptions): TokenRegistry; /** * Structured fields that can be attached to log entries. */ type LogFields = Record; /** * Logger interface providing structured logging with child scoping. * * @remarks * This interface defines a minimal, framework-agnostic logging contract. * The underlying implementation uses pino for transport handling (console, * file, remote, JSON, pretty, etc.) but consumers only interact with this * stable interface. * * @example * ```typescript * import { createLogger } from '@core/runtime' * * const logger = createLogger({ level: 'debug' }) * * // Simple message * logger.info('Server started') * * // Message with structured fields * logger.info('Request received', { method: 'POST', path: '/api/transfer' }) * * // Create child logger with context * const requestLogger = logger.child({ requestId: 'abc-123' }) * requestLogger.debug('Processing transfer') * // Output includes: requestId in all subsequent logs * ``` */ interface Logger { /** * Log a debug-level message. * @param message - The log message. * @param fields - Optional structured fields. * @returns void */ debug(message: string, fields?: LogFields): void; /** * Log an info-level message. * @param message - The log message. * @param fields - Optional structured fields. * @returns void */ info(message: string, fields?: LogFields): void; /** * Log a warning-level message. * @param message - The log message. * @param fields - Optional structured fields. * @returns void */ warn(message: string, fields?: LogFields): void; /** * Log an error-level message. * @param message - The log message. * @param fields - Optional structured fields. * @returns void */ error(message: string, fields?: LogFields): void; /** * Create a child logger with additional contextual bindings. * * @param tags - Key-value pairs to add to the child logger's context. * Undefined values are filtered out automatically. * @returns A new Logger instance with merged bindings. * * @example * ```typescript * const requestLogger = logger.child({ requestId: 'req-123' }) * const userLogger = requestLogger.child({ userId: 'user-456' }) * // All logs from userLogger include both requestId and userId * ``` */ child(tags: LogFields): Logger; } /** * Handler function for event subscriptions. */ type EventHandler = (event: Event) => void | Promise; /** * Event bus for publishing and subscribing to events. * * @remarks * Supports wildcard topic subscriptions: * - `*` matches exactly one segment * - `**` matches zero or more segments * * @example * ```typescript * const bus = createEventBus() * * // Subscribe to all events * bus.on((event) => console.log(event)) * * // Subscribe to specific topic * bus.on('tx.wait.started', (event) => console.log(event)) * * // Subscribe with wildcard * bus.on('tx.wait.*', (event) => console.log(event)) * bus.on('tx.**', (event) => console.log(event)) * * // Emit events * bus.emit({ name: 'tx.wait.started', data: { txId: '0x123' } }) * ``` */ interface EventBus { /** * Emit an event to all matching subscribers. * * @param event - The event to emit. * @remarks * Synchronous and never throws. Handler errors are isolated. */ emit(event: Event): void; /** * Create a child event bus with scoped tags. * * @param tags - Tags to merge into all emitted events. * @returns A new EventBus with merged tags. */ child(tags: Tags): EventBus; /** * Subscribe to all events. * * @param handler - Function called for every event. * @returns Unsubscribe function. */ on(handler: EventHandler): () => void; /** * Subscribe to events matching a pattern. * * @param pattern - Topic pattern (supports `*` and `**` wildcards). * @param handler - Function called for matching events. * @returns Unsubscribe function. * * @remarks * Wildcard semantics: * - `*` matches exactly one segment (no dots) * - `**` matches zero or more segments (only valid at end) * * @example * ```typescript * bus.on('*', handler) // matches 'tx', 'user' (single segment only) * bus.on('tx.wait.*', handler) // matches tx.wait.started, tx.wait.failed * bus.on('tx.wait.**', handler) // matches tx.wait, tx.wait.started, tx.wait.foo.bar * bus.on('**', handler) // matches all events * ``` */ on(pattern: string, handler: EventHandler): () => void; } /** * Metrics type definitions for the Runtime module. * * @remarks * Define a minimal, pluggable metrics interface that can be backed by any * metrics library (hot-shots, dd-trace, prom-client, etc.). * * The interface supports: * - Counters for monotonically increasing values * - Histograms for distributions (latencies, sizes) * - Timers as a convenience wrapper for timing operations * - Label scoping via `child()` for dimensional metrics * * @example * ```typescript * // Basic usage * metrics.counter('requests.total').inc({ method: 'POST' }) * metrics.histogram('request.duration').observe({ status: 200 }, 42.5) * * // Timer convenience * const stop = metrics.timer('db.query').start({ table: 'users' }) * await query() * stop() // Records duration automatically * * // Scoping adds base labels to all metrics * const scoped = metrics.child({ service: 'bridge', env: 'prod' }) * scoped.counter('transfers').inc() // Includes service + env labels * ``` */ /** * Labels for dimensional metrics. * * @remarks * Labels (also called tags in some systems) are key-value pairs that * provide dimensions for metric aggregation and filtering. * Values must be primitives for serialization compatibility. * * @example * ```typescript * const labels: MetricLabels = { * chain: 'Ethereum', * status: 'success', * retries: 3, * cached: true, * } * ``` */ type MetricLabels = Record; /** * A counter metric for monotonically increasing values. * * @remarks * Use counters for values that only go up: request counts, error counts, * bytes processed, etc. The value resets only on process restart. * * @see {@link Metrics.counter} to obtain a Counter instance. * * @example * ```typescript * const counter = metrics.counter('http.requests') * * // Increment by 1 * counter.inc() * counter.inc({ method: 'GET' }) * * // Increment by specific value * counter.inc(5) * counter.inc({ method: 'POST' }, 3) * ``` */ interface Counter { /** * Increment the counter value. * * @param labelsOrValue - The labels object or increment value. * When a number, increments by that amount with no labels. * When an object, uses as labels with optional value in second param. * @param value - The increment value when first arg is labels. Default: 1. * @returns void * * @example * ```typescript * counter.inc() // +1, no labels * counter.inc(5) // +5, no labels * counter.inc({ method: 'GET' }) // +1, with labels * counter.inc({ method: 'POST' }, 3) // +3, with labels * ``` */ inc(labelsOrValue?: MetricLabels | number, value?: number): void; } /** * A histogram metric for recording value distributions. * * @remarks * Use histograms for values that vary and need percentile analysis: * request durations, response sizes, queue depths, etc. * * @see {@link Metrics.histogram} to obtain a Histogram instance. * * @example * ```typescript * const histogram = metrics.histogram('http.duration') * * // Record a value * histogram.observe(42.5) * histogram.observe({ status: 200 }, 42.5) * ``` */ interface Histogram { /** * Record an observation value. * * @param labelsOrValue - The labels object or observed value. * When a number, records that value with no labels. * When an object, uses as labels with value in second param. * @param value - The observed value when first arg is labels. Default: 0. * @returns void * * @example * ```typescript * histogram.observe(42.5) // Value only * histogram.observe({ status: 200 }, 42.5) // With labels * ``` */ observe(labelsOrValue?: MetricLabels | number, value?: number): void; } /** * A timer metric for measuring operation durations. * * @remarks * Timers provide a convenience wrapper that automatically records durations * to an underlying histogram. Call `start()` to begin timing and the * returned function to stop and record the elapsed time in milliseconds. * * @see {@link Metrics.timer} to obtain a Timer instance. * * @example * ```typescript * const timer = metrics.timer('db.query') * * // Start timing * const stop = timer.start({ table: 'users' }) * await performQuery() * stop() // Records duration in milliseconds * ``` */ interface Timer { /** * Start timing an operation. * * @param labels - The optional labels for the timing observation. * @returns A stop function that records the duration when called. * * @example * ```typescript * const stop = timer.start({ operation: 'fetch' }) * await fetchData() * stop() // Records elapsed time * ``` */ start(labels?: MetricLabels): () => void; } /** * Main metrics interface for instrumentation. * * @remarks * This interface is designed to be thin and pluggable. Implementations * can delegate to any metrics library: * * - **hot-shots**: StatsD/DogStatsD client * - **dd-trace**: Datadog APM * - **prom-client**: Prometheus * - **opentelemetry-js**: OpenTelemetry * * The `child()` method creates a scoped metrics instance that automatically * includes base labels on all metric operations. * * @see {@link createMockMetrics} for testing. * @see {@link noopMetrics} for a no-op implementation. * * @example * ```typescript * // Create a scoped metrics instance * const appMetrics = metrics.child({ * service: 'app-kit', * version: '1.0.0', * }) * * // All metrics include service + version labels * appMetrics.counter('transfers.initiated').inc({ chain: 'ethereum' }) * ``` */ interface Metrics { /** * Get or create a counter metric by name. * * @param name - The metric name (e.g., 'http.requests.total'). * @returns A Counter instance for the given name. * * @example * ```typescript * const counter = metrics.counter('requests.total') * counter.inc({ method: 'GET' }) * ``` */ counter(name: string): Counter; /** * Get or create a histogram metric by name. * * @param name - The metric name (e.g., 'http.request.duration'). * @returns A Histogram instance for the given name. * * @example * ```typescript * const histogram = metrics.histogram('request.duration') * histogram.observe({ status: 200 }, 42.5) * ``` */ histogram(name: string): Histogram; /** * Get or create a timer metric by name. * * @param name - The metric name (e.g., 'db.query.duration'). * @returns A Timer instance for the given name. * * @example * ```typescript * const stop = metrics.timer('db.query').start() * await query() * stop() * ``` */ timer(name: string): Timer; /** * Create a child metrics instance with scoped labels. * * @param labels - The base labels to include on all metric operations. * @returns A new Metrics instance with merged labels. * * @remarks * Labels from the child are merged with any labels passed to individual * metric operations. Call-site labels take precedence for the same key. * * @example * ```typescript * const scoped = metrics.child({ chain: 'Ethereum' }) * scoped.counter('transfers').inc({ status: 'success' }) * // Labels: { chain: 'Ethereum', status: 'success' } * ``` */ child(labels: MetricLabels): Metrics; } /** * Core type definitions for the runtime package. * * @remarks * This module defines the foundational types used throughout the SDK: * * - {@link Runtime} - Complete runtime with all services (clock, logger, metrics, events) * - {@link ExecutionContext} - Context for middleware with observability surface * - {@link Clock}, {@link Tags}, {@link Event} - Supporting types * * **Naming Convention** * * | Input Type | Resolved Type | Description | * |------------|---------------|-------------| * | `Partial` | `Runtime` | Runtime services | * | `OperationMeta` | `OperationContext` | WHAT - operation target | * | `InvocationMeta` | `InvocationContext` | WHO/HOW - call chain | * * @packageDocumentation */ /** * Clock interface for time operations. * * @remarks * Abstracting time allows tests to control timing without real delays. * Production code uses {@link defaultClock}, tests use mock implementations. * * @example * ```typescript * import { defaultClock, type Clock } from '@core/runtime' * * const start = defaultClock.now() * // ... do work ... * const elapsed = defaultClock.since(start) * ``` */ interface Clock { /** * Return the current timestamp in milliseconds since Unix epoch. * * @returns Current time in milliseconds. */ now(): number; /** * Calculate elapsed time since a given timestamp. * * @param start - The start timestamp in milliseconds. * @returns Elapsed time in milliseconds (`now() - start`). */ since: (start: number) => number; } /** * Contextual metadata tags for logging and metrics. * * @remarks * Tags are key-value pairs attached to log entries and metrics. * Values can be primitives or undefined (undefined values are filtered out). * * Common tags include: * - `opId` - Operation identifier for correlation * - `chain` - Blockchain network name * - `phase` - Current pipeline phase * * @example * ```typescript * import type { Tags } from '@core/runtime' * * const tags: Tags = { * opId: 'op-abc123', * chain: 'Ethereum', * phase: 'validate', * optional: undefined, // Will be filtered out * } * ``` */ type Tags = Record; /** * A structured event emitted by the runtime. * * @remarks * Events provide a standardized way to capture lifecycle moments, * actions, and state changes throughout the SDK. */ interface Event { /** The event name/identifier. */ name: string; /** Log level for the event. */ level?: 'debug' | 'info' | 'warn' | 'error'; /** Timestamp (epoch ms) when the event occurred. */ at?: number; /** Contextual tags for filtering/categorization. */ tags?: Tags; /** Arbitrary payload data associated with the event. */ data?: unknown; } /** * Complete runtime with all services guaranteed present. * * @remarks * The runtime is the container for all cross-cutting concerns: logging, * timing, events, and metrics. All services are guaranteed to be available. * * **Creating a Runtime** * * Use {@link createRuntime} to create a fully-configured runtime: * ```typescript * import { createRuntime } from '@core/runtime' * * const runtime = createRuntime() * runtime.logger.info('Hello') * runtime.metrics.counter('requests').inc() * ``` * * **Partial Runtime Input** * * When accepting runtime configuration as input, use `Partial`: * ```typescript * function myFunction(options: { runtime?: Partial }) { * const runtime = createRuntime(options.runtime) * // ... * } * ``` * * @example * ```typescript * import { createRuntime, type Runtime } from '@core/runtime' * * const runtime: Runtime = createRuntime() * * // All services are guaranteed present * runtime.logger.info('Processing request') * runtime.metrics.counter('requests').inc() * runtime.events.emit({ name: 'request.received' }) * const now = runtime.clock.now() * ``` */ interface Runtime { /** * Clock for time operations. * * @remarks * Provides the current timestamp. Use {@link defaultClock} for production * or custom clocks for deterministic testing. */ clock: Clock; /** * Logger for structured logging. * * @remarks * Provides debug, info, warn, error methods with structured data support. */ logger: Logger; /** * Metrics collector for observability. * * @remarks * Provides counters, histograms, and timers for application metrics. */ metrics: Metrics; /** * Event bus for pub/sub events. * * @remarks * Enables decoupled event emission and subscription across the SDK. */ events: EventBus; } /** * A component in the call chain. * * @remarks * Each caller identifies itself with a type (app, kit, provider, adapter) * and a name/version. This enables proper attribution in logs, metrics, and traces. * * @example * ```typescript * import type { Caller } from '@core/runtime' * * const appCaller: Caller = { type: 'app', name: 'MyDApp', version: '1.0.0' } * const kitCaller: Caller = { type: 'kit', name: 'BridgeKit', version: '2.0.0' } * ``` */ interface Caller { /** * Type of component in the call hierarchy. * * @remarks * Common types: `app`, `kit`, `provider`, `adapter` */ readonly type: string; /** Name of the component (e.g., 'BridgeKit', 'cctp-v2'). */ readonly name: string; /** Version of the component (e.g., '1.0.0'). */ readonly version?: string | undefined; } /** * User input for invocation metadata. * * @remarks * Defines **WHO** called and **HOW** to observe: trace correlation, runtime override, * and caller chain. This is the user-facing input type, resolved to `InvocationContext`. * * Passed as the optional invocation argument to actions and primitives. * * @example * ```typescript * import type { InvocationMeta } from '@core/runtime' * * // Minimal - just traceId * const meta: InvocationMeta = { traceId: 'abc-123' } * * // Full - with runtime override and caller chain * const meta: InvocationMeta = { * traceId: 'abc-123', * runtime: myRuntime, * callers: [ * { type: 'app', name: 'MyDApp', version: '1.0.0' }, * ], * } * ``` */ interface InvocationMeta { /** * Trace ID for distributed tracing correlation. * * @remarks * If not provided, generated automatically. */ readonly traceId?: string | undefined; /** * Runtime override (complete replacement). * * @remarks * When provided, this runtime completely replaces the default runtime. * Must be a complete Runtime instance (e.g., from `createRuntime()`). * If not provided, the default runtime is used. */ readonly runtime?: Runtime | undefined; /** * Token registry override (complete replacement). * * @remarks * When provided, this registry completely replaces the default token registry. * Enables kits to pass their token registry to adapters. * If not provided, the default token registry is used. */ readonly tokens?: TokenRegistry | undefined; /** * Call chain - each caller appends itself. * * @remarks * Ordered from outermost (first) to innermost (last). * Example: [app, kit, provider] */ readonly callers?: readonly Caller[] | undefined; /** * Cooperative cancellation signal for the invocation. * * @remarks * When provided, the signal is threaded onto the resolved * {@link InvocationContext} so operations can forward it to * cancellable work (e.g. `fetch`, timers, adapter calls). Optional and * backwards-compatible: callers that do not support cancellation simply * omit it. Aborting the signal is the caller's responsibility; the * runtime only propagates it. */ readonly signal?: AbortSignal | undefined; } /** * Resolved invocation context with guaranteed values. * * @remarks * Defines **WHO** called and **HOW** to observe. Contains the complete runtime * and guaranteed trace ID. * * Created by `resolveInvocationContext()` from `InvocationMeta`. * * @example * ```typescript * import type { InvocationContext } from '@core/runtime' * * const ctx: InvocationContext = { * traceId: 'abc-123', * runtime: completeRuntime, * callers: [{ type: 'app', name: 'MyDApp' }], * } * ``` */ interface InvocationContext { /** * Trace ID for distributed tracing correlation. * * @remarks * Guaranteed to be present (generated if not provided in input). */ readonly traceId: string; /** * Complete runtime with all services. * * @remarks * All services (clock, logger, events, metrics) are guaranteed present. */ readonly runtime: Runtime; /** * Token registry for resolving token information. * * @remarks * Guaranteed to be present. Uses provided registry or falls back to default. */ readonly tokens: TokenRegistry; /** * Call chain (empty array if not provided). */ readonly callers: readonly Caller[]; /** * Cooperative cancellation signal for the invocation. * * @remarks * Mirrors {@link InvocationMeta.signal}. Present only when the caller * supplied one — the runtime never fabricates a signal. Operations may * forward it to cancellable work; aborting remains the caller's * responsibility. */ readonly signal?: AbortSignal | undefined; } /** * Factory for creating Runtime instances with defaults. * * @packageDocumentation */ /** * Configuration options for {@link createRuntime}. * * @remarks * Only `logger` and `metrics` can be overridden. Internal services * (`clock`, `events`) are managed by the SDK. */ interface RuntimeOptions { /** * Custom logger implementation. * * @remarks * Integrate with your existing logging infrastructure (pino, winston, etc.). * Must implement debug, info, warn, error, and child methods. * * Default: pino logger at 'info' level. */ logger?: Logger; /** * Custom metrics implementation. * * @remarks * Plug into your observability stack (Prometheus, StatsD, DataDog, etc.). * Must implement counter, histogram, timer, and child methods. * * Default: No-op metrics (no collection). */ metrics?: Metrics; } /** * Create a complete Runtime with sensible defaults. * * @param options - Optional configuration to override logger and metrics. * @returns A frozen, immutable Runtime with all services guaranteed present. * @throws KitError (INPUT_VALIDATION_FAILED) if options contain invalid services. * * @remarks * Creates a fully-configured runtime by merging provided options with defaults. * The returned runtime is frozen to enforce immutability. * * | Service | Default | Configurable | * |---------|---------|--------------| * | `logger` | pino logger (info level) | Yes | * | `metrics` | No-op metrics | Yes | * | `events` | Internal event bus | No | * | `clock` | `Date.now()` | No | * * **Why only logger and metrics?** * * - **Logger/Metrics**: Integration points with your infrastructure * - **Events**: Internal pub/sub mechanism - subscribe via `runtime.events.on()` * - **Clock**: Testing concern - use mock factories for tests * * @example * ```typescript * import { createRuntime, createLogger } from '@core/runtime' * * // Use all defaults * const runtime = createRuntime() * * // Custom logger * const runtime = createRuntime({ * logger: createLogger({ level: 'debug' }), * }) * * // Custom metrics (e.g., Prometheus) * const runtime = createRuntime({ * metrics: myPrometheusMetrics, * }) * * // Subscribe to events (don't replace the bus) * runtime.events.on('operation.*', (event) => { * console.log('Event:', event.name) * }) * ``` */ declare function createRuntime(options?: RuntimeOptions): Runtime; /** * Fallback values for invocation context resolution. */ interface InvocationDefaults { /** Default runtime to use if not overridden in meta. */ runtime: Runtime; /** Default token registry to use if not overridden in meta. */ tokens: TokenRegistry; } /** * Resolve invocation metadata to invocation context. * * @param meta - User-provided invocation metadata (**WHO/HOW**), optional. * @param defaults - Default runtime and tokens to use if not overridden. * @returns Frozen, immutable invocation context with guaranteed values. * @throws KitError when meta contains invalid properties. * * @remarks * Resolves the **WHO** called and **HOW** to observe: * - TraceId: Uses provided value or generates new one * - Runtime: Uses meta.runtime if provided, otherwise defaults.runtime * - Tokens: Uses meta.tokens if provided, otherwise defaults.tokens * - Callers: Uses provided array or empty array * * The returned context is frozen to enforce immutability. * * @example * ```typescript * import { resolveInvocationContext, createRuntime } from '@core/runtime' * import { createTokenRegistry } from '@core/tokens' * * const defaults = { * runtime: createRuntime(), * tokens: createTokenRegistry(), * } * * // Minimal - just using defaults * const ctx = resolveInvocationContext(undefined, defaults) * * // With trace ID and caller info * const ctx = resolveInvocationContext( * { * traceId: 'abc-123', * callers: [{ type: 'kit', name: 'BridgeKit', version: '1.0.0' }], * }, * defaults * ) * * // With runtime override (complete replacement) * const ctx = resolveInvocationContext( * { runtime: createRuntime({ logger: myLogger }) }, * defaults * ) * ``` */ declare function resolveInvocationContext(meta: InvocationMeta | undefined, defaults: InvocationDefaults): InvocationContext; /** * Invocation context extension - adds callers to an existing context. * * @packageDocumentation */ /** * Extend an invocation context by appending a caller to its call chain. * * @param context - The existing invocation context to extend. * @param caller - The caller to append to the call chain. * @returns A new frozen invocation context with the caller appended. * * @remarks * This function creates a new immutable context with the caller appended * to the `callers` array while preserving all other context properties * (traceId, runtime, tokens). * * The returned context is frozen to enforce immutability. * * @example * ```typescript * import { extendInvocationContext } from '@core/runtime' * * const caller = { type: 'provider', name: 'CCTPV2', version: '1.0.0' } * const extended = extendInvocationContext(existingContext, caller) * // extended.callers === [...existingContext.callers, caller] * ``` */ declare function extendInvocationContext(context: InvocationContext, caller: Caller): InvocationContext; /** * Create a W3C/OpenTelemetry-compatible trace ID. * * @returns 32-character lowercase hex string (128-bit). * * @remarks * **Standard function for generating `traceId` values.** Compatible with * OpenTelemetry, Jaeger, Zipkin, and AWS X-Ray. * * @example * ```typescript * const traceId = createTraceId() // "a1b2c3d4e5f6789012345678abcdef00" * ``` */ declare function createTraceId(): string; /** * Transfer speed options for cross-chain operations. * * Defines the available speed modes for CCTPv2 transfers, affecting * both transfer time and potential fee implications. */ declare enum TransferSpeed { /** Fast burn mode - reduces transfer time but may have different fee implications */ FAST = "FAST", /** Standard burn mode - normal transfer time with standard fees */ SLOW = "SLOW" } /** * Context object representing a wallet and signing authority on a specific blockchain network. * * Combines a wallet or contract address, the blockchain it resides on, and the adapter (signer) * responsible for authorizing transactions. Used to specify the source or destination in cross-chain * transfer operations. * * @remarks * The `adapter` (signer) and `address` do not always have to belong to the same entity. For example, * in minting or withdrawal scenarios, the signing adapter may authorize a transaction that credits * funds to a different recipient address. This context is essential for cross-chain operations, * ensuring that both the address and the associated adapter are correctly paired with the intended * blockchain, but not necessarily with each other. * * @example * ```typescript * import type { WalletContext } from '@core/provider' * import { adapter, blockchain } from './setup' * * const wallet: WalletContext = { * adapter, * address: '0x1234...abcd', * chain: blockchain, * } * ``` */ interface WalletContext { /** * The adapter (signer) for the wallet on the specified chain. * * Responsible for authorizing transactions and signing messages on behalf of the wallet or * for a different recipient, depending on the use case. */ adapter: Adapter; /** * The wallet or contract address. * * Must be a valid address format for the specified blockchain. May differ from the adapter's * own address in scenarios such as relayed transactions or third-party minting. */ address: string; /** * The blockchain network where the wallet or contract address resides. * * Determines the context and format for the address and adapter. */ chain: TChainDefinition; } /** * Wallet context for bridge destinations with optional custom recipient. * * Extends WalletContext to support scenarios where the recipient address * differs from the signer address (e.g., bridging to a third-party wallet). * The signer address is used for transaction authorization, while the * recipient address specifies where the minted funds should be sent. * * @typeParam TAdapterCapabilities - The adapter capabilities type to use for the wallet context. * @typeParam TChainDefinition - The chain definition type to use for the wallet context. * * @example * ```typescript * import type { DestinationWalletContext } from '@core/provider' * import { adapter, blockchain } from './setup' * * // Bridge to a custom recipient address * const destination: DestinationWalletContext = { * adapter, * address: '0x1234...abcd', // Signer address * chain: blockchain, * recipientAddress: '0x9876...fedc' // Custom recipient * } * ``` */ interface DestinationWalletContext extends WalletContext { /** * Optional custom recipient address for minted funds. * * When provided, minted tokens will be sent to this address instead of * the address specified in the wallet context. The wallet context address * is still used for transaction signing and authorization. * * Must be a valid address format for the specified blockchain. */ recipientAddress?: string; /** * Whether Circle's relayer submits the destination transaction. * * How an omitted value resolves, and whether an explicit `false` is accepted, * is provider-specific. */ useForwarder?: boolean; /** * Optional destination dApp deposit action for a fast cross-chain transfer. * * When set, the burned USDC is minted to Circle's GenericExecutor on the * destination chain, which calls the registered dApp (for example, a Gateway * `depositFor`) in the same relayed flow. Consumed by the CCTP v2 provider's * executor-deposit path; requires `useForwarder: true`. * * @see {@link BridgeDepositAction} */ deposit?: BridgeDepositAction; } /** * Destination dApp deposit action for a fast cross-chain transfer. * * When present on a bridge destination, the CCTP v2 provider routes the * transfer through Circle's GenericExecutor: the burned USDC is minted to the * executor on the destination chain, which then calls the registered dApp (for * example, a Gateway `depositFor`) in the same relayed flow. Encoded into * executor hookData via `buildDepositForGenericExecutorPayload`. * * @example * ```typescript * import type { BridgeDepositAction } from '@core/provider' * * const deposit: BridgeDepositAction = { * dappId: 'gateway_deposit', * params: ['0xTokenMessengerWithFees', '0xDepositAccount', 0n], * } * ``` */ interface BridgeDepositAction { /** * Registered dApp identifier the GenericExecutor invokes on the destination * chain (for example, `'gateway_deposit'`). */ dappId: string; /** * Positional arguments for the dApp function, in ABI order. Dynamic amount * slots are filled in by the executor from the minted amount. */ params: readonly unknown[]; } /** * Parameters for executing a cross-chain bridge operation. */ interface BridgeParams$1 // params.token is typed as `0x${string}` * ``` */ TToken extends string = 'USDC'> { /** The source adapter containing wallet and chain information */ source: WalletContext; /** The destination adapter containing wallet and chain information */ destination: DestinationWalletContext; /** The amount to transfer (as a string to avoid precision issues) */ amount: string; /** The token to transfer (provider-defined; defaults to `'USDC'`) */ token: TToken; /** Bridge configuration (e.g., fast burn settings) */ config: BridgeConfig; /** * Optional server-signed quote to reuse, typically the * {@link EstimateResult.quote} returned by an earlier `estimate` call. * * When present and still valid, a provider with a server-signed quote * model may reuse it instead of fetching a fresh quote, so the fee the * caller was quoted is the fee they pay. Providers decide when a reused * quote is still valid (e.g. freshness, fee token, speed); an unusable or * mismatched quote is ignored and a fresh one is fetched. Transfer * parameters are validated by the provider's on-chain contract, so a quote * reused for a different transfer is rejected there rather than silently. * Providers without a quote model ignore this field entirely, and do so * silently — nothing verifies that a quote reached the provider that issued * it, because the route is matched to a provider only after these * parameters are validated. A quote is meaningful only on the route that * produced it. * * Typed `unknown`: a caller reaches `bridge` through a provider-agnostic * surface, so this shared type names no provider's shape. It is public * input in any case, and is validated before any field is read — by the * provider that serves the route, or by the kit for routes it prices * itself. Treat it as opaque and pass it back unmodified. * * This is a `bridge` input. A quote is an output of `estimate`, not an * input to it — `estimate` always returns a freshly-priced quote, and a * provider may reject a quote passed to `estimate` rather than ignore it. */ quote?: unknown; /** * Optional invocation metadata for tracing and correlation. * * When provided, the `traceId` is used to correlate all events emitted during * the bridge operation. If not provided, an OpenTelemetry-compatible traceId * will be auto-generated. */ invocationMeta?: InvocationMeta; } /** * Machine-readable classification of a {@link BridgeStep} error. * * Consumers may use this field for UX decisions (e.g. distinguish a user * rejection from a wallet capability error) without string-matching on * {@link BridgeStep.errorMessage}. The original human-readable error * message is always preserved for display/logging. * * @remarks * The categories map to the most common failure shapes observed across * the EIP-5792 batched bridge path and the sequential bridge path: * * - `user_rejected` — user declined a wallet request (JSON-RPC `4001`). * - `atomic_unsupported` — wallet reported it cannot perform EIP-5792 * atomic batching on this chain. Covers JSON-RPC `5700` (unsupported * capabilities), `5710` (chain not supported for the requested * capability), and `5750` (atomicity requires a wallet upgrade which * the user declined), or equivalent viem-wrapped messages. * - `batch_too_large` — wallet rejected the batch for exceeding its * size limit (JSON-RPC `5740`). * - `duplicate_batch_id` — wallet reported a duplicate batchId * (JSON-RPC `5720`). * - `unknown_bundle` — wallet reported an unknown bundle id during * status polling (JSON-RPC `5730`). * - `polling_timeout` — SDK polled `wallet_getCallsStatus` until the * configured timeout without receiving a terminal status. * - `failed_offchain` — wallet reported EIP-5792 `statusCode: 400` * (batch not included onchain, wallet will not retry). * - `reverted_onchain` — wallet reported EIP-5792 `statusCode: 500` * (batch reverted completely onchain). * - `partial_reverted` — wallet reported EIP-5792 `statusCode: 600` * (batch reverted partially onchain). * - `chain_revert` — transaction was mined but reverted on-chain * (sequential path). * - `unknown` — error did not match any of the above categories. * * @since 2.0.0 * * @example * ```typescript * import type { BridgeStep } from '@core/provider' * * const step: BridgeStep = { * name: 'approve', * state: 'error', * errorMessage: 'User rejected the request', * errorCategory: 'user_rejected', * } * * if (step.errorCategory === 'user_rejected') { * // silent abort: user intentionally cancelled * } else if (step.errorCategory === 'atomic_unsupported') { * // hint the user about switching to step-by-step signing * } * ``` */ type BridgeStepErrorCategory = 'user_rejected' | 'atomic_unsupported' | 'batch_too_large' | 'duplicate_batch_id' | 'unknown_bundle' | 'polling_timeout' | 'failed_offchain' | 'reverted_onchain' | 'partial_reverted' | 'chain_revert' | 'unknown'; /** * A step in the bridge process. * * @remarks * This interface represents a single step in the bridge process, * such as approval, burn, or mint. * * @example * ```typescript * const step: BridgeStep = { * name: 'Approve', * state: 'success', * txHash: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', * explorerUrl: 'https://etherscan.io/tx/0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', * } * ``` */ interface BridgeStep { /** Human-readable name of the step (e.g., "Approve", "Burn", "Mint") */ name: string; /** The state of the step */ state: 'pending' | 'success' | 'error' | 'noop'; /** Optional transaction hash for this step (if applicable) */ txHash?: string; /** Optional explorer URL for viewing this transaction on a block explorer */ explorerUrl?: string; /** Optional data for the step */ data?: unknown; /** * Whether this step was executed via Circle's Forwarder (relay service). * Only applicable for mint steps. * * - `true`: The mint was handled by Circle's Orbit relayer * - `false`: The user submitted the mint transaction directly * - `undefined`: Not applicable (non-mint steps) */ forwarded?: boolean; /** * Whether this step was executed as part of an EIP-5792 batched * `wallet_sendCalls` request. * * - `true`: The step was included in a batched call bundle * - `undefined`: The step was executed individually (sequential flow) */ batched?: boolean | undefined; /** * The wallet-assigned batch identifier from `wallet_sendCalls`. * * Present only when {@link batched} is `true`. Can be used with * `wallet_getCallsStatus` to query the status of the entire bundle. */ batchId?: string | undefined; /** Optional human-readable error message */ errorMessage?: string; /** Optional raw error object (can be Viem/Ethers/Chain error) */ error?: unknown; /** * Optional machine-readable classification of the error. * * Present when the step is in `state: 'error'` and the SDK was able to * categorize the failure. See {@link BridgeStepErrorCategory} for the * list of categories and how they map to underlying error shapes. * * @remarks * The human-readable {@link errorMessage} is always preserved for * logging and display; this field is additive and should be preferred * over string-matching `errorMessage` for machine decisions. * * @since 2.0.0 */ errorCategory?: BridgeStepErrorCategory; } /** * A non-fatal advisory surfaced on a {@link BridgeResult} or an * {@link EstimateResult}. * * Warnings report things the caller should know about that did not fail the * operation — for example a requested FAST transfer that was degraded to SLOW. * They are additive and optional: providers populate them when relevant and * leave `warnings` undefined otherwise, so consumers that ignore the field are * unaffected. * * The codes are shared across both results, so a check written against one * works against the other. A code is raised only where its condition can * arise, so an estimate reaches a subset of what a bridge does. * * @example * ```typescript * const downgrade = result.warnings?.find(w => w.code === 'SPEED_DOWNGRADED') * if (downgrade) { * // Inform the user that the requested FAST speed was not available. * showToast(`Transfer speed changed to ${String(downgrade.data?.['actual'])}`) * } * ``` */ interface BridgeWarning { /** * Stable machine-readable warning code (e.g. `'SPEED_DOWNGRADED'`). Prefer * branching on this over `message`. */ code: string; /** Optional human-readable explanation for logging or display. */ message?: string; /** * Optional structured context for the warning (e.g. * `{ requested: 'FAST', actual: 'SLOW' }`). */ data?: Record; } /** * Warning code surfaced on `result.warnings` when a requested FAST transfer is * degraded to SLOW because fast-burn allowance was unavailable. Exported as a * stable, machine-readable identifier so consumers can branch on it without * hardcoding the string. * * @example * ```typescript * const wasDowngraded = result.warnings?.some( * (w) => w.code === SPEED_DOWNGRADED_WARNING_CODE, * ) * ``` */ declare const SPEED_DOWNGRADED_WARNING_CODE: "SPEED_DOWNGRADED"; /** * Warning code surfaced on `result.warnings` when a caller-supplied `quote` * could not be reused — refused up front, or accepted and then superseded by a * re-fetch — so the fee actually paid may differ from the one quoted. Exported * as a stable, machine-readable identifier so consumers can branch on it (e.g. * to re-confirm the fee in a UI) without hardcoding the string. * * @example * ```typescript * const quoteChanged = result.warnings?.some( * (w) => w.code === QUOTE_NOT_REUSED_WARNING_CODE, * ) * ``` */ declare const QUOTE_NOT_REUSED_WARNING_CODE: "QUOTE_NOT_REUSED"; /** * Result object returned after a successful cross-chain bridge operation. * * This interface contains all the details about a completed bridge, including * the bridge parameters, source and destination information, * and the sequence of steps that were executed. * * @example * ```typescript * const result: BridgeResult = await provider.bridge(source, dest, '100') * console.log(`Transferred ${result.amount} ${result.token}`) * console.log(`Steps executed: ${result.steps.length}`) * ``` */ interface BridgeResult { /** The amount that was transferred (as a string to avoid precision issues) */ amount: string; /** * The token that was transferred. * * @remarks * `TToken` defaults to `'USDC'` to preserve source compatibility for * consumers that use the result type without an explicit generic. Kits that * route across providers use `BridgeResult` internally. * * Provider implementations narrow this in their own subclass code * by passing a literal as the `TToken` generic — for example a * USDC-only provider declares `BridgeResult<'USDC'>`, and a * provider whose tokens are bytes32 identifiers declares the result * with a `0x`-prefixed template-literal string type. */ token: TToken; /** The state of the transfer */ state: 'pending' | 'success' | 'error'; /** The bridge configuration that was used for this operation */ config?: BridgeConfig; /** The provider that was used for this operation */ provider: string; /** Information about the source chain and address */ source: { /** The source wallet/contract address */ address: string; /** The source blockchain network */ chain: ChainDefinition; }; /** Information about the destination chain and address */ destination: { /** The destination wallet/contract address */ address: string; /** The destination blockchain network */ chain: ChainDefinition; /** * Optional custom recipient address for minted funds. * * When provided during the bridge operation, minted tokens are sent to this * address instead of the destination address. This field is preserved in the * result for retry operations to maintain consistency with the original burn. */ recipientAddress?: string; /** * Whether Circle's Forwarder was used for this bridge operation. * * When true, the mint transaction was handled by Circle's Orbit relayer * instead of requiring the user to submit it manually. */ useForwarder?: boolean; }; /** Array of steps that were executed during the bridge process */ steps: BridgeStep[]; /** * Non-fatal advisories surfaced during the bridge (e.g. a FAST→SLOW speed * downgrade). Optional and additive — providers populate it when relevant * and leave it undefined otherwise. See {@link BridgeWarning}. */ warnings?: BridgeWarning[]; } /** * Cost estimation result for a cross-chain transfer operation. * * This interface provides detailed information about the expected costs * for a transfer, including gas fees on different chains and protocol fees. * It also includes the input context (token, amount, source, destination) to * provide a complete view of the transfer being estimated. * * @example * ```typescript * const estimate: EstimateResult = await provider.estimate(source, dest, '100') * console.log('Estimating transfer of', estimate.amount, estimate.token) * console.log('From', estimate.source.chain.name, 'to', estimate.destination.chain.name) * console.log('Total gas fees:', estimate.gasFees.length) * console.log('Protocol fees:', estimate.fees.length) * ``` * * @typeParam TToken - The symbol type of the estimated token. Defaults to * `'USDC'` for source compatibility. Provider-agnostic kit internals use * `string` explicitly. * @typeParam TFeeToken - The symbol type of the protocol/service fee token * (`fees[].token`). Defaults to `'USDC'` for source compatibility. The fee * token is independent of the transferred token — a wETH transfer may pay * its fee in native currency or USDC. * @typeParam TQuote - The shape of `quote`. Defaults to `unknown`, since a * result read across providers could carry any of their quote shapes; a * provider narrows it to the one it returns. */ interface EstimateResult { /** * The token being estimated. * * @remarks * `TToken` defaults to `'USDC'` to preserve source compatibility for * consumers that use the result type without an explicit generic. Kits that * route across providers use `EstimateResult` internally. */ token: TToken; /** The amount being transferred */ amount: string; /** Information about the source chain and address */ source: { /** The source wallet/contract address */ address: string; /** The source blockchain network */ chain: Blockchain; }; /** Information about the destination chain and address */ destination: { /** The destination wallet/contract address */ address: string; /** The destination blockchain network */ chain: Blockchain; /** Optional custom recipient address for minted funds. */ recipientAddress?: string; }; /** Array of gas fees required for the transfer on different blockchains */ gasFees: { /** The name of the step */ name: string; /** The token used to pay gas fees (e.g., "ETH", "MATIC") */ token: string; /** The blockchain where this gas fee applies */ blockchain: Blockchain; /** The estimated gas fee amount (as a string to avoid precision issues) */ fees: EstimatedGas | null; /** Optional error object if the estimate failed */ error?: unknown; }[]; /** Array of protocol and service fees for the transfer */ fees: { /** The type of fee - from the bridge kit, provider (CCTP), or forwarder (Circle Orbit relayer) */ type: 'kit' | 'provider' | 'forwarder'; /** * The token symbol in which the fee is charged. Legacy providers * populate this with `'USDC'`. Providers whose fee token is * server-chosen per quote populate this with a best-effort symbol * resolved by the provider (e.g. native currency symbol for the * source chain, `'USDC'` for the chain's USDC address, or the * raw address string as a fallback when the symbol is unknown). * A provider whose quote carries the canonical raw address exposes it * there; narrow `quote` to that provider's type to read it. * * The static type is the `TFeeToken` generic (defaults to `string`); * USDC-only providers narrow it to `'USDC'`. */ token: TFeeToken; /** The fee amount (as a string to avoid precision issues) */ amount: string | null; /** Optional error object if the estimate failed */ error?: unknown; }[]; /** * Optional server-signed quote. * * Carries what the provider received from its off-chain quote service, * for the caller to pass back to `bridge` and be charged the fee they * were quoted. Providers without a server-signed quote model (e.g. CCTP * v2 USDC bridges) leave this field undefined; the `fees[]` array is the * single source of fee data for those providers. * * Typed as the `TQuote` parameter, which defaults to `unknown`, because a * result read through a provider-agnostic surface could have come from any * of them. A provider narrows it to what it actually returns — raw signed * bytes for some, a metadata object for others — and any per-component fee * breakdown lives there; `fees[]` carries the single fee summary either way. * Narrow it to the issuing provider's type before reading a field. */ quote?: TQuote; /** * Optional non-fatal advisories about how this estimate was produced. * * An estimate can differ from what the caller asked for without failing — * the speed may be re-priced — and that difference leaves no positive trace * anywhere else in the result: it can only be inferred by comparing the * quote's fee items against the speed that was asked for, on a provider * whose quote exposes them. The codes are drawn * from the same set a bridge uses, so a consumer checks both results the same * way. * * @see {@link BridgeWarning} * * @example * ```typescript * const estimate = await kit.estimate(params) * const repriced = estimate.warnings?.some( * (w) => w.code === SPEED_DOWNGRADED_WARNING_CODE, * ) * ``` */ warnings?: BridgeWarning[]; } /** * Configuration options for customizing bridge behavior. * * @remarks * This interface is currently incomplete and will be expanded in future versions * to include additional configuration options such as slippage tolerance, * deadline settings, and other bridge parameters. * */ interface BridgeConfig { /** * The transfer speed mode for CCTPv2 transfers. * * Controls whether to use fast burn mode (FAST) or standard mode (SLOW). * Fast burn may reduce transfer time but could have different fee implications. * * @defaultValue TransferSpeed.FAST */ transferSpeed?: TransferSpeed | `${TransferSpeed}` | undefined; /** * Enable or disable EIP-5792 batched transaction execution. * * When `true` (or `undefined` / omitted), the bridge will attempt to batch * the approve and burn calls into a single `wallet_sendCalls` request if * the connected wallet supports it. Set to `false` to explicitly opt out * and always use the sequential approve -> burn flow. * * @defaultValue `undefined` (batching attempted when the wallet supports it) * * @example * ```typescript * const config: BridgeConfig = { * batchTransactions: false, // force sequential flow * } * ``` */ batchTransactions?: boolean | undefined; /** * The maximum fee to pay for the burn operation. * * Provide the amount as a base-10 numeric string representing the * token amount in human-readable format. For example: to set a maximum * fee of 1 USDC, pass `"1"`. Decimal values are supported (e.g., `"0.5"` * for half a USDC). * * @defaultValue `"0"` * * @example * ```typescript * import type { BridgeConfig, TransferSpeed } from '@core/provider' * * const config: BridgeConfig = { * transferSpeed: TransferSpeed.FAST, * maxFee: "1", // 1 USDC maximum fee * customFee: { * value: "0.5", // 0.5 USDC developer fee * recipientAddress: "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0" * } * } * ``` */ maxFee?: string; /** * The custom fee to charge for the transfer. * * Whatever value you provide here is **added on top of the transfer amount**. The user must have * enough balance for `amount + customFee`, and the wallet signs for that total on the source * chain. The custom fee is split automatically: * * - 10% routes to Circle. * - 90% routes to your `recipientAddress`. * * The original transfer amount proceeds through CCTPv2 unchanged, and the protocol fee (1–14 bps * in FAST mode, 0% in STANDARD) is taken from that transfer amount. * * @example * ```typescript * import type { BridgeConfig } from '@core/provider' * * const config: BridgeConfig = { * customFee: { * value: '5', // 5 USDC developer fee * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0', * }, * } * * // Fee flow for a 100 USDC transfer with 5 USDC custom fee: * // Source chain (Ethereum): * // - Wallet debits: 105 USDC total (100 transfer + 5 custom fee) * // - Custom fee split: 0.5 USDC (10%) → Circle, 4.5 USDC (90%) → your recipientAddress * // - Amount sent to CCTPv2: 100 USDC (unchanged) * // * // Destination chain (Base): * // - CCTPv2 FAST fee (example: 1 bps): ~0.01 USDC deducted * // - User receives: ~99.99 USDC * // * // Note: Actual CCTP fees vary by route (1-14 bps for FAST, 0 bps for STANDARD) * ``` */ customFee?: CustomFee | undefined; /** * Which leg pays the protocol fee. * * `'source'` leaves the delivered amount unreduced; `'destination'` takes the * fee from it. Omit it to let the routed provider decide — a provider rejects * a value it cannot honour. */ feePayment?: 'source' | 'destination' | undefined; } /** * Custom fee configuration charged by the integrator. * * Use to charge an absolute fee on the source chain in human-readable * token amounts. * * @remarks * This is an absolute amount, not a percentage. The `recipientAddress` must be * a valid address for the source chain of the transfer. * * @example * ```typescript * import type { CustomFee } from '@core/provider' * * const config: CustomFee = { * value: '1', // 1 USDC * recipientAddress: '0x1234567890123456789012345678901234567890', * } * ``` */ interface CustomFee { /** * The absolute fee to charge for the transfer. * * Provide the amount as a base-10 numeric string representing the token * amount in human-readable format. For example: to charge 1 USDC, pass * `"1"`. Decimal values are supported (e.g., `"0.5"` for half a USDC). * This is not a percentage. * * Note: passing `"0"` results in no fee being charged. */ value?: string | undefined; /** * The fee recipient for the bridge transfer. * * This is the address that will receive the fee on the source chain of the * bridge transfer. The fee recipient address **must be a valid address for * the source chain** of the bridge transfer. * * @remarks * Circle automatically receives 10% of every custom fee; the remaining 90% is * sent to this `recipientAddress`. * * For example: if bridging from Ethereum to Solana, pass an EVM address like * `"0x1234567890123456789012345678901234567890"` because the source chain * is Ethereum. */ recipientAddress?: string | undefined; } /** * Represents the context of an adapter used for cross-chain operations. * * An AdapterContext must always specify both the adapter and the chain explicitly. * The address field behavior is determined by the adapter's address control model: * * - **Developer-controlled adapters**: The `address` field is required because * each operation must explicitly specify which address to use. * - **User-controlled adapters**: The `address` field is forbidden because * the address is automatically resolved from the connected wallet or signer. * - **Legacy adapters**: The `address` field remains optional for backward compatibility. * * This ensures clear, debuggable code where the intended chain is always visible at the call site, * and address requirements are enforced at compile time based on adapter capabilities. * * @typeParam TAdapterCapabilities - The adapter capabilities type to derive address requirements from * @typeParam TChainIdentifier - The chain identifier type constraint (defaults to ChainIdentifier) * * @example * ```typescript * // Developer-controlled adapter (address required) * const devContext: AdapterContext<{ addressContext: 'developer-controlled', supportedChains: [] }> = { * adapter: myDevAdapter, * chain: 'Ethereum', * address: '0x123...' // Required * } * * // User-controlled adapter (address forbidden) * const userContext: AdapterContext<{ addressContext: 'user-controlled', supportedChains: [] }> = { * adapter: myUserAdapter, * chain: 'Ethereum' * // address: '0x123...' // TypeScript error: not allowed * } * ``` */ type AdapterContext = { /** The adapter instance for blockchain operations */ adapter: Adapter; /** The chain reference, which can be a ChainDefinition, Blockchain enum, or string literal */ chain: TChainIdentifier; } & AddressField>; /** * Represents a bridge destination with an explicit custom recipient address. * * Extends {@link AdapterContext} with an additional `recipientAddress` field to specify * a custom recipient that differs from the adapter's address. Use this when bridging to * third-party wallets or smart contracts rather than the default address associated with * the destination adapter. * * @typeParam TCapabilities - The adapter capabilities type for the destination adapter * @typeParam TChainIdentifier - The chain identifier type constraint (defaults to ChainIdentifier) * * @remarks * The `recipientAddress` must be a valid address format for the destination chain * specified in the adapter context. The bridge provider validates address compatibility * during the transfer preparation phase and will throw an error if the address format * is invalid for the target chain. * * @example * ```typescript * import { BridgeDestinationWithAddress } from '@core/provider' * import { ethereumAdapter } from './adapters' * * // Bridge to a custom recipient address on Ethereum * const destination: BridgeDestinationWithAddress = { * adapter: ethereumAdapter, * chain: 'Ethereum', * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0' * } * ``` */ type BridgeDestinationWithAddress = AdapterContext & { /** * The custom recipient address on the destination chain. * * Must be a valid address format for the chain specified in this adapter context. * This address will receive the bridged funds instead of the adapter's default address. */ recipientAddress: string; }; /** * Forwarder-only destination without an adapter. * * Used when Circle's Forwarder handles the mint transaction and no destination * adapter is available. Requires both `useForwarder: true` and a `recipientAddress`. * * When using this destination type: * - The mint step completes when the IRIS API confirms `forwardState === 'CONFIRMED'` * - No on-chain transaction confirmation is performed (no adapter available) * - The mint step's `data` field will be undefined (no transaction receipt) * * @typeParam TChainIdentifier - The chain identifier type constraint (defaults to ChainIdentifier) * * @example * ```typescript * // Forwarder-only destination (no adapter needed) * const dest: ForwarderDestination = { * chain: 'Base', * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0', * useForwarder: true * } * ``` */ interface ForwarderDestination { /** The destination chain where USDC will be minted */ chain: TChainIdentifier; /** The recipient address that will receive the minted USDC */ recipientAddress: string; /** Must be true for forwarder-only destinations */ useForwarder: true; } /** * Union type representing a bridge destination. * * Supports multiple destination configurations: * - {@link AdapterContext}: Standard destination with adapter (for default recipient) * - {@link BridgeDestinationWithAddress}: Destination with adapter and custom recipient * - {@link ForwarderDestination}: Forwarder-only destination without adapter (requires recipientAddress) * * When `useForwarder` is enabled with an adapter, Circle's Orbit relayer handles the mint * transaction and the adapter is used to wait for transaction confirmation. * * When `useForwarder` is enabled without an adapter (ForwarderDestination), the mint step * completes when the IRIS API confirms `forwardState === 'CONFIRMED'` without on-chain * confirmation. * * @typeParam TAdapterCapabilities - The adapter capabilities type for the destination adapter * @typeParam TChainIdentifier - The chain identifier type constraint (defaults to ChainIdentifier) * * @example * ```typescript * // Standard destination with adapter * const dest1: BridgeDestination = { adapter, chain: 'Base' } * * // Destination with adapter and custom recipient * const dest2: BridgeDestination = { adapter, chain: 'Base', recipientAddress: '0x...' } * * // Destination with forwarder enabled (adapter for tx confirmation) * const dest3: BridgeDestination = { adapter, chain: 'Base', useForwarder: true } * * // Forwarder-only destination (no adapter, requires recipientAddress) * const dest4: BridgeDestination = { chain: 'Base', useForwarder: true, recipientAddress: '0x...' } * ``` */ type BridgeDestination = ((AdapterContext | BridgeDestinationWithAddress) & { /** * Enable Circle's relayer to submit the destination transaction. * * Where the relay fee is charged depends on the route and on * {@link BridgeConfig.feePayment}: it may be taken from the amount that * arrives, or priced into a quote the source transaction pays. * * Whether the option is required, optional, or refused depends on the * routed provider and the rest of the config. */ useForwarder?: boolean; }) | ForwarderDestination; /** * Context for retry operations containing source and destination adapter contexts. * * This interface provides the necessary context for retry operations, including * both the source adapter context (where the retry originates) and the destination * adapter context (where the retry is targeted). This ensures that retry operations * have access to both the source and destination chain information needed for * validation and execution. * * The destination adapter (`to`) is optional to support forwarder-only destinations * where Circle's Orbit relayer handles the mint transaction without requiring a * destination adapter. When `to` is undefined, the retry operation relies on * IRIS API confirmation instead of on-chain transaction confirmation. * * @example * ```typescript * // Standard retry with both adapters * const retryContext: RetryContext = { * from: sourceAdapter, * to: destAdapter * } * * // Forwarder-only retry (no destination adapter) * const forwarderRetryContext: RetryContext = { * from: sourceAdapter, * to: undefined // Forwarder handles mint * } * ``` */ interface RetryContext { /** The source adapter context for the retry operation */ from: Adapter; /** * The destination adapter context for the retry operation. * * Optional for forwarder-only destinations where Circle's Orbit relayer * handles the mint transaction. When undefined, the retry operation relies * on IRIS API confirmation (`forwardState === 'CONFIRMED'`) instead of * on-chain transaction confirmation via the adapter. */ to?: Adapter; } /** * Result of analyzing bridge steps to determine retry feasibility and continuation point. * * This interface provides comprehensive information about the state of bridge steps, * including which steps have completed, which have failed, and whether the operation * can be retried from a specific point. It also includes the reason for failure * and identifies the next step to continue from. * * @example * ```typescript * const analysis: StepAnalysisResult = { * continuationStep: 'Burn', * isRetryable: true, * completedSteps: ['Approve'], * failedSteps: ['Burn'], * reason: 'Transaction timeout' * } * ``` */ interface StepAnalysisResult { /** The next step to continue from, or null if no continuation is possible */ continuationStep: string | null; /** Whether the flow requires user action (false for pending states that need waiting) */ isActionable: boolean; /** Array of step names that have completed successfully */ completedSteps: string[]; /** Array of step names that have failed */ failedSteps: string[]; /** Optional reason for failure or retry decision */ reason?: string; } /** * Abstract base class for bridging providers that implement cross-chain bridging protocols. * * This class defines the standard interface that all bridging providers must implement * to support cross-chain bridging. It provides a standardized way to check route * support, estimate costs, and execute bridge operations across different protocols. * * Bridging providers are responsible for: * - Validating bridge parameters and route support * - Estimating gas costs and protocol fees * - Executing the actual bridge operations * - Handling protocol-specific logic and error conditions * * @remarks * Token-type default rationale: `TToken` defaults to the literal * `'USDC'` so a USDC-only subclass needs no generic ceremony at every * call site. This matches the literal `'USDC'` default on * {@link BridgeParams} (consumed at the provider boundary, where the * provider knows exactly which token symbol it accepts). The default * matches the default on {@link BridgeResult} and {@link EstimateResult} for * source compatibility. Provider-agnostic kit internals widen those result * types explicitly. * * Quotes are not typed here. A provider that issues one narrows its own * `estimate` return to the shape it produces — see the CCTPx provider's * `QuoteEnvelope` — which keeps that shape in the provider package rather * than in this shared one. `bridge` takes a caller-supplied quote, which is * public input the provider validates before reading a field. * * @example * ```typescript * class CustomBridgingProvider extends BridgingProvider { * supportsRoute(source: Chain, destination: Chain, token: TokenType): boolean { * // Implementation specific logic * return true * } * * async estimate(params: BridgeParams): Promise { * // Cost estimation logic * return { ... } * } * * async bridge(params: BridgeParams): Promise { * // Bridge execution logic * return { ... } * } * } * ``` */ declare abstract class BridgingProvider, TToken extends string = 'USDC', TFeeToken extends string = 'USDC'> { /** The name of the provider */ abstract name: string; /** * The chains that this provider supports. */ abstract supportedChains: ChainDefinition[]; /** * The action dispatcher for this provider. * * This property holds a reference to an action dispatcher that can be used to * dispatch events or actions during the transfer process. It is optional and * can be null if no dispatcher is registered. */ actionDispatcher?: Actionable | null; /** * Type-level map of action names to their payload types. * This property exists only at the type level and is used for TypeScript inference. */ readonly actions: TProviderActions; /** * Determines if this provider supports transfers between the specified source and destination chains. * * This method should check if the provider can handle transfers between the given chains, * typically by verifying that both chains have the necessary contract deployments and * configurations for the provider's protocol. * * @param source - The source chain definition * @param destination - The destination chain definition * @param token - The token to transfer (provider-defined; defaults to `'USDC'`) * @param useForwarder - When `true`, also checks that the route supports forwarding * @returns `true` (or a promise resolving to `true`) if the provider supports * this route, `false` when it is definitively unsupported. * * @remarks * This method may be asynchronous for providers that resolve route support * via network I/O (e.g. an off-chain token registry). Callers should await * the result so both synchronous and asynchronous providers are supported. * * A provider MAY instead **throw a `RETRYABLE` `KitError`** when it cannot * determine support because of a transient failure (e.g. the token registry * is unreachable), to distinguish "couldn't check" from a definitive * `false`. The kit's route resolver catches such throws, records them per * provider, and surfaces a retryable route-check error rather than a * misleading "unsupported route". Returning `false` must mean the route is * genuinely unsupported, not that the check failed. * * @example * ```typescript * const provider = new CCTPV2Provider() * const canTransfer = await provider.supportsRoute(Ethereum, Base, 'USDC') * if (canTransfer) { * console.log('CCTP v2 transfer is supported between Ethereum and Base') * } * ``` */ abstract supportsRoute(source: ChainDefinition, destination: ChainDefinition, token: TToken, useForwarder?: boolean): boolean | Promise; /** * Executes a cross-chain bridge operation between the specified source and destination chains. * * This method performs the actual bridge operation by coordinating with the underlying * protocol contracts and handling the multi-step process required for cross-chain * bridging. The implementation details vary by protocol but typically involve * burning/locking tokens on the source chain and minting/unlocking on the destination. * * @param params - The bridge parameters containing source, destination, amount, and configuration * @param token - The token to bridge (provider-defined; defaults to `'USDC'`) * @param config - Optional bridge configuration including speed and fee settings * @returns Promise resolving to the bridge result with transaction details and steps * @throws {KitError} If the parameters are invalid * @throws {UnsupportedRouteError} If the route is not supported * @throws {BridgeError} If the bridge operation fails * * @example * ```typescript * const result = await provider.bridge({ * source: { adapter: sourceAdapter, chain: 'Ethereum' }, * destination: { adapter: destAdapter, chain: 'Base' }, * amount: '10.50', * token: 'USDC' * }) * ``` */ abstract bridge(params: BridgeParams$1): Promise>; /** * Estimates the cost and fees for a cross-chain bridge operation without executing it. * * This method calculates the expected gas costs and protocol fees for a bridge * operation, allowing users to understand the total cost before committing to * the transaction. The estimation should be as accurate as possible but may * vary slightly from actual execution due to network conditions. * * @param params - The bridge parameters for cost estimation * @returns Promise resolving to the cost estimate including gas and protocol fees * @throws {KitError} If the parameters are invalid * @throws {UnsupportedRouteError} If the route is not supported * * @example * ```typescript * const estimate = await provider.estimate({ * source: { adapter: sourceAdapter, chain: 'Ethereum' }, * destination: { adapter: destAdapter, chain: 'Base' }, * amount: '10.50', * token: 'USDC' * }) * console.log('Estimated cost:', estimate.totalCost) * ``` */ abstract estimate(params: BridgeParams$1): Promise>; /** * Get all destination chains that are supported for transfers from the given source chain. * * This method filters the provider's supported chains to return only those that are * compatible with the source chain. Compatibility is determined by matching testnet * status (mainnet chains can only transfer to mainnet chains, testnets to testnets) * and excluding the source chain itself. * * @param source - The source chain definition to find compatible destinations for * @returns Array of chain definitions that can serve as destinations for the given source * * @example * ```typescript * const provider = new BridgingProvider() * const destinations = provider.getSupportedDestinationsFor(Ethereum) * console.log('Available destinations from Ethereum:', destinations.map(d => d.name)) * ``` */ getSupportedDestinationsFor(source: ChainDefinition): ChainDefinition[]; /** * Return the decimal precision for the given token, or `undefined` when * the provider does not track it. * * Consumers that format a result amount resolve decimals through this * hook first, falling back to their own built-in token registry when it * returns `undefined`. The default implementation returns `undefined`, * so a provider whose tokens are already in the consumer's registry needs * no override; a provider that identifies tokens outside that registry * overrides this to supply their decimals. * * @param _token - The token to resolve decimals for (provider-defined); * unused by the default implementation, consumed by overrides. * @param _sourceChain - Source chain of the bridge. Providers whose tokens * live in per-network registries use it to scope the lookup to the relevant * network; unused by the default implementation. Required, so a lookup is * never asked to guess which network a token belongs to. * @returns A promise resolving to the token's decimals, or `undefined` * when the provider cannot resolve it. * * @example * ```typescript * const decimals = await provider.getTokenDecimals(token, source.chain) * if (decimals === undefined) { * // fall back to the consumer's own decimals lookup * } * ``` */ getTokenDecimals(_token: TToken, _sourceChain: ChainDefinition): Promise; /** * Register an event dispatcher for handling provider-specific actions and events. * * * @param dispatcher - The event dispatcher implementing the Actionable interface * * @example * ```typescript * const provider = new BridgingProvider() * * const actionDispatcher = new Actionable() * * provider.registerDispatcher(actionDispatcher) * * // Now provider actions will be dispatched to the action dispatcher * await provider.bridge(transferParams) * ``` */ registerDispatcher(dispatcher: Actionable): void; /** * Determines if this provider supports retry operations for the given bridge result. * * This method checks whether the provider can retry a failed bridge operation. * By default, all providers return false unless explicitly implemented. * Providers that support retry should override this method to return true * when retry is feasible for the given result. * * @param result - The bridge result to check for retry support * @returns `true` if retry is supported for this result, `false` otherwise * * @example * ```typescript * const result = await provider.bridge(params) * if (provider.supportsRetry(result)) { * const retryResult = await provider.retry(result, retryContext) * } * ``` */ supportsRetry(result: BridgeResult): boolean; /** * Retries a failed bridge operation from the point of failure. * * This method attempts to retry a bridge operation that has previously failed, * continuing from the appropriate step based on the analysis of completed and * failed steps. By default, this method throws an error indicating that retry * is not supported. Providers that support retry should override this method. * * @param result - The failed bridge result to retry * @param context - The retry context containing source and destination adapter contexts * @param invocationMeta - Optional invocation metadata for tracing and correlation. * When provided, enables custom traceId, runtime overrides, and caller chain tracking. * @returns Promise resolving to the retry bridge result * @throws {Error} If retry is not supported by this provider * * @example * ```typescript * const result = await provider.bridge(params) * if (result.state === 'error' && provider.supportsRetry(result)) { * const retryContext: RetryContext = { * from: { adapter: sourceAdapter, chain: 'Ethereum' }, * to: { adapter: destAdapter, chain: 'Base' } * } * const retryResult = await provider.retry(result, retryContext) * } * ``` */ retry(result: BridgeResult, context: RetryContext, invocationMeta?: InvocationMeta): Promise>; /** * Analyzes bridge steps to determine retry feasibility and continuation point. * * This method examines the steps of a bridge operation to determine which steps * have completed, which have failed, and whether the operation can be retried * from a specific point. By default, this method throws an error indicating that * step analysis is not supported. Providers that support retry should override * this method to provide step analysis capabilities. * * @param steps - Array of bridge steps to analyze * @returns StepAnalysisResult containing retry analysis information * @throws Error If step analysis is not supported by this provider * * @example * ```typescript * const result = await provider.bridge(params) * if (result.state === 'error') { * const analysis = provider.analyzeStepsForRetry(result.steps) * if (analysis.isRetryable) { * console.log(`Can retry from step: ${analysis.continuationStep}`) * } * } * ``` */ analyzeStepsForRetry(steps: BridgeStep[]): StepAnalysisResult; } /** * The expiry window of a signed quote. * * A signed quote is short-lived; refresh it immediately before submitting * on-chain rather than caching it. * * The API uses different field names depending on `mode`: * - `TIMESTAMP` → `expiresAt` (unix seconds) * - `BLOCK_NUMBER` → `expiresAtBlock` (source-chain block number) * * @internal */ type FeeQuoteExpiry = { /** Identify an exact Unix timestamp expiry. */ readonly mode: 'TIMESTAMP'; /** Unix timestamp in seconds at which the quote expires. */ readonly expiresAt: number; } | { /** Identify a source-chain block-number expiry. */ readonly mode: 'BLOCK_NUMBER'; /** Authoritative source-chain block at which the quote expires. */ readonly expiresAtBlock: number; /** Optional advisory Unix timestamp estimate for the expiry block. */ readonly blockEstimatedAt?: number; }; /** * Token string accepted by `bridge` / `estimate`. * * Use `'USDC'` for CCTP v2, a known CCTPx symbol (`'cirBTC'`, `'wETH'`, * `'EURC'`), or a 32-byte hex CCTPx token id. * * @example * ```typescript * import type { BridgeToken } from '@circle-fin/bridge-kit' * * const usdc: BridgeToken = 'USDC' * const eurc: BridgeToken = 'EURC' * const tokenId: BridgeToken = * '0x0000000000000000000000000000000000000000000000000000000063697254' * ``` */ type BridgeToken = 'USDC' | CCTPXRouteToken; /** * Configuration accepted by `bridge` and `estimate`. * * @remarks * The kit's name for {@link BridgeConfig}, kept as the parameter type so a * kit-only option can be added here without touching the provider-facing config. * * @example * ```typescript * import type { BridgeExecutionConfig } from '@circle-fin/bridge-kit' * * const config: BridgeExecutionConfig = { * transferSpeed: 'FAST', * feePayment: 'source', * } * ``` * @since 1.14.0 */ type BridgeExecutionConfig = BridgeConfig; /** * Describe one signed Fee Service line item in human-readable USDC. * * @example * ```typescript * import type { ReceiveExactFeeItem } from '@circle-fin/bridge-kit' * * const item: ReceiveExactFeeItem = { * type: 'FORWARD', * amount: '0.25', * args: [], * argsHash: `0x${'00'.repeat(32)}`, * } * ``` * @since 1.14.0 */ interface ReceiveExactFeeItem { /** The Fee Service item type, such as `FORWARD` or `PRE_FINALITY`. */ readonly type: string; /** The fee amount in human-readable USDC. */ readonly amount: string; /** The ABI arguments covered by the signed quote. */ readonly args: readonly string[]; /** The hash of the ABI arguments covered by the signed quote. */ readonly argsHash: string; } /** * Return a receive-exact bridge estimate backed by a short-lived signed quote. * * @remarks * Treat `quote` as opaque and sensitive. Pass it back to * {@link BridgeKit.bridge}; do not log or decode it. Bridge Kit validates a * supplied quote against the exact transfer parameters and rejects it when it * is invalid, mismatched, expired, or too close to expiry. * * @example * ```typescript * import { BridgeKit, type BridgeParams } from '@circle-fin/bridge-kit' * * declare const adapter: BridgeParams['from']['adapter'] * const kit = new BridgeKit() * * const estimate = await kit.estimate({ * from: { adapter, chain: 'Ethereum' }, * to: { * chain: 'Base', * recipientAddress: '0x1234567890123456789012345678901234567890', * useForwarder: true, * }, * amount: '100', * config: { feePayment: 'source' }, * }) * console.log(estimate.amountReceived, estimate.totalDebit) * ``` * @since 1.14.0 */ interface ReceiveExactEstimateResult extends EstimateResult { /** The exact amount the destination recipient receives, in USDC. */ readonly amountReceived: string; /** The total signed fee collected on the source chain, in USDC. */ readonly feeTotal: string; /** The itemized signed fee quote, with amounts in human-readable USDC. */ readonly feeItems: readonly ReceiveExactFeeItem[]; /** The total source-wallet debit (`amountReceived + feeTotal`), in USDC. */ readonly totalDebit: string; /** The authoritative expiry returned by the Fee Service. */ readonly quoteExpiry: FeeQuoteExpiry; /** Opaque signed quote bytes to pass to {@link BridgeKit.bridge}. */ readonly quote: string; } /** * Result returned by {@link BridgeKit.estimate} for legacy and source-fee modes. * * @remarks * The plain-estimate arm leaves `quote` as `unknown`, because the kit routes * across providers and each issues its own quote shape. Narrow to a provider's * own estimate type to read it, or take the receive-exact arm, whose `quote` is * the raw signed bytes. * * @example * ```typescript * import { * BridgeKit, * type BridgeEstimateResult, * type BridgeParams, * } from '@circle-fin/bridge-kit' * * declare const params: BridgeParams * const kit = new BridgeKit() * const result: BridgeEstimateResult = await kit.estimate(params) * if ('amountReceived' in result) console.log(result.totalDebit) * ``` * @since 1.14.0 */ type BridgeEstimateResult = EstimateResult | ReceiveExactEstimateResult; type FeeFunction = (params: BridgeParams$1) => Promise | string; type FeeRecipientFunction = (feePayoutChain: ChainDefinition, params: BridgeParams$1) => Promise | string; /** * Custom fee policy for BridgeKit. * * Provides hooks to calculate an absolute custom fee and resolve the fee recipient address * on the source chain. The returned fee is **added on top of the transfer amount** (the wallet signs for * `amount + customFee`). Once collected, the custom fee is split: * * - **10%** automatically routes to Circle. * - **90%** routes to your supplied `recipientAddress`. * * The entire transfer amount still flows through CCTPv2, which then charges its own protocol fee. * * Use `computeFee` (recommended) for human-readable amounts, or `calculateFee` (deprecated) * for smallest-unit amounts. Only one should be provided. * * **USDC only.** Because the fee is collected on top of the transfer amount and * split through CCTPv2's USDC flow, this policy cannot apply to any other token. * Bridging a non-USDC token (for example CCTPx `cirBTC` or `wETH`) * is rejected with `INPUT_VALIDATION_FAILED` before anything is submitted — * on `bridge` and `estimate` alike — rather than proceeding without the fee. * A per-call `config.customFee` is rejected the same way. * * @example * ```typescript * import type { CustomFeePolicy, BridgeParams } from '@circle-fin/bridge-kit' * * const policy: CustomFeePolicy = { * // computeFee receives human-readable amounts (e.g., '100' for 100 USDC) * computeFee: (params: BridgeParams) => { * const amount = parseFloat(params.amount) * * // 1% fee, capped between 5-50 USDC * const fee = Math.min(Math.max(amount * 0.01, 5), 50) * return fee.toFixed(6) * }, * resolveFeeRecipientAddress: (feePayoutChain) => * feePayoutChain.type === 'solana' * ? 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' * : '0x1234567890123456789012345678901234567890', * } * ``` */ type CustomFeePolicy = { /** * A function that returns the fee to charge for the bridge transfer. * The value returned from the function represents an absolute fee. * The returned fee is **added on top of the transfer amount**. For example, returning * `'5'` (5 USDC) for a 100 USDC transfer causes the wallet to debit 105 USDC total. * CCTPv2 still processes the full 100 USDC transfer amount, while the custom fee is split * 10%/90% between Circle and your fee recipient. * * @example * ```typescript * computeFee: (params) => { * const amount = parseFloat(params.amount) * return (amount * 0.01).toString() // 1% fee * } * ``` */ computeFee: FeeFunction; calculateFee?: never; /** * A function that returns the fee recipient for a bridge transfer. * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer. * The fee recipient address **must be a valid address for the source chain** of the bridge transfer. * * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`, * because the source chain of the bridge transfer is Ethereum. */ resolveFeeRecipientAddress: FeeRecipientFunction; } | { computeFee?: never; /** * Calculate the fee to charge for the bridge transfer using smallest-unit amounts. * * @deprecated Use `computeFee` instead, which receives human-readable amounts. * * The `params.amount` is in smallest units (e.g., `'100000000'` for 100 USDC). */ calculateFee: FeeFunction; /** * A function that returns the fee recipient for a bridge transfer. * The value returned from the function represents the address that will receive the fee on the source chain of the bridge transfer. * The fee recipient address **must be a valid address for the source chain** of the bridge transfer. * * For example: if you are bridging from Ethereum to Solana you would return `'0x1234567890123456789012345678901234567890'`, * because the source chain of the bridge transfer is Ethereum. */ resolveFeeRecipientAddress: FeeRecipientFunction; }; /** * Parameters for initiating a cross-chain USDC bridge transfer. * * This type is used as the primary input to {@link BridgeKit.bridge}, allowing users to specify * the source and destination adapters, transfer amount, and optional configuration. * * - The `from` field specifies the source adapter context (wallet and chain). * - The `to` field specifies the destination, supporting both explicit and derived recipient addresses. * - The `config` field allows customization of bridge behavior (e.g., transfer speed). * - The `token` field is optional and defaults to `'USDC'`. It accepts * `'USDC'`, a known CCTPx symbol, or a bytes32 CCTPx token id. * * @typeParam TFromAdapterCapabilities - The source adapter capabilities type. * @typeParam TToAdapterCapabilities - The destination adapter capabilities type. * * @example * ```typescript * import { BridgeKit, BridgeChain } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * // Using BridgeChain enum values (full autocomplete support) * const params: BridgeParams = { * from: { adapter: sourceAdapter, chain: BridgeChain.Ethereum }, * to: { adapter: destAdapter, chain: BridgeChain.Base }, * amount: '10.5', * config: { transferSpeed: 'FAST' }, * token: 'USDC' * } * * // Using string literals (also works with autocomplete) * const params2: BridgeParams = { * from: { adapter: sourceAdapter, chain: 'Ethereum_Sepolia' }, * to: { adapter: destAdapter, chain: 'Base_Sepolia' }, * amount: '10.5' * } * * // With explicit recipient address: * const paramsWithAddress: BridgeParams = { * from: { adapter: sourceAdapter, chain: BridgeChain.Ethereum }, * to: { * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', * adapter: destAdapter, * chain: BridgeChain.Base * }, * amount: '10.5' * } * * // ❌ Compile error - Algorand is not a supported bridge chain * const invalidParams: BridgeParams = { * from: { adapter: sourceAdapter, chain: 'Algorand' }, // TypeScript error! * to: { adapter: destAdapter, chain: 'Base' }, * amount: '10.5' * } * ``` * * @see {@link BridgeChain} for the enum of supported chains. * @see {@link BridgeChainIdentifier} for the type of valid chain values. */ interface BridgeParams { /** * The source adapter context (wallet and chain) for the transfer. */ from: AdapterContext; /** * The destination for the transfer, supporting explicit or derived recipient addresses */ to: BridgeDestination; /** * The amount to transfer */ amount: string; /** * Optional bridge configuration (e.g., transfer speed). * If omitted, defaults will be used */ config?: BridgeExecutionConfig; /** * The token to transfer. Defaults to `'USDC'`. * * A known symbol is a convenience for a canonical CCTPx registration. A * symbol that maps to more than one bridge resolves to the registration * pinned by the provider. Pass the bridge's bytes32 token id directly when * an exact registration is required. * * If omitted, defaults to `'USDC'`. * * @example * ```typescript * // USDC via CCTPv2 (default) * const usdc: BridgeParams['token'] = 'USDC' * * // CCTPx by bare symbol — resolves via the known-symbol map * const bare: BridgeParams['token'] = 'wETH' * * // CCTPx by bytes32 token id * const explicit: BridgeParams['token'] = * '0x0000000000000000000000000000000000000000000000000000000063697254' * ``` */ token?: BridgeToken; /** * Optional invocation metadata for tracing and correlation. * * When provided, the `traceId` is used to correlate all events emitted during * the bridge operation. If not provided, an OpenTelemetry-compatible traceId * will be auto-generated. * * @example * ```typescript * const params: BridgeParams = { * from: { adapter: sourceAdapter, chain: 'Ethereum' }, * to: { adapter: destAdapter, chain: 'Base' }, * amount: '100', * invocationMeta: { * traceId: 'my-custom-trace-id', * callers: [{ type: 'app', name: 'MyDApp', version: '1.0.0' }], * }, * } * ``` */ invocationMeta?: InvocationMeta; /** * Optional server-signed quote to reuse — pass the `quote` returned by an * earlier {@link BridgeKit.estimate | estimate} call straight back so the * fee you were quoted is the fee you pay. * * Treat the value as opaque, and never log or decode it. It belongs to * whichever provider issued it and carries that provider's own shape, * which is why it is typed `unknown` here: a route is matched to a * provider after these parameters are validated, so the kit cannot know * whose quote this is. The provider that serves the route validates it * before reading any field. * * An unusable quote is not handled the same way everywhere, so take the * value from an estimate result rather than constructing one: * - A provider with a reusable quote model (e.g. CCTPx) reuses it while it * is fresh and matches the requested fee token and speed; otherwise it * transparently fetches a fresh quote and flags a `QUOTE_NOT_REUSED` * result warning, so a stale quote is never worse than passing none. * - Receive-exact bridging (`config.feePayment: 'source'`) instead * **rejects** a quote that is invalid, mismatched, expired, or too close * to expiry, rather than repricing behind your back. * - Providers with no quote model (e.g. USDC via CCTP v2) ignore it — * **silently**. Route selection happens after these parameters are * validated, so the kit cannot tell whose quote this is, and nothing * checks that it reached the provider that issued it. In practice this * bites when the token changes between `estimate` and `bridge`: a quote * from a CCTPx token (`cirBTC`, `wETH`) passed to a plain USDC bridge is * dropped without an error or a warning, and the fee comes from CCTP v2 * instead. Keeping the same token routes back to the same provider, so * the quote arrives. Re-estimate whenever the transfer changes. * * The transfer parameters (amount, recipient, chains) are validated * on-chain, so a quote reused for a different transfer is rejected by the * contract rather than silently — reuse a quote only for the transfer it * was estimated for. * * This field is for {@link BridgeKit.bridge | bridge} only. A quote is * produced by `estimate` and consumed by `bridge`, and `estimate` always * returns a freshly-priced one. Passing a quote back into `estimate` is a * usage error: CCTPx rejects it outright, while receive-exact ignores it and * prices afresh, so the quote you get back is never the one you sent. Take * the quote from the estimate result, not from your input. * * @example * ```typescript * const estimate = await kit.estimate({ * from: { adapter: sourceAdapter, chain: 'Ethereum' }, * to: { adapter: destAdapter, chain: 'Base' }, * amount: '100', * token: 'wETH', * }) * * // Reuse the quoted fee for the bridge. * const result = await kit.bridge({ * from: { adapter: sourceAdapter, chain: 'Ethereum' }, * to: { adapter: destAdapter, chain: 'Base' }, * amount: '100', * token: 'wETH', * quote: estimate.quote, * }) * ``` */ quote?: unknown; } /** * Union of all chain definition types. * * Each chain preserves literal types via `as const`. * * @internal */ type AllChainDefinitions = (typeof Chains)[keyof typeof Chains]; /** * Filter chain definitions to only those with CCTP v2 support. * * @internal */ type FilterCCTPV2 = T extends { cctp: { contracts: { v2: unknown; }; }; } ? T : never; /** * Chain types that support CCTP v2 bridging. * * This type is automatically derived from the actual chain definitions, so it * updates when new chain types gain CCTP v2 support. * * @example * ```typescript * import type { CCTPV2SupportedChainType } from '@circle-fin/bridge-kit' * * const chainType: CCTPV2SupportedChainType = 'evm' // Valid * console.log(chainType) * ``` */ type CCTPV2SupportedChainType = FilterCCTPV2['type']; /** * Options for filtering supported chains returned by {@link BridgeKit.getSupportedChains}. * * At least one filtering option must be provided. Multiple options can be combined to create more specific filters. * * @example * ```typescript * const kit = new BridgeKit() * * // Get all supported chains (no filtering) * const allChains = kit.getSupportedChains() * * // Get only EVM chains * const evmChains = kit.getSupportedChains({ chainType: 'evm' }) * * // Get EVM and Solana chains * const evmAndSolana = kit.getSupportedChains({ chainType: ['evm', 'solana'] }) * * // Get only mainnet chains * const mainnets = kit.getSupportedChains({ isTestnet: false }) * * // Get only EVM mainnet chains * const evmMainnets = kit.getSupportedChains({ chainType: 'evm', isTestnet: false }) * * // Get only chains that support forwarding * const forwarderChains = kit.getSupportedChains({ forwarderSupported: true }) * * // Get only chains that can pay fees on the source chain (receive-exact) * const sourceFeeChains = kit.getSupportedChains({ sourceFeeSupported: true }) * ``` */ type GetSupportedChainsOptions = { /** * Filter chains by type (e.g., 'evm', 'solana'). * Can be a single type or an array of types. * If not provided, returns chains of all types. * * @example * ```typescript * // Single type * kit.getSupportedChains({ chainType: 'evm' }) * * // Multiple types * kit.getSupportedChains({ chainType: ['evm', 'solana'] }) * ``` */ chainType: CCTPV2SupportedChainType | CCTPV2SupportedChainType[]; /** * Filter chains by network type. * - `true`: only testnet chains * - `false`: only mainnet chains * - `undefined`: all chains (default) * * @example * ```typescript * // Get only mainnet chains * kit.getSupportedChains({ isTestnet: false }) * * // Get only testnet chains * kit.getSupportedChains({ isTestnet: true }) * ``` */ isTestnet?: boolean; /** * Filter chains by forwarder support. * - `true`: only chains that support forwarding (as source or destination) * - `false`: only chains that do not support forwarding * - `undefined`: all chains (default) */ forwarderSupported?: boolean; /** * Filter chains by source-paid ("receive-exact") fee support. * A chain qualifies when it configures a `TokenMessengerWithFees` wrapper, * making it usable as a source for `config.feePayment: 'source'` transfers. * - `true`: only chains that support source-paid fees * - `false`: only chains that do not support source-paid fees * - `undefined`: all chains (default) */ sourceFeeSupported?: boolean; } | { chainType?: CCTPV2SupportedChainType | CCTPV2SupportedChainType[]; isTestnet: boolean; forwarderSupported?: boolean; sourceFeeSupported?: boolean; } | { chainType?: CCTPV2SupportedChainType | CCTPV2SupportedChainType[]; isTestnet?: boolean; forwarderSupported: boolean; sourceFeeSupported?: boolean; } | { chainType?: CCTPV2SupportedChainType | CCTPV2SupportedChainType[]; isTestnet?: boolean; forwarderSupported?: boolean; sourceFeeSupported: boolean; }; /** * Configuration forwarded to the default bridging providers. */ interface DefaultProvidersConfig { /** * Custom HTTP headers forwarded with the CCTP provider's attestation (Iris) * API requests. See {@link BridgeKitConfig.headers}. */ headers?: Record; } /** * The default providers that will be used in addition to the providers provided * to the BridgeKit constructor. * * @remarks * Provider order is load-bearing. `CCTPV2BridgingProvider` is listed first * because its `supportsRoute` is a strict `token === 'USDC'` literal check, so * a USDC bridge is accepted by the first candidate and its *route check* never * pays the cost of `CCTPXBridgingProvider`'s IRIS token-registry lookup. * `CCTPXBridgingProvider` is listed second and handles every other supported * token. If the CCTPv2 literal check is ever relaxed, re-evaluate this order so * USDC keeps short-circuiting ahead of the registry-backed CCTPx route check. * * Construction is a separate cost, and it does not depend on the token being * bridged: `CCTPXBridgingProvider`'s constructor fires a non-blocking warm-up * refresh of both per-network token registries against IRIS. Every * `BridgeKit` therefore issues two background IRIS requests, including a * USDC-only integration that never routes through CCTPx. The warm-up can * neither block nor reject construction; when it succeeds it seeds the * registry cache, which is what lets a later route check survive an IRIS * outage by serving the cached registry. * * @param config - Optional configuration forwarded to the default providers * @returns The default bridging providers */ declare const getDefaultProviders: (config?: DefaultProvidersConfig) => readonly [CCTPV2BridgingProvider, CCTPXBridgingProvider]; /** * Configuration options for initializing a BridgeKit instance. * * The configuration allows you to specify which bridging providers should be * available for cross-chain token transfers. Each provider implements a specific * bridging protocol (e.g., CCTPv2) and supports a set of chains. * * When multiple providers are specified, the kit will automatically select the * appropriate provider based on the source/destination chains and token type * for each transfer request. * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * import type { BridgeParams, CustomFeePolicy } from '@circle-fin/bridge-kit' * import type { ChainDefinition } from '@core/chains' * * // Create kit with default CCTPV2BridgingProvider * const kit = new BridgeKit() * * // Set custom fee policy using the setter method * kit.setCustomFeePolicy({ * computeFee: (params: BridgeParams): string => { * const amount = parseFloat(params.amount) * return (amount * 0.01).toFixed(6) // 1% fee * }, * resolveFeeRecipientAddress: (chain: ChainDefinition): string => { * return '0x1234567890123456789012345678901234567890' * } * }) * * // Add additional custom providers if needed * // const kit = new BridgeKit({ * // providers: [new MyCustomBridgingProvider()] * // }) * ``` */ interface BridgeKitConfig { /** * Array of bridging providers that will be available for routing transfers. * * Each provider must implement the BridgingProvider interface and declare * which chains and tokens it supports. The kit will automatically select * the appropriate provider based on order and the transfer parameters. */ providers?: TExtraProviders; /** * Disable error telemetry. * * When `true`, the SDK will not POST error details to the telemetry * endpoint when public methods throw. Defaults to `false` (enabled). * * @defaultValue false */ disableErrorReporting?: boolean; /** * Custom HTTP headers forwarded with the default providers' attestation * (Iris) API requests — both `CCTPV2BridgingProvider` (USDC routes) and * `CCTPXBridgingProvider` (non-USDC routes). * * @remarks * Headers are merged on top of the SDK defaults (such as `Content-Type`) * rather than replacing them. The header is forwarded as-is to Circle's API; * the SDK does not interpret it. * * @example * ```typescript * const kit = new BridgeKit({ * headers: { 'X-Access-Key': '00000000-0000-0000-0000-000000000000' }, * }) * ``` */ headers?: Record; } /** * Keys present on any member of a union of object types. * * `keyof (A | B)` resolves to only the keys common to every member (the * intersection). Distributing over the union with a conditional collects * each member's keys instead, yielding the true union of keys. * * @typeParam T - A union of object types. */ type KeysOfUnion = T extends unknown ? keyof T : never; /** * Merges action types from multiple bridging providers into a unified action map. * * This utility type takes an array of bridging providers and creates a merged * action type that combines all action names and their corresponding payload types * from each provider. It ensures type safety when dispatching events across * multiple providers while maintaining the specific payload types for each action. * * The type works by: * 1. Extracting all action names from the union of provider action maps * 2. For each action name, creating a union of all payload types that use that name * 3. Preserving the specific payload type for each action across providers * * @typeParam Ps - A readonly array of flexible bridging providers * @returns A merged action map where each key is an action name and the value is * the union of all payload types for that action across providers * * @example * ```typescript * // Given providers with actions: * // Provider1: { 'transfer.started': { txHash: string } } * // Provider2: { 'transfer.started': { blockNumber: number } } * * // MergeActions will create: * // { 'transfer.started': { txHash: string } | { blockNumber: number } } * ``` */ type MergeActions = { [K in KeysOfUnion]: Extract>[K]; }; /** * Type representing the default providers included in the BridgeKit. * * This type extracts the return type from the `getDefaultProviders()` function, * ensuring that the default providers are properly typed and included in the * overall provider configuration. */ type DefaultProviders = ReturnType; /** * Complete action map combining default providers with extra providers. * * This type merges the actions from both the default providers (CCTPv2 and * CCTPx) and any additional providers passed to the BridgeKit constructor. It * ensures that all available actions from all providers are accessible through * the event system. * * @typeParam EP - Array of extra bridging providers beyond the defaults * @returns A merged action map containing all actions from default and extra providers * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * import { CustomProvider } from './custom-provider' * * const kit = new BridgeKit({ * providers: [new CustomProvider()] * }) * * // AllActions will include actions from both CCTPv2 and CustomProvider * type AvailableActions = AllActions<[CustomProvider]> * ``` */ type AllActions = MergeActions<[ ...DefaultProviders, ...EP ]>; /** * Union of all available action names across all providers. * * This type extracts the keys from the merged action map, providing a union * of all possible action names that can be used with the event system. * It enables type-safe event handling by ensuring only valid action names * can be used when registering event handlers. * * @typeParam EP - Array of extra bridging providers beyond the defaults * @returns A union of all action names available across all providers * * @example * ```typescript * // ActionName will be something like: * // 'transfer.started' | 'transfer.completed' | 'custom.action' * * kit.on('transfer.started', (payload) => { * // TypeScript knows this is a valid action name * }) * ``` */ type ActionName = keyof AllActions; /** * Type for event handler functions that can be registered with the BridgeKit. * * This type extracts the handler function type from the `on` method parameters, * ensuring that event handlers have the correct signature and payload types. * It enables type-safe event handling by preserving the specific payload types * for each action. * * @typeParam T - The specific BridgeKit instance type * @returns The function type for event handlers with proper payload typing * * @example * ```typescript * const kit = new BridgeKit() * * // ActionHandler will be the correct function type for handlers * const handler: ActionHandler = (payload) => { * // payload is properly typed based on the action * } * ``` */ type ActionHandler = Parameters[1]; /** * A type alias that enables flexible provider type handling in the event system. * * This uses `any` as an intentional "escape hatch" to allow the complex generic * type machinery to work when merging action types from different providers. * Type safety is still preserved at usage sites through overloaded method signatures * and the Actionable dispatcher's typing system. * * Without this flexibility, TypeScript cannot properly infer the merged action types * across different provider implementations while maintaining a clean developer * experience for event handlers. */ type FlexibleBridgingProvider = BridgingProvider; /** * Route cross-chain USDC bridging through Circle's Cross-Chain Transfer Protocol v2 (CCTPv2). * * This method orchestrates the entire cross-chain bridging process including: * 1. Parameter validation and route resolution * 2. Provider selection and configuration * 3. Transaction execution on both source and destination chains * 4. Event emission for monitoring and debugging * * The process is atomic - if any step fails, the method will throw an error * with detailed information about the failure point and any completed steps. * * @param params - The bridge parameters containing source, destination, amount, and token * @returns Promise resolving to the bridge result with transaction details and steps * @throws {KitError} If the parameters are invalid * @throws {BridgeError} If the bridging process fails * @throws {UnsupportedRouteError} If the route is not supported * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * // Create kit with default CCTPv2 provider * const kit = new BridgeKit() * const adapter = createViemAdapterFromPrivateKey({ privateKey: '0x...' }) * * // Execute cross-chain transfer * const result = await kit.bridge({ * from: { adapter, chain: 'Ethereum' }, * to: { adapter, chain: 'Base' }, * amount: '10.50' * }) * * // Monitor bridge events * kit.on('approve', (payload) => { * console.log('Approval complete:', payload.values.txHash) * }) * ``` */ declare class BridgeKit { /** * The providers used for executing transfers. */ providers: [...DefaultProviders, ...TExtraProviders]; /** * The action dispatcher for the kit. */ actionDispatcher: Actionable>; /** * A custom fee policy for the kit. */ customFeePolicy: CustomFeePolicy | undefined; /** Whether error telemetry is disabled. */ private readonly disableErrorReporting; /** Per-kit telemetry identity for shared helpers. */ private readonly telemetryConfig; /** * Create a new BridgeKit instance. * * @param config - The configuration containing the CCTPv2 provider * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * ``` */ constructor(config?: BridgeKitConfig); /** * Register an event handler for a specific bridge action. * * Subscribe to events emitted during bridge operations such as approval, burn, * attestation fetch, and mint actions. Handlers receive strongly-typed payloads * based on the action name. * * Multiple handlers can be registered for the same action, and all will be invoked * when the action occurs. Use the wildcard '*' to listen to all actions. * * @typeParam K - The action name to listen for * @param action - The action name or '*' for all actions * @param handler - Callback function to invoke when the action occurs * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * // Listen to specific action * kit.on('approve', (payload) => { * console.log('Approval transaction:', payload.values.txHash) * }) * * // Listen to all actions * kit.on('*', (payload) => { * console.log('Action:', payload.method) * }) * ``` */ on>(action: K, handlers: (payload: AllActions[K]) => void): void; on(action: '*', handler: (payload: AllActions[keyof AllActions]) => void): void; /** * Unregister an event handler for a specific bridge action. * * This method removes a previously registered event handler. You must pass * the exact same handler function reference that was used during registration. * Use the wildcard '*' to remove handlers listening to all actions. * * @typeParam K - The action name to stop listening for * @param action - The action name or '*' for all actions * @param handler - The handler function to remove (must be the same reference) * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * // Define handler * const handler = (payload) => { * console.log('Approval:', payload) * } * * // Register * kit.on('approve', handler) * * // Later, unregister * kit.off('approve', handler) * ``` */ off>(action: K, handlers: (payload: AllActions[K]) => void): void; off(action: '*', handler: (payload: AllActions[keyof AllActions]) => void): void; /** * Execute a cross-chain USDC transfer using CCTPv2. * * Handle the complete CCTPv2 transfer flow, including parameter validation, * chain resolution, and transfer execution. Provide comprehensive validation of * all parameters before initiating the transfer. * * Perform validation of: * - Source and destination wallet contexts * - Chain identifiers (string, enum, or chain definition) * - Amount format and token type * - CCTPv2 support for the chain pair * - Transfer configuration options * * @param params - The transfer parameters containing source, destination, amount, token, and optional invocation metadata * @returns Promise resolving to the transfer result with transaction details and steps * @throws {KitError} When any parameter validation fails. * @throws {KitError} With `INPUT_UNSUPPORTED_ROUTE` (1003, `FATAL`) when no * registered provider supports the route. * @throws {KitError} With `SERVICE_ROUTE_CHECK_UNAVAILABLE` (8003, * `RETRYABLE`) when a provider's route check failed transiently — for * example an unreachable token registry. Support could not be determined, * so retry rather than treating the route as unsupported. * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const kit = new BridgeKit() * * // Create a single adapter that can work across chains * const adapter = createViemAdapterFromPrivateKey({ * privateKey: process.env.PRIVATE_KEY, * }) * * // Basic usage * const result = await kit.bridge({ * from: { adapter, chain: 'Ethereum' }, * to: { adapter, chain: 'Base' }, * amount: '100.50' * }) * * // With custom invocation metadata * const result = await kit.bridge({ * from: { adapter, chain: 'Ethereum' }, * to: { adapter, chain: 'Base' }, * amount: '100.50', * invocationMeta: { * traceId: 'custom-trace-id', * callers: [{ type: 'app', name: 'MyDApp', version: '1.0.0' }], * }, * }) * * // Handle result * if (result.state === 'success') { * console.log('Bridge completed!') * result.steps.forEach(step => { * console.log(`${step.name}: ${step.explorerUrl}`) * }) * } else { * console.error('Bridge failed:', result.steps) * } * ``` */ bridge(params: Omit, 'token'> & { token?: 'USDC'; }): Promise; bridge(params: BridgeParams): Promise>; /** * Retry a failed or incomplete cross-chain USDC bridge operation. * * Provide a high-level interface for resuming bridge operations that have failed * or become stuck during execution. Automatically identify the provider that was * used for the original transfer and delegate the retry logic to that provider's * implementation. * * Use this functionality to handle: * - Network timeouts or temporary connectivity issues * - Gas estimation failures that can be resolved with updated parameters * - Pending transactions that need to be resubmitted * - Failed steps in multi-step bridge flows * * @param result - The bridge result from a previous failed or incomplete operation. * Must contain the provider name and step execution history. * @param context - The retry context containing fresh adapter instances for both * source and destination chains. These adapters should be properly * configured with current network connections and signing capabilities. * @param invocationMeta - Optional invocation metadata for tracing and correlation. * If not provided, uses the traceId from the original result. * @returns A promise that resolves to the updated bridge result after retry execution. * The result will contain the complete step history including both original * and retry attempts. * * @throws {Error} When the original provider specified in the result is not found * in the current kit configuration. * @throws {Error} When the underlying provider's retry operation fails due to * non-recoverable errors or invalid state. * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const kit = new BridgeKit() * * // Create adapters for source and destination chains * const sourceAdapter = createViemAdapterFromPrivateKey({ privateKey: '...' }) * const destAdapter = createViemAdapterFromPrivateKey({ privateKey: '...' }) * * // Assume we have a failed bridge result from a previous operation * const failedResult: BridgeResult = { * state: 'error', * provider: 'CCTPV2BridgingProvider', * steps: [ * { name: 'approve', state: 'success', txHash: '0x123...' }, * { name: 'burn', state: 'error', errorMessage: 'Gas limit exceeded' } * ], * // ... other properties * } * * // Basic retry (uses traceId from original result) * const retryResult = await kit.retry(failedResult, { * from: sourceAdapter, * to: destAdapter * }) * * // Retry with custom invocation metadata * const retryResult = await kit.retry( * failedResult, * { from: sourceAdapter, to: destAdapter }, * { * traceId: 'custom-trace-id', * callers: [{ type: 'app', name: 'MyApp' }], * } * ) * ``` */ retry(result: BridgeResult, context: RetryContext, invocationMeta?: InvocationMeta): Promise>; /** * Estimate the cost and fees for a cross-chain USDC bridge operation. * * This method calculates the expected gas fees and protocol costs for bridging * without actually executing the transaction. It performs the same validation * as the bridge method but stops before execution. * * @param params - The bridge parameters for cost estimation, including optional invocation metadata * @returns Promise resolving to detailed cost breakdown including gas estimates * @throws {KitError} When the parameters are invalid. * @throws {UnsupportedRouteError} When the route is not supported. * @throws {KitError} With `SERVICE_ROUTE_CHECK_UNAVAILABLE` (8003, * `RETRYABLE`) when a provider's route check failed transiently — for * example an unreachable token registry. Support could not be determined, * so retry rather than treating the route as unsupported. * * @example * ```typescript * // Basic usage * const estimate = await kit.estimate({ * from: { adapter: adapter, chain: 'Ethereum' }, * to: { adapter: adapter, chain: 'Base' }, * amount: '10.50', * token: 'USDC' * }) * console.log('Estimated cost:', estimate.totalCost) * * // With custom invocation metadata * const estimate = await kit.estimate({ * from: { adapter: adapter, chain: 'Ethereum' }, * to: { adapter: adapter, chain: 'Base' }, * amount: '10.50', * token: 'USDC', * invocationMeta: { * traceId: 'custom-trace-id', * callers: [{ type: 'app', name: 'MyDApp', version: '1.0.0' }], * }, * }) * ``` */ estimate(params: Omit, 'token'> & { token?: 'USDC'; config: { feePayment: 'source'; }; }): Promise; estimate(params: Omit, 'token'> & { token?: 'USDC'; }): Promise; estimate(params: BridgeParams): Promise>; /** * Get all chains supported by any provider in the kit, with optional filtering. * * Aggregate and deduplicate the supported chains from all registered providers. * This provides a comprehensive list of chains that can be used as either source * or destination for transfers through this kit instance. * * The method automatically deduplicates chains based on their chain identifier, * ensuring each chain appears only once in the result regardless of how many * providers support it. * * @param options - Optional filtering options to narrow down the returned chains * @returns Array of unique chain definitions supported by the registered providers * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * // Get all supported chains (no filtering) * const allChains = kit.getSupportedChains() * * // Get only EVM chains * const evmChains = kit.getSupportedChains({ chainType: 'evm' }) * * // Get EVM and Solana chains * const evmAndSolana = kit.getSupportedChains({ chainType: ['evm', 'solana'] }) * * // Get only mainnet chains * const mainnets = kit.getSupportedChains({ isTestnet: false }) * * // Get only EVM mainnet chains * const evmMainnets = kit.getSupportedChains({ chainType: 'evm', isTestnet: false }) * * // Get only chains that support forwarding * const forwarderChains = kit.getSupportedChains({ forwarderSupported: true }) * * // Get only chains that can pay fees on the source chain (receive-exact) * const sourceFeeChains = kit.getSupportedChains({ sourceFeeSupported: true }) * * console.log('Supported chains:') * allChains.forEach(chain => { * console.log(`- ${chain.name} (${chain.type})`) * }) * ``` */ getSupportedChains(options?: GetSupportedChainsOptions): ChainDefinition[]; /** * Validate that source and destination chains are on the same network type. * * This method ensures that both chains are either testnet or mainnet, preventing * cross-network transfers which are not supported by the bridging protocols. * * @param resolvedParams - The resolved bridge parameters containing source and destination chains * @throws {NetworkMismatchError} If source and destination chains are on different network types */ private validateNetworkCompatibility; /** * Find a provider that supports the given transfer route. * * This method centralizes the provider selection logic to ensure consistency * between transfer and estimate operations. It resolves the source and destination * chains from the provided adapters and finds the first provider that supports * the route for the specified token. * * The search iterates every registered provider in registration order, so a * USDC bridge is accepted by the CCTPv2 provider (registered first) before * the CCTPx provider's registry-backed route check runs. * * @param params - The transfer parameters containing source, destination, and token * @returns Promise resolving to the provider that supports this route * @throws Will throw an error if no provider supports the route */ private findProviderForRoute; /** * Scale a bridge amount — and the transfer-token-denominated fee fields * (`config.maxFee`, `config.customFee.value`) — from their human-readable * form to the token's smallest units. This is the single place all amount * scaling happens, for every token: parameter resolution leaves amounts * human-readable, and this boundary scales them once the route provider is * known. * * USDC has a fixed 6-decimal precision (and the route provider does not * track it). Any other token's decimals are provider-specific and only known * once the route provider is selected, so they are resolved through the * provider's `getTokenDecimals` hook. A non-USDC amount is never forwarded to * a provider unscaled — when its decimals cannot be resolved the operation * fails loud with a {@link KitError} rather than passing an unscaled * magnitude that would mis-size the transfer. * * @param providerParams - The resolved bridge parameters whose `amount` and * fee fields are human-readable. * @param provider - The route provider selected for this transfer; its * `getTokenDecimals` hook resolves a non-USDC token's precision. * @returns The params with `amount`, `config.maxFee`, and * `config.customFee.value` scaled to smallest units. * @throws {KitError} When a non-USDC token's decimals cannot be resolved. */ private scaleResolvedAmount; /** * Find the default CCTP v2 provider for a source-fee forwarding route. * * This resolves CCTP v2's receive-exact wrapper, which is USDC-only: its fee is quoted and * collected in source-chain USDC. A route on another token pays its fee through its own provider, * so it has no source-fee provider here and resolves to `undefined` for the caller to route * normally. An eligible route with no matching provider still throws, so a USDC route never * silently swaps providers. * * @param params - The resolved provider parameters. * @returns The CCTP v2 provider that supports the forwarded route, or `undefined` when the route * is not USDC. * @throws {UnsupportedRouteError} When the route is USDC but no source-fee provider supports it. * @internal */ private findSourceFeeProvider; /** * Merge custom fee configuration into provider parameters. * * Prioritizes any custom fee configuration already present on the * provider-resolved params and uses the kit-level custom fee configuration * as a fallback only when a value is missing. If neither the provider params * nor the kit configuration can supply a value, no custom fee configuration * is added to the provider params. * * @param providerParams - The provider-resolved bridge parameters that may be enriched. * @returns The same `providerParams` reference, with custom fee * configuration merged when applicable. * @throws KitError `INPUT_VALIDATION_FAILED` (`FATAL`) when a custom fee is * requested for a non-USDC token, by either the kit-wide policy or a * per-call `config.customFee`. * * @remarks * - Existing values on `providerParams.config.customFee` are preserved. * - Kit-level functions are invoked lazily and only for missing values. * - If both sources provide no values, `customFee` is omitted entirely. * - Custom fees are USDC-only. A non-USDC token with a fee requested is * rejected here, before the provider call, so nothing is submitted and no * fee is silently dropped. */ private mergeCustomFeeConfig; /** * Resolve the custom fee for a bridge transfer. * * Checks which fee function the user provided and executes accordingly: * - `computeFee`: receives human-readable amounts, returns human-readable fee * - `calculateFee` (deprecated): receives smallest units, returns smallest units * * The custom fee policy is a USDC-only feature: the fee is collected on top * of the transfer amount and split through CCTPv2's USDC flow. A non-USDC * token with a policy set is rejected by {@link mergeCustomFeeConfig} before * this runs, so the non-USDC branch here is only a type-narrowing guard. * * @param providerParams - The resolved bridge parameters (amounts in smallest units). * @returns The resolved fee in smallest units, or `undefined` when no policy * is set or the policy returned nothing. */ private resolveFee; /** * Set the custom fee policy for the kit. * * Use `computeFee` (recommended) for human-readable amounts, or `calculateFee` * (deprecated) for smallest-unit amounts. Only one should be provided. * * **USDC only.** The custom fee is collected on top of the transfer amount * and split through CCTPv2's USDC flow, so it cannot apply to any other * token. Bridging a non-USDC token (for example a CCTPx `cirBTC` or `wETH` * selector) with this policy set throws `INPUT_VALIDATION_FAILED` before * anything is submitted, rather than proceeding without the fee — a silently * uncollected fee is a revenue loss the caller cannot see. A per-call * `config.customFee` is rejected the same way. Bridge USDC, or drop the fee * for that route. * * ```text * Transfer amount (user input, e.g., 1,000 USDC) * ↓ Wallet signs for transfer + custom fee (e.g., 1,000 + 10 = 1,010 USDC) * ↓ Custom fee split (10% Circle, 90% your recipientAddress wallet) * ↓ Full transfer amount (1,000 USDC) forwarded to CCTPv2 * ↓ CCTPv2 protocol fee (e.g., 0.1 USDC) deducted from transfer amount * ↓ User receives funds on destination chain (e.g., 999.9 USDC) * ``` * * @param customFeePolicy - The custom fee policy to set. * @throws {KitError} If the custom fee policy is invalid or missing required functions * * @example * ```typescript * import { BridgeKit } from '@circle-fin/bridge-kit' * * const kit = new BridgeKit() * * kit.setCustomFeePolicy({ * // computeFee receives human-readable amounts (e.g., '100' for 100 USDC) * computeFee: (params) => { * const amount = parseFloat(params.amount) * * // 1% fee, bounded to 5-50 USDC * const fee = Math.min(Math.max(amount * 0.01, 5), 50) * return fee.toFixed(6) * }, * resolveFeeRecipientAddress: (feePayoutChain) => { * return feePayoutChain.type === 'solana' * ? '9xQeWvG816bUx9EP9MnZ4buHh3A6E2dFQa4Xz6V7C7Gn' * : '0x23f9a5BEA7B92a0638520607407BC7f0310aEeD4' * }, * }) * * // 100 USDC transfer + 5 USDC custom fee results: * // - Wallet signs for 105 USDC total. * // - Circle receives 0.5 USDC (10% share of the custom fee). * // - Your recipientAddress wallet receives 4.5 USDC. * // - CCTPv2 processes 100 USDC and later deducts its own protocol fee. * ``` */ setCustomFeePolicy(customFeePolicy: CustomFeePolicy): void; /** * Remove the custom fee policy for the kit. * * @example * ```typescript * kit.removeCustomFeePolicy() * ``` */ removeCustomFeePolicy(): void; } /** * Schema for validating bridge parameters with chain identifiers. * This extends the core provider's schema but adapts it for the bridge kit's * more flexible interface that accepts chain identifiers. * * The schema validates: * - From adapter context (must always include both adapter and chain) * - To bridge destination (AdapterContext or BridgeDestinationWithAddress) * - Amount is a non-empty numeric string \> 0 * - Token is optional and defaults to 'USDC' * - Optional config parameters (transfer speed, max fee) * * @example * ```typescript * import { bridgeParamsWithChainIdentifierSchema } from '@circle-fin/bridge-kit' * * const params = { * from: { * adapter: sourceAdapter, * chain: 'Ethereum' * }, * to: { * adapter: destAdapter, * chain: 'Base' * }, * amount: '100.50', * token: 'USDC', * config: { * transferSpeed: 'FAST' * } * } * * const result = bridgeParamsWithChainIdentifierSchema.safeParse(params) * if (result.success) { * console.log('Parameters are valid') * } else { * console.error('Validation failed:', result.error) * } * ``` */ declare const bridgeParamsWithChainIdentifierSchema: z.ZodObject<{ from: z.ZodObject<{ adapter: z.ZodObject<{ prepare: z.ZodFunction, z.ZodUnknown>; waitForTransaction: z.ZodFunction, z.ZodUnknown>; getAddress: z.ZodFunction, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }>; chain: never; address: z.ZodOptional; }, "strict", z.ZodTypeAny, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; }, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; }>; to: z.ZodUnion<[z.ZodEffects, z.ZodUnknown>; waitForTransaction: z.ZodFunction, z.ZodUnknown>; getAddress: z.ZodFunction, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }>; chain: never; address: z.ZodOptional; } & { recipientAddress: z.ZodString; useForwarder: z.ZodOptional; }, "strip", z.ZodTypeAny, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; }, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; }>, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; }, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; }>, z.ZodEffects; }, "strict", z.ZodTypeAny, { chain: never; recipientAddress: string; useForwarder: true; }, { chain: never; recipientAddress: string; useForwarder: true; }>, { chain: never; recipientAddress: string; useForwarder: true; }, { chain: never; recipientAddress: string; useForwarder: true; }>, z.ZodObject<{ adapter: z.ZodObject<{ prepare: z.ZodFunction, z.ZodUnknown>; waitForTransaction: z.ZodFunction, z.ZodUnknown>; getAddress: z.ZodFunction, z.ZodUnknown>; }, "strip", z.ZodTypeAny, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }, { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }>; chain: never; address: z.ZodOptional; } & { useForwarder: z.ZodOptional; }, "strict", z.ZodTypeAny, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; useForwarder?: boolean | undefined; }, { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; useForwarder?: boolean | undefined; }>]>; amount: z.ZodPipeline>; token: z.ZodOptional, z.ZodString]>>; config: z.ZodOptional>; feePayment: z.ZodOptional>; maxFee: z.ZodOptional>>; customFee: z.ZodOptional>; recipientAddress: z.ZodOptional; }, "strict", z.ZodTypeAny, { value?: string | undefined; recipientAddress?: string | undefined; }, { value?: string | undefined; recipientAddress?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { transferSpeed?: TransferSpeed | undefined; feePayment?: "source" | "destination" | undefined; maxFee?: string | undefined; customFee?: { value?: string | undefined; recipientAddress?: string | undefined; } | undefined; }, { transferSpeed?: TransferSpeed | undefined; feePayment?: "source" | "destination" | undefined; maxFee?: string | undefined; customFee?: { value?: string | undefined; recipientAddress?: string | undefined; } | undefined; }>>; quote: z.ZodOptional; }, "strip", z.ZodTypeAny, { from: { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; }; to: { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; } | { chain: never; recipientAddress: string; useForwarder: true; } | { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; useForwarder?: boolean | undefined; }; amount: string; token?: string | undefined; config?: { transferSpeed?: TransferSpeed | undefined; feePayment?: "source" | "destination" | undefined; maxFee?: string | undefined; customFee?: { value?: string | undefined; recipientAddress?: string | undefined; } | undefined; } | undefined; quote?: unknown; }, { from: { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; }; to: { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; recipientAddress: string; address?: string | undefined; useForwarder?: boolean | undefined; } | { chain: never; recipientAddress: string; useForwarder: true; } | { adapter: { prepare: (...args: unknown[]) => unknown; waitForTransaction: (...args: unknown[]) => unknown; getAddress: (...args: unknown[]) => unknown; }; chain: never; address?: string | undefined; useForwarder?: boolean | undefined; }; amount: string; token?: string | undefined; config?: { transferSpeed?: TransferSpeed | undefined; feePayment?: "source" | "destination" | undefined; maxFee?: string | undefined; customFee?: { value?: string | undefined; recipientAddress?: string | undefined; } | undefined; } | undefined; quote?: unknown; }>; /** * Assert that the provided value conforms to {@link CustomFeePolicy}. * * Throws a validation error with annotated paths if the configuration is * malformed. * * @param config - The custom fee policy to validate * * @example * ```ts * const config = { * computeFee: () => '1', // 1 USDC (human-readable) * resolveFeeRecipientAddress: () => '0x1234567890123456789012345678901234567890', * } * assertCustomFeePolicy(config) * // If no error is thrown, `config` is a valid CustomFeePolicy * ``` */ declare function assertCustomFeePolicy(config: unknown): asserts config is CustomFeePolicy; export { Arbitrum, ArbitrumSepolia, Arc, ArcTestnet, Avalanche, AvalancheFuji, BalanceError, Base, BaseSepolia, Blockchain, BridgeChain, BridgeKit, Codex, CodexTestnet, Cronos, CronosTestnet, Edge, EdgeTestnet, Ethereum, EthereumSepolia, HyperEVM, HyperEVMTestnet, Injective, InjectiveTestnet, Ink, InkTestnet, InputError, KitError, Linea, LineaSepolia, Monad, MonadTestnet, Morph, MorphTestnet, NetworkError, OnchainError, Optimism, OptimismSepolia, Pharos, PharosTestnet, Plasma, PlasmaTestnet, Plume, PlumeTestnet, Polygon, PolygonAmoy, QUOTE_NOT_REUSED_WARNING_CODE, RateLimitError, RpcError, SPEED_DOWNGRADED_WARNING_CODE, Sei, SeiTestnet, ServiceError, Solana, SolanaDevnet, Sonic, SonicTestnet, TransferSpeed, Unichain, UnichainSepolia, WorldChain, WorldChainSepolia, XDC, XDCApothem, XLayer, XLayerTestnet, assertCustomFeePolicy, bridgeParamsWithChainIdentifierSchema, createRuntime, createTokenRegistry, createTraceId, extendInvocationContext, getErrorCode, getErrorMessage, isBalanceError, isFatalError, isInputError, isKitError, isNetworkError, isOnchainError, isRateLimitError, isRetryableError, isRpcError, isServiceError, resolveChainIdentifier, resolveInvocationContext, setExternalPrefix }; export type { ActionHandler, AdapterContext, BaseChainDefinition, BridgeChainIdentifier, BridgeConfig, BridgeEstimateResult, BridgeExecutionConfig, BridgeKitConfig, BridgeParams, BridgeResult, BridgeToken, BridgeWarning, CCTPConfig, CCTPContracts, CCTPMergedConfig, CCTPSplitConfig, CCTPV2SupportedChainType, CCTPXChainConfig, Caller, ChainDefinition, ChainDefinitionWithCCTPX, ChainIdentifier$1 as ChainIdentifier, Currency, CustomFeePolicy, EVMChainDefinition, ErrorDetails, EstimateResult, EstimatedGas, GetSupportedChainsOptions, InvocationContext, InvocationDefaults, InvocationMeta, KitContractType, KitContracts, NonEVMChainDefinition, ReceiveExactEstimateResult, ReceiveExactFeeItem, Recoverability, RetryContext, VersionConfig };