/** * 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 { EarningProvider, NoClaimableRewardsResult, ClaimedAmount, VaultQuery, GetVaultsResult, EarnOpportunity, LiquidityProfile, ExploreVaultsSortBy, ExploreVaultsResult, PositionInfo, PositionPnLInfo, AccruedRewardInfo, DepositQuoteInfo, AssetAmount, EarnGasFeeEstimateBase, WithdrawalQuoteInfo, ClaimRewardsQuoteInfo, EarnActions, EarnActionName, EarnDepositOutcome, EarnWithdrawResult, EarnCrossChainDepositStatus, EarnCrossChainDepositWaitResult, EarnSameChainDepositResult, EarnCrossChainDepositResult, EarnServiceProvider } from '@circle-fin/provider-earn-service'; export { AccruedRewardInfo, ApyProfile, AssetAmount, ClaimRewardsQuoteInfo, ClaimRewardsResult, ClaimedAmount, ClaimedRewardsResult, CollateralInfo, DecodedEarnTx, DepositQuoteInfo, EARN_EXECUTE_REVIEW_KIND, EarnActionBase, EarnActionName, EarnActions, EarnBridgeCctpStatus, EarnBridgeDepositStep, EarnBridgeDepositStepName, EarnBridgeHopStatus, EarnBridgeQuoteExpiry, EarnCrossChainDepositResult, EarnCrossChainDepositStatus, EarnCrossChainDepositWaitOutcome, EarnCrossChainDepositWaitResult, EarnDepositOutcome, EarnDepositResult, EarnEncodedTransaction, EarnErrorTrace, EarnErrorTraceBase, EarnExecuteAuthorizationReview, EarnExecuteReview, EarnGasFeeEstimateBase, EarnOperationName, EarnOpportunity, EarnSameChainDepositResult, EarnServiceConfig, EarnStep, EarnStepBase, EarnStepName, EarnWithdrawResult, EarningProvider, ExploreVaultsPagination, ExploreVaultsResult, ExploreVaultsSortBy, FeeInfo, GetVaultsResult, LiquidityProfile, ManagerInfo, NoClaimableRewardsResult, PositionInfo, PositionPnLInfo, RiskSignals, VaultError, VaultInfo, VaultOpportunity, VaultQuery, VaultRewardInfo, VaultWarning, WithdrawalQuoteInfo, getCrossChainDepositStatusOutcome, isEarnErrorTrace, isEarnExecuteReview, isTerminalCrossChainDepositStatus } from '@circle-fin/provider-earn-service'; 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 = 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; } /** * 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 earn (vault deposit/withdraw) * operations through the Earn Kit. * * @example * ```typescript * import { EarnChain } from '@core/chains' * * const result = await earnKit.deposit({ * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * amount: '100', * }) * ``` */ declare enum EarnChain { Arc = "Arc", Arc_Testnet = "Arc_Testnet" } /** * Chain definition that supports earn operations. * * Constrained to chains where supported earn vaults are deployed. */ type EarnChainDefinition = ChainDefinition & { chain: `${EarnChain}`; }; /** * Chain identifier accepted by earn operations. * * Supports: * - ChainDefinition objects (e.g., ArcTestnet) * - EarnChain enum values * - String literals of EarnChain values */ type EarnChainIdentifier = EarnChainDefinition | EarnChain | `${EarnChain}`; /** * Blockchains supported as the source chain for cross-chain Earn deposits. * * Single source of truth for the source allowlist: the Earn Service bridge * route map is `satisfies`-checked against {@link EarnBridgeSourceBlockchain}, * and both the type and the runtime validation schema derive from this array. * * @example * ```typescript * import { EARN_BRIDGE_SOURCE_BLOCKCHAINS } from '@core/chains' * * console.log(EARN_BRIDGE_SOURCE_BLOCKCHAINS.join(', ')) * ``` */ declare const EARN_BRIDGE_SOURCE_BLOCKCHAINS: readonly [Blockchain.Arbitrum, Blockchain.Arbitrum_Sepolia, Blockchain.Base, Blockchain.Base_Sepolia, Blockchain.Ethereum, Blockchain.Ethereum_Sepolia]; /** * Blockchains supported as the source chain for cross-chain Earn deposits. * * Cross-chain Earn deposits bridge USDC from one of these chains into a vault * on an {@link EarnBridgeDestinationBlockchain} chain. */ type EarnBridgeSourceBlockchain = (typeof EARN_BRIDGE_SOURCE_BLOCKCHAINS)[number]; /** * Chain definition for a cross-chain Earn deposit source chain. * * Constrained to chains in {@link EarnBridgeSourceBlockchain}. */ type EarnBridgeSourceChainDefinition = ChainDefinition & { chain: `${EarnBridgeSourceBlockchain}`; }; /** * Chain identifier accepted for the source side of a cross-chain Earn deposit. * * Constrains the source to Ethereum Sepolia, Arbitrum Sepolia, or Base Sepolia. * * @example * ```typescript * import type { EarnBridgeSourceChainIdentifier } from '@core/chains' * * const source: EarnBridgeSourceChainIdentifier = 'Ethereum_Sepolia' * ``` */ type EarnBridgeSourceChainIdentifier = EarnBridgeSourceChainDefinition | EarnBridgeSourceBlockchain | `${EarnBridgeSourceBlockchain}`; /** * Blockchains supported as the destination (vault) chain for cross-chain Earn * deposits. Single source of truth for the destination allowlist. * * @example * ```typescript * import { EARN_BRIDGE_DESTINATION_BLOCKCHAINS } from '@core/chains' * * console.log(EARN_BRIDGE_DESTINATION_BLOCKCHAINS.join(', ')) * ``` */ declare const EARN_BRIDGE_DESTINATION_BLOCKCHAINS: readonly [Blockchain.Arc, Blockchain.Arc_Testnet]; /** * Blockchains supported as the destination (vault) chain for cross-chain Earn * deposits. * * Intentionally narrower than {@link EarnChain}: cross-chain deposits * land on Arc (mainnet) or Arc Testnet. */ type EarnBridgeDestinationBlockchain = (typeof EARN_BRIDGE_DESTINATION_BLOCKCHAINS)[number]; /** * Chain definition for a cross-chain Earn deposit destination chain. * * Constrained to chains in {@link EarnBridgeDestinationBlockchain}. */ type EarnBridgeDestinationChainDefinition = ChainDefinition & { chain: `${EarnBridgeDestinationBlockchain}`; }; /** * Chain identifier accepted for the destination (vault) side of a cross-chain * Earn deposit. Constrains the destination to Arc or Arc Testnet. * * @example * ```typescript * import type { EarnBridgeDestinationChainIdentifier } from '@core/chains' * * const destination: EarnBridgeDestinationChainIdentifier = 'Arc' * ``` */ type EarnBridgeDestinationChainIdentifier = EarnBridgeDestinationChainDefinition | EarnBridgeDestinationBlockchain | `${EarnBridgeDestinationBlockchain}`; /** * Retrieve a chain definition by its blockchain enum value. * * Searches the set of known chain definitions and returns the one matching the provided * blockchain enum or string value. Throws an error if no matching chain is found. * * @param blockchain - The blockchain enum or its string representation to look up. * @returns The corresponding ChainDefinition object for the given blockchain. * * @throws Error If no chain definition is found for the provided enum value. * * @example * ```typescript * import { getChainByEnum } from '@core/chains' * import { Blockchain } from '@core/chains' * * const ethereum = getChainByEnum(Blockchain.Ethereum) * console.log(ethereum.name) // "Ethereum" * ``` */ declare const getChainByEnum: (blockchain: Blockchain | `${Blockchain}`) => 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; } & 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; /** * 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 = (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; }; /** * 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): 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 definitions for Earn operations. * * These error codes provide fine-grained categorization of failures * from the Earn service, enabling SDK consumers to distinguish * between input errors (fix your request) and service errors (retry later). * * Error code ranges: * - 1100-1106: INPUT errors — invalid, unsupported, or stale request state * - 8100-8105: SERVICE errors — retryable backend/provider failures * * @example * ```typescript * import { EarnError, isInputError, isRetryableError } from '@circle-fin/earn-kit' * * try { * await earnKit.deposit(params) * } catch (error) { * if (isInputError(error)) { * // Fix the request: vault doesn't exist, chain not supported, etc. * } * if (isRetryableError(error)) { * // Try again: signing timed out, provider temporarily unavailable, etc. * } * } * ``` */ declare const EarnError: { /** The requested vault does not exist for the provided chain. */ readonly VAULT_NOT_FOUND: { readonly code: 1100; readonly name: "EARN_VAULT_NOT_FOUND"; readonly type: ErrorType; }; /** The specified blockchain is not supported for earn operations. */ readonly UNSUPPORTED_CHAIN: { readonly code: 1101; readonly name: "EARN_UNSUPPORTED_CHAIN"; readonly type: ErrorType; }; /** The vault's underlying asset is not supported. */ readonly UNSUPPORTED_VAULT: { readonly code: 1102; readonly name: "EARN_UNSUPPORTED_VAULT"; readonly type: ErrorType; }; /** The submitted signature could not be verified. */ readonly SIGNATURE_REJECTED: { readonly code: 1103; readonly name: "EARN_SIGNATURE_REJECTED"; readonly type: ErrorType; }; /** General input validation failure (invalid ID, batch size, etc.). */ readonly INVALID_INPUT: { readonly code: 1104; readonly name: "EARN_INVALID_INPUT"; readonly type: ErrorType; }; /** * The cross-chain bridge route is not configured (missing CCTP or adapter * contract configuration), as opposed to the chain itself being * unsupported. */ readonly UNSUPPORTED_BRIDGE_ROUTE: { readonly code: 1105; readonly name: "EARN_UNSUPPORTED_BRIDGE_ROUTE"; readonly type: ErrorType; }; /** * The bridge quote expired. This is an INPUT error because the prepared * request is stale and must be replaced instead of retried. */ readonly BRIDGE_QUOTE_EXPIRED: { readonly code: 1106; readonly name: "EARN_BRIDGE_QUOTE_EXPIRED"; readonly type: ErrorType; }; /** The proxy signing call failed — retryable. */ readonly SIGNING_FAILED: { readonly code: 8100; readonly name: "EARN_SIGNING_FAILED"; readonly type: ErrorType; }; /** An external provider API request failed — retryable. */ readonly PROVIDER_ERROR: { readonly code: 8101; readonly name: "EARN_PROVIDER_ERROR"; readonly type: ErrorType; }; /** Failed to fetch reward data — retryable. */ readonly REWARDS_FETCH_FAILED: { readonly code: 8102; readonly name: "EARN_REWARDS_FETCH_FAILED"; readonly type: ErrorType; }; /** An internal earn service error occurred — retryable. */ readonly INTERNAL_ERROR: { readonly code: 8103; readonly name: "EARN_INTERNAL_ERROR"; readonly type: ErrorType; }; /** EarnKit interactions are temporarily paused off-chain — retryable. */ readonly PAUSED: { readonly code: 8104; readonly name: "EARN_PAUSED"; readonly type: ErrorType; }; /** Position PnL is still reconciling and can be retried. */ readonly POSITION_PNL_PENDING: { readonly code: 8105; readonly name: "EARN_POSITION_PNL_PENDING"; 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 for a {@link KitError} that is RESUMABLE. * * @remarks * RESUMABLE errors are a strict subset of retryable errors: a multi-phase * operation completed some on-chain work (for example, a token approval * landed) before failing. Re-running from scratch is safe, but a kit-level * `retry()` can resume from the failed phase and skip the work that already * succeeded. * * Prefer this guard over reaching into `error.recoverability === 'RESUMABLE'` * directly so callers do not depend on the internal {@link Recoverability} * type. Use {@link isRetryableError} when you only need to know whether * retrying is worthwhile; use this when you want to branch on "this is a * partial completion — `retry()` skips already-committed work" versus "safe to * restart from scratch". * * @param error - Unknown error to check. * @returns `true` if `error` is a {@link KitError} with `RESUMABLE` * recoverability. * * @example * ```typescript * import { isResumableError } from '@core/errors' * * try { * await kit.deposit(params) * } catch (error) { * if (isResumableError(error)) { * // Approval already landed — resume without re-approving. * await kit.retry(error) * } * } * ``` */ declare function isResumableError(error: unknown): error is KitError; /** * 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; /** * 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> { } } /** * 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" } /** * 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>; /** * Type definitions for the Amount system. * * @remarks * This module defines the core types for type-safe token amount handling. * Amounts are immutable value objects that carry the raw bigint value * and decimal precision. Token identity (symbol, address) is managed * separately by the token registry. * * @packageDocumentation */ /** * An immutable token amount value. * * @remarks * Amounts are pure numeric value objects containing the raw bigint value * (in smallest units) and decimal precision. They are immutable - all * math operations return new Amount instances. * * Token identity (symbol, contract address) is intentionally NOT included. * This separation ensures developers explicitly source token metadata from * the token registry, preventing incorrect symbol display. * * @example * ```typescript * const amount: Amount = { * raw: 1_000_000n, // 1 token in smallest units (e.g., 1 USDC) * decimals: 6, * } * ``` */ interface Amount$1 { /** * The raw value in smallest units (e.g., wei for ETH, micro-units for USDC). */ readonly raw: bigint; /** * Number of decimal places for this token. * * @remarks * Common values: * - USDC/USDT: 6 * - ETH/ERC-20: 18 */ readonly decimals: number; } /** * Configuration for creating amounts. * * @remarks * Specifies the decimal precision for the amount. Typically obtained * from the token registry. */ interface AmountConfig { /** * Number of decimal places. */ decimals: number; } /** * Options for formatting amounts as human-readable strings. */ interface FormatOptions { /** * Locale for number formatting. * * @defaultValue 'en-US' */ locale?: string; /** * Minimum fraction digits to display. * * @defaultValue 0 */ minimumFractionDigits?: number; /** * Maximum fraction digits to display. * * @defaultValue decimals */ maximumFractionDigits?: number; /** * Use grouping separators (e.g., 1,000,000). * * @defaultValue true */ useGrouping?: boolean; } /** * Options for parsing human-readable strings to amounts. * * @remarks * Currently only supports '.' as the decimal separator (en-US style). */ interface ParseOptions { /** * Number of decimal places. */ decimals: number; /** * Whether to allow negative values. * * @defaultValue false */ allowNegative?: boolean; } /** * Result of comparing two amounts. */ type ComparisonResult = -1 | 0 | 1; /** * Types that can be converted to an Amount. * * @remarks * - `bigint`: Raw value (requires config with decimals) * - `string`: Human-readable (e.g., "100.50") * - `number`: Human-readable (e.g., 100.5) - beware of precision! * - `Amount`: Existing amount or plain object with Amount shape */ type AmountLike = bigint | string | number | Amount$1; /** * JSON representation of an Amount. * * @remarks * Used for serialization. The `raw` value is stringified since JSON * does not support bigint natively. * * @example * ```typescript * const json: AmountJSON = { * raw: "1500000", * decimals: 6, * formatted: "1.5" * } * ``` */ interface AmountJSON { /** The raw value as a string (bigint serialized). */ raw: string; /** Number of decimal places. */ decimals: number; /** Human-readable formatted value. */ formatted: string; } /** * Minimal fields required for internal Amount operations. * * @remarks * This internal type mirrors the public {@link Amount} interface shape but exists * separately to avoid circular dependencies. Internal modules (math, comparison, * formatting) import this lightweight type instead of the full Amount class. * * The Amount class implements this interface, so internal helpers can operate * on either Amount instances or plain objects with the same shape. * * @see {@link ../types.ts#Amount} for the public interface * @internal */ interface AmountFields { readonly raw: bigint; readonly decimals: number; } /** * Fluent Amount class for type-safe token amount handling. * * @remarks * The `Amount` class provides an immutable, fluent API for working with token * amounts. It wraps a raw bigint value with decimal precision and provides * chainable methods for math, comparison, and formatting. * * Token identity (symbol, contract address) is intentionally NOT included. * This ensures developers explicitly source token metadata from the token * registry, preventing incorrect symbol display. * * @example * ```typescript * import { Amount } from '@core/amounts' * * // Create from raw value or parse from string * const a = Amount.of(1_000_000n, { decimals: 6 }) * const b = Amount.parse('0.5', { decimals: 6 }) * * // Fluent operations * const result = a.add(b).mul(2n).sub(Amount.parse('0.25', { decimals: 6 })) * * // Comparisons and formatting * a.gt(b) // true * a.toString() // "1" * * // For display with symbol, combine with token registry: * // `${amount.toString()} ${token.symbol}` * ``` * * @packageDocumentation */ /** * An immutable token amount with fluent API methods. * * @remarks * The `Amount` class provides a type-safe, ergonomic way to work with token * amounts. It combines the raw bigint value with decimal precision and * provides chainable methods for: * * - **Math operations**: add, sub, mul, div, abs, neg * - **Comparisons**: eq, lt, lte, gt, gte, cmp, min, max * - **Predicates**: isZero, isPositive, isNegative * - **Formatting**: formatted, toString, toJSON * - **Conversion**: toDecimals * * All operations return new Amount instances - the class is immutable. * * Token identity (symbol) is intentionally excluded. Source token metadata * from the token registry for display purposes. */ declare class Amount implements AmountFields { /** The raw value in smallest units (e.g., wei for ETH, micro-units for USDC). */ readonly raw: bigint; /** Number of decimal places for this token. */ readonly decimals: number; private constructor(); /** * Create an Amount from a raw bigint value. * * @param raw - The raw value in smallest units. * @param config - Configuration with decimals. * @returns A new immutable Amount instance. * @throws KitError If raw is not a bigint or decimals is invalid. * * @example * ```typescript * // Get decimals from token registry * const amount = Amount.of(1_000_000n, { decimals: 6 }) * ``` */ static of(raw: bigint, config: AmountConfig): Amount; /** * Parse a human-readable string or number into an Amount. * * @param input - The input to parse (e.g., "100.50" or 100.5). * @param options - Parse options including decimals. * @returns A new immutable Amount instance. * @throws KitError If input is invalid or parsing fails. * * @example * ```typescript * const amount = Amount.parse('100.50', { decimals: 6 }) * ``` */ static parse(input: string | number, options: ParseOptions): Amount; /** * Convert any AmountLike value to an Amount. * * @param input - The input (bigint, string, number, or existing Amount). * @param config - Configuration (required for non-Amount inputs). * @returns A new immutable Amount instance. * @throws KitError If conversion fails or config is missing. * * @remarks * When providing a `number` input, very large or small values may be * converted to exponential notation (e.g., `1e21`), which is not supported. * For such values, provide a `string` representation instead. * * @example * ```typescript * Amount.from(1_000_000n, { decimals: 6 }) // from bigint * Amount.from('1.00', { decimals: 6 }) // from string * Amount.from(existingAmount) // pass-through * ``` */ static from(input: AmountLike, config?: AmountConfig): Amount; /** * Create a zero Amount with the given configuration. * * @param config - Configuration with decimals. * @returns A zero Amount instance. * * @example * ```typescript * const zero = Amount.zero({ decimals: 6 }) * ``` */ static zero(config: AmountConfig): Amount; /** * Check if a value is an Amount-like object. * * @param value - The value to check. * @returns True if the value has Amount shape (raw: bigint, decimals: number). * * @example * ```typescript * Amount.isAmount({ raw: 1000000n, decimals: 6 }) // true * Amount.isAmount({ value: 100 }) // false * ``` */ static isAmount(value: unknown): value is { raw: bigint; decimals: number; }; /** * Sum an array of Amounts. * * @param amounts - The amounts to sum (must have same decimals). * @returns A new Amount with the total sum. * @throws KitError If amounts array is empty or decimals don't match. * * @example * ```typescript * const fee1 = Amount.parse('0.10', { decimals: 6 }) * const fee2 = Amount.parse('0.25', { decimals: 6 }) * const fee3 = Amount.parse('0.15', { decimals: 6 }) * * const total = Amount.sum([fee1, fee2, fee3]) * total.toString() // "0.5" * ``` */ static sum(amounts: readonly Amount[]): Amount; /** * Deserialize an Amount from a JSON object. * * @param json - The JSON object (e.g., from `JSON.parse()`). * @returns A new Amount instance. * @throws KitError If the JSON structure is invalid. * * @example * ```typescript * const json = JSON.parse('{"raw":"1500000","decimals":6}') * const amount = Amount.fromJSON(json) * ``` */ static fromJSON(json: unknown): Amount; /** * Compare this Amount with another. * * @param other - The Amount to compare with. * @returns -1 if this is less than other, 0 if equal, 1 if this is greater. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * const b = Amount.parse('2.0', { decimals: 6 }) * a.compare(b) // -1 * ``` */ compare(other: Amount): ComparisonResult; /** * Check if this Amount equals another. * * @param other - The Amount to compare with. * @returns True if the raw values are equal. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * const b = Amount.parse('1.5', { decimals: 6 }) * a.eq(b) // true * ``` */ eq(other: Amount): boolean; /** * Check if this Amount is less than another. * * @param other - The Amount to compare with. * @returns True if this.raw is less than other.raw. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.0', { decimals: 6 }) * const b = Amount.parse('2.0', { decimals: 6 }) * a.lt(b) // true * ``` */ lt(other: Amount): boolean; /** * Check if this Amount is less than or equal to another. * * @param other - The Amount to compare with. * @returns True if this.raw is less than or equal to other.raw. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * const b = Amount.parse('1.5', { decimals: 6 }) * a.lte(b) // true * ``` */ lte(other: Amount): boolean; /** * Check if this Amount is greater than another. * * @param other - The Amount to compare with. * @returns True if this.raw is greater than other.raw. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('2.0', { decimals: 6 }) * const b = Amount.parse('1.0', { decimals: 6 }) * a.gt(b) // true * ``` */ gt(other: Amount): boolean; /** * Check if this Amount is greater than or equal to another. * * @param other - The Amount to compare with. * @returns True if this.raw is greater than or equal to other.raw. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('2.0', { decimals: 6 }) * const b = Amount.parse('2.0', { decimals: 6 }) * a.gte(b) // true * ``` */ gte(other: Amount): boolean; /** * Return the minimum of this Amount and another. * * @param other - The Amount to compare with. * @returns The smaller of the two amounts. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.0', { decimals: 6 }) * const b = Amount.parse('2.0', { decimals: 6 }) * a.min(b).toString() // "1" * ``` */ min(other: Amount): Amount; /** * Return the maximum of this Amount and another. * * @param other - The Amount to compare with. * @returns The larger of the two amounts. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.0', { decimals: 6 }) * const b = Amount.parse('2.0', { decimals: 6 }) * a.max(b).toString() // "2" * ``` */ max(other: Amount): Amount; /** * Add another Amount to this one. * * @param other - The Amount to add. * @returns A new Amount with the sum. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * const b = Amount.parse('0.5', { decimals: 6 }) * a.add(b).toString() // "2" * ``` */ add(other: Amount): Amount; /** * Subtract another Amount from this one. * * @param other - The Amount to subtract. * @returns A new Amount with the difference. * @throws KitError If amounts have different decimals. * * @example * ```typescript * const a = Amount.parse('2.0', { decimals: 6 }) * const b = Amount.parse('0.5', { decimals: 6 }) * a.sub(b).toString() // "1.5" * ``` */ sub(other: Amount): Amount; /** * Multiply this Amount by a scalar. * * @param multiplier - The scalar to multiply by (bigint or integer number). * @returns A new Amount with the product. * * @remarks * When using a `number` as a multiplier, precision is limited by standard * JavaScript floating-point capabilities (~15-17 significant digits). For * high-precision calculations, provide the multiplier as a `bigint`. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * a.mul(2n).toString() // "3" * a.mul(3).toString() // "4.5" * ``` */ mul(multiplier: bigint | number): Amount; /** * Divide this Amount by a scalar. * * @param divisor - The scalar to divide by (bigint or integer number). * @returns A new Amount with the quotient (integer division). * @throws KitError If divisor is zero. * * @remarks * When using a `number` as a divisor, precision is limited by standard * JavaScript floating-point capabilities (~15-17 significant digits). For * high-precision calculations, provide the divisor as a `bigint`. * * @example * ```typescript * const a = Amount.parse('6.0', { decimals: 6 }) * a.div(2n).toString() // "3" * a.div(4).toString() // "1.5" * ``` */ div(divisor: bigint | number): Amount; /** * Get the absolute value of this Amount. * * @returns A new Amount with the absolute value. * * @example * ```typescript * const a = Amount.of(-1_500_000n, { decimals: 6 }) * a.abs().toString() // "1.5" * ``` */ abs(): Amount; /** * Negate this Amount. * * @returns A new Amount with the negated value. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * a.neg().raw // -1_500_000n * ``` */ neg(): Amount; /** * Check if this Amount is zero. * * @returns True if the raw value is 0n. * * @example * ```typescript * Amount.zero({ decimals: 6 }).isZero() // true * Amount.parse('0.001', { decimals: 6 }).isZero() // false * ``` */ isZero(): boolean; /** * Check if this Amount is positive. * * @returns True if the raw value is greater than 0n. * * @example * ```typescript * Amount.parse('1.0', { decimals: 6 }).isPositive() // true * Amount.zero({ decimals: 6 }).isPositive() // false * ``` */ isPositive(): boolean; /** * Check if this Amount is negative. * * @returns True if the raw value is less than 0n. * * @example * ```typescript * Amount.of(-1_000_000n, { decimals: 6 }).isNegative() // true * Amount.parse('1.0', { decimals: 6 }).isNegative() // false * ``` */ isNegative(): boolean; /** * Convert this Amount to a different decimal precision. * * @param newDecimals - The target number of decimal places. * @returns A new Amount with adjusted precision (or this if same precision). * @throws KitError If newDecimals is invalid. * * @example * ```typescript * // Scale up: 6 decimals → 18 decimals * const usdc = Amount.parse('1.5', { decimals: 6 }) * const scaled = usdc.toDecimals(18) * scaled.raw // 1_500_000_000_000_000_000n * * // Scale down: 18 decimals → 6 decimals (truncates) * const eth = Amount.of(1_500_000_000_000_000_000n, { decimals: 18 }) * eth.toDecimals(6).raw // 1_500_000n * ``` */ toDecimals(newDecimals: number): Amount; /** * Format this Amount as a human-readable string. * * @param options - Formatting options (locale, fraction digits, grouping). * @returns A formatted string (e.g., "1,000.50"). * * @example * ```typescript * const a = Amount.parse('1000.5', { decimals: 6 }) * a.formatted() // "1,000.5" * a.formatted({ minimumFractionDigits: 2 }) // "1,000.50" * a.formatted({ useGrouping: false }) // "1000.5" * ``` */ formatted(options?: FormatOptions): string; /** * Convert to a human-readable string. * * @returns A formatted string like "1.5". * * @remarks * For display with a token symbol, combine with the token registry: * ```typescript * `${amount.toString()} ${token.symbol}` * ``` * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * a.toString() // "1.5" * ``` */ toString(): string; /** * Convert to a JSON-serializable object. * * @returns An object with raw (as string), decimals, and formatted value. * * @example * ```typescript * const a = Amount.parse('1.5', { decimals: 6 }) * a.toJSON() * // { raw: "1500000", decimals: 6, formatted: "1.5" } * ``` */ toJSON(): AmountJSON; } /** * Estimated gas details for one transaction in a kit-level Earn quote, with * every amount as a decimal string so quote results stay JSON-serializable. * * @example * ```typescript * const gas: EarnEstimatedGas = { gas: '73567', gasPrice: '20003763738', fee: '1471616886913446' } * ``` */ interface EarnEstimatedGas { /** Estimated gas units as a decimal string, e.g. '73567'. */ readonly gas: string; /** Estimated price per gas unit as a decimal string in wei. */ readonly gasPrice: string; /** Total estimated fee as a decimal string in wei. */ readonly fee: string; } /** * Estimated native gas fee for one transaction in an Earn quote. * * A discriminated union on `fees`: a successful estimate carries * {@link EarnEstimatedGas} details and no `error`; a failed estimate carries * `fees: null` and a sanitized `error` message. * * @example * ```typescript * function describe(entry: EarnGasFeeEstimate): string { * if (entry.fees === null) { * return `${entry.name}: estimation failed (${entry.error})` * } * return `${entry.name}: ${entry.fees.fee} wei` * } * ``` */ type EarnGasFeeEstimate = (EarnGasFeeEstimateBase & { /** Estimated gas details with amounts formatted as decimal strings. */ readonly fees: EarnEstimatedGas; /** Never present on a successful estimate. */ readonly error?: never; }) | (EarnGasFeeEstimateBase & { /** Null because estimation failed. */ readonly fees: null; /** Sanitized estimation error message. */ readonly error: string; }); /** * A type alias that enables flexible provider type handling. * * Decouples the internal provider array type from the external * `EarningProvider` import while preserving generic provider arrays. */ type FlexibleEarningProvider = EarningProvider; /** * Adapter context for earn operations, constrained to earn-supported chains. * * @typeParam TAdapterCapabilities - The adapter capabilities type * @typeParam TChainIdentifier - The chain identifier type accepted by the adapter context */ type EarnAdapterContext = AdapterContext; /** * Configuration options for earn operations. * * EarnKit supports dual-mode authentication: operations work both with * and without an API key. When present, the API key enables permissioned * features like integrator attribution tracking. * * @example * ```typescript * // Permissionless (no API key) * const config: EarnConfig = {} * * // Permissioned (with API key) * const config: EarnConfig = { * apiKey: 'TEST_API_KEY:keyId:keySecret', * } * ``` */ interface EarnConfig { /** * Optional Circle API key for permissioned access. * * When provided, enables integrator attribution tracking and * higher rate limits. When omitted, the SDK operates in * permissionless mode. * * Format: `_API_KEY::`. A legacy * `KIT_KEY::` value is also accepted. */ readonly apiKey?: string | undefined; /** * Optional Circle API key for permissioned access. * * @deprecated Use {@link EarnConfig.apiKey} instead. Still honored when * `apiKey` is omitted, and `apiKey` takes precedence when both are set. */ readonly kitKey?: string | undefined; /** * Optional base URL override for the Earn Service API. * * Defaults to `https://api.circle.com` when omitted. Override for testing * against staging or local environments. */ readonly baseUrl?: string | undefined; /** * Enable or disable atomic batched transaction execution. * * When `true` (or `undefined` / omitted), same-chain deposit and withdraw * bundle the approve and execute calls into one adapter-native atomic batch * when the connected wallet supports it. Set to `false` to force the * sequential approve → execute flow. * * @defaultValue `undefined` (batching attempted when the wallet supports it) */ readonly batchTransactions?: boolean | undefined; } /** * Parameters for fetching vault information. * * Provide vault queries as chain + vaultAddress pairs. The API * supports up to 20 vault queries per request. * * @example * ```typescript * // Batch lookup * const params: GetVaultsParams = { * vaults: [ * { chain: 'Arc_Testnet', vaultAddress: '0x8eB67...' }, * { chain: 'Arc_Testnet', vaultAddress: '0xBEEF0...' }, * ], * } * ``` */ interface GetVaultsParams { /** Vault queries (chain + vaultAddress pairs). */ readonly vaults: readonly VaultQuery[]; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for discovering vaults available on a chain. * * Only `chain` is required. Filters narrow the result set, and results * are paginated and sorted server-side. * * @example * ```typescript * const params: ExploreVaultsParams = { * chain: 'Arc_Testnet', * minApy: '0.03', * sortBy: 'apy', * } * ``` */ interface ExploreVaultsParams { /** Chain to discover vaults on (e.g., 'Arc_Testnet'). */ readonly chain: EarnChainIdentifier; /** Optional protocol filter (e.g., 'morpho'). Matched case-insensitively. */ readonly protocol?: string | undefined; /** Optional asset symbol filter, matched case-insensitively. Defaults to 'USDC'. */ readonly asset?: string | undefined; /** Optional minimum net APY as a decimal string (e.g., '0.03' for 3%). */ readonly minApy?: string | undefined; /** Optional minimum total deposits in token units (e.g., '1000000'). */ readonly minTvl?: string | undefined; /** Optional sort order: 'apy', 'tvl', or 'name'. Defaults to 'tvl'. */ readonly sortBy?: ExploreVaultsSortBy | undefined; /** Optional page number (1-based). Defaults to 1. */ readonly page?: number | undefined; /** Optional results per page (100-500). Defaults to 100. */ readonly pageSize?: number | undefined; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for lazily iterating all vaults available on a chain. * * Identical to {@link ExploreVaultsParams} minus `page`: the iterator * fetches page after page on demand. `pageSize` still controls how many * vaults each underlying request fetches. * * @example * ```typescript * const params: ExploreVaultsIteratorParams = { * chain: 'Arc_Testnet', * sortBy: 'apy', * } * ``` */ type ExploreVaultsIteratorParams = Omit; /** * Parameters for fetching a wallet's position in a vault. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: GetPositionParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * } * ``` */ interface GetPositionParams { /** Source adapter context containing the wallet to query. */ readonly from: EarnAdapterContext; /** On-chain vault contract address to query position for. */ readonly vaultAddress: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for retrieving the status of a cross-chain Earn deposit. * * The status lookup is chain-agnostic; it is keyed only by the bridge * execution ID returned from a cross-chain {@link CrossChainDepositParams} * deposit. * * @example * ```typescript * const params: GetCrossChainDepositStatusParams = { * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * } * ``` */ interface GetCrossChainDepositStatusParams { /** Idempotency execution ID returned by the cross-chain deposit. */ readonly execId: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for waiting on a cross-chain Earn deposit to reach a terminal * bridge state. * * Polls the bridge status until the deposit settles (or fails) or the wait * budget elapses. On timeout the waiter resolves with the last observed * status and a `timeout` outcome rather than throwing, so callers can inspect * where the bridge stalled. * * @example * ```typescript * const params: WaitForCrossChainDepositParams = { * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * pollIntervalMs: 5_000, * maxWaitMs: 1_200_000, * } * ``` */ interface WaitForCrossChainDepositParams { /** Idempotency execution ID returned by the cross-chain deposit. */ readonly execId: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; /** Delay between status polls in milliseconds. Defaults to 5000. */ readonly pollIntervalMs?: number | undefined; /** Maximum total wait time in milliseconds. Defaults to 1200000 (20 min). */ readonly maxWaitMs?: number | undefined; /** * Optional cancellation signal. When it aborts, the wait rejects with a * `NETWORK_ABORTED` error instead of resolving. Cancellation is observed * between polls, not mid-request. */ readonly signal?: AbortSignal | undefined; } /** * Parameters for depositing into a DeFi lending vault. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: SameChainDepositParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ interface SameChainDepositParams { /** Source adapter context (wallet and chain) for the deposit. */ readonly from: EarnAdapterContext; /** On-chain vault contract address to deposit into. */ readonly vaultAddress: string; /** * Amount to deposit in human-readable decimal format. * * @example '100.50' for 100.50 USDC */ readonly amount: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Destination of a cross-chain Earn deposit. * * The destination is adapter-less: the source wallet signs a single ERC-3009 * authorization on the source chain, and a relayer executes the bridge and * vault deposit on the destination chain. No destination-side signing occurs, * so only the destination chain and the wallet receiving the vault position * are required. * * @example * ```typescript * const destination: EarnCrossChainDepositDestination = { * chain: 'Arc_Testnet', * recipientAddress: '0x1234567890123456789012345678901234567890', * } * ``` */ interface EarnCrossChainDepositDestination { /** Destination Earn chain where the vault is deployed. */ readonly chain: EarnBridgeDestinationChainIdentifier; /** Destination wallet that receives the vault position. */ readonly recipientAddress: string; } /** * Parameters for depositing into a DeFi lending vault from another chain. * * @remarks * Cross-chain Earn deposits currently support Ethereum Sepolia, Arbitrum * Sepolia, and Base Sepolia as source chains, with Arc Testnet as the Earn * destination chain. * * Cross-chain deposits require `from.adapter` to support EIP-712 typed-data * signing through `signTypedData`. Providers validate this capability at * runtime before preparing a bridge deposit. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: CrossChainDepositParams = { * from: { adapter, chain: 'Ethereum_Sepolia' }, * to: { * chain: 'Arc_Testnet', * recipientAddress: '0x1234567890123456789012345678901234567890', * }, * vaultAddress: '0x...', * amount: '100.50', * maxFee: '0.028041', * } * ``` */ interface CrossChainDepositParams { /** Source adapter context (wallet and source chain) for the deposit. */ readonly from: EarnAdapterContext; /** Destination chain and recipient of the vault position. */ readonly to: EarnCrossChainDepositDestination; /** On-chain vault contract address to deposit into. */ readonly vaultAddress: string; /** * Amount to deposit in human-readable decimal format. * * @example '100.50' for 100.50 USDC */ readonly amount: string; /** * Maximum source-collected bridge fee the caller is willing to accept, in * human-readable fee token units from the quote. * * Derive this from a recent cross-chain deposit quote by summing * `quote.fees[].amount`. The prepared bridge bundle must not exceed this cap * before the source wallet signs its ERC-3009 authorization. * * @example '0.028041' for 0.028041 USDC */ readonly maxFee: string; /** * CCTP transfer speed for the source burn. * * `FAST` uses a low finality threshold for quicker settlement; * `SLOW` waits for full finality. Affects the source-collected fee. */ readonly transferSpeed?: TransferSpeed | `${TransferSpeed}` | undefined; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for depositing into a DeFi lending vault. * * @example * ```typescript * const sameChainParams: AnyDepositParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * } * * const crossChainParams: AnyDepositParams = { * from: { adapter, chain: 'Ethereum_Sepolia' }, * to: { * chain: 'Arc_Testnet', * recipientAddress: '0x1234567890123456789012345678901234567890', * }, * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ type AnyDepositParams = SameChainDepositParams | CrossChainDepositParams; /** * Parameters for depositing into a DeFi lending vault on the same chain as * the signer. * * @deprecated Use {@link SameChainDepositParams}, or {@link AnyDepositParams} * for cross-chain-aware code. * * @example * ```typescript * const params: DepositParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ type DepositParams = SameChainDepositParams; /** * Parameters for withdrawing from a DeFi lending vault. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: WithdrawParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '50.00', * } * ``` */ interface WithdrawParams { /** Source adapter context (wallet and chain) for the withdrawal. */ readonly from: EarnAdapterContext; /** On-chain vault contract address to withdraw from. */ readonly vaultAddress: string; /** * Amount to withdraw in human-readable decimal format. * * @example '50.00' for 50.00 USDC */ readonly amount: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for claiming rewards. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: ClaimRewardsParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * } * ``` */ interface ClaimRewardsParams { /** Source adapter context (wallet and chain) for claiming. */ readonly from: EarnAdapterContext; /** On-chain vault contract address. */ readonly vaultAddress: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for getting a same-chain deposit quote. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: SameChainGetDepositQuoteParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ interface SameChainGetDepositQuoteParams { /** Source adapter context (wallet and chain). */ readonly from: EarnAdapterContext; /** On-chain vault contract address. */ readonly vaultAddress: string; /** Amount in human-readable decimal format. */ readonly amount: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for getting a cross-chain deposit quote. * * @remarks * Mirrors {@link CrossChainDepositParams}: previews a deposit whose funds * bridge from `from.chain` into a vault on the destination `chain`. The quote * is read-only (no `idempotencyKey`) and surfaces the bridge forwarder fee in * {@link EarnDepositQuoteInfo.fees}. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: CrossChainGetDepositQuoteParams = { * from: { adapter, chain: 'Ethereum_Sepolia' }, * chain: 'Arc_Testnet', * address: '0x1234567890123456789012345678901234567890', * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ interface CrossChainGetDepositQuoteParams { /** Source adapter context (wallet and source chain). */ readonly from: EarnAdapterContext; /** Destination Earn chain where the vault is deployed. */ readonly chain: EarnBridgeDestinationChainIdentifier; /** Destination wallet that receives the vault position. */ readonly address: string; /** On-chain vault contract address. */ readonly vaultAddress: string; /** Amount in human-readable decimal format. */ readonly amount: string; /** * CCTP transfer speed to price the quote for. * * Should match the speed used at deposit time so the quoted forwarder fee * reflects the actual cost. `FAST` prices the low-finality path. */ readonly transferSpeed?: TransferSpeed | `${TransferSpeed}` | undefined; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for getting a deposit quote. * * Same-chain when only `from` is provided; cross-chain when a destination * `chain` (and destination `address`) are provided and differ from * `from.chain`. * * @example * ```typescript * const sameChainParams: GetDepositQuoteParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * } * * const crossChainParams: GetDepositQuoteParams = { * from: { adapter, chain: 'Ethereum_Sepolia' }, * chain: 'Arc_Testnet', * address: '0x1234567890123456789012345678901234567890', * vaultAddress: '0x...', * amount: '100.50', * } * ``` */ type GetDepositQuoteParams = SameChainGetDepositQuoteParams | CrossChainGetDepositQuoteParams; /** * Parameters for getting a withdrawal quote. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: GetWithdrawalQuoteParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '50.00', * } * ``` */ interface GetWithdrawalQuoteParams { /** Source adapter context (wallet and chain). */ readonly from: EarnAdapterContext; /** On-chain vault contract address. */ readonly vaultAddress: string; /** Amount in human-readable decimal format. */ readonly amount: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** * Parameters for getting a claim rewards quote. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * * @example * ```typescript * const params: GetClaimRewardsQuoteParams = { * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * } * ``` */ interface GetClaimRewardsQuoteParams { /** Source adapter context (wallet and chain). */ readonly from: EarnAdapterContext; /** On-chain vault contract address. */ readonly vaultAddress: string; /** Optional earn configuration. */ readonly config?: EarnConfig | undefined; } /** Token amount returned by the SDK in human-readable decimal form. */ type EarnAssetAmount = Omit & { /** Token amount in human-readable decimal format. */ readonly amount: string; }; /** * Distributive `Omit` over a union. * * A plain `Omit` is not distributive: `keyof (A | B)` collapses to * the shared keys, dropping every variant-specific field and the discriminant * narrowing. Distributing over each member preserves the union. */ type DistributiveOmit = T extends unknown ? Omit : never; /** Liquidity profile returned by the SDK with amounts as decimal strings. */ type EarnLiquidityProfile = Omit & { /** Total value deposited in human-readable decimal format. */ readonly totalDeposits: string; /** Available liquidity in human-readable decimal format. */ readonly available: string; /** Outstanding vault share tokens (ERC4626 totalSupply) in decimal format. */ readonly totalSupply: string; }; /** * Vault information returned by the SDK. * * Derived with a distributive `Omit` so each opportunity variant keeps its * product-specific fields and the `productType` discriminant. */ type EarnVaultInfo = DistributiveOmit & { /** Total value deposited in human-readable decimal format. */ readonly totalDeposits: string; /** Available liquidity in the vault in human-readable decimal format. */ readonly liquidity: string; /** * Liquidity profile with amounts as human-readable decimal strings. * * Optional during the expand/contract migration window: a backend that * predates the nested facets omits it, so it is absent until the response * carries it. */ readonly liquidityProfile?: EarnLiquidityProfile; }; /** Result of a batch vault lookup. */ type EarnGetVaultsResult = Omit & { /** Successfully resolved vault information. */ readonly vaults: readonly EarnVaultInfo[]; }; /** Result of a vault discovery query. */ type EarnExploreVaultsResult = Omit & { /** Vaults matching the query, in the requested sort order. */ readonly vaults: readonly EarnVaultInfo[]; }; /** Accrued reward returned by the SDK in human-readable decimal form. */ type EarnAccruedRewardInfo = Omit & { /** Accrued reward amount in human-readable decimal format. */ readonly amount: string; }; type ProviderAvailablePositionPnLInfo = Extract; /** Profit-and-loss calculation state returned by the SDK. */ type EarnPositionPnLInfo = (Omit & { /** Total principal deposited minus withdrawals in human-readable decimal format. */ readonly principalDeposited: string; /** Total yield earned in human-readable decimal format. */ readonly totalYieldEarned: string; }) | Exclude; /** Position information returned by the SDK. */ type EarnPositionInfo = Omit & { /** Current withdrawable value in human-readable decimal format. */ readonly currentBalance: string; /** Vault shares held in human-readable decimal format. */ readonly shares: string; /** Profit-and-loss calculation state and values for this position. */ readonly pnl: EarnPositionPnLInfo; /** Pending reward tokens available for claiming. */ readonly accruedRewards: readonly EarnAccruedRewardInfo[]; }; /** Kit-level reward amount returned from a claim rewards operation. */ type EarnClaimedAmount = Omit & { /** Reward amount in human-readable decimal format. */ readonly amount: string; }; /** * Kit-level result returned after claimable rewards are submitted on-chain. */ interface EarnClaimedRewardsResult { /** Discriminates the successful on-chain claim result. */ readonly status: 'claimed'; /** Reward token amounts that were claimed. */ readonly rewards: readonly EarnClaimedAmount[]; /** Confirmed on-chain transaction hash. */ readonly txHash: string; /** Explorer URL for the confirmed on-chain transaction. */ readonly explorerUrl: string; } /** * Kit-level result of a claim rewards operation. * * @example * ```typescript * const result: EarnClaimRewardsResult = await claimRewards(context, params) * if (result.status === 'no_rewards') { * console.log('No rewards to claim') * } else { * const reward = result.rewards[0] * console.log(`Claimed ${reward?.amount} ${reward?.symbol}, tx: ${result.txHash}`) * } * ``` */ type EarnClaimRewardsResult = NoClaimableRewardsResult | EarnClaimedRewardsResult; /** Result of a deposit quote operation. */ type EarnDepositQuoteInfo = Omit & { /** Deposit asset and amount in human-readable decimal format. */ readonly deposit: EarnAssetAmount; /** Expected vault shares to receive in human-readable decimal format. */ readonly expectedShares: EarnAssetAmount; /** Fees applied to the deposit in human-readable decimal format. */ readonly fees: readonly EarnAssetAmount[]; /** Estimated native gas fees with amounts formatted as decimal strings. */ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined; }; /** Result of a withdrawal quote operation. */ type EarnWithdrawalQuoteInfo = Omit & { /** The withdrawal amount being quoted in human-readable decimal format. */ readonly withdrawal: EarnAssetAmount; /** Vault shares that would be redeemed in human-readable decimal format. */ readonly sharesToRedeem: EarnAssetAmount; /** Maximum amount the user can currently withdraw in human-readable decimal format. */ readonly maxWithdrawable: EarnAssetAmount; /** Fees applied to the withdrawal in human-readable decimal format. */ readonly fees: readonly EarnAssetAmount[]; /** Estimated native gas fees with amounts formatted as decimal strings. */ readonly gasFees?: readonly EarnGasFeeEstimate[] | undefined; }; /** Result of a claim rewards quote operation. */ type EarnClaimRewardsQuoteInfo = Omit & { /** Reward tokens available for claiming in human-readable decimal format. */ readonly rewards: readonly EarnAssetAmount[]; }; /** * Parameters for all EarnKit operations. * * @example * ```typescript * import type { EarnOperationParams } from '@circle-fin/earn-kit' * * function queueEarnOperation(params: EarnOperationParams) { * return params * } * ``` */ type EarnOperationParams = AnyDepositParams | WithdrawParams | ClaimRewardsParams | GetVaultsParams | ExploreVaultsParams | ExploreVaultsIteratorParams | GetPositionParams | GetDepositQuoteParams | GetWithdrawalQuoteParams | GetClaimRewardsQuoteParams; /** * Mutable context for EarnKit operations. * * @typeParam TProviders - Array type of earning providers */ interface EarnKitContext { /** Array of earn providers used to execute earn operations. */ providers: TProviders; } /** * Configuration options for creating an EarnKit context. * * @typeParam TExtraProviders - Array type of additional earn providers */ interface EarnKitConfig { /** Optional array of custom earn providers. */ providers?: TExtraProviders; /** * Disable success telemetry for completed EarnKit operations. * * When `true`, direct {@link EarnKit} instances do not send success events * to Circle's telemetry endpoint for vault lookups, vault discovery, * deposits, withdrawals, or reward claims. The events include SDK metadata * and allowlisted operation context; they do not include wallet addresses or * amounts. Defaults to `false`. * * @defaultValue false */ disableAnalytics?: boolean; /** * Disable error telemetry for failed public operations. * * When `true`, direct {@link EarnKit} instances do not send structured * error details to Circle's telemetry endpoint. Defaults to `false`. * * @defaultValue false */ disableErrorReporting?: boolean; } /** * A high-level class-based interface for DeFi lending vault operations. * * EarnKit provides a familiar class-based API for developers who prefer * traditional object-oriented patterns. The class maintains an internal * context and provides methods for depositing, withdrawing, claiming * rewards, and querying vault and position data. * * Key features: * - Strongly typed parameters with comprehensive Zod validation * - Supported earn vault deposits and withdrawals * - Deposit quote queries (expected shares, share price, APY without executing a transaction) * - Withdrawal quote queries (shares to redeem, max withdrawable, fees without executing a transaction) * - Claim rewards quote queries (claimable reward details without executing a transaction) * - Reward claiming * - P&L position tracking * - Dual-mode authentication (permissioned and permissionless) * - Full TypeScript support with IntelliSense * * @example * ```typescript * import { EarnChain, EarnKit } from '@circle-fin/earn-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const kit = new EarnKit() * const adapter = createViemAdapterFromPrivateKey({ * privateKey: process.env.PRIVATE_KEY, * }) * * // Fetch vault info * const { vaults } = await kit.getVaults({ * vaults: [{ chain: EarnChain.Arc_Testnet, vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88' }], * }) * const [vault] = vaults * if (vault === undefined) { * throw new Error('No earn vaults available') * } * * // Deposit into a vault. Same-chain params resolve to the same-chain * // result overload; cross-chain params (with a `to` destination) * // resolve to bridge submission details instead. * const result = await kit.deposit({ * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: vault.vaultAddress, * amount: '100.50', * }) * console.log(`Deposited ${result.amount} into ${result.vaultAddress}, tx: ${result.txHash}`) * ``` * * @remarks * For functional usage, import and use the operations directly: * ```typescript * import { createEarnKitContext, deposit } from '@circle-fin/earn-kit' * const context = createEarnKitContext() * await deposit(context, params) * ``` */ declare class EarnKit { private readonly context; /** Per-kit identity and opt-out state for error telemetry. */ private readonly telemetryConfig; /** Per-kit identity and opt-out state for success telemetry. */ private readonly analyticsTelemetryConfig; /** * Event dispatcher for step-level events emitted during multi-phase earn * operations. Prefer {@link EarnKit.on} / {@link EarnKit.off} over using * this directly. */ readonly actionDispatcher: Actionable; /** * Create a new EarnKit instance. * * Accept an optional configuration object to customize the kit's * behavior. If no configuration is provided, the kit is initialized * with default settings using the built-in EarnServiceProvider. * * @param config - Optional configuration for the EarnKit instance * * @example * ```typescript * import { EarnKit } from '@circle-fin/earn-kit' * * // Create with default configuration * const kit = new EarnKit() * ``` */ constructor(config?: EarnKitConfig); /** * Register an event handler for an earn operation action. * * Subscribe to step-level events emitted during deposits, withdrawals, and * reward claims. Handlers receive strongly typed payloads based on the * action name. Use the wildcard `'*'` to receive every event. Multiple * handlers can be registered for the same action. * * Action names: * - `'deposit'` — a deposit's `fetchParams` and `execute` phases * - `'crossChainDeposit'` — a cross-chain deposit's `prepare`, `sign`, and * `submit` bridge phases * - `'withdraw'` — a withdrawal's `fetchParams` and `execute` phases * - `'claimRewards'` — a claim's `fetchParams` and `execute` phases * - `'approve'` — the token-approval phase of a deposit or withdrawal * - `'*'` — all of the above * * @typeParam K - The action name to listen for. * @param action - The action name, or `'*'` for all actions. * @param handler - Callback invoked when the action occurs. * * @example * ```typescript * const kit = new EarnKit() * * kit.on('withdraw', (payload) => { * if (payload.values.name === 'execute' && payload.values.state === 'success') { * console.log('withdrawal tx:', payload.values.txHash) * } * }) * * kit.on('*', (payload) => { * console.log(`${payload.operation}/${payload.method}: ${payload.values.state}`) * }) * ``` */ on(action: K, handler: (payload: EarnActions[K]) => void): void; on(action: '*', handler: (payload: EarnActions[EarnActionName]) => void): void; /** * Unregister a previously registered event handler. * * Pass the same handler function reference used during registration. Use * the wildcard `'*'` to remove a handler that was 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 reference to remove. * * @example * ```typescript * const kit = new EarnKit() * * const handler = (payload: EarnActions['deposit']) => console.log(payload.method) * kit.on('deposit', handler) * // ...later * kit.off('deposit', handler) * ``` */ off(action: K, handler: (payload: EarnActions[K]) => void): void; off(action: '*', handler: (payload: EarnActions[EarnActionName]) => void): void; /** * Resume a multi-phase earn operation that previously failed. * * Pass the {@link KitError} caught from a `deposit`, `withdraw`, or * `claimRewards` call. The error carries the original operation, inputs, * and step progress, so the operation can be re-run while skipping phases * that already completed (for example a successful token approval). Use * `isRetryableError(error)` to check whether retrying is worthwhile before * calling this. * * @remarks * Resuming re-fetches execution params and re-submits the `execute` * transaction; the earn service deduplicates execution server-side, which * makes this safe in the common case. But if a prior attempt broadcast the * `execute` transaction and then failed before its receipt was observed, * that transaction may still be in flight when `retry()` re-broadcasts. * Treat `retry()` as best-effort recovery, not an atomic operation. * * @param error - The error caught from a previous multi-phase earn operation. * @returns A promise resolving to the result of the resumed operation. * @throws {@link KitError} If `error` is not a retryable {@link KitError} * carrying earn retry context, names an unknown provider, or the resumed * operation itself fails. * * @example * ```typescript * import { isRetryableError } from '@circle-fin/earn-kit' * * try { * await kit.deposit(params) * } catch (error) { * if (isRetryableError(error)) { * const result = await kit.retry(error) * const txHash = * 'kind' in result && result.kind === 'same-chain' * ? result.txHash * : undefined * console.log('recovered, tx:', txHash) * } * } * ``` */ retry(error: unknown): Promise; /** * Return the chains supported by configured earn providers. * * @returns Deduplicated supported chain definitions * * @example * ```typescript * const kit = new EarnKit() * const chains = kit.getSupportedChains() * ``` */ getSupportedChains(): ChainDefinition[]; /** * Fetch available vault information. * * Query the configured earn providers to get a list of available * DeFi lending vaults with APY, TVL, and reward information. * * @param params - Query parameters with vault address and optional chain filter * @returns A promise resolving to the list of available vaults * @throws {@link KitError} If no provider is configured * * @example * ```typescript * const kit = new EarnKit() * const result = await kit.getVaults({ * vaults: [{ chain: 'Arc_Testnet', vaultAddress: '0x8eB67...' }], * }) * result.vaults.forEach(v => console.log(`${v.name}: ${(v.currentApy * 100).toFixed(2)}% APY`)) * ``` */ getVaults(params: GetVaultsParams): Promise; /** * Discover vaults available on a chain. * * Query the configured earn providers for vaults matching the optional * protocol, asset, APY, and TVL filters. Results are paginated and * sorted server-side. * * @param params - Discovery parameters with chain and optional filters * @returns A promise resolving to the matching vaults with pagination metadata * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const kit = new EarnKit() * const result = await kit.exploreVaults({ * chain: 'Arc_Testnet', * minApy: '0.03', * sortBy: 'apy', * }) * result.vaults.forEach(v => console.log(`${v.name}: ${(v.currentApy * 100).toFixed(2)}% APY`)) * const guarded = result.vaults.filter(v => v.circleGuarded) // Circle-guarded vaults only * ``` */ exploreVaults(params: ExploreVaultsParams): Promise; /** * Lazily iterate every vault available on a chain. * * Fetch page after page on demand and yield individual vaults, so callers * never manage `page` arithmetic. Breaking out of the loop early stops * further requests. * * @param params - Discovery parameters (no `page`; the iterator manages it) * @returns An async generator yielding each matching vault * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const kit = new EarnKit() * for await (const vault of kit.exploreVaultsIterator({ * chain: 'Arc_Testnet', * sortBy: 'apy', * })) { * console.log(`${vault.name}: ${(vault.currentApy * 100).toFixed(2)}% APY`) * } * ``` */ exploreVaultsIterator(params: ExploreVaultsIteratorParams): AsyncGenerator; /** * Fetch P&L position data for the connected wallet. * * Query balance, principal, earnings, and shares data for the wallet * specified in the adapter context. * * @param params - Position query parameters with adapter context * @returns A promise resolving to the wallet's position info * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const position = await kit.getPosition({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * if (position.pnl.status === 'available') { * console.log(`Yield: ${position.pnl.totalYieldEarned}`) * } * ``` */ getPosition(params: GetPositionParams): Promise; /** * Fetch the current status of a cross-chain deposit by execution ID. * * Performs a single status read of the bridge lifecycle (source relay, CCTP * attestation, destination mint) for a deposit submitted via a cross-chain * {@link EarnKit.deposit}. To wait for settlement, use * {@link EarnKit.waitForCrossChainDeposit}. * * @param params - Status query parameters identifying the deposit by execId * @returns A promise resolving to the structured cross-chain deposit status * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If no configured provider supports cross-chain * deposit status lookups * @throws {@link KitError} If the status request fails * * @example * ```typescript * const status = await kit.getCrossChainDepositStatus({ * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * }) * console.log(`Bridge ${status.execId} is ${status.status}`) * ``` */ getCrossChainDepositStatus(params: GetCrossChainDepositStatusParams): Promise; /** * Poll a cross-chain deposit until it reaches a terminal bridge state. * * Cross-chain deposits are long-running (source burn → CCTP attestation → * destination mint), so this is the primary way to observe completion. On * timeout the promise resolves with the last observed status and a `timeout` * outcome rather than throwing, so callers can inspect where the bridge * stalled. * * @param params - Wait parameters: `execId`, optional `config`, `pollIntervalMs`, `maxWaitMs` * @returns A promise resolving to the wait result and last observed status * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If no configured provider supports cross-chain * deposit waits * @throws {@link KitError} If a status request fails with a non-retryable error * * @example * ```typescript * const result = await kit.waitForCrossChainDeposit({ * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * maxWaitMs: 1_200_000, * }) * console.log(`Bridge ended as ${result.outcome}`) * ``` */ waitForCrossChainDeposit(params: WaitForCrossChainDepositParams): Promise; /** * Execute a deposit into a DeFi lending vault. * * Same-chain deposits build signed instructions via the earn service, issue * a max USDC ERC-20 approval when needed, and submit the deposit on-chain. * Cross-chain deposits sign and submit a bridge authorization. * * @param params - Deposit parameters including vault address and amount * @returns A promise resolving to same-chain transaction details or * cross-chain submission details * @throws {@link KitError} If validation fails, no provider is configured, * the same-chain adapter contract is not configured, the approval or * deposit transaction reverts on-chain, the cross-chain source route is not * supported, source and destination networks differ, the source adapter * cannot sign typed data, or the bridge API rejects the prepare or submit * request. * * @example * ```typescript * const result = await kit.deposit({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * }) * console.log(`Deposited ${result.amount} into ${result.vaultAddress}, tx: ${result.txHash}`) * ``` */ deposit(params: SameChainDepositParams): Promise; /** * Execute a cross-chain deposit into a DeFi lending vault. * * Sign a single ERC-3009 authorization on the source chain and submit it to * the bridge; a relayer executes the bridge transfer and vault deposit on * the destination chain, crediting the position to `to.recipientAddress`. * * @param params - Cross-chain deposit parameters including the source * adapter context, destination chain and recipient, vault address, and * amount * @returns A promise resolving to the bridge submission details * @throws {@link KitError} If validation fails, no configured provider * supports cross-chain deposits, the source route is not supported, * source and destination networks differ, the source adapter cannot sign * typed data, the prepared typed data does not match the requested * deposit, or the bridge API rejects the prepare or submit request. * * @example * ```typescript * const result = await kit.deposit({ * from: { adapter, chain: 'Ethereum_Sepolia' }, * to: { * chain: 'Arc_Testnet', * recipientAddress: '0x1234567890123456789012345678901234567890', * }, * vaultAddress: '0x...', * amount: '100.50', * maxFee: '0.028041', * }) * console.log(`Submitted bridge deposit ${result.execId}`) * ``` */ deposit(params: CrossChainDepositParams): Promise; deposit(params: AnyDepositParams): Promise; /** * Execute a withdrawal from a DeFi lending vault. * * Build signed withdrawal instructions via the earn service, approve the * adapter contract to spend vault share tokens if needed, then submit the * withdrawal on-chain. Return the withdrawal result including the on-chain * transaction hash, withdrawn amount, and target vault. * * @param params - Withdrawal parameters including vault address and amount * @returns A promise resolving to the withdrawal result with transaction details * @throws {@link KitError} If validation fails, no provider is configured, * the chain has no adapter contract configured, the share-token approval * reverts on-chain, or the withdrawal transaction reverts on-chain. * * @example * ```typescript * const result = await kit.withdraw({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '50.00', * }) * console.log(`Withdrew ${result.amount} from ${result.vaultAddress}, tx: ${result.txHash}`) * ``` */ withdraw(params: WithdrawParams): Promise; /** * Claim rewards from earn vaults. * * Build signed claim rewards instructions via the earn service, submit * them on-chain through the adapter, and return the confirmed transaction * hash. When no rewards are claimable, no transaction is submitted. * * @param params - Claim parameters including adapter context * @returns A promise resolving to the claim result with reward details * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const result = await kit.claimRewards({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * * if (result.status === 'claimed') { * console.log(`Claimed ${result.rewards.length} reward token(s), tx: ${result.txHash}`) * } * ``` * * @internal */ claimRewards(params: ClaimRewardsParams): Promise; /** * Get an informational quote for a deposit into a vault. * * Query expected shares, share price, and APY for the specified * deposit amount without executing any transaction. * * @param params - Deposit quote parameters including vault address and amount * @returns A promise resolving to the deposit quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const quote = await kit.getDepositQuote({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '100.50', * }) * console.log(`Expected shares: ${quote.expectedShares.amount}`) * ``` */ getDepositQuote(params: GetDepositQuoteParams): Promise; /** * Get an informational quote for a withdrawal from a vault. * * Query shares to redeem, max withdrawable, and fees for the specified * withdrawal amount without executing any transaction. * * @param params - Withdrawal quote parameters including vault address and amount * @returns A promise resolving to the withdrawal quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const quote = await kit.getWithdrawalQuote({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * amount: '50.00', * }) * console.log(`Shares to redeem: ${quote.sharesToRedeem.amount}`) * ``` */ getWithdrawalQuote(params: GetWithdrawalQuoteParams): Promise; /** * Get an informational quote for claiming rewards. * * Query claimable reward details without executing any transaction. * * @param params - Claim rewards quote parameters including vault address * @returns A promise resolving to the claim rewards quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * const quote = await kit.getClaimRewardsQuote({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0x...', * }) * console.log(`Claimable rewards: ${quote.rewards.length}`) * ``` * * @internal */ getClaimRewardsQuote(params: GetClaimRewardsQuoteParams): Promise; } /** * The default providers used when no custom providers are specified. * * @returns An array containing the default EarnServiceProvider * @internal */ declare const getDefaultProviders: () => readonly [EarnServiceProvider]; /** * Type alias for the default providers returned by getDefaultProviders. * * Exported to allow proper type extraction from EarnKitContext. */ type DefaultProviders = ReturnType; /** * Create an EarnKit context with validated configuration. * * Initialize an EarnKitContext with default providers and optional * custom configuration. Custom and default providers are merged, * preserving their exact types for type safety. * * @typeParam TExtraProviders - Array type of additional earn providers * @param config - Optional configuration for the EarnKit context * @returns A fully initialized EarnKitContext ready for earn operations * * @example * ```typescript * import { createEarnKitContext } from '@circle-fin/earn-kit' * * // Create context with defaults * const context = createEarnKitContext() * ``` * * @example * ```typescript * import { createEarnKitContext } from '@circle-fin/earn-kit' * * // Create context with custom providers * const context = createEarnKitContext({ * providers: [myCustomEarnProvider], * }) * ``` */ declare function createEarnKitContext(config?: EarnKitConfig): EarnKitContext<[...TExtraProviders, ...DefaultProviders]>; /** * Fetch vault information from the earn service. * * Query the configured earn providers to get information about one * or more DeFi lending vaults. Accept batch queries as chain + * vaultAddress pairs. * * @param context - The EarnKit context containing providers * @param params - Vault query parameters * @returns A promise resolving to the vault lookup results * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * import { createEarnKitContext, getVaults } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * const result = await getVaults(context, { * vaults: [{ chain: 'Arc_Testnet', vaultAddress: '0x...' }], * }) * console.log(`Found ${result.vaults.length} vaults`) * ``` */ declare function getVaults(context: EarnKitContext, params: GetVaultsParams): Promise; /** * Discover vaults available on a chain. * * Query the configured earn providers for vaults matching the optional * protocol, asset, APY, and TVL filters. Results are paginated and * sorted server-side. * * @param context - The EarnKit context containing providers * @param params - Vault discovery parameters * @returns A promise resolving to the matching vaults with pagination metadata * @throws {@link KitError} If validation fails, no provider is configured, * no configured provider implements vault discovery, or no provider * supports the requested chain * * @example * ```typescript * import { createEarnKitContext, exploreVaults } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * const result = await exploreVaults(context, { * chain: 'Arc_Testnet', * minApy: '0.03', * sortBy: 'apy', * }) * console.log(`Found ${result.pagination.totalCount} vaults`) * ``` */ declare function exploreVaults(context: EarnKitContext, params: ExploreVaultsParams): Promise; /** * Lazily iterate every vault available on a chain. * * Wrap {@link exploreVaults} in an async generator that fetches page after * page on demand and yields individual vaults, so callers never manage * `page` arithmetic. Pages are fetched only as iteration progresses: * breaking out of the loop early stops further requests. * * Parameters are validated eagerly (before the first iteration), so invalid * input throws at call time rather than on the first `next()`. * * Iteration stops at the Earn Service API's hard page cap * ({@link MAX_EXPLORE_PAGE}) even if the service reports more pages: pages * beyond the cap are not fetchable by any client, so the cap also guards * against a service that pathologically over-reports `totalPages`. * * @param context - The EarnKit context containing providers * @param params - Vault discovery parameters (no `page`; the iterator manages it) * @returns An async generator yielding each matching vault * @throws {@link KitError} If validation fails, no provider is configured, * no configured provider implements vault discovery, or no provider * supports the requested chain * * @example * ```typescript * import { createEarnKitContext, exploreVaultsIterator } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * for await (const vault of exploreVaultsIterator(context, { * chain: 'Arc_Testnet', * sortBy: 'apy', * })) { * console.log(`${vault.name}: ${(vault.currentApy * 100).toFixed(2)}% APY`) * } * ``` */ declare function exploreVaultsIterator(context: EarnKitContext, params: ExploreVaultsIteratorParams): AsyncGenerator; /** * Fetch P&L position data for a wallet. * * Query the configured earn providers to get balance, principal, * earnings, and shares data for the wallet specified in the adapter context. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Position query parameters with adapter context * @returns A promise resolving to the wallet's position info * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * import { * createEarnKitContext, * getPosition, * EarnChain, * } from '@circle-fin/earn-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const context = createEarnKitContext() * const adapter = createViemAdapterFromPrivateKey({ privateKey: '0x...' }) * * const position = await getPosition(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * console.log(`Balance: ${position.currentBalance}`) * ``` */ declare function getPosition(context: EarnKitContext, params: GetPositionParams): Promise; /** * Fetch the current status of a cross-chain Earn deposit by execution ID. * * Performs a single status read of the bridge lifecycle (source relay, CCTP * attestation, destination mint) for a previously submitted cross-chain * deposit. The lookup is chain-agnostic — it is keyed only by `execId`. * * To wait for settlement, use `waitForCrossChainDeposit`, which polls this * status until a terminal state or timeout. * * @param context - The EarnKit context containing providers * @param params - Status query parameters identifying the deposit by execId * @returns A promise resolving to the structured cross-chain deposit status * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If the status request fails * * @example * ```typescript * import { * createEarnKitContext, * getCrossChainDepositStatus, * } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * * const status = await getCrossChainDepositStatus(context, { * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * }) * console.log(`Bridge ${status.execId} is ${status.status}`) * ``` */ declare function getCrossChainDepositStatus(context: EarnKitContext, params: GetCrossChainDepositStatusParams): Promise; /** * Poll a cross-chain Earn deposit until it reaches a terminal bridge state. * * Cross-chain deposits are long-running (source burn → CCTP attestation → * destination mint), so this is the primary way to observe completion. The * polling, terminal detection, and per-poll `status` step events live in the * provider (mirroring how the same-chain deposit phases emit events); this kit * operation validates input, selects the provider, and delegates. * * On timeout the promise resolves with the last observed status and a `timeout` * outcome rather than throwing, so callers can inspect where the bridge * stalled. * * @param context - The EarnKit context containing providers * @param params - Wait parameters: `execId`, optional `config`, `pollIntervalMs`, `maxWaitMs` * @returns A promise resolving to the wait result and last observed status * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If a status request fails with a non-retryable error * * @example * ```typescript * import { * createEarnKitContext, * waitForCrossChainDeposit, * } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * * const result = await waitForCrossChainDeposit(context, { * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * maxWaitMs: 1_200_000, * }) * console.log(`Bridge ended as ${result.outcome}`) * ``` */ declare function waitForCrossChainDeposit(context: EarnKitContext, params: WaitForCrossChainDepositParams): Promise; /** * Execute a deposit into a DeFi lending vault. * * Validate user params, resolve the chain and wallet address, then delegate to * the selected earn provider. Same-chain deposits return transaction details; * cross-chain deposits return bridge submission details. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Deposit parameters including vault address, amount, and adapter * @returns A promise resolving to same-chain transaction details or cross-chain submission details * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If same-chain adapter config or source-chain bridge config is missing * @throws {@link KitError} If source and destination networks differ * @throws {@link KitError} If the source chain does not support USDC or CCTP * @throws {@link KitError} If the source adapter cannot sign typed data * @throws {@link KitError} If the API rejects bridge prepare or submit * @throws {@link KitError} If the USDC approval or deposit transaction reverts on-chain * * @example * ```typescript * import { * createEarnKitContext, * deposit, * EarnChain, * } from '@circle-fin/earn-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const context = createEarnKitContext() * const adapter = createViemAdapterFromPrivateKey({ privateKey: '0x...' }) * * // Same-chain params resolve to the same-chain result overload. * const result = await deposit(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * amount: '100.50', * }) * console.log(`Deposited ${result.amount} into ${result.vaultAddress}, tx: ${result.txHash}`) * * // Cross-chain params (with a `to` destination) resolve to bridge * // submission details instead: result.execId, result.status. * ``` */ declare function deposit(context: EarnKitContext, params: SameChainDepositParams): Promise; declare function deposit(context: EarnKitContext, params: CrossChainDepositParams): Promise; declare function deposit(context: EarnKitContext, params: AnyDepositParams): Promise; /** * Execute a withdrawal from a DeFi lending vault. * * Validate user params, resolve the chain and wallet address, then delegate * the full on-chain flow (fetch signed instructions, issue a max vault-share * ERC-20 approval when needed, submit the withdrawal, wait for confirmation) * to the selected earn provider. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Withdrawal parameters including vault address, amount, and adapter * @returns A promise resolving to the withdrawal result with transaction details * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If the chain has no adapter contract configured * @throws {@link KitError} If the vault share token approval transaction reverts on-chain * @throws {@link KitError} If the withdrawal transaction reverts on-chain * * @example * ```typescript * import { * createEarnKitContext, * withdraw, * EarnChain, * } from '@circle-fin/earn-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const context = createEarnKitContext() * const adapter = createViemAdapterFromPrivateKey({ privateKey: '0x...' }) * * const result = await withdraw(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * amount: '50.00', * }) * console.log(`Withdrew ${result.amount} from ${result.vaultAddress}, tx: ${result.txHash}`) * ``` */ declare function withdraw(context: EarnKitContext, params: WithdrawParams): Promise; /** * Claim rewards from earn vaults. * * Validate user params, resolve the chain and wallet address, then delegate * the full on-chain flow (fetch signed instructions, submit the claim, wait * for confirmation) to the selected earn provider. When no rewards are * claimable, the provider returns rewards without submitting a transaction. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Claim parameters including adapter context and vault address * @returns A promise resolving to the claim result with reward details * @throws {@link KitError} If validation fails or no provider is configured * @throws {@link KitError} If the chain has no adapter contract configured * @throws {@link KitError} If the earn service API request or response fails * @throws {@link KitError} If the claim transaction reverts on-chain * * @example * ```typescript * import { * createEarnKitContext, * claimRewards, * EarnChain, * } from '@circle-fin/earn-kit' * import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2' * * const context = createEarnKitContext() * const adapter = createViemAdapterFromPrivateKey({ privateKey: '0x...' }) * * const result = await claimRewards(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * if (result.status === 'no_rewards') { * console.log('No rewards to claim') * } else { * console.log(`Claimed ${result.rewards.length} reward(s), tx: ${result.txHash}`) * } * ``` * * @internal */ declare function claimRewards(context: EarnKitContext, params: ClaimRewardsParams): Promise; /** * Get an informational quote for a deposit into a vault. * * Query expected shares, share price, and APY for the specified deposit amount * without executing any transaction. When a destination `chain` (and * destination `address`) different from `from.chain` is provided, the quote is * cross-chain and additionally surfaces the bridge forwarder fee in * {@link EarnDepositQuoteInfo.fees}. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Deposit quote parameters including vault address and amount * @returns A promise resolving to the deposit quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * import { * createEarnKitContext, * getDepositQuote, * EarnChain, * } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * * // Same-chain quote * const quote = await getDepositQuote(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * amount: '100.50', * }) * console.log(`Expected shares: ${quote.expectedShares.amount}`) * * // Cross-chain quote. `transferSpeed` prices the chosen CCTP finality path * // (FAST adds the PRE_FINALITY fee); omit it to use the service default. * const crossChainQuote = await getDepositQuote(context, { * from: { adapter, chain: 'Ethereum_Sepolia' }, * chain: EarnChain.Arc_Testnet, * address: '0x1234567890123456789012345678901234567890', * vaultAddress: '0x...', * amount: '100.50', * transferSpeed: 'FAST', * }) * // Cross-chain quotes surface the source-collected bridge fees (one entry per * // item), e.g. the destination forward fee: * const forwardFee = crossChainQuote.fees.find((fee) => fee.type === 'FORWARD') * ``` */ declare function getDepositQuote(context: EarnKitContext, params: GetDepositQuoteParams): Promise; /** * Get an informational quote for a withdrawal from a vault. * * Query shares to redeem, max withdrawable, and fees for the specified * withdrawal amount without executing any transaction. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Withdrawal quote parameters including vault address and amount * @returns A promise resolving to the withdrawal quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * import { * createEarnKitContext, * getWithdrawalQuote, * EarnChain, * } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * const quote = await getWithdrawalQuote(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * amount: '50.00', * }) * console.log(`Shares to redeem: ${quote.sharesToRedeem.amount}`) * ``` */ declare function getWithdrawalQuote(context: EarnKitContext, params: GetWithdrawalQuoteParams): Promise; /** * Return all chains supported by configured earn providers. * * @param context - The EarnKit context containing providers * @returns Deduplicated supported chain definitions * * @example * ```typescript * import { createEarnKitContext, getSupportedChains } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * const chains = getSupportedChains(context) * ``` */ declare function getSupportedChains(context: EarnKitContext): ChainDefinition[]; /** * Get an informational quote for claiming rewards. * * Query claimable reward details without executing any transaction. * * @typeParam TFromAdapterCapabilities - The adapter capabilities type * @param context - The EarnKit context containing providers * @param params - Claim rewards quote parameters including vault address * @returns A promise resolving to the claim rewards quote information * @throws {@link KitError} If validation fails or no provider is configured * * @example * ```typescript * import { * createEarnKitContext, * getClaimRewardsQuote, * EarnChain, * } from '@circle-fin/earn-kit' * * const context = createEarnKitContext() * const quote = await getClaimRewardsQuote(context, { * from: { adapter, chain: EarnChain.Arc_Testnet }, * vaultAddress: '0x...', * }) * console.log(`Claimable rewards: ${quote.rewards.length}`) * ``` * * @internal */ declare function getClaimRewardsQuote(context: EarnKitContext, params: GetClaimRewardsQuoteParams): Promise; /** * Validation schema for VaultQuery. * * @example * ```typescript * import { vaultQuerySchema } from '@circle-fin/earn-kit' * * const result = vaultQuerySchema.safeParse({ * chain: 'Arc_Testnet', * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * ``` */ declare const vaultQuerySchema: z.ZodObject<{ chain: z.ZodUnion<[z.ZodEffects, z.ZodNativeEnum, z.ZodEffects; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodLiteral<"evm">; chainId: z.ZodNumber; }, "strict", z.ZodTypeAny, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>, z.ZodObject<{ chain: z.ZodNativeEnum; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodEnum<["algorand", "avalanche", "solana", "aptos", "near", "stellar", "sui", "hedera", "noble", "polkadot"]>; }, "strict", z.ZodTypeAny, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; }, "strip", z.ZodTypeAny, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: `0x${string}`; }, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: string; }>; /** * Validation schema for GetVaultsParams. * * @example * ```typescript * import { getVaultsParamsSchema } from '@circle-fin/earn-kit' * * const result = getVaultsParamsSchema.safeParse({ * vaults: [ * { * chain: 'Arc_Testnet', * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }, * ], * }) * ``` */ declare const getVaultsParamsSchema: z.ZodObject<{ vaults: z.ZodArray, z.ZodNativeEnum, z.ZodEffects; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodLiteral<"evm">; chainId: z.ZodNumber; }, "strict", z.ZodTypeAny, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>, z.ZodObject<{ chain: z.ZodNativeEnum; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodEnum<["algorand", "avalanche", "solana", "aptos", "near", "stellar", "sui", "hedera", "noble", "polkadot"]>; }, "strict", z.ZodTypeAny, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; }, "strip", z.ZodTypeAny, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: `0x${string}`; }, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: string; }>, "many">; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaults: { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: `0x${string}`; }[]; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; }, { vaults: { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; vaultAddress: string; }[]; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; }>; /** * Validation schema for ExploreVaultsParams. * * @example * ```typescript * import { exploreVaultsParamsSchema } from '@circle-fin/earn-kit' * * const result = exploreVaultsParamsSchema.safeParse({ * chain: 'Arc_Testnet', * minApy: '0.03', * sortBy: 'apy', * }) * ``` */ declare const exploreVaultsParamsSchema: z.ZodObject<{ chain: z.ZodUnion<[z.ZodEffects, z.ZodNativeEnum, z.ZodEffects; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodLiteral<"evm">; chainId: z.ZodNumber; }, "strict", z.ZodTypeAny, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>, z.ZodObject<{ chain: z.ZodNativeEnum; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodEnum<["algorand", "avalanche", "solana", "aptos", "near", "stellar", "sui", "hedera", "noble", "polkadot"]>; }, "strict", z.ZodTypeAny, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>; protocol: z.ZodOptional; asset: z.ZodOptional; minApy: z.ZodOptional>; minTvl: z.ZodOptional>; sortBy: z.ZodOptional>; page: z.ZodOptional; pageSize: z.ZodOptional; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; protocol?: string | undefined; asset?: string | undefined; minApy?: string | undefined; minTvl?: string | undefined; sortBy?: "name" | "apy" | "tvl" | undefined; page?: number | undefined; pageSize?: number | undefined; }, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; protocol?: string | undefined; asset?: string | undefined; minApy?: string | undefined; minTvl?: string | undefined; sortBy?: "name" | "apy" | "tvl" | undefined; page?: number | undefined; pageSize?: number | undefined; }>; /** * Validation schema for ExploreVaultsIteratorParams. * * Identical to {@link exploreVaultsParamsSchema} minus `page`: the iterator * advances through pages itself. * * @example * ```typescript * import { exploreVaultsIteratorParamsSchema } from '@circle-fin/earn-kit' * * const result = exploreVaultsIteratorParamsSchema.safeParse({ * chain: 'Arc_Testnet', * sortBy: 'apy', * }) * ``` */ declare const exploreVaultsIteratorParamsSchema: z.ZodObject, z.ZodNativeEnum, z.ZodEffects; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodLiteral<"evm">; chainId: z.ZodNumber; }, "strict", z.ZodTypeAny, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>, z.ZodObject<{ chain: z.ZodNativeEnum; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodEnum<["algorand", "avalanche", "solana", "aptos", "near", "stellar", "sui", "hedera", "noble", "polkadot"]>; }, "strict", z.ZodTypeAny, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>; protocol: z.ZodOptional; asset: z.ZodOptional; minApy: z.ZodOptional>; minTvl: z.ZodOptional>; sortBy: z.ZodOptional>; page: z.ZodOptional; pageSize: z.ZodOptional; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "page">, "strip", z.ZodTypeAny, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; protocol?: string | undefined; asset?: string | undefined; minApy?: string | undefined; minTvl?: string | undefined; sortBy?: "name" | "apy" | "tvl" | undefined; pageSize?: number | undefined; }, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; protocol?: string | undefined; asset?: string | undefined; minApy?: string | undefined; minTvl?: string | undefined; sortBy?: "name" | "apy" | "tvl" | undefined; pageSize?: number | undefined; }>; /** * Validation schema for GetPositionParams. * * @example * ```typescript * import { getPositionParamsSchema } from '@circle-fin/earn-kit' * * const result = getPositionParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * ``` */ declare const getPositionParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Validation schema for AnyDepositParams. * * @example * ```typescript * import { anyDepositParamsSchema } from '@circle-fin/earn-kit' * * const result = anyDepositParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '100.50', * }) * * const crossChainResult = anyDepositParamsSchema.safeParse({ * from: { adapter, chain: 'Ethereum_Sepolia' }, * to: { * chain: 'Arc_Testnet', * recipientAddress: '0x1234567890123456789012345678901234567890', * }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '100.50', * }) * ``` */ declare const anyDepositParamsSchema: z.ZodUnion<[z.ZodObject<{ from: z.ZodType; to: z.ZodObject<{ chain: z.ZodUnion<[z.ZodEffects, z.ZodEffects; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodLiteral<"evm">; chainId: z.ZodNumber; }, "strict", z.ZodTypeAny, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>, z.ZodObject<{ chain: z.ZodNativeEnum; name: z.ZodString; title: z.ZodOptional; nativeCurrency: z.ZodObject<{ name: z.ZodString; symbol: z.ZodString; decimals: z.ZodNumber; }, "strip", z.ZodTypeAny, { symbol: string; name: string; decimals: number; }, { symbol: string; name: string; decimals: number; }>; isTestnet: z.ZodBoolean; explorerUrl: z.ZodString; rpcEndpoints: z.ZodArray; eurcAddress: z.ZodNullable; usdcAddress: z.ZodNullable; usdtAddress: z.ZodNullable; cctp: z.ZodNullable; cctpx: z.ZodOptional; kitContracts: z.ZodOptional; adapter: z.ZodOptional; }, "strip", z.ZodTypeAny, { bridge?: string | undefined; adapter?: string | undefined; }, { bridge?: string | undefined; adapter?: string | undefined; }>>; gateway: z.ZodOptional; genericExecutor: z.ZodOptional; }, "strict", z.ZodTypeAny, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }, { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; }>>; }, "strict", z.ZodTypeAny, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }, { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }>; forwarderSupported: z.ZodObject<{ source: z.ZodBoolean; destination: z.ZodBoolean; }, "strip", z.ZodTypeAny, { source: boolean; destination: boolean; }, { source: boolean; destination: boolean; }>; }, "strict", z.ZodTypeAny, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }, { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; }>>; } & { type: z.ZodEnum<["algorand", "avalanche", "solana", "aptos", "near", "stellar", "sui", "hedera", "noble", "polkadot"]>; }, "strict", z.ZodTypeAny, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }, { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }>]>; recipientAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>, `0x${string}`, string>; }, "strict", z.ZodTypeAny, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; recipientAddress: `0x${string}`; }, { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; recipientAddress: string; }>; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; amount: z.ZodEffects>, string, string>; maxFee: z.ZodEffects>, string, string>; transferSpeed: z.ZodOptional>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strict", z.ZodTypeAny, { vaultAddress: `0x${string}`; to: { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; recipientAddress: `0x${string}`; }; amount: string; maxFee: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; transferSpeed?: "FAST" | "SLOW" | undefined; }, { vaultAddress: string; to: { chain: string | { type: "evm"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; chainId: number; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; } | { type: "algorand" | "avalanche" | "solana" | "aptos" | "near" | "stellar" | "sui" | "hedera" | "noble" | "polkadot"; chain: Blockchain; name: string; nativeCurrency: { symbol: string; name: string; decimals: number; }; isTestnet: boolean; explorerUrl: string; rpcEndpoints: string[]; eurcAddress: string | null; usdcAddress: string | null; usdtAddress: string | null; title?: string | undefined; cctp?: any; cctpx?: any; kitContracts?: { bridge?: string | undefined; adapter?: string | undefined; } | undefined; gateway?: { domain: number; contracts: { v1?: { wallet: string; minter: string; depositForHandler?: string | undefined; genericExecutor?: string | undefined; } | undefined; }; forwarderSupported: { source: boolean; destination: boolean; }; } | undefined; }; recipientAddress: string; }; amount: string; maxFee: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; transferSpeed?: "FAST" | "SLOW" | undefined; }>, z.ZodObject<{ from: z.ZodType; to: z.ZodOptional; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; amount: z.ZodEffects>, string, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strict", z.ZodTypeAny, { vaultAddress: `0x${string}`; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; to?: undefined; }, { vaultAddress: string; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; to?: undefined; }>]>; /** * Validation schema for DepositParams. * * @deprecated Use {@link anyDepositParamsSchema}, which also accepts * cross-chain deposit params. * * @example * ```typescript * import { depositParamsSchema } from '@circle-fin/earn-kit' * * const result = depositParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '100.50', * }) * ``` */ declare const depositParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; amount: z.ZodEffects>, string, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Validation schema for GetCrossChainDepositStatusParams. * * @example * ```typescript * import { getCrossChainDepositStatusParamsSchema } from '@circle-fin/earn-kit' * * const result = getCrossChainDepositStatusParamsSchema.safeParse({ * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * }) * ``` */ declare const getCrossChainDepositStatusParamsSchema: z.ZodObject<{ execId: z.ZodString; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { execId: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; }, { execId: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; }>; /** * Validation schema for WaitForCrossChainDepositParams. * * @example * ```typescript * import { waitForCrossChainDepositParamsSchema } from '@circle-fin/earn-kit' * * const result = waitForCrossChainDepositParamsSchema.safeParse({ * execId: 'e9e77922-c8a4-4158-93de-d73a78417d99', * pollIntervalMs: 5_000, * maxWaitMs: 1_200_000, * }) * ``` */ declare const waitForCrossChainDepositParamsSchema: z.ZodObject<{ execId: z.ZodString; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; pollIntervalMs: z.ZodOptional; maxWaitMs: z.ZodOptional; signal: z.ZodOptional>; }, "strip", z.ZodTypeAny, { execId: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; pollIntervalMs?: number | undefined; maxWaitMs?: number | undefined; signal?: AbortSignal | undefined; }, { execId: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; pollIntervalMs?: number | undefined; maxWaitMs?: number | undefined; signal?: AbortSignal | undefined; }>; /** * Validation schema for WithdrawParams. * * @example * ```typescript * import { withdrawParamsSchema } from '@circle-fin/earn-kit' * * const result = withdrawParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '50.00', * }) * ``` */ declare const withdrawParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; amount: z.ZodEffects>, string, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Validation schema for ClaimRewardsParams. * * @example * ```typescript * import { claimRewardsParamsSchema } from '@circle-fin/earn-kit' * * const result = claimRewardsParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * ``` * * @internal */ declare const claimRewardsParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Validation schema for GetDepositQuoteParams. * * Same-chain when only `from` is provided; cross-chain when a destination * `chain` and `address` are provided. * * @example * ```typescript * import { getDepositQuoteParamsSchema } from '@circle-fin/earn-kit' * * const result = getDepositQuoteParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '100.50', * }) * * const crossChainResult = getDepositQuoteParamsSchema.safeParse({ * from: { adapter, chain: 'Ethereum_Sepolia' }, * chain: 'Arc_Testnet', * address: '0x1234567890123456789012345678901234567890', * vaultAddress: '0x8eB67A509616cd6A7c1B3c8C21D48FF57df3d458', * amount: '100.50', * }) * ``` */ declare const getDepositQuoteParamsSchema: z.ZodType; /** * Validation schema for GetWithdrawalQuoteParams. * * @example * ```typescript * import { getWithdrawalQuoteParamsSchema } from '@circle-fin/earn-kit' * * const result = getWithdrawalQuoteParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * amount: '50.00', * }) * ``` */ declare const getWithdrawalQuoteParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; amount: z.ZodEffects>, string, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; amount: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Validation schema for GetClaimRewardsQuoteParams. * * @example * ```typescript * import { getClaimRewardsQuoteParamsSchema } from '@circle-fin/earn-kit' * * const result = getClaimRewardsQuoteParamsSchema.safeParse({ * from: { adapter, chain: 'Arc_Testnet' }, * vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88', * }) * ``` * * @internal */ declare const getClaimRewardsQuoteParamsSchema: z.ZodObject<{ from: z.ZodType; vaultAddress: z.ZodEffects, string, string>, string, string>, string, string>, `0x${string}`, string>, `0x${string}`, string>; config: z.ZodOptional; kitKey: z.ZodOptional; baseUrl: z.ZodOptional; batchTransactions: z.ZodOptional; }, "strict", z.ZodTypeAny, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }, { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; }>>; }, "strip", z.ZodTypeAny, { vaultAddress: `0x${string}`; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }, { vaultAddress: string; config?: { apiKey?: string | undefined; kitKey?: string | undefined; baseUrl?: string | undefined; batchTransactions?: boolean | undefined; } | undefined; from?: any; }>; /** * Assert that the provided value conforms to the given earn params schema. * * Validate earn parameters using the provided Zod schema and track * validation state to avoid duplicate checks. Throw a structured * error with detailed validation messages if any parameter is invalid. * * @typeParam T - The expected type after validation * @param params - The earn parameters to validate * @param schema - The Zod schema to validate against * @throws {@link KitError} If the parameters fail validation * * @example * ```typescript * import { assertEarnParams, depositParamsSchema } from '@circle-fin/earn-kit' * * assertEarnParams(params, depositParamsSchema) * ``` */ declare function assertEarnParams(params: unknown, schema: z.ZodSchema): asserts params is T; export { Amount, Blockchain, EarnChain, EarnError, EarnKit, KitError, TransferSpeed, anyDepositParamsSchema, assertEarnParams, claimRewards, claimRewardsParamsSchema, createEarnKitContext, deposit, depositParamsSchema, exploreVaults, exploreVaultsIterator, exploreVaultsIteratorParamsSchema, exploreVaultsParamsSchema, getChainByEnum, getClaimRewardsQuote, getClaimRewardsQuoteParamsSchema, getCrossChainDepositStatus, getCrossChainDepositStatusParamsSchema, getDepositQuote, getDepositQuoteParamsSchema, getErrorCode, getErrorMessage, getPosition, getPositionParamsSchema, getSupportedChains, getVaults, getVaultsParamsSchema, getWithdrawalQuote, getWithdrawalQuoteParamsSchema, isFatalError, isInputError, isKitError, isResumableError, isRetryableError, setExternalPrefix, vaultQuerySchema, waitForCrossChainDeposit, waitForCrossChainDepositParamsSchema, withdraw, withdrawParamsSchema }; export type { AdapterContext, AnyDepositParams, ChainDefinition, ChainIdentifier, ClaimRewardsParams, CrossChainDepositParams, CrossChainGetDepositQuoteParams, DepositParams, EarnAccruedRewardInfo, EarnAdapterContext, EarnAssetAmount, EarnChainDefinition, EarnChainIdentifier, EarnClaimRewardsQuoteInfo, EarnClaimRewardsResult, EarnClaimedAmount, EarnClaimedRewardsResult, EarnConfig, EarnCrossChainDepositDestination, EarnDepositQuoteInfo, EarnEstimatedGas, EarnExploreVaultsResult, EarnGasFeeEstimate, EarnGetVaultsResult, EarnKitConfig, EarnKitContext, EarnLiquidityProfile, EarnOperationParams, EarnPositionInfo, EarnPositionPnLInfo, EarnVaultInfo, EarnWithdrawalQuoteInfo, ErrorDetails, ExploreVaultsIteratorParams, ExploreVaultsParams, GetClaimRewardsQuoteParams, GetCrossChainDepositStatusParams, GetDepositQuoteParams, GetPositionParams, GetVaultsParams, GetWithdrawalQuoteParams, Recoverability, SameChainDepositParams, SameChainGetDepositQuoteParams, WaitForCrossChainDepositParams, WithdrawParams };