list_supported_chains
Retrieve all supported blockchain networks and their configurations for cross-chain trading operations on Paloma DEX.
Instructions
List all supported chains with their configurations.
Returns:
JSON string with all supported chain information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"type": "object"
}
Implementation Reference
- padex.py:651-675 (handler)The handler function for the 'list_supported_chains' tool. It iterates over CHAIN_CONFIGS to build and return a JSON object listing all supported chains with their key configurations.async def list_supported_chains(ctx: Context) -> str: """List all supported chains with their configurations. Returns: JSON string with all supported chain information. """ try: chains_info = {} for chain_id, config in CHAIN_CONFIGS.items(): chains_info[chain_id] = { "chain_id": config.chain_id, "name": config.name, "rpc_url": config.rpc_url, "explorer_url": config.explorer_url, "has_pusd_token": bool(config.pusd_token), "has_pusd_connector": bool(config.pusd_connector), "has_etf_connector": bool(config.etf_connector) } return json.dumps(chains_info, indent=2) except Exception as e: logger.error(f"Error listing chains: {e}") return f"Error listing chains: {str(e)}"
- padex.py:60-131 (helper)Global dictionary CHAIN_CONFIGS containing ChainConfig instances for all 7 supported EVM chains. This is the core data source used by list_supported_chains to generate its output.CHAIN_CONFIGS = { ChainID.ETHEREUM_MAIN: ChainConfig( chain_id=1, name="Ethereum", rpc_url="https://eth.llamarpc.com", pusd_token=os.getenv("PUSD_TOKEN_ETH", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_ETH", ""), etf_connector=os.getenv("ETF_CONNECTOR_ETH", ""), explorer_url="https://etherscan.io", gas_price_gwei=30 ), ChainID.ARBITRUM_MAIN: ChainConfig( chain_id=42161, name="Arbitrum One", rpc_url="https://arb1.arbitrum.io/rpc", pusd_token=os.getenv("PUSD_TOKEN_ARB", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_ARB", ""), etf_connector=os.getenv("ETF_CONNECTOR_ARB", ""), explorer_url="https://arbiscan.io", gas_price_gwei=1 ), ChainID.OPTIMISM_MAIN: ChainConfig( chain_id=10, name="Optimism", rpc_url="https://mainnet.optimism.io", pusd_token=os.getenv("PUSD_TOKEN_OP", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_OP", ""), etf_connector=os.getenv("ETF_CONNECTOR_OP", ""), explorer_url="https://optimistic.etherscan.io", gas_price_gwei=1 ), ChainID.BASE_MAIN: ChainConfig( chain_id=8453, name="Base", rpc_url="https://mainnet.base.org", pusd_token=os.getenv("PUSD_TOKEN_BASE", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_BASE", ""), etf_connector=os.getenv("ETF_CONNECTOR_BASE", ""), explorer_url="https://basescan.org", gas_price_gwei=1 ), ChainID.BSC_MAIN: ChainConfig( chain_id=56, name="BNB Smart Chain", rpc_url="https://bsc-dataseed1.binance.org", pusd_token=os.getenv("PUSD_TOKEN_BSC", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_BSC", ""), etf_connector=os.getenv("ETF_CONNECTOR_BSC", ""), explorer_url="https://bscscan.com", gas_price_gwei=5 ), ChainID.POLYGON_MAIN: ChainConfig( chain_id=137, name="Polygon", rpc_url="https://polygon-rpc.com", pusd_token=os.getenv("PUSD_TOKEN_MATIC", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_MATIC", ""), etf_connector=os.getenv("ETF_CONNECTOR_MATIC", ""), explorer_url="https://polygonscan.com", gas_price_gwei=30 ), ChainID.GNOSIS_MAIN: ChainConfig( chain_id=100, name="Gnosis Chain", rpc_url="https://rpc.gnosischain.com", pusd_token=os.getenv("PUSD_TOKEN_GNOSIS", ""), pusd_connector=os.getenv("PUSD_CONNECTOR_GNOSIS", ""), etf_connector=os.getenv("ETF_CONNECTOR_GNOSIS", ""), explorer_url="https://gnosisscan.io", gas_price_gwei=2 ) }
- padex.py:48-58 (helper)Dataclass defining the structure of chain configurations used in CHAIN_CONFIGS and accessed by the list_supported_chains tool.class ChainConfig: """Configuration for a blockchain network""" chain_id: int name: str rpc_url: str pusd_token: str pusd_connector: str etf_connector: str explorer_url: str gas_price_gwei: int = 20
- padex.py:38-46 (helper)Enum defining the string keys (chain IDs) for the supported chains, used as keys in CHAIN_CONFIGS.class ChainID(str, Enum): ETHEREUM_MAIN = "1" OPTIMISM_MAIN = "10" BSC_MAIN = "56" POLYGON_MAIN = "137" BASE_MAIN = "8453" ARBITRUM_MAIN = "42161" GNOSIS_MAIN = "100"
- padex.py:650-651 (registration)The @mcp.tool() decorator registers the list_supported_chains function as an MCP tool.@mcp.tool() async def list_supported_chains(ctx: Context) -> str: