// Package web3 wraps chain configuration + multi-chain RPC plumbing. // // The HTTP layer asks this package for canonical chain data; the RPC // proxy fans out through a pool defined in client.go. luxfi/* packages // are preferred for any chain library imports (see ~/.claude/CLAUDE.md). package web3 // ChainInfo is the canonical per-chain record exposed at /v1/chains. // Mirrors bootnode/core/chains/registry.py. type ChainInfo struct { ID string `json:"id"` Name string `json:"name"` ChainID int64 `json:"chainId"` IsEVM bool `json:"isEvm"` Currency string `json:"currency"` Explorer string `json:"explorer"` } // allChains is the initial static set; production reads from // deps.Base ("registry" table) so customers can add custom chains. // // TODO(bootnode-port): hydrate from bootnode/core/chains/registry.py // (CHAIN_REGISTRY) at startup; allow per-org overrides. var allChains = []ChainInfo{ {ID: "ethereum", Name: "Ethereum", ChainID: 1, IsEVM: true, Currency: "ETH", Explorer: "https://etherscan.io"}, {ID: "polygon", Name: "Polygon", ChainID: 137, IsEVM: true, Currency: "MATIC", Explorer: "https://polygonscan.com"}, {ID: "arbitrum", Name: "Arbitrum One", ChainID: 42161, IsEVM: true, Currency: "ETH", Explorer: "https://arbiscan.io"}, {ID: "optimism", Name: "Optimism", ChainID: 10, IsEVM: true, Currency: "ETH", Explorer: "https://optimistic.etherscan.io"}, {ID: "base", Name: "Base", ChainID: 8453, IsEVM: true, Currency: "ETH", Explorer: "https://basescan.org"}, {ID: "bsc", Name: "BNB Chain", ChainID: 56, IsEVM: true, Currency: "BNB", Explorer: "https://bscscan.com"}, {ID: "avalanche", Name: "Avalanche C-Chain", ChainID: 43114, IsEVM: true, Currency: "AVAX", Explorer: "https://snowtrace.io"}, {ID: "lux", Name: "Lux Network", ChainID: 96369, IsEVM: true, Currency: "LUX", Explorer: "https://explore.lux.network"}, } // AllChains returns every chain Bootnode currently knows about. func AllChains() []ChainInfo { return append([]ChainInfo(nil), allChains...) } // ChainByName looks up one chain by its kebab-cased ID. func ChainByName(id string) (ChainInfo, bool) { for _, c := range allChains { if c.ID == id { return c, true } } return ChainInfo{}, false }