interface NetworksRegistryInner { /** * Reference to this schema file */ $schema: string; description: string; /** * List of networks */ networks: Network[]; title: string; /** * Date and time of the last update */ updatedAt: Date; /** * Version of the registry */ version: string; } interface Network { /** * [optional] List of possible aliases for the network id, e.g. ethereum, eth, mainnet, * eth-mainnet */ aliases?: string[]; /** * List of API URLs for the network, i.e. Etherescan-like API to get ABI. Use * {CUSTOM_API_KEY} as a placeholder for a private API key */ apiUrls?: APIURL[]; /** * CAIP-2 Chain ID, e.g. eip155:1, bip122:000000000019d6689c085ae165831e93 */ caip2Id: string; /** * URL to the chain documentation */ docsUrl?: string; /** * URLs for the block explorers */ explorerUrls?: string[]; /** * Firehose block information */ firehose?: Firehose; /** * Display name of the network, e.g. Ethereum Mainnet, Bitcoin Testnet */ fullName: string; /** * Graph Node specific configuration information */ graphNode?: GraphNode; /** * Icons for the network */ icon?: Icon; /** * Established name of the network in The Graph ecosystem, e.g. mainnet, btc, * arweave-mainnet, near-testnet */ id: string; /** * Documentation to run indexer components for this network */ indexerDocsUrls?: IndexerDocsURL[]; /** * Issuance rewards on the Graph Network for this chain */ issuanceRewards: boolean; /** * Symbol of the native token */ nativeToken?: string; /** * Whether the network is a mainnet/testnet/devnet */ networkType: NetworkType; /** * Relations to other networks in the registry */ relations?: Relation[]; /** * List of RPC URLs for the chain. Use {CUSTOM_API_KEY} as a placeholder for a private API * key */ rpcUrls?: string[]; /** * Second display name of the network, e.g. Sepolia, Nova */ secondName?: string; /** * Services available for the network in the ecosystem */ services: Services; /** * Short display name of the network, e.g. Ethereum, BNB */ shortName: string; /** * Token API specific configuration information */ tokenApi?: TokenAPI; } interface APIURL { /** * Kind of API */ kind: APIURLKind; url: string; } /** * Kind of API */ declare enum APIURLKind { Blockscout = "blockscout", Etherscan = "etherscan", Ethplorer = "ethplorer", Other = "other", Subscan = "subscan" } /** * Firehose block information */ interface Firehose { /** * Block features supported by the network */ blockFeatures?: string[]; /** * Block type, e.g. sf.ethereum.type.v2.Block */ blockType: string; /** * Protobuf definitions on buf.build, e.g. https://buf.build/streamingfast/firehose-ethereum */ bufUrl: string; /** * Bytes encoding, e.g. hex, 0xhex, base58 */ bytesEncoding: BytesEncoding; /** * [optional] Timestamp when the network was deprecated in Firehose software */ deprecatedAt?: Date; /** * [optional] Whether there is support for extended EVM block model */ evmExtendedModel?: boolean; /** * First available block information */ firstStreamableBlock?: FirstStreamableBlock; } /** * Bytes encoding, e.g. hex, 0xhex, base58 */ declare enum BytesEncoding { Base58 = "base58", Base64 = "base64", Hex = "hex", Other = "other", The0Xhex = "0xhex" } /** * First available block information */ interface FirstStreamableBlock { /** * Block height of the first streamable block. Can be different from genesis */ height: number; /** * Id of the first streamable block either in 0x-prefixed hex or base58 */ id: string; } /** * Graph Node specific configuration information */ interface GraphNode { /** * [optional] Timestamp when the network was deprecated in Graph Node software */ deprecatedAt?: Date; /** * [optional] Protocol name in graph-node, e.g. ethereum, near, arweave */ protocol?: Protocol; } /** * [optional] Protocol name in graph-node, e.g. ethereum, near, arweave */ declare enum Protocol { Arweave = "arweave", Cosmos = "cosmos", Ethereum = "ethereum", Near = "near", Other = "other", Starknet = "starknet" } /** * Icons for the network */ interface Icon { /** * Web3Icons icon - see https://github.com/0xa3k5/web3icons */ web3Icons?: Web3Icons; } /** * Web3Icons icon - see https://github.com/0xa3k5/web3icons */ interface Web3Icons { /** * Web3Icons icon ID */ name: string; /** * Variants of the icon, if none specified - all are available */ variants?: string[]; } interface IndexerDocsURL { /** * Docs description, e.g. Arbitrum 101 */ description?: string; /** * URL to the documentation, e.g. https://docs.infradao.com/archive-nodes-101/arbitrum */ url: string; } /** * Whether the network is a mainnet/testnet/devnet */ declare enum NetworkType { Beacon = "beacon", Devnet = "devnet", Mainnet = "mainnet", Testnet = "testnet" } interface Relation { /** * Kind of relation */ kind: RelationKind; /** * ID of the related network, e.g. mainnet, near-mainnet */ network: string; } /** * Kind of relation */ declare enum RelationKind { BeaconOf = "beaconOf", EvmOf = "evmOf", ForkedFrom = "forkedFrom", L2Of = "l2Of", Other = "other", ShardOf = "shardOf", SvmOf = "svmOf", TestnetOf = "testnetOf" } /** * Services available for the network in the ecosystem */ interface Services { /** * Firehose gRPC URLs, e.g. eth.firehose.pinax.network:443 */ firehose?: string[]; /** * Substreams-based subgraphs studio deployment URLs, e.g. https://api.thegraph.com/deploy */ sps?: string[]; /** * Subgraph studio deployment URLs, e.g. https://api.thegraph.com/deploy */ subgraphs?: string[]; /** * Substreams gRPC URLs, e.g. eth.substreams.pinax.network:443 */ substreams?: string[]; /** * Token API URLs, e.g. https://token-api.thegraph.com */ tokenApi?: string[]; } /** * Token API specific configuration information */ interface TokenAPI { /** * [optional] Timestamp when the network was deprecated in Token API software */ deprecatedAt?: Date; features?: Feature[]; /** * Network ID in Token API, has to be an ID or alias of an existing network */ networkId?: string; } /** * List of Token API features supported */ declare enum Feature { Dexes = "dexes", Nfts = "nfts", Other = "other", Tokens = "tokens" } declare class Convert { static toNetworksRegistryInner(json: string): NetworksRegistryInner; static networksRegistryInnerToJson(value: NetworksRegistryInner): string; } /** * Client for interacting with The Graph Networks Registry. * Provides methods to load the registry from json, file or URL. */ declare class NetworksRegistry { private registry; /** * Creates a new NetworksRegistry instance. * @param registry - The parsed NetworksRegistry data */ constructor(registry: NetworksRegistryInner); /** * Gets all networks in the registry. * @returns Array of all network elements */ get networks(): Network[]; /** * Gets the version of the loaded registry. * @returns Version string */ get version(): string; /** * Gets the date of the last update of the registry. * @returns Date object */ get updatedAt(): Date; /** * Attempts to fetch the registry from a given URL, returns null if fetch fails * @internal */ private static tryFetchRegistry; /** * Fetches and loads the latest version of the networks registry. First tries to fetch from * the primary registry URL at networks-registry.thegraph.com, then falls back to the fallback URL at GitHub * Uses the library version to determine the latest compatible registry URL. * Library version 0.5.x will use the latest registry version 0.5.y even if 0.6.z is available * * @returns Promise that resolves to a new NetworksRegistry instance * @throws Error if the registry fetch fails * * @example * ```typescript * const registry = await NetworksRegistry.fromLatestVersion(); * ``` */ static fromLatestVersion(): Promise; /** * Fetches and loads a specific version of the networks registry. First tries to fetch from * the primary registry URL at networks-registry.thegraph.com, then falls back to the fallback URL at GitHub * * @param version - The exact version to fetch (e.g. "0.5.0") * @returns Promise that resolves to a new NetworksRegistry instance * @throws Error if the registry fetch fails * * @example * ```typescript * const registry = await NetworksRegistry.fromExactVersion("0.5.0"); * ``` */ static fromExactVersion(version: string): Promise; /** * Loads the networks registry from a URL. * * @param url - The URL to fetch the registry from * @returns Promise that resolves to a new NetworksRegistry instance * @throws Error if the fetch fails or the response is invalid */ static fromUrl(url: string): Promise; /** * Creates a new registry instance from a JSON string. * * @param json - The JSON string containing registry data * @returns A new NetworksRegistry instance * @throws Error if the JSON is invalid */ static fromJson(json: string): NetworksRegistry; /** * Loads the networks registry from a local JSON file. * * @param path - Path to the JSON file * @returns A new NetworksRegistry instance * @throws Error if the file cannot be read or contains invalid data */ static fromFile(path: string): NetworksRegistry; /** * Gets the URL for the latest compatible version of the registry. * Uses the major and minor version from package.json. * * @returns The URL string for the latest version */ static getLatestVersionUrl(): string; /** * Gets the URL for the latest compatible version of the registry at GitHub. * Uses the major and minor version from package.json. * * @returns The URL string for the latest version */ static getLatestVersionFallbackUrl(): string; /** * Gets the URL for a specific version of the registry. * * @param version - The exact version (e.g. "0.5.0") * @returns The URL string for the specified version */ static getExactVersionUrl(version: string): string; /** * Gets the URL for a specific version of the registry at GitHub. * * @param version - The exact version (e.g. "0.5.0") * @returns The URL string for the specified version */ static getExactVersionFallbackUrl(version: string): string; /** * Finds a network by its unique identifier. * * @param id - The network ID (e.g. "mainnet", "optimism") * @returns The network if found, undefined otherwise * @deprecated Use getNetworkByGraphId instead * * @example * ```typescript * const mainnet = registry.getNetworkById("mainnet"); * ``` */ getNetworkById(id: string): Network | undefined; /** * Finds a network by its ID or one of its aliases. * * @param alias - The network ID or alias (e.g. "eth" for Ethereum mainnet) * @returns The network if found, undefined otherwise * @deprecated Use getNetworkByGraphId instead * * @example * ```typescript * const ethereum = registry.getNetworkByAlias("eth"); * ``` */ getNetworkByAlias(alias: string): Network | undefined; /** * Finds a network by its graph ID (either its ID field or one of its aliases). * * @param id - The graph ID, which could be either the network's ID or one of its aliases * @returns The network if found, undefined otherwise * * @example * ```typescript * const mainnet = registry.getNetworkByGraphId("mainnet"); * const ethereum = registry.getNetworkByGraphId("eth"); * ``` */ getNetworkByGraphId(id: string): Network | undefined; /** * Finds a network by its CAIP-2 chain ID. * * @param chainId - The CAIP-2 chain ID in the format "[namespace]:[reference]" (e.g., "eip155:1") * @returns The network if found, undefined otherwise * * @example * ```typescript * const ethereum = registry.getNetworkByCaip2Id("eip155:1"); * ``` */ getNetworkByCaip2Id(chainId: string): Network | undefined; /** * Gets API URLs for a network, filtered by kind and with environment variables applied. * Environment variable placeholders in the format {VARIABLE_NAME} will be replaced with * actual environment variable values. URLs that reference non-existent environment * variables will be omitted from the result. * * @param networkId - The network ID or alias * @param kinds - Optional array of API URL kinds to filter by. If not provided or empty, returns all kinds * @returns Array of API URLs with environment variables applied * * @example * ```typescript * // Get all Etherscan API URLs * const etherscanUrls = registry.getApiUrls("mainnet", [APIURLKind.Etherscan]); * * // Get all API URLs for the network * const allUrls = registry.getApiUrls("mainnet"); * ``` */ getApiUrls(networkId: string, kinds?: APIURLKind[]): string[]; /** * Gets RPC URLs for a network with environment variables applied. * Environment variable placeholders in the format {VARIABLE_NAME} will be replaced with * actual environment variable values. URLs that reference non-existent environment * variables will be omitted from the result. * * @param networkId - The network ID or alias * @returns Array of RPC URLs with environment variables applied * * @example * ```typescript * // Get all RPC URLs for ethereum mainnet * const rpcUrls = registry.getRpcUrls("mainnet"); * ``` */ getRpcUrls(networkId: string): string[]; } export { type APIURL, APIURLKind, BytesEncoding, Convert, Feature, type Firehose, type FirstStreamableBlock, type GraphNode, type Icon, type IndexerDocsURL, type Network, NetworkType, NetworksRegistry, type NetworksRegistryInner, Protocol, type Relation, RelationKind, type Services, type TokenAPI, type Web3Icons };