import { IAsyncStorage } from './storage'; import { MsgTypeUrl, SupportedChain } from './types'; import type { TxStatusResponseJSON, AssetJSON } from '@skip-go/client'; export interface WithChainId { chainId: string; } export declare enum BRIDGES { IBC = "IBC", AXELAR = "AXELAR", CCTP = "CCTP", HYPERLANE = "HYPERLANE", STARGATE = "STARGATE", OPINIT = "OPINIT", GO_FAST = "GO_FAST", EUREKA = "EUREKA" } export type SmartSwapOptions = { split_routes: boolean; evm_swaps: boolean; }; interface Asset { chainId: string; denom: string; } export type { AssetJSON }; export type RequestIbcTransferRouteArgs = { sourceAsset: Asset; destAssetChainId: string; }; export type RequestIbcSwapRouteArgs = { amountIn: string; sourceAsset: Asset; destAsset: Asset; cumulativeAffiliateFeeBps: string; }; export type SupportedAssetsArgs = { nativeOnly?: boolean; includeEVMAssets?: boolean; includeCW20Assets?: boolean; includeNoMetadataAssets?: boolean; includeSVMAssets?: boolean; onlyTestnets?: boolean; }; export type RequestSupportedAssetsForChainArgs = { chainId: string; nativeOnly?: boolean; includeEVMAssets?: boolean; includeCW20Assets?: boolean; includeNoMetadataAssets?: boolean; includeSVMAssets?: boolean; }; export type SkipCosmosMsg = { multi_chain_msg: { chain_id: string; msg_type_url: MsgTypeUrl; msg: string; path: string[]; }; }; export type SkipCosmosMsgV2 = { cosmos_tx: { chain_id: string; msgs: { msg_type_url: MsgTypeUrl; msg: string; }[]; path: string[]; }; }; export type SkipEvmMsg = { evm_tx: { chain_id: string; data: string; required_erc20_approvals: { amount: string; spender: string; token_contract: string; }[]; to: string; value: string; }; }; export type SkipMsg = SkipCosmosMsg | SkipEvmMsg; export type SkipMsgV2 = SkipCosmosMsgV2 | SkipEvmMsg; export type EstimatedFee = { fee_type: 'SMART_RELAY' | 'SWAP' | 'BRIDGE' | 'RELAY' | 'GAS'; bridge_id: string; amount: string; usd_amount: string; origin_asset: { denom: string; chain_id: string; origin_denom: string; origin_chain_id: string; symbol: string; name: string; logo_uri: string; decimals: number; token_contract: string; }; chain_id: string; denom: string; tx_index: number; }; export type Affiliates = { affiliates: { basis_points_fee: string; address: string; }[]; }; export type MsgsRequest = { source_asset_denom: string; source_asset_chain_id: string; dest_asset_denom: string; dest_asset_chain_id: string; amount_in: string; amount_out: string; address_list: string[]; operations: any[]; slippage_tolerance_percent: string; timeout_seconds?: string; chain_ids_to_affiliates?: Record; }; export type MsgResponse = { estimated_fees: EstimatedFee[]; msgs: SkipMsg[]; txs: SkipMsgV2[]; }; export type SwapVenue = { chain_id: string; name: string; logo_uri: string; }; export type RouteRequest = { source_asset_denom: string; source_asset_chain_id: string; dest_asset_denom: string; dest_asset_chain_id: string; amount_in: string; cumulative_affiliate_fee_bps?: string; swap_venues?: SwapVenue[]; allow_unsafe?: boolean; experimental_features?: string[]; bridges?: BRIDGES[]; allow_multi_tx?: boolean; smart_relay?: boolean; go_fast?: boolean; smart_swap_options?: SmartSwapOptions; }; export type RouteResponse = { source_asset_denom: string; source_asset_chain_id: string; dest_asset_denom: string; dest_asset_chain_id: string; amount_in: string; operations: any[]; chain_ids: string[]; does_swap: boolean; amount_out: string; estimated_amount_out: string; swap_venue?: SwapVenue; swap_venues?: SwapVenue[]; txs_required: number; usd_amount_in: string; usd_amount_out: string; swap_price_impact_percent: string | null; estimated_fees: EstimatedFee[]; warning: { type: 'LOW_INFO_WARNING' | 'BAD_PRICE_WARNING'; message: string; } | null | undefined; estimated_route_duration_seconds: number; }; export type RecommendedAssetRequest = { source_asset_denom: string; source_asset_chain_id: string; dest_chain_id: string; }; export type RecommendedAssetResponse = { denom: string; chainId: string; originDenom: string; symbol: string; name: string; logoUri: string; decimals: number; }; export type SubmitTransactionRequest = { chain_id: string; tx: string; }; export type TrackTransactionRequest = { chain_id: string; tx_hash: string; }; export type TransactionResponse = { tx_hash: string; }; export type TransactionStatusRequest = { tx_hash: string; chain_id: string; }; export declare enum SKIP_TXN_STATUS { STATE_SUBMITTED = "STATE_SUBMITTED", STATE_PENDING = "STATE_PENDING", STATE_COMPLETED = "STATE_COMPLETED", STATE_ABANDONED = "STATE_ABANDONED", STATE_RECEIVED = "STATE_RECEIVED", STATE_COMPLETED_SUCCESS = "STATE_COMPLETED_SUCCESS", STATE_COMPLETED_ERROR = "STATE_COMPLETED_ERROR", STATE_UNKNOWN = "STATE_UNKNOWN" } export declare enum TRANSFER_STATE { TRANSFER_UNKNOWN = "TRANSFER_UNKNOWN", TRANSFER_PENDING = "TRANSFER_PENDING", TRANSFER_RECEIVED = "TRANSFER_RECEIVED", TRANSFER_SUCCESS = "TRANSFER_SUCCESS", TRANSFER_FAILURE = "TRANSFER_FAILURE" } export type PacketContent = { chain_id: string; tx_hash: string; explorer_link?: string; }; type RecommendedChainRequest = { source_asset_denom: string; source_asset_chain_id: string; allow_multi_tx?: boolean; }; type RecommendedChainResponse = Record; type GetBalancesRequest = Record; type BalanceDenom = { amount: string; decimals: number; formatted_amount: string; price: string | null; value_usd: string | null; error?: { message: string; }; }; type GetBalancesResponse = { chains: Record; }>; }; export type SkipSupportedAsset = { chainId: string; denom: string; originDenom: string; originChainId: string; symbol: string; logoUri: string; trace: string; name: string | null; decimals: number; tokenContract?: string; coingeckoId: string | undefined; isCw20: boolean | undefined; }; export declare const DEFAULT_CLIENT_ID = "elements-sdk"; export declare const SKIP_API_BASE_URL = "https://api.skip.money"; export declare const SKIP_API_PROXY_URL = "https://api.leapwallet.io/proxy-skip"; /** * `SkipAPI` class provides a range of methods to interact with the Skip API. * It includes functionalities such as retrieving supported chains and assets, * fetching routing information for token transfers, submitting transactions, * and tracking their status. This class acts as an interface for applications * to interact with the Skip API. */ export declare class SkipAPI { private static ky; private static supportedChainsCache; private static clientID; private static integratorID; static isCacheInitialized(): boolean; static initializeCache(storage: IAsyncStorage): void; static setClientID(clientID: string): void; static getClientID(): string; static setIntegratorID(integratorID: string): void; static getIntegratorID(): string | undefined; /** * Retrieves the list of supported chains from the Skip API. * @returns A Promise that resolves to an object containing either a list of supported chains * on success, or an error message on failure. See {@link SupportedChains}. */ static getSupportedChains(options?: { includeEVM?: boolean; includeTestnets?: boolean; cached?: boolean; includeSVM?: boolean; }): Promise<{ success: false; error: string; } | { success: true; chains: SupportedChain[]; }>; /** * Retrieves the supported assets for a specified chain. * @param args - The arguments for the request including chainId and nativeOnly flag. See {@link RequestSupportedAssetsForChainArgs}. * @returns A promise that resolves to an object containing the supported assets for the given chain, * or an error message if unsuccessful. See {@link SkipSupportedAsset}. */ static getSupportedAssets(args: SupportedAssetsArgs): Promise<{ success: false; error: string; } | { success: true; assets: Record; }>; /** * Retrieves the supported assets for a specified chain. * @param args - The arguments for the request including chainId and nativeOnly flag. See {@link RequestSupportedAssetsForChainArgs}. * @returns A promise that resolves to an object containing the supported assets for the given chain, * or an error message if unsuccessful. See {@link SkipSupportedAsset}. */ static getSupportedAssetsForChain(args: RequestSupportedAssetsForChainArgs): Promise<{ success: false; error: string; } | { success: true; assets: SkipSupportedAsset[]; }>; /** * Fetches the IBC origin assets based on provided asset details. * @param args - Array of objects containing denom and chainId. See the argument structure in {@link SkipSupportedAsset}. * @returns A promise that resolves to an object containing either the origin assets {@link SkipSupportedAsset} * or an error message. */ static getIbcOriginAssets(args: { denom: string; chainId: string; }[]): Promise<{ success: false; error: string; } | { success: true; data: (SkipSupportedAsset | null)[]; }>; /** * Calculates the route for token transfer between two assets. * @param args - The arguments required to calculate the route, including source and destination asset details. See {@link RouteRequest}. * @returns A promise that resolves to an object containing the route details {@link RouteResponse} or an error message. */ static getRoute(args: RouteRequest): Promise<{ success: false; error: string; } | { success: true; route: RouteResponse; }>; /** * Fetches recommended chains for a given asset. * @param args - The request arguments including source asset denom and chain ID, and an optional flag for multi-tx. See {@link RecommendedChainRequest}. * @returns A promise that resolves to an array containing recommended chains {@link RecommendedAssetResponse} or an error message. */ static getRecommendedAssets(args: RecommendedAssetRequest): Promise<{ success: false; error: string; } | { success: true; recommendations: RecommendedAssetResponse[]; }>; /** * Fetches recommended chains for a given asset. * @param args - The request arguments including source asset denom and chain ID, and an optional flag for multi-tx. * @returns A promise that resolves to an object containing recommended chains or an error message. */ static getRecommendedChainAssets(args: RecommendedChainRequest): Promise<{ success: false; error: string; } | { success: true; chains: RecommendedChainResponse; }>; /** * Retrieves the necessary messages for transaction creation. * @param args - The request parameters including asset and transaction details. {@link MsgsRequest} * @returns A promise that resolves to an object containing transaction messages or an error message. */ static getMessages(args: MsgsRequest): Promise<{ success: true; msgs: SkipMsg[]; data: MsgResponse; } | { success: false; error: string; }>; /** * Submits a transaction to the blockchain. * @param args - The transaction request including chain ID and transaction data. {@link SubmitTransactionRequest} * @returns A promise that resolves to an object indicating the success of the transaction submission * along with the transaction response {@link TransactionResponse} or an error message. */ static submitTransaction(args: SubmitTransactionRequest): Promise<{ success: true; response: TransactionResponse; } | { success: false; error: string; }>; static trackTransaction(args: TrackTransactionRequest): Promise<{ success: true; response: TransactionResponse; } | { success: false; error: string; }>; /** * Retrieves the status of a transaction. * @param args - Request parameters including transaction hash and chain ID ({@link TransactionStatusRequest}). * @returns A promise resolving to an object containing the transaction status * ({@link TxStatusResponseJSON}) or an error message. */ static getTxnStatus(args: TransactionStatusRequest): Promise<{ success: true; response: TxStatusResponseJSON; } | { success: false; error: string; }>; static getBalances(args: GetBalancesRequest): Promise<{ success: true; response: GetBalancesResponse; } | { success: false; error: string; }>; }