@hyperlane-xyz/sdk
Version:
The official SDK for the Hyperlane Network
100 lines • 4.01 kB
TypeScript
import { PopulatedTransaction } from 'ethers';
import { Address, ProtocolType } from '@hyperlane-xyz/utils';
import { HyperlaneModule, HyperlaneModuleParams } from '../core/AbstractHyperlaneModule.js';
import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js';
import { MultiProvider } from '../providers/MultiProvider.js';
import { AnnotatedEV5Transaction } from '../providers/ProviderType.js';
import { ChainName } from '../types.js';
import { EvmXERC20Reader, XERC20Limits, XERC20LimitsMap } from './EvmXERC20Reader.js';
import { XERC20Type } from './types.js';
/**
* Configuration for XERC20 limits management
*/
export interface XERC20ModuleConfig {
type: XERC20Type;
limits: XERC20LimitsMap;
}
/**
* Addresses managed by the XERC20 module
*/
export interface XERC20ModuleAddresses {
xERC20: Address;
warpRoute: Address;
}
/**
* Module for managing XERC20 mint/burn limits and bridges.
* Follows HyperlaneModule pattern with read() and update() methods.
* Supports both Standard XERC20 (setLimits) and Velodrome XERC20 (setBufferCap/addBridge/removeBridge).
*/
export declare class EvmXERC20Module extends HyperlaneModule<ProtocolType.Ethereum, XERC20ModuleConfig, XERC20ModuleAddresses> {
protected readonly multiProvider: MultiProvider;
protected logger: import("pino").default.Logger<never>;
readonly reader: EvmXERC20Reader;
protected readonly multiProtocolProvider: MultiProtocolProvider;
readonly chainName: ChainName;
constructor(multiProvider: MultiProvider, args: HyperlaneModuleParams<XERC20ModuleConfig, XERC20ModuleAddresses>);
read(): Promise<XERC20ModuleConfig>;
/**
* Generate transactions to update XERC20 limits to match expected config.
* Detects drift and generates correction transactions.
*/
update(expectedConfig: XERC20ModuleConfig): Promise<AnnotatedEV5Transaction[]>;
/**
* Detect drift between expected and actual configurations.
*/
protected detectDriftFromConfigs(expected: XERC20ModuleConfig, actual: XERC20ModuleConfig): {
missingBridges: Address[];
extraBridges: Address[];
limitMismatches: Array<{
bridge: Address;
expected: XERC20Limits;
actual: XERC20Limits;
}>;
};
/**
* Get expected bridge addresses from config.
*/
protected getExpectedBridges(): Address[];
/**
* Generate transactions to set limits for a bridge.
*/
generateSetLimitsTxs(bridge: Address, limits: XERC20Limits): Promise<AnnotatedEV5Transaction[]>;
/**
* Generate transactions to add a bridge.
* For Standard XERC20, equivalent to setLimits.
* For Velodrome, uses addBridge function.
*/
generateAddBridgeTxs(bridge: Address, limits: XERC20Limits): Promise<AnnotatedEV5Transaction[]>;
/**
* Generate transactions to remove a bridge (Velodrome only).
*/
generateRemoveBridgeTxs(bridge: Address): Promise<AnnotatedEV5Transaction[]>;
protected annotateTransaction(tx: PopulatedTransaction, chainId: number, to: Address): AnnotatedEV5Transaction;
static fromWarpRouteConfig(multiProvider: MultiProvider, chain: ChainName, warpRouteConfig: {
type: string;
token: Address;
xERC20?: {
warpRouteLimits: {
type: XERC20Type;
mint?: string;
burn?: string;
bufferCap?: string;
rateLimitPerSecond?: string;
};
extraBridges?: Array<{
lockbox: Address;
limits: {
type: XERC20Type;
mint?: string;
burn?: string;
bufferCap?: string;
rateLimitPerSecond?: string;
};
}>;
};
}, warpRouteAddress: Address): Promise<{
module: EvmXERC20Module;
config: XERC20ModuleConfig;
}>;
}
//# sourceMappingURL=EvmXERC20Module.d.ts.map