import { Logger } from 'pino'; import { Log } from 'viem'; import { Address } from '@hyperlane-xyz/utils'; import { MultiProvider } from '../providers/MultiProvider.js'; import { ChainName, ChainNameOrId } from '../types.js'; import { WarpCoreConfig } from '../warp/types.js'; import { TokenType } from './config.js'; import { WarpRouteDeployConfig, XERC20TokenExtraBridgesLimits, XERC20Type } from './types.js'; import { XERC20_VS_ABI } from './xerc20-abi.js'; type BridgeConfigBase = { chain: ChainName; type: typeof TokenType.XERC20Lockbox | typeof TokenType.XERC20; xERC20Address: Address; bridgeAddress: Address; decimals: number; owner: Address; }; export type BridgeConfigVS = BridgeConfigBase & { bufferCap: number; rateLimitPerSecond: number; }; export type BridgeConfigWL = BridgeConfigBase & { mint: number; burn: number; }; export type GetExtraLockboxesOptions = { chain: ChainNameOrId; xERC20Address: Address; multiProvider: MultiProvider; logger?: Logger; /** Known token type, when the caller has already derived it. */ type?: XERC20Type; /** * The warp route's own router. Its limits are reported separately as * warpRouteLimits, so leaving it in here would double count the route as a * bridge of itself. */ warpRouteAddress?: Address; }; export declare const XERC20_LOG_SCAN_BLOCK_RANGE = 1000000; /** * Reads the bridges the xERC20 holds non-zero limits for, other than the warp * route's own router. * * Neither xERC20 interface can list its bridges: every limit getter is keyed by * a bridge address, so the set of addresses is only observable through the * events the token emitted when those limits were set. Those events are * therefore read for the addresses alone, and every limit is then read from the * token, so a bridge reconfigured by something that emits nothing this SDK * parses is still reported at the limits it currently holds. */ export declare function getExtraLockBoxConfigs({ xERC20Address, chain, multiProvider, logger, type: knownType, warpRouteAddress, }: GetExtraLockboxesOptions): Promise; export type ConfigurationChangedLog = Log; /** * Parses ConfigurationChanged logs and keeps only the most recent configuration * of each bridge, keyed by its normalized address. * * A bridge can be reconfigured more than once in the same block, so the block * number alone is not a total order over the logs and logIndex breaks the tie. */ export declare function latestConfigurationPerBridge(logs: Log[]): Map; /** * Derives bridge configurations for Velodrome XERC20 tokens. * Extracts bufferCap and rateLimitPerSecond limits from warp deploy config. * @param warpDeployConfig - Warp route deployment configuration * @param warpCoreConfig - Warp core configuration with token metadata * @param multiProvider - Multi-chain provider for contract interactions * @returns Array of bridge configurations for Velodrome XERC20 */ export declare function deriveBridgesConfig(warpDeployConfig: WarpRouteDeployConfig, warpCoreConfig: WarpCoreConfig, multiProvider: MultiProvider): Promise; /** * Derives bridge configurations for Standard XERC20 tokens. * Extracts mint and burn limits from warp deploy config. * @param chains - Optional list of chains to filter by * @param warpDeployConfig - Warp route deployment configuration * @param warpCoreConfig - Warp core configuration with token metadata * @param multiProvider - Multi-chain provider for contract interactions * @returns Array of bridge configurations for Standard XERC20 */ export declare function deriveStandardBridgesConfig(chains: ChainName[] | undefined, warpDeployConfig: WarpRouteDeployConfig, warpCoreConfig: WarpCoreConfig, multiProvider: MultiProvider): Promise; /** * Thrown when a contract exposes neither the Standard nor the Velodrome limit * management interface, so which getter would answer its limits is unknown. * * Typed rather than a bare Error so a caller can tell it apart from a failure * to read the bytecode at all, which says nothing about the contract and must * not be treated as an answer. */ export declare class UnknownXERC20TypeError extends Error { } export declare function deriveXERC20TokenType(multiProvider: MultiProvider, chain: ChainNameOrId, address: Address): Promise; export {}; //# sourceMappingURL=xerc20.d.ts.map