import { Address, WithAddress } from '@hyperlane-xyz/utils'; import { TokenType } from '../token/config.js'; import { DelayedFlowRouterHookIsmConfig, IsmConfig, NetFlowRateLimitedHookIsmConfig } from '../ism/types.js'; type ChainAddresses = Record; export declare function ismTreeContainsRateLimited(ism: IsmConfig): boolean; /** * True if a `rateLimited` node appears anywhere inside a `compositeIsm` in * the tree. * * Deliberately separate from {@link ismTreeContainsRateLimited} rather than * folded into it: that predicate gates the EVM `rateLimitedIsm`'s * deferred-deploy machinery, which asserts an Ethereum/Tron chain * (`resolveWarpIsmAndHook` and its callers in `deploy/warp.ts`). A * compositeIsm is a Sealevel program and must never enter those paths. */ export declare function ismTreeContainsCompositeRateLimited(ism: IsmConfig): boolean; /** * Recursively sets `recipient` on all RATE_LIMITED ISM nodes in the config tree. * Pass `undefined` to strip the field. * `defaultOwner` is set on nodes that don't have an explicit owner. */ export declare function setRateLimitedIsmRecipient(ismConfig: IsmConfig, recipient: Address | undefined, defaultOwner?: string): IsmConfig; export type HybridHookIsmConfig = NetFlowRateLimitedHookIsmConfig | DelayedFlowRouterHookIsmConfig; /** * True if a warp-route hybrid hook/ISM node (NET_FLOW_RATE_LIMITED or * DELAYED_FLOW_ROUTER) exists anywhere in the ISM config tree. */ export declare function ismTreeContainsHybridHookIsm(ism: IsmConfig | undefined): boolean; /** * True if a MAILBOX_DEFAULT or hybrid hook/ISM node exists anywhere in the * tree. Used to keep warp-route-only and self-referential ISM types out of * core default-ISM configs (see core/types.ts). */ export declare function ismTreeContainsMailboxDefaultOrHybrid(ism: IsmConfig): boolean; /** * Deep-collects every hybrid hook/ISM node in an ISM config tree (including * derived trees, whose nodes additionally carry an `address` field). */ export declare function collectHybridIsmNodes(ism: IsmConfig): HybridHookIsmConfig[]; /** * Recursively maps every hybrid hook/ISM node in an ISM config tree * (traversing aggregation/routing/amount-routing containers), leaving all * other nodes untouched. */ export declare function mapHybridIsmNodes(ismConfig: IsmConfig, mapNode: (node: HybridHookIsmConfig) => IsmConfig): IsmConfig; /** * Rejects combining a predicate wrapper with a hybrid hook/ISM. * * Both want to own the router's hook slot: the hybrid instance must BE the * hook (shared bucket state with its ISM role), while the predicate wrapper * installs `aggregation([wrapper, previousHook])`. Nesting the hybrid inside * that aggregation is mechanically possible — StaticAggregationHook forwards * each child its own `quoteDispatch` amount, which is what the hybrid's nested * `_Router_dispatch` needs — but only on the native-fee path: when the * dispatch metadata names a non-zero `feeToken`, the aggregation passes * `value: 0` to every child, starving the hybrid's nested dispatch. Until that * path is verified at the contract level, the combination is rejected rather * than silently producing a route whose policy hook or flow limiter is * missing from the dispatch path. * * TODO(hybrid+predicate composition verified): allow composing the two by * threading the hybrid address into PredicateWrapperDeployer.deployAndConfigure * as `existingHookOverride`. */ export declare function assertNoPredicateWrapperWithHybridIsm(chain: string, config: unknown): void; /** * Rejects a hybrid hook/ISM on a router implementation it cannot meter. * * Enforced on every path that can install a hybrid on a router — deploy * (assertHybridIsmDeployConstraints) and `warp apply` * (EvmWarpModule.createHookAndPredicateUpdateTxs). A hybrid on, say, a * collateralVault router deploys fine (the constructor only reads `token()`) * and then reverts on every dispatch and delivery, because `localCollateral()` * calls `totalAssets()` on a router that is not an `LpCollateralRouter`. */ export declare function assertHybridIsmTokenTypeSupported(chain: string, type: TokenType | undefined): void; /** * Replaces every hybrid hook/ISM node in an ISM tree with the address of the * already-deployed instance. * * The hybrid leaf is deployed exactly once per chain and shared between the * router's hook and ISM surfaces, so the parent tree handed to EvmIsmModule * must reference it by address rather than re-declaring it — otherwise the * parent deploy would mint a second instance with its own bucket state. * Sibling of `resolveHybridHookNodesToAddress` on the hook surface. */ export declare function resolveHybridIsmNodesToAddress(ismConfig: IsmConfig, address: Address): IsmConfig; /** * Collapses only derived hybrid nodes that already name `address`. * Used when comparing an on-chain tree with a target whose shared hybrid leaf * is intentionally opaque; an older leaf must remain visible as a difference. */ export declare function collapseMatchingHybridIsmNodes(ismConfig: IsmConfig, address: Address): IsmConfig; /** * The comparable form of a hybrid hook/ISM node: the fields that identify the * contract instance the config asks for, with addresses lowercased, `duration` * stringified (it parses to a bigint, which `deepEquals` cannot compare across * separately-parsed copies) and `remoteIsms` canonicalized. * * A hybrid is declared on BOTH the hook and the ISM surface of the same * router, and one instance has to satisfy both, so the two declarations are * compared through here — a difference in any of these fields would otherwise * be silently resolved in favour of whichever surface the deploy read first. * `address` is deliberately absent: a derived tree carries one, a config tree * does not, and comparing them is the caller's job. */ export declare function canonicalHybridNode(node: HybridHookIsmConfig, chainLookup: RemoteIsmChainLookup, context: string): Record; /** * Prepares an ISM tree for the deferred (post-token) warp deploy pass: * injects `warpRouter` into every hybrid hook/ISM node and overrides `owner` * to the intermediate deployer. DELAYED_FLOW_ROUTER `remoteIsms` are also * dropped. The deployer-signed cross-chain enrollment pass applies the final * configuration and ends with the ownership transfer to the configured owner. * Sibling of `setRateLimitedIsmRecipient`. */ export declare function prepareHybridIsmNodesForDeploy(ismConfig: IsmConfig, warpRouter: Address, intermediateOwner: Address): IsmConfig; /** * How `completeHybridIsmNodes` fills a DELAYED_FLOW_ROUTER's `remoteIsms`. */ export declare const DelayedFlowRemoteIsmsSourceType: { /** Resolve the field with resolveDelayedFlowRemoteIsms. */ readonly Resolved: 'resolved'; /** * Leave the field unset, which makes consumers preserve the current on-chain * enrollment. For paths that run beside the cross-chain enrollment pass * (buildDelayedFlowEnrollmentTxs): it is the enrollment's only writer, and * two writers planning the same enrollment emit it twice. */ readonly Deferred: 'deferred'; }; export type DelayedFlowRemoteIsmsSource = { type: typeof DelayedFlowRemoteIsmsSourceType.Resolved; /** Pairing derived from the route, or undefined when it is unknown here. */ derived: Record | undefined; } | { type: typeof DelayedFlowRemoteIsmsSourceType.Deferred; }; /** * Minimal chain-resolution surface `canonicalizeRemoteIsms` needs. MultiProvider * satisfies it structurally, which keeps this module free of that import. */ export interface RemoteIsmChainLookup { tryGetDomainId(chainNameOrId: string | number): number | null; tryGetChainName(chainNameOrId: string | number): string | null; } /** * The single representation of a DelayedFlowRouterHookIsm's `remoteIsms`: * canonical chain name -> lowercase bytes32, which is exactly what the reader * emits (deriveDelayedFlowRemoteIsms). Deploy, update and check all resolve the * field through here, so they enroll, diff and compare the same entries. * * Both key forms a user can write are accepted and collapse to the chain name: * a name, and the chain's domain id. Neither is left ambiguous — a key that * resolves to no known chain is rejected rather than skipped (it would * otherwise pass a config-level preflight and only fail once contracts are * deployed), and two keys naming the same chain are rejected too (a single * on-chain entry per domain cannot satisfy both, so the config could never * converge). */ export declare function canonicalizeRemoteIsms(remoteIsms: Record, chainLookup: RemoteIsmChainLookup, context: string): Record; /** * Single source of truth for a DelayedFlowRouterHookIsm's `remoteIsms`: both * the expected config `warp check` compares and the enrollment transactions * `warp apply` emits resolve the field through here, so they cannot disagree * (they once did, and the route never converged). * * Route-derived peers are authoritative for chains in the route: their * addresses can change during replacement, while `warp read` still contains * the installed instances' old enrollment. Configured entries are retained * for external chains the route cannot derive, preserving unusual topologies. */ export declare function resolveDelayedFlowRemoteIsms(configured: Record | undefined, derived: Record | undefined, context: string, chainLookup: RemoteIsmChainLookup): Record | undefined; /** * Completes hybrid hook/ISM nodes in an EXPECTED config tree with the values * the deploy machinery manages: `warpRouter` (the containing warp router, * always injected — see resolveHybridWarpRouter), the NET_FLOW `owner` default * (the chain's config owner, when the node omits one), and, for * DELAYED_FLOW_ROUTER, the `remoteIsms` pairing. Used by * expandWarpDeployConfig so `warp check` compares complete expectations * against the fully-derived on-chain config, and by EvmWarpModule so `warp * apply` plans against the same complete config. * * `defaultOwner` is only consulted for a NET_FLOW node that omits `owner` * (DELAYED_FLOW_ROUTER's is schema-required), so callers that cannot resolve * an owner still get `warpRouter` filled. */ export declare function completeHybridIsmNodes(ismConfig: IsmConfig, warpRouter: Address, remoteIsms: DelayedFlowRemoteIsmsSource, defaultOwner: Address | undefined, chainLookup: RemoteIsmChainLookup): IsmConfig; export declare function extractIsmAndHookFactoryAddresses(registryAddresses: ChainAddresses): Pick, "domainRoutingIsmFactory" | "incrementalDomainRoutingIsmFactory" | "staticAggregationHookFactory" | "staticAggregationIsmFactory" | "staticMerkleRootMultisigIsmFactory" | "staticMerkleRootWeightedMultisigIsmFactory" | "staticMessageIdMultisigIsmFactory" | "staticMessageIdWeightedMultisigIsmFactory">; export declare function multisigIsmVerificationCost(m: number, n: number): number; export declare function normalizeConfig(obj: WithAddress): any; export declare function sortArraysInConfig(config: any): any; export {}; //# sourceMappingURL=ism.d.ts.map