import { WithAddress } from '@hyperlane-xyz/utils'; import { IsmType as AltVMIsmType } from './altvm.js'; import { Artifact, ArtifactDeployed, ArtifactNew, ConfigOnChain, IArtifactManager } from './artifact.js'; import { ChainLookup } from './chain.js'; export type IsmModuleType = { config: IsmConfig; derived: DerivedIsmConfig; addresses: IsmModuleAddresses; }; export interface IsmConfigs { domainRoutingIsm: DomainRoutingIsmConfig; merkleRootMultisigIsm: MultisigIsmConfig; messageIdMultisigIsm: MultisigIsmConfig; testIsm: TestIsmConfig; } export type IsmType = keyof IsmConfigs; export type IsmConfig = IsmConfigs[IsmType]; export type DerivedIsmConfig = WithAddress; export declare const STATIC_ISM_TYPES: IsmType[]; export interface MultisigIsmConfig { type: 'merkleRootMultisigIsm' | 'messageIdMultisigIsm'; validators: string[]; threshold: number; } export interface TestIsmConfig { type: 'testIsm'; } export interface DomainRoutingIsmConfig { type: 'domainRoutingIsm'; owner: string; domains: Record; } export type IsmModuleAddresses = { deployedIsm: string; mailbox: string; }; export interface DeployedIsmAddress { address: string; } export interface IsmArtifactConfigs { domainRoutingIsm: RoutingIsmArtifactConfig; merkleRootMultisigIsm: MultisigIsmConfig; messageIdMultisigIsm: MultisigIsmConfig; testIsm: TestIsmConfig; } /** * Should be used for the specific artifact code that * deploys or reads any kind of ISM and its nested configs (Routing, Aggregation, ...) */ export type IsmArtifactConfig = IsmArtifactConfigs[IsmType]; /** * Describes the configuration of deployed ISM and its nested configs (Routing, Aggregation, ...) */ export type DeployedIsmArtifact = ArtifactDeployed; /** * Should be used to implement an object/closure or class that is in charge of coordinating * deployment of an ISM config which might include nested ISM deployments (Routing, Aggregation, ...) */ export type IIsmArtifactManager = IArtifactManager; export interface RoutingIsmArtifactConfig { type: 'domainRoutingIsm'; owner: string; domains: Record>; } export type RawRoutingIsmArtifactConfig = ConfigOnChain; export interface RawIsmArtifactConfigs { domainRoutingIsm: RawRoutingIsmArtifactConfig; merkleRootMultisigIsm: MultisigIsmConfig; messageIdMultisigIsm: MultisigIsmConfig; testIsm: TestIsmConfig; } /** * Should be used for the specific artifact code that * deploys or reads a single artifact on chain */ export type RawIsmArtifactConfig = RawIsmArtifactConfigs[IsmType]; /** * Describes the configuration of deployed ISM without nested config expansion (Routing, Aggregation, ...) */ export type DeployedRawIsmArtifact = ArtifactDeployed; /** * Should be used to implement an object/closure or class that individually deploys * ISMs on chain */ export interface IRawIsmArtifactManager extends IArtifactManager { /** * Read any ISM by detecting its type and delegating to the appropriate reader. * This is the generic entry point for reading ISMs of unknown types. * @param address The on-chain address of the ISM * @returns The artifact configuration and deployment data */ readIsm(address: string): Promise; } /** * Determines if a new ISM should be deployed instead of updating the existing one. * Deploy new ISM if: * - ISM type changed * - ISM config changed (for static/immutable ISMs: multisig, testIsm) * * For routing ISMs, config changes don't trigger redeployment as they support updates. * * @param actual The current deployed ISM configuration * @param expected The desired ISM configuration * @returns true if a new ISM should be deployed, false if existing can be updated */ export declare function shouldDeployNewIsm(actual: IsmArtifactConfig, expected: IsmArtifactConfig): boolean; /** * Merges current (on-chain) and expected ISM artifacts, preserving DEPLOYED state * for unchanged nested ISMs in routing configurations. * * This prevents unnecessary redeployment of domain ISMs when only mutable properties * (like routing ISM owner) change. * * @param currentArtifact Deployed ISM artifact from chain (undefined if not deployed) * @param expectedArtifact Expected ISM configuration (from user config) * @returns Merged artifact with appropriate deployment states */ export declare function mergeIsmArtifacts(currentArtifact: DeployedIsmArtifact | undefined, expectedArtifact: ArtifactNew | DeployedIsmArtifact): ArtifactNew | DeployedIsmArtifact; export declare function altVMIsmTypeToProviderSdkType(altVMType: AltVMIsmType): IsmType; export declare function ismArtifactToDerivedConfig(artifact: DeployedIsmArtifact, chainLookup: ChainLookup): DerivedIsmConfig; /** * Converts IsmConfig (Config API) to IsmArtifactConfig (Artifact API). * * Key transformations: * - String chain names → numeric domain IDs (for routing ISM domains) * - Address string references → ArtifactUnderived objects * - Recursively handles nested routing ISM configurations * - Other ISM types (multisig, testIsm) pass through unchanged * * @param config The ISM configuration using Config API format * @param chainLookup Chain lookup interface for resolving chain names to domain IDs * @returns Artifact wrapper around IsmArtifactConfig suitable for artifact writers * * @example * ```typescript * // Config API format * const ismConfig: IsmConfig = { * type: 'domainRoutingIsm', * owner: '0x123...', * domains: { * ethereum: { type: 'merkleRootMultisigIsm', validators: [...], threshold: 2 }, * polygon: '0xabc...' // address reference * } * }; * * // Convert to Artifact API format * const artifact = ismConfigToArtifact(ismConfig, chainLookup); * // artifact.config.domains is now Record> * // with numeric domain IDs and properly wrapped nested configs * ``` */ export declare function ismConfigToArtifact(config: IsmConfig, chainLookup: ChainLookup): ArtifactNew; //# sourceMappingURL=ism.d.ts.map