UNPKG

@hyperlane-xyz/registry

Version:

A collection of configs, artifacts, and schemas for Hyperlane

45 lines (44 loc) 2.3 kB
import type { Logger } from 'pino'; import type { ChainMap, ChainMetadata, ChainName, WarpCoreConfig, WarpRouteDeployConfig } from '@hyperlane-xyz/sdk'; import { ChainAddresses, UpdateChainParams, WarpRouteId } from '../types.js'; import { AddWarpRouteConfigOptions, RegistryType, type ChainFiles, type IRegistry, type RegistryContent } from '../registry/IRegistry.js'; import { SynchronousRegistry } from '../registry/SynchronousRegistry.js'; export interface FileSystemRegistryOptions { uri: string; logger?: Logger; } /** * A registry that uses a local file system path as its data source. * Requires file system access so it cannot be used in the browser. */ export declare class FileSystemRegistry extends SynchronousRegistry implements IRegistry { readonly type = RegistryType.FileSystem; constructor(options: FileSystemRegistryOptions); getUri(itemPath?: string): string; /** * Retrieves filepaths for chains, warp core, and warp deploy configs */ listRegistryContent(): RegistryContent; getMetadata(): ChainMap<ChainMetadata>; getAddresses(): ChainMap<ChainAddresses>; removeChain(chainName: ChainName): void; addWarpRoute(config: WarpCoreConfig, options?: AddWarpRouteConfigOptions): void; addWarpRouteConfig(warpConfig: WarpRouteDeployConfig, options: AddWarpRouteConfigOptions): void; protected listFiles(dirPath: string): string[]; protected createOrUpdateChain(chain: UpdateChainParams): void; protected createChainFile(chainName: ChainName, fileName: keyof ChainFiles, data: any, cache: ChainMap<any>, prefix?: string): void; protected createFile(file: { filePath: string; data: string; }): void; protected removeFiles(filePaths: string[]): void; protected getWarpRoutesForIds(ids: WarpRouteId[]): WarpCoreConfig[]; protected getWarpDeployConfigForIds(ids: WarpRouteId[]): WarpRouteDeployConfig[]; /** * Reads config files for the given WarpRouteIds. * @param ids - The WarpRouteIds to read configs for. * @param configURIs - A mapping of WarpRouteIds to file paths where the configs are stored. * @returns An array of config objects. */ protected readConfigsForIds<Config>(ids: WarpRouteId[], configURIs: Record<WarpRouteId, string>): Config[]; }