UNPKG

@hyperlane-xyz/sdk

Version:

The official SDK for the Hyperlane Network

191 lines 11.7 kB
import { Address, Domain, EvmChainId, ProtocolType } from '@hyperlane-xyz/utils'; import { CCIPContractCache } from '../ccip/utils.js'; import { HyperlaneAddresses } from '../contracts/types.js'; import { HyperlaneModule, HyperlaneModuleParams } from '../core/AbstractHyperlaneModule.js'; import { ProxyFactoryFactories } from '../deploy/contracts.js'; import { ContractVerifier } from '../deploy/verify/ContractVerifier.js'; import { TokenFeeReaderParams } from '../fee/EvmTokenFeeReader.js'; import { MultiProvider } from '../providers/MultiProvider.js'; import { AnnotatedEV5Transaction } from '../providers/ProviderType.js'; import { ChainName, ChainNameOrId } from '../types.js'; import { EvmWarpRouteReader } from './EvmWarpRouteReader.js'; import { DerivedTokenRouterConfig, HypTokenRouterConfig } from './types.js'; type WarpRouteAddresses = HyperlaneAddresses<ProxyFactoryFactories> & { deployedTokenRoute: Address; }; export declare class EvmWarpModule extends HyperlaneModule<ProtocolType.Ethereum, HypTokenRouterConfig, WarpRouteAddresses> { protected readonly multiProvider: MultiProvider; protected readonly ccipContractCache?: CCIPContractCache | undefined; protected readonly contractVerifier?: ContractVerifier | undefined; protected logger: import("pino").default.Logger<never>; reader: EvmWarpRouteReader; readonly chainName: ChainName; readonly chainId: EvmChainId; readonly domainId: Domain; constructor(multiProvider: MultiProvider, args: HyperlaneModuleParams<HypTokenRouterConfig, WarpRouteAddresses>, ccipContractCache?: CCIPContractCache | undefined, contractVerifier?: ContractVerifier | undefined); /** * Retrieves the token router configuration for the specified address. * * @param address - The address to derive the token router configuration from. * @returns A promise that resolves to the token router configuration. */ read(): Promise<DerivedTokenRouterConfig>; /** * Updates the Warp Route contract with the provided configuration. * * IMPORTANT — irreversible side effects when expectedConfig includes `predicateWrapper`: * The PredicateRouterWrapper contract is deployed on-chain during planning (before this * method returns). If the returned transactions are never submitted, the wrapper is * orphaned. See PredicateWrapperDeployer.deployAndConfigure for details. * * @param expectedConfig - The configuration for the token router to be updated. * @returns An array of Ethereum transactions that were executed to update the contract, or an error if the update failed. */ update(expectedConfig: HypTokenRouterConfig, tokenReaderParams?: Partial<TokenFeeReaderParams>): Promise<AnnotatedEV5Transaction[]>; /** * Create a transaction to update the remote routers for the Warp Route contract. * * @param actualConfig - The on-chain router configuration, including the remoteRouters array. * @param expectedConfig - The expected token router configuration. * @returns A array with a single Ethereum transaction that need to be executed to enroll the routers */ createEnrollRemoteRoutersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createUnenrollRemoteRoutersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createAddRebalancersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createRemoveRebalancersUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Create transactions to enroll CrossCollateralRouter routers. */ createEnrollCrossCollateralRoutersTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Create transactions to unenroll CrossCollateralRouter routers. */ createUnenrollCrossCollateralRoutersTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; private toCanonicalRouterId; getAllowedBridgesApprovalTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; createAddAllowedBridgesUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; createRemoveBridgesTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createAddRemoteOutputAssetsTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createRemoveRemoteOutputAssetsTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createUpdateEverclearFeeParamsTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; createRemoveEverclearFeeParamsTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Create a transaction to update the remote routers for the Warp Route contract. * * @param actualConfig - The on-chain router configuration, including the remoteRouters array. * @param expectedConfig - The expected token router configuration. * @returns A array with a single Ethereum transaction that need to be executed to enroll the routers */ createSetDestinationGasUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Create transactions to update an existing ISM config, or deploy a new ISM and return a tx to setInterchainSecurityModule * * @param actualConfig - The on-chain router configuration, including the ISM configuration, and address. * @param expectedConfig - The expected token router configuration, including the ISM configuration. * @returns Ethereum transaction that need to be executed to update the ISM configuration. */ createIsmUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; createHookUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; /** * Deploys hook updates and predicate wrapper together so the post-update hook address * is available to deployAndConfigure without a stale on-chain read. */ createHookAndPredicateUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; /** * Searches the current on-chain hook tree for a PredicateRouterWrapper that * matches by registry and policyId. Returns the wrapper address and its current * on-chain owner when found, undefined otherwise. * * Uses unbounded recursion into aggregation hooks (consistent with * EvmTokenAdapter.findPredicateWrapperInHook and EvmWarpRouteReader.findPredicateAddressInHook). */ private findDeployedPredicateWrapper; /** * Recursively searches a hook tree for a matching PredicateRouterWrapper. * Descends into StaticAggregationHook sub-hooks without depth limit. */ private searchPredicateInHook; /** * Checks whether a single hook address is a PredicateRouterWrapper matching * the warp route and expected config. Returns the match or undefined. */ private matchPredicateWrapper; /** * Check if predicate wrapper is already deployed with fully matching config * (registry, policyId, and owner). * * @param actualConfig - The on-chain router configuration. * @param expectedPredicateConfig - The expected predicate wrapper configuration. * @returns True if wrapper is deployed with all fields matching, false otherwise. */ isPredicateWrapperDeployed(actualConfig: DerivedTokenRouterConfig, expectedPredicateConfig: { predicateRegistry: string; policyId: string; owner: string; }): Promise<boolean>; /** * Create transactions to deploy predicate wrapper and update hook. * * @param actualConfig - The on-chain router configuration. * @param expectedConfig - The expected token router configuration. * @returns transactions to execute and whether a new wrapper is being deployed. * deploysNewWrapper=true means the predicate emits its own setHook(aggregation) * that supersedes any hook update in the same batch. */ createPredicateWrapperUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig, pendingHookAddress?: Address): Promise<{ transactions: AnnotatedEV5Transaction[]; deploysNewWrapper: boolean; }>; /** * Create transactions to update token fee configuration. * * @param actualConfig - The on-chain router configuration. * @param expectedConfig - The expected token router configuration. * @returns Ethereum transactions that need to be executed to update the token fee. */ createTokenFeeUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig, tokenReaderParams?: Partial<TokenFeeReaderParams>): Promise<AnnotatedEV5Transaction[]>; /** * Transfer ownership of an existing Warp route with a given config. * * @param actualConfig - The on-chain router configuration. * @param expectedConfig - The expected token router configuration. * @returns Ethereum transaction that need to be executed to update the owner. */ createOwnershipUpdateTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Updates or deploys the ISM using the provided configuration. * * @returns Object with deployedIsm address, and update Transactions */ deployOrUpdateIsm(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<{ deployedIsm: Address; updateTransactions: AnnotatedEV5Transaction[]; }>; /** * Creates a transaction to upgrade the Warp Route implementation if the package version is below specified version. * * @param actualConfig - The current on-chain configuration * @param expectedConfig - The expected configuration * @returns An array of transactions to upgrade the implementation if needed */ upgradeWarpRouteImplementationTx(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): Promise<AnnotatedEV5Transaction[]>; createSetMaxFeePpmTxs(actualConfig: DerivedTokenRouterConfig, expectedConfig: HypTokenRouterConfig): AnnotatedEV5Transaction[]; /** * Deploys the Warp Route. * * @param chain - The chain to deploy the module on. * @param config - The configuration for the token router. * @param multiProvider - The multi-provider instance to use. * @returns A new instance of the EvmERC20WarpHyperlaneModule. */ static create(params: { chain: ChainNameOrId; config: HypTokenRouterConfig; multiProvider: MultiProvider; ccipContractCache?: CCIPContractCache; contractVerifier?: ContractVerifier; proxyFactoryFactories: HyperlaneAddresses<ProxyFactoryFactories>; }): Promise<EvmWarpModule>; } export {}; //# sourceMappingURL=EvmWarpModule.d.ts.map