UNPKG

kirapay-axelar-sdk

Version:

TypeScript SDK for cross-chain swaps with CCIP and Axelar bridges

104 lines (103 loc) 3.12 kB
import { type Address, type ChainId, type KiraSdkConfig } from "./types"; import { type PublicClient } from "viem"; /** * ConfigManager handles all chain-specific configurations and provides * methods to access those configurations in a standardized way. */ export declare class ConfigManager { private rpcs; private ccipConfig; private axelarConfig; private defaultTtlSeconds; private defaultSwapDeadlineSeconds; /** * Create a new ConfigManager instance * @param config SDK configuration */ constructor(config?: KiraSdkConfig); /** * Get RPC URL for a chain (first configured URL) * @param chainId Chain ID * @returns RPC URL */ getRpcUrl(chainId: ChainId): string; /** * Get CCIP configuration for a chain * @param chainId Chain ID * @returns CCIP configuration or undefined if not available */ getCcipConfig(chainId: ChainId): { router: Address; selector: bigint; }; /** * Get Axelar configuration for a chain * @param chainId Chain ID * @returns Axelar configuration or undefined if not available */ getAxelarConfig(chainId: ChainId): { gateway: Address; dstChainName?: string; dstContract?: string; usdcSymbol?: string; wrappedSymbols?: { usdc?: string; weth?: string; }; }; /** * Get preferred wrapped symbol names for Axelar on a chain (e.g., axlUSDC, axlETH) */ getAxelarWrappedSymbols(chainId: ChainId): { usdc?: string; weth?: string; } | undefined; /** * Get default TTL seconds for cross-chain payloads */ getDefaultTtlSeconds(): number; /** * Get default swap deadline seconds (from now) */ getDefaultSwapDeadlineSeconds(): number; /** * Get a viem public client for a given chain ID * Uses configured RPCs; if multiple, builds a fallback transport */ getPublicClient(chainId: ChainId): PublicClient; /** * Check if a bridge type is supported for a chain pair * @param srcChainId Source chain ID * @param dstChainId Destination chain ID * @param bridge Bridge type * @returns Whether the bridge is supported */ isBridgeSupported(srcChainId: ChainId, dstChainId: ChainId, bridge: "CCIP" | "AXELAR"): boolean; /** * Get all configured RPCs * @returns Record of RPC URLs by chain ID */ getAllRpcs(): Record<number, string | string[]>; /** * Get all CCIP configurations * @returns Record of CCIP configurations by chain ID */ getAllCcipConfigs(): Record<number, { router: Address; selector: bigint; }>; /** * Get all Axelar configurations * @returns Record of Axelar configurations by chain ID */ getAllAxelarConfigs(): Record<number, { gateway: Address; dstChainName?: string; dstContract?: string; usdcSymbol?: string; wrappedSymbols?: { usdc?: string; weth?: string; }; }>; }