@malda-protocol/protocol-config
Version:
Centralized contract addresses, constants, and token configurations for Malda Protocol
107 lines • 4.55 kB
TypeScript
import { type Token, type ProtocolConfig } from './types.js';
import type { Chain } from '@wagmi/core/chains';
/**
* Check if a market (token) is supported on a specific chain
* @param token The token to check
* @param chainId The chain ID to check
* @returns boolean indicating if the market is available on the specified chain
*/
export declare function isMarketSupportedOnChain(token: Token, chainId: number): boolean;
/**
* Check if a market (token) is supported on a specific chain (using chain object)
* @param token The token to check
* @param chain The chain object to check
* @returns boolean indicating if the market is available on the specified chain
*/
export declare function isMarketSupportedOnChainObject(token: Token, chain: Chain): boolean;
/**
* Get all markets available on a specific chain
* @param tokens Array of tokens to filter
* @param chainId The chain ID to filter by
* @returns Array of tokens available on the specified chain
*/
export declare function getMarketsForChain(tokens: Token[], chainId: number): Token[];
/**
* Get all markets available on a specific chain (using chain object)
* @param tokens Array of tokens to filter
* @param chain The chain object to filter by
* @returns Array of tokens available on the specified chain
*/
export declare function getMarketsForChainObject(tokens: Token[], chain: Chain): Token[];
/**
* Get all supported chains for a specific market/token
* @param token The token to get supported chains for
* @param allChains Array of all possible chain objects
* @param config Protocol configuration to check asset details
* @returns Array of chain objects where this market is available
*/
export declare function getSupportedChainsForMarket(token: Token | null, allChains: readonly Chain[], config: ProtocolConfig): Chain[];
/**
* Transform protocol assets into simplified token format
* @param config Protocol configuration
* @returns Array of tokens derived from the config assets
*/
export declare function createTokensFromConfig(config: ProtocolConfig): Token[];
/**
* Get underlying token address for a specific chain
* @param token The token to get the underlying address for
* @param chainId The chain ID
* @returns The underlying token address or undefined if not available
*/
export declare function getUnderlyingAddress(token: Token, chainId: number): string | undefined;
/**
* Get underlying token address for a specific chain (using chain object)
* @param token The token to get the underlying address for
* @param chain The chain object
* @returns The underlying token address or undefined if not available
*/
export declare function getUnderlyingAddressForChain(token: Token, chain: Chain): string | undefined;
/**
* Find a chain object by its ID
* @param chainId The chain ID to find
* @param chains Array of chain objects to search in
* @returns The chain object or undefined if not found
*/
export declare function findChainById(chainId: number, chains: readonly Chain[]): Chain | undefined;
/**
* Get underlying token address for a specific wagmi chain
* @param token The token to get the underlying address for
* @param chain Wagmi Chain object
* @returns The underlying token address or undefined if not available
*/
export declare function getUnderlyingAddressForWagmiChain(token: Token, chain: Chain): string | undefined;
/**
* Get the native currency symbol for a wagmi chain
* @param chain Wagmi Chain object
* @returns The native currency symbol (e.g., 'ETH')
*/
export declare function getNativeCurrencySymbol(chain: Chain): string;
/**
* Get the first RPC URL for a wagmi chain
* @param chain Wagmi Chain object
* @returns The first RPC URL or undefined if none available
*/
export declare function getRpcUrl(chain: Chain): string | undefined;
/**
* Get the block explorer URL for a wagmi chain
* @param chain Wagmi Chain object
* @returns The block explorer URL or undefined if none available
*/
export declare function getBlockExplorerUrl(chain: Chain): string | undefined;
/**
* Check if a wagmi chain is a testnet
* @param chain Wagmi Chain object
* @returns boolean indicating if the chain is a testnet
*/
export declare function isTestnetChain(chain: Chain): boolean;
/**
* Get production (mainnet) chains
* @returns Array of production chains only
*/
export declare function getProductionChains(): readonly Chain[];
/**
* Get testnet chains
* @returns Array of testnet chains only
*/
export declare function getTestnetChains(): readonly Chain[];
//# sourceMappingURL=utils.d.ts.map