import type { Squid } from "@0xsquid/sdk"; import { ChainData, ChainType, Token } from "@0xsquid/squid-types"; import { QueryClient } from "@tanstack/react-query"; import type { AppConfig } from "../../core/types/config"; import { SwapDirection, SwapParams } from "../../core/types/swap"; import type { TokenGroup, TokenWithBalance } from "../../core/types/tokens"; export declare const assetsBaseUrl = "https://raw.githubusercontent.com/0xsquid/assets/main"; export declare const shareSubgraphId: (token1: Token, token2: Token) => boolean; /** * Check if `tokenToCheck` shares any subgraph id with the tokens being compared * If any of the tokens being compared shares a subgraph id with `tokenToCheck`, it will be sorted first * @param a first token being compared * @param b second token being compared * @param tokenToCheck the token to check subgraph ids against */ export declare const sortTokensBySharedSubgraphIds: ({ a, b, tokenToCheck, }: { a: Token; b: Token; tokenToCheck: Token; }) => -1 | 0 | 1; /** * Returns an array of supported chain IDs based on the provided config: * - If `availableChains` is defined, only chains in `availableChains` will be returned * - If `disabledChains` is defined, chains in `disabledChains` will be removed * - If none of the above is defined, returns all chains */ export declare const getSupportedChainIdsForDirection: (chainIds: string[], config: Pick, direction?: SwapDirection) => string[]; /** * Filter available chains based on provided config and direction */ export declare const filterChains: ({ chains, config, direction, }: { chains: ChainData[]; config: Pick; direction?: SwapDirection | undefined; }) => ChainData[]; /** * Filter tokens based on provided config and direction */ export declare const filterTokens: ({ tokens, config, direction, }: { tokens: Token[]; config: Pick; direction?: SwapDirection | undefined; }) => Token[]; export declare function getTokenImage(token?: Pick): string; /** * When user changes something from the SwapView * param changed can be chains, tokens, or destination address * * If source chain is changed but source token is undefined, need to find a default token * If destination chain is changed but destination token is undefined, need to find a default token * If only source token is changed, and destination token is not, and they were the same, then destination token becomes undefined * If only destination token is changed but source is not, and they were the same, then source token updates to something else * */ export declare const getNewSwapParamsFromInput: ({ inputParams, initialSwapRoute, tokens, chains, config, queryClient, connectedSourceAddress, }: { inputParams: SwapParams; initialSwapRoute?: SwapParams | undefined; tokens: Token[]; chains: ChainData[]; config: Pick; queryClient: QueryClient; connectedSourceAddress?: string | undefined; }) => SwapParams; export declare const sortAllTokens: (tokenA: Pick, tokenB: Pick) => number; export declare const findToken: >(tokens: T[], chainId?: string, address?: string) => T | undefined; export declare const findNativeToken: (tokens: Token[], chain: Pick & { nativeCurrency: Pick; }) => Token | undefined; export declare const normalizeIbcAddress: (address: string) => string; /** * Groups tokens based on their properties (symbol, coingeckoId) * Some custom logic to handle native/wrapped pairs * * @param tokens - Array of TokenWithBalance objects to be grouped * @param chainType - Optional parameter to filter tokens by chain type ('evm' or 'cosmos') * @returns Object containing grouped tokens and ungrouped tokens */ export declare const groupTokensBySymbol: (tokens: T[], chainType?: ChainType) => { grouped: TokenGroup[]; ungrouped: T[]; }; /** * Groups tokens based on their chainId * * @param tokens - Array of TokenWithBalance objects to be grouped * @param chains - Array of ChainData objects to find chain information * @returns Array of TokenGroup objects */ export declare const groupTokensByChainId: (tokens: T[], chains: ChainData[]) => TokenGroup[]; /** * Removes some tokens based on address and chain ID. * Some tokens will be returned by backend but should be hidden. * * Also filters tokens in `config.availableTokens` if provided. * * TODO: in the future we might want to have this as a token attribute instead. */ export declare const filterViewableTokens: (tokens: T[], config: Pick, direction?: SwapDirection) => T[]; export declare const getSecretNetworkBalances: (chainData: ChainData, cosmosAddress: string, squidTokens: Token[], keplrTypeWallet: any) => Promise; export declare function getTokenAssetsKey(token?: Pick): string; export type AssetsColors = { chains: Record; tokens: Record; }; export declare function fetchAssetsColors(): Promise; export declare function isSupportedChainType(chainType: string): chainType is ChainType; /** * Normalizes SDK data after each init/refetch before the rest of hooks consumes it. * * - Removes chains whose chainType is not supported by the local package. * - Drops tokens for those removed chains. * - Converts Evmos chains/tokens to EVM. * - Applies optional asset colors. */ export declare function initializeSquidData(squid: Squid, assetsColors?: AssetsColors): void; export declare function isEmptyObject(obj: Record | undefined): boolean; export declare const normalizeTokenSymbol: (symbol: string) => string; export declare const areTokenSymbolsCompatible: (symbol1: string, symbol2: string) => boolean; export declare function isEvmosChain(chain: ChainData | undefined): boolean;