import type { ChainMetadata } from '@hyperlane-xyz/sdk/metadata/chainMetadataTypes'; import type { WarpRouteDeployConfig } from '@hyperlane-xyz/sdk/token/types'; import type { ChainMap, ChainName } from '@hyperlane-xyz/sdk/types'; import type { WarpCoreConfig } from '@hyperlane-xyz/sdk/warp/types'; import type { Logger } from 'pino'; import { AddWarpRouteConfigOptions, ChainAddresses, UpdateChainParams, WarpDeployConfigMap, WarpRouteConfigMap, WarpRouteFilterParams } from '../types.js'; import { BaseRegistry } from './BaseRegistry.js'; import { ChainFiles, IRegistry, IRegistryMethods, RegistryContent, RegistryType } from './IRegistry.js'; export interface GithubRegistryOptions { uri?: string; proxyUrl?: string; branch?: string; authToken?: string; logger?: Logger; /** * Override browser detection. Defaults to true if running in a browser environment. */ isBrowser?: boolean; } type GithubRateResponse = { resources: { core: { limit: number; used: number; remaining: number; reset: number; }; }; }; export declare const GITHUB_API_URL = "https://api.github.com"; export declare const GITHUB_API_VERSION = "2022-11-28"; export declare class GithubFetchError extends Error { readonly status: number; readonly statusText: string; constructor(response: Response); } /** * A registry that uses a github repository as its data source. * Reads are performed via the github API and github's raw content URLs. * Writes are not yet supported (TODO) */ export declare class GithubRegistry extends BaseRegistry implements IRegistry { readonly type = RegistryType.Github; readonly url: URL; readonly branch: string; readonly repoOwner: string; readonly repoName: string; readonly proxyUrl: string | undefined; private readonly authToken; /** True when running in a browser environment (overridable via options). */ private readonly isBrowser; private archiveEntries?; private archiveEntriesPromise?; readonly unimplementedMethods: Set; private readonly baseApiHeaders; constructor(options?: GithubRegistryOptions); getUri(itemPath?: string): string; listRegistryContent(): Promise; getChains(): Promise>; getMetadata(): Promise>; getChainMetadata(chainName: ChainName): Promise; getAddresses(): Promise>; getChainAddresses(chainName: ChainName): Promise; addChain(_chains: UpdateChainParams): Promise; updateChain(_chains: UpdateChainParams): Promise; removeChain(_chains: ChainName): Promise; getWarpRoute(routeId: string): Promise; getWarpDeployConfig(routeId: string): Promise; getWarpRoutes(filter?: WarpRouteFilterParams): Promise; getWarpDeployConfigs(filter?: WarpRouteFilterParams): Promise; protected readConfigs(routeIds: string[], routeConfigUrls: string[]): Promise>; addWarpRoute(_config: WarpCoreConfig): Promise; addWarpRouteConfig(_config: WarpRouteDeployConfig, _options: AddWarpRouteConfigOptions): Promise; getApiUrl(): Promise; getApiRateLimit(): Promise; protected getRawContentUrl(path: string): string; protected fetchChainFile(fileName: keyof ChainFiles, chainName: ChainName): Promise; protected fetchYamlFiles(urls: string[]): Promise; /** * Returns an array of URLs to download the repository zip archive. * If authToken is set, returns the GitHub API zipball endpoint URL only. * Otherwise returns public archive URLs for branch, tag, and commit-SHA fallbacks. */ protected getArchiveDownloadUrls(): Promise; /** * Ensure the repository archive is downloaded and entries are cached in memory. */ protected ensureArchiveEntries(): Promise; /** * Fetch a YAML file, using in-memory archive if available for raw content paths. */ protected fetchYamlFile(url: string): Promise; protected fetch(url: string): Promise; } export {};