UNPKG

@hyperlane-xyz/sdk

Version:

The official SDK for the Hyperlane Network

455 lines 16.3 kB
import { z } from 'zod'; import { AbstractCcipReadIsm, ArbL2ToL1Ism, CCIPIsm, IAggregationIsm, IInterchainSecurityModule, IMultisigIsm, IRoutingIsm, IStaticWeightedMultisigIsm, InterchainAccountRouter, OPStackIsm, PausableIsm, TestIsm, TrustedRelayerIsm } from '@hyperlane-xyz/core'; import type { Address, Domain, ValueOf, WithAddress } from '@hyperlane-xyz/utils'; import { ChainMap, OwnableConfig } from '../types.js'; export declare enum ModuleType { UNUSED = 0, ROUTING = 1, AGGREGATION = 2, LEGACY_MULTISIG = 3,// DEPRECATED MERKLE_ROOT_MULTISIG = 4, MESSAGE_ID_MULTISIG = 5, NULL = 6, CCIP_READ = 7, ARB_L2_TO_L1 = 8, WEIGHTED_MERKLE_ROOT_MULTISIG = 9, WEIGHTED_MESSAGE_ID_MULTISIG = 10 } export declare const IsmType: { readonly CUSTOM: "custom"; readonly OP_STACK: "opStackIsm"; readonly ROUTING: "domainRoutingIsm"; readonly FALLBACK_ROUTING: "defaultFallbackRoutingIsm"; readonly AMOUNT_ROUTING: "amountRoutingIsm"; readonly INTERCHAIN_ACCOUNT_ROUTING: "interchainAccountRouting"; readonly AGGREGATION: "staticAggregationIsm"; readonly STORAGE_AGGREGATION: "storageAggregationIsm"; readonly MERKLE_ROOT_MULTISIG: "merkleRootMultisigIsm"; readonly MESSAGE_ID_MULTISIG: "messageIdMultisigIsm"; readonly STORAGE_MERKLE_ROOT_MULTISIG: "storageMerkleRootMultisigIsm"; readonly STORAGE_MESSAGE_ID_MULTISIG: "storageMessageIdMultisigIsm"; readonly TEST_ISM: "testIsm"; readonly PAUSABLE: "pausableIsm"; readonly TRUSTED_RELAYER: "trustedRelayerIsm"; readonly ARB_L2_TO_L1: "arbL2ToL1Ism"; readonly WEIGHTED_MERKLE_ROOT_MULTISIG: "weightedMerkleRootMultisigIsm"; readonly WEIGHTED_MESSAGE_ID_MULTISIG: "weightedMessageIdMultisigIsm"; readonly CCIP: "ccipIsm"; readonly OFFCHAIN_LOOKUP: "offchainLookupIsm"; }; export type IsmType = (typeof IsmType)[keyof typeof IsmType]; export declare const MUTABLE_ISM_TYPE: IsmType[]; /** * @notice Statically deployed ISM types * @dev ISM types with immutable config embedded in contract bytecode via MetaProxy */ export declare const STATIC_ISM_TYPES: IsmType[]; export declare const DYNAMICALLY_ROUTED_ISM_TYPES: readonly ["amountRoutingIsm", "interchainAccountRouting"]; /** Type guard for dynamically routed ISM types */ export declare function isDynamicallyRoutedIsmType(type: IsmType): type is (typeof DYNAMICALLY_ROUTED_ISM_TYPES)[number]; export declare function ismTypeToModuleType(ismType: IsmType): ModuleType; export type ValidatorConfig = { address: Address; alias: string; }; export type MultisigConfig = { validators: Array<ValidatorConfig>; threshold: number; }; export type MultisigIsmConfig = z.infer<typeof MultisigIsmConfigSchema>; export type WeightedMultisigIsmConfig = z.infer<typeof WeightedMultisigIsmConfigSchema>; export type TestIsmConfig = z.infer<typeof TestIsmConfigSchema>; export type PausableIsmConfig = z.infer<typeof PausableIsmConfigSchema>; export type OpStackIsmConfig = z.infer<typeof OpStackIsmConfigSchema>; export type TrustedRelayerIsmConfig = z.infer<typeof TrustedRelayerIsmConfigSchema>; export type CCIPIsmConfig = z.infer<typeof CCIPIsmConfigSchema>; export type ArbL2ToL1IsmConfig = z.infer<typeof ArbL2ToL1IsmConfigSchema>; export type OffchainLookupIsmConfig = z.infer<typeof OffchainLookupIsmConfigSchema>; export type NullIsmConfig = TestIsmConfig | PausableIsmConfig | OpStackIsmConfig | TrustedRelayerIsmConfig | CCIPIsmConfig; type BaseRoutingIsmConfig<T extends typeof IsmType.ROUTING | typeof IsmType.FALLBACK_ROUTING | typeof IsmType.AMOUNT_ROUTING | typeof IsmType.INTERCHAIN_ACCOUNT_ROUTING> = { type: T; }; export type DomainRoutingIsmConfig = BaseRoutingIsmConfig<typeof IsmType.ROUTING | typeof IsmType.FALLBACK_ROUTING> & OwnableConfig & { domains: ChainMap<IsmConfig>; }; export declare const InterchainAccountRouterIsmSchema: z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { type: z.ZodLiteral<"interchainAccountRouting">; isms: z.ZodRecord<z.ZodString, z.ZodString>; }, "strip", z.ZodTypeAny, { type: "interchainAccountRouting"; owner: string; isms: Record<string, string>; ownerOverrides?: Record<string, string> | undefined; }, { type: "interchainAccountRouting"; owner: string; isms: Record<string, string>; ownerOverrides?: Record<string, string> | undefined; }>; export type InterchainAccountRouterIsm = z.infer<typeof InterchainAccountRouterIsmSchema>; export type AmountRoutingIsmConfig = BaseRoutingIsmConfig<typeof IsmType.AMOUNT_ROUTING> & { lowerIsm: IsmConfig; upperIsm: IsmConfig; threshold: number; }; export type RoutingIsmConfig = DomainRoutingIsmConfig | AmountRoutingIsmConfig | InterchainAccountRouterIsm; export type AggregationIsmConfig = { type: typeof IsmType.AGGREGATION | typeof IsmType.STORAGE_AGGREGATION; modules: Array<IsmConfig>; threshold: number; }; export type IsmConfig = z.infer<typeof IsmConfigSchema>; export type DerivedIsmConfig = WithAddress<Exclude<IsmConfig, Address>>; export type DeployedIsmType = { [IsmType.CUSTOM]: IInterchainSecurityModule; [IsmType.ROUTING]: IRoutingIsm; [IsmType.FALLBACK_ROUTING]: IRoutingIsm; [IsmType.AMOUNT_ROUTING]: IRoutingIsm; [IsmType.AGGREGATION]: IAggregationIsm; [IsmType.STORAGE_AGGREGATION]: IAggregationIsm; [IsmType.MERKLE_ROOT_MULTISIG]: IMultisigIsm; [IsmType.MESSAGE_ID_MULTISIG]: IMultisigIsm; [IsmType.STORAGE_MERKLE_ROOT_MULTISIG]: IMultisigIsm; [IsmType.STORAGE_MESSAGE_ID_MULTISIG]: IMultisigIsm; [IsmType.OP_STACK]: OPStackIsm; [IsmType.TEST_ISM]: TestIsm; [IsmType.PAUSABLE]: PausableIsm; [IsmType.TRUSTED_RELAYER]: TrustedRelayerIsm; [IsmType.CCIP]: CCIPIsm; [IsmType.ARB_L2_TO_L1]: ArbL2ToL1Ism; [IsmType.WEIGHTED_MERKLE_ROOT_MULTISIG]: IStaticWeightedMultisigIsm; [IsmType.WEIGHTED_MESSAGE_ID_MULTISIG]: IStaticWeightedMultisigIsm; [IsmType.OFFCHAIN_LOOKUP]: AbstractCcipReadIsm; [IsmType.INTERCHAIN_ACCOUNT_ROUTING]: InterchainAccountRouter; }; export type DeployedIsm = ValueOf<DeployedIsmType>; export type RoutingIsmDelta = { domainsToUnenroll: Domain[]; domainsToEnroll: Domain[]; owner?: Address; mailbox?: Address; }; export declare const TestIsmConfigSchema: z.ZodObject<{ type: z.ZodLiteral<"testIsm">; }, "strip", z.ZodTypeAny, { type: "testIsm"; }, { type: "testIsm"; }>; export declare const MultisigConfigSchema: z.ZodObject<{ validators: z.ZodArray<z.ZodString, "many">; threshold: z.ZodNumber; }, "strip", z.ZodTypeAny, { threshold: number; validators: string[]; }, { threshold: number; validators: string[]; }>; export declare const WeightedMultisigConfigSchema: z.ZodObject<{ validators: z.ZodArray<z.ZodObject<{ signingAddress: z.ZodString; weight: z.ZodNumber; }, "strip", z.ZodTypeAny, { signingAddress: string; weight: number; }, { signingAddress: string; weight: number; }>, "many">; thresholdWeight: z.ZodNumber; }, "strip", z.ZodTypeAny, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }>; export declare const TrustedRelayerIsmConfigSchema: z.ZodObject<{ type: z.ZodLiteral<"trustedRelayerIsm">; relayer: z.ZodString; }, "strip", z.ZodTypeAny, { type: "trustedRelayerIsm"; relayer: string; }, { type: "trustedRelayerIsm"; relayer: string; }>; export declare const CCIPIsmConfigSchema: z.ZodObject<{ type: z.ZodLiteral<"ccipIsm">; originChain: z.ZodString; }, "strip", z.ZodTypeAny, { type: "ccipIsm"; originChain: string; }, { type: "ccipIsm"; originChain: string; }>; export declare const OffchainLookupIsmConfigSchema: z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { type: z.ZodLiteral<"offchainLookupIsm">; urls: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { type: "offchainLookupIsm"; owner: string; urls: string[]; ownerOverrides?: Record<string, string> | undefined; }, { type: "offchainLookupIsm"; owner: string; urls: string[]; ownerOverrides?: Record<string, string> | undefined; }>; export declare const isOffchainLookupIsmConfig: (config: unknown) => config is { type: "offchainLookupIsm"; owner: string; urls: string[]; ownerOverrides?: Record<string, string> | undefined; }; export declare const OpStackIsmConfigSchema: z.ZodObject<{ type: z.ZodLiteral<"opStackIsm">; origin: z.ZodString; nativeBridge: z.ZodString; }, "strip", z.ZodTypeAny, { type: "opStackIsm"; nativeBridge: string; origin: string; }, { type: "opStackIsm"; nativeBridge: string; origin: string; }>; export declare const ArbL2ToL1IsmConfigSchema: z.ZodObject<{ type: z.ZodLiteral<"arbL2ToL1Ism">; bridge: z.ZodString; }, "strip", z.ZodTypeAny, { type: "arbL2ToL1Ism"; bridge: string; }, { type: "arbL2ToL1Ism"; bridge: string; }>; export declare const PausableIsmConfigSchema: z.ZodIntersection<z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { paused: z.ZodBoolean; }, "strip", z.ZodTypeAny, { owner: string; paused: boolean; ownerOverrides?: Record<string, string> | undefined; }, { owner: string; paused: boolean; ownerOverrides?: Record<string, string> | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"pausableIsm">; }, "strip", z.ZodTypeAny, { type: "pausableIsm"; }, { type: "pausableIsm"; }>>; export declare const MultisigIsmConfigSchema: z.ZodIntersection<z.ZodObject<{ validators: z.ZodArray<z.ZodString, "many">; threshold: z.ZodNumber; }, "strip", z.ZodTypeAny, { threshold: number; validators: string[]; }, { threshold: number; validators: string[]; }>, z.ZodObject<{ type: z.ZodUnion<[z.ZodLiteral<"merkleRootMultisigIsm">, z.ZodLiteral<"messageIdMultisigIsm">, z.ZodLiteral<"storageMerkleRootMultisigIsm">, z.ZodLiteral<"storageMessageIdMultisigIsm">]>; }, "strip", z.ZodTypeAny, { type: "merkleRootMultisigIsm" | "messageIdMultisigIsm" | "storageMerkleRootMultisigIsm" | "storageMessageIdMultisigIsm"; }, { type: "merkleRootMultisigIsm" | "messageIdMultisigIsm" | "storageMerkleRootMultisigIsm" | "storageMessageIdMultisigIsm"; }>>; export declare const WeightedMultisigIsmConfigSchema: z.ZodIntersection<z.ZodObject<{ validators: z.ZodArray<z.ZodObject<{ signingAddress: z.ZodString; weight: z.ZodNumber; }, "strip", z.ZodTypeAny, { signingAddress: string; weight: number; }, { signingAddress: string; weight: number; }>, "many">; thresholdWeight: z.ZodNumber; }, "strip", z.ZodTypeAny, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }>, z.ZodObject<{ type: z.ZodUnion<[z.ZodLiteral<"weightedMerkleRootMultisigIsm">, z.ZodLiteral<"weightedMessageIdMultisigIsm">]>; }, "strip", z.ZodTypeAny, { type: "weightedMerkleRootMultisigIsm" | "weightedMessageIdMultisigIsm"; }, { type: "weightedMerkleRootMultisigIsm" | "weightedMessageIdMultisigIsm"; }>>; export declare const RoutingIsmConfigSchema: z.ZodSchema<RoutingIsmConfig>; export declare const AggregationIsmConfigSchema: z.ZodSchema<AggregationIsmConfig>; export declare const IsmConfigSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{ type: z.ZodLiteral<"testIsm">; }, "strip", z.ZodTypeAny, { type: "testIsm"; }, { type: "testIsm"; }>, z.ZodObject<{ type: z.ZodLiteral<"opStackIsm">; origin: z.ZodString; nativeBridge: z.ZodString; }, "strip", z.ZodTypeAny, { type: "opStackIsm"; nativeBridge: string; origin: string; }, { type: "opStackIsm"; nativeBridge: string; origin: string; }>, z.ZodIntersection<z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { paused: z.ZodBoolean; }, "strip", z.ZodTypeAny, { owner: string; paused: boolean; ownerOverrides?: Record<string, string> | undefined; }, { owner: string; paused: boolean; ownerOverrides?: Record<string, string> | undefined; }>, z.ZodObject<{ type: z.ZodLiteral<"pausableIsm">; }, "strip", z.ZodTypeAny, { type: "pausableIsm"; }, { type: "pausableIsm"; }>>, z.ZodObject<{ type: z.ZodLiteral<"trustedRelayerIsm">; relayer: z.ZodString; }, "strip", z.ZodTypeAny, { type: "trustedRelayerIsm"; relayer: string; }, { type: "trustedRelayerIsm"; relayer: string; }>, z.ZodObject<{ type: z.ZodLiteral<"ccipIsm">; originChain: z.ZodString; }, "strip", z.ZodTypeAny, { type: "ccipIsm"; originChain: string; }, { type: "ccipIsm"; originChain: string; }>, z.ZodIntersection<z.ZodObject<{ validators: z.ZodArray<z.ZodString, "many">; threshold: z.ZodNumber; }, "strip", z.ZodTypeAny, { threshold: number; validators: string[]; }, { threshold: number; validators: string[]; }>, z.ZodObject<{ type: z.ZodUnion<[z.ZodLiteral<"merkleRootMultisigIsm">, z.ZodLiteral<"messageIdMultisigIsm">, z.ZodLiteral<"storageMerkleRootMultisigIsm">, z.ZodLiteral<"storageMessageIdMultisigIsm">]>; }, "strip", z.ZodTypeAny, { type: "merkleRootMultisigIsm" | "messageIdMultisigIsm" | "storageMerkleRootMultisigIsm" | "storageMessageIdMultisigIsm"; }, { type: "merkleRootMultisigIsm" | "messageIdMultisigIsm" | "storageMerkleRootMultisigIsm" | "storageMessageIdMultisigIsm"; }>>, z.ZodIntersection<z.ZodObject<{ validators: z.ZodArray<z.ZodObject<{ signingAddress: z.ZodString; weight: z.ZodNumber; }, "strip", z.ZodTypeAny, { signingAddress: string; weight: number; }, { signingAddress: string; weight: number; }>, "many">; thresholdWeight: z.ZodNumber; }, "strip", z.ZodTypeAny, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }, { validators: { signingAddress: string; weight: number; }[]; thresholdWeight: number; }>, z.ZodObject<{ type: z.ZodUnion<[z.ZodLiteral<"weightedMerkleRootMultisigIsm">, z.ZodLiteral<"weightedMessageIdMultisigIsm">]>; }, "strip", z.ZodTypeAny, { type: "weightedMerkleRootMultisigIsm" | "weightedMessageIdMultisigIsm"; }, { type: "weightedMerkleRootMultisigIsm" | "weightedMessageIdMultisigIsm"; }>>, z.ZodType<RoutingIsmConfig, z.ZodTypeDef, RoutingIsmConfig>, z.ZodType<AggregationIsmConfig, z.ZodTypeDef, AggregationIsmConfig>, z.ZodObject<{ type: z.ZodLiteral<"arbL2ToL1Ism">; bridge: z.ZodString; }, "strip", z.ZodTypeAny, { type: "arbL2ToL1Ism"; bridge: string; }, { type: "arbL2ToL1Ism"; bridge: string; }>, z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { type: z.ZodLiteral<"offchainLookupIsm">; urls: z.ZodArray<z.ZodString, "many">; }, "strip", z.ZodTypeAny, { type: "offchainLookupIsm"; owner: string; urls: string[]; ownerOverrides?: Record<string, string> | undefined; }, { type: "offchainLookupIsm"; owner: string; urls: string[]; ownerOverrides?: Record<string, string> | undefined; }>, z.ZodObject<{ owner: z.ZodString; ownerOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; } & { type: z.ZodLiteral<"interchainAccountRouting">; isms: z.ZodRecord<z.ZodString, z.ZodString>; }, "strip", z.ZodTypeAny, { type: "interchainAccountRouting"; owner: string; isms: Record<string, string>; ownerOverrides?: Record<string, string> | undefined; }, { type: "interchainAccountRouting"; owner: string; isms: Record<string, string>; ownerOverrides?: Record<string, string> | undefined; }>]>; export {}; //# sourceMappingURL=types.d.ts.map