@fuel-infrastructure/fuel-hyperlane-registry
Version:
A collection of configs, artifacts, and schemas for Hyperlane
65 lines (64 loc) • 2.97 kB
TypeScript
import type { Logger } from 'pino';
import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk';
import { ChainAddresses, WarpDeployConfigMap, WarpRouteConfigMap } from '../types.js';
import { BaseRegistry } from './BaseRegistry.js';
import { ChainFiles, IRegistry, RegistryContent, RegistryType, UpdateChainParams, WarpRouteFilterParams } from './IRegistry.js';
export interface GithubRegistryOptions {
uri?: string;
proxyUrl?: string;
branch?: string;
authToken?: string;
logger?: Logger;
}
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";
/**
* 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;
private readonly baseApiHeaders;
constructor(options?: GithubRegistryOptions);
getUri(itemPath?: string): string;
listRegistryContent(): Promise<RegistryContent>;
getChains(): Promise<Array<ChainName>>;
getMetadata(): Promise<ChainMap<ChainMetadata>>;
getChainMetadata(chainName: ChainName): Promise<ChainMetadata | null>;
getAddresses(): Promise<ChainMap<ChainAddresses>>;
getChainAddresses(chainName: ChainName): Promise<ChainAddresses | null>;
addChain(_chains: UpdateChainParams): Promise<void>;
updateChain(_chains: UpdateChainParams): Promise<void>;
removeChain(_chains: ChainName): Promise<void>;
getWarpRoute(routeId: string): Promise<WarpCoreConfig | null>;
getWarpDeployConfig(routeId: string): Promise<WarpRouteDeployConfig | null>;
getWarpRoutes(filter?: WarpRouteFilterParams): Promise<WarpRouteConfigMap>;
getWarpDeployConfigs(filter?: WarpRouteFilterParams): Promise<WarpDeployConfigMap>;
protected readConfigs<ConfigMap>(routeIds: string[], routeConfigUrls: string[]): Promise<Record<string, ConfigMap>>;
addWarpRoute(_config: WarpCoreConfig): Promise<void>;
getApiUrl(): Promise<string>;
getApiRateLimit(): Promise<GithubRateResponse['resources']['core']>;
protected getRawContentUrl(path: string): string;
protected fetchChainFile<T>(fileName: keyof ChainFiles, chainName: ChainName): Promise<T | null>;
protected fetchYamlFiles<T>(urls: string[]): Promise<T[]>;
protected fetchYamlFile<T>(url: string): Promise<T>;
protected fetch(url: string): Promise<Response>;
}
export {};