import { Address } from '@hyperlane-xyz/utils'; import { MultiProtocolProvider } from '../providers/MultiProtocolProvider.js'; import { ChainName } from '../types.js'; import { RateLimitMidPoint, xERC20Limits } from './adapters/ITokenAdapter.js'; import { XERC20Type } from './types.js'; export interface StandardXERC20Limits { type: typeof XERC20Type.Standard; mint: string; burn: string; } export interface VeloXERC20Limits { type: typeof XERC20Type.Velo; bufferCap: string; rateLimitPerSecond: string; } /** * Unified XERC20 limits type */ export type XERC20Limits = StandardXERC20Limits | VeloXERC20Limits; /** * Map of bridge addresses to their limits */ export type XERC20LimitsMap = Record
; export declare function toStandardLimits(limits: xERC20Limits): StandardXERC20Limits; export declare function toVeloLimits(rateLimits: RateLimitMidPoint): VeloXERC20Limits; /** * The conversions from what a token's getters return to the limits this SDK * reports. EvmXERC20Reader exposes them as protected methods, so its * readLimits hands its own bound versions here and a subclass overriding one * still decides what its reader reports. */ export interface XERC20LimitsConverters { toStandardLimits: (limits: xERC20Limits) => StandardXERC20Limits; toVeloLimits: (rateLimits: RateLimitMidPoint) => VeloXERC20Limits; } /** * Reads the current limits the xERC20 holds for each bridge, keyed by the * bridge address as it was passed in. * * Which getter answers depends on the implementation, so the type decides: * Velodrome exposes the whole rate limit struct through `rateLimits`, while a * canonical xERC20 exposes `mintingMaxLimitOf`/`burningMaxLimitOf`. Both are * read from the token itself rather than from the events it emitted, so a * limit changed by an implementation that emits nothing, or emits an event * this SDK does not know, is still reported at its current value. * * The bridges are read at the chain's configured RPC concurrency. Discovery * hands over every address the token ever announced, deactivated ones included * because the zero-limit filter runs on what is read here, and a Standard token * costs two calls per bridge, so a token with a long history would otherwise * open that whole history's worth of reads at once. */ export declare function readXERC20Limits({ multiProtocolProvider, chain, xERC20Address, bridges, type, converters, }: { multiProtocolProvider: MultiProtocolProvider; chain: ChainName; xERC20Address: Address; bridges: Address[]; type: XERC20Type; converters?: XERC20LimitsConverters; }): Promise