import type { Address, Domain } from '@hyperlane-xyz/utils'; import type { ExternalBridgeType } from '../config/types.js'; import type { BridgeTransferStatus } from '../interfaces/IExternalBridge.js'; import type { IStore } from './store/IStore.js'; export interface Identifiable { id: string; } export interface CrossChainAction { origin: Domain; destination: Domain; amount: bigint; } export interface Timestamped { createdAt: number; updatedAt: number; } export interface TrackedActionBase extends Identifiable, CrossChainAction, Timestamped { status: string; } export type TransferStatus = 'in_progress' | 'complete'; export type RebalanceIntentStatus = 'not_started' | 'in_progress' | 'complete' | 'cancelled' | 'failed'; export type RebalanceActionStatus = 'in_progress' | 'complete' | 'failed'; /** * Execution method for rebalancing: * - `movable_collateral`: Uses MovableCollateralRouter.rebalance() on-chain * - `inventory`: Uses external bridges + transferRemote */ export type ExecutionMethod = 'movable_collateral' | 'inventory'; /** * Type of rebalance action: * - `rebalance_message`: Standard movable collateral rebalance (Hyperlane message) * - `inventory_movement`: External bridge transfer (e.g., LiFi) to move inventory * - `inventory_deposit`: transferRemote to deposit inventory as collateral */ export type ActionType = 'rebalance_message' | 'inventory_movement' | 'inventory_deposit'; export interface Transfer extends TrackedActionBase { status: TransferStatus; messageId: string; sender: Address; recipient: Address; } export interface RebalanceIntent extends TrackedActionBase { status: RebalanceIntentStatus; bridge?: Address; priority?: number; strategyType?: string; executionMethod?: ExecutionMethod; externalBridge?: ExternalBridgeType; } export interface RebalanceAction extends TrackedActionBase { status: RebalanceActionStatus; type: ActionType; intentId: string; messageId?: string; txHash?: string; externalBridgeTransferId?: string; externalBridgeId?: ExternalBridgeType; lastBridgeStatus?: BridgeTransferStatus['status']; nonPendingSince?: number; } export type ITransferStore = IStore; export type IRebalanceIntentStore = IStore; export type IRebalanceActionStore = IStore; /** * Represents an inventory intent that has been partially fulfilled * and can continue execution. Values are derived from action states. */ export interface PartialInventoryIntent { intent: RebalanceIntent; /** Sum of complete inventory_deposit action amounts */ completedAmount: bigint; /** Amount remaining to fulfill (0n when final deposit is fully in-flight). Formula: intent.amount - completedAmount - inflightAmount */ remaining: bigint; /** True when intent has in_progress inventory_deposit actions (not safe to continue, but still active) */ hasInflightDeposit: boolean; } //# sourceMappingURL=types.d.ts.map