import type { Abi, Address, Hex, TypedDataDomain } from "viem"; import type { Account, AddressOrAccount, IHasVaultAddress, ISubAccount } from "../../entities/Account.js"; import type { Wallet } from "../../entities/Wallet.js"; import type { SwapperMode, SwapQuote, SwapQuoteRequest } from "../swapService/swapServiceTypes.js"; export type EVCBatchItem = { targetContract: Address; onBehalfOfAccount: Address; value: bigint; data: Hex; }; export type EVCBatchOperation = { type: "operation"; name: string; items: EVCBatchItem[]; /** Additional wallet tokens whose `balanceOf(account)` should be tracked in * simulation layers. This is metadata only; it is not encoded into EVC * calldata. */ walletBalanceTokens?: Address[]; }; export type EVCBatchEntry = EVCBatchItem | EVCBatchOperation; export declare function isEVCBatchOperation(entry: EVCBatchEntry): entry is EVCBatchOperation; export declare function flattenBatchEntries(entries: readonly EVCBatchEntry[]): EVCBatchItem[]; export type EncodeDepositArgs = { chainId: number; vault: Address; amount: bigint; receiver: Address; owner: Address; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; permit2?: Permit2Data; }; export type EncodeMintArgs = { chainId: number; vault: Address; shares: bigint; receiver: Address; owner: Address; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; permit2?: Permit2Data; }; export type EncodeWithdrawArgs = { chainId: number; vault: Address; assets: bigint; receiver: Address; owner: Address; disableCollateral?: boolean; }; export type EncodeRedeemArgs = { chainId: number; vault: Address; shares: bigint; receiver: Address; owner: Address; disableCollateral?: boolean; }; export type EncodeBorrowArgs = { chainId: number; vault: Address; amount: bigint; owner: Address; borrowAccount: Address; receiver: Address; currentController?: Address; enableController?: boolean; enableCollateral?: boolean; collateralVault?: Address; collateralAmount?: bigint; collateralShareSource?: CollateralShareSource; collateralWrappedNativeInfo?: WrappedNativeInfo; collateralPermit2?: Permit2Data; }; export type EncodeRepayArgs = { chainId: number; vault: Address; amount: bigint; receiver: Address; subAccount?: ISubAccount; disableController?: boolean; }; export type EncodeLiquidationArgs = { chainId: number; vault: Address; violator: Address; collateral: Address; repayAssets: bigint; minYieldBalance: bigint; liquidatorSubAccountAddress: Address; enableCollateral?: boolean; enableController?: boolean; }; export type ResolveRequiredApprovalsWithWalletArgs = { plan: TransactionPlan; chainId: number; wallet: Wallet; usePermit2?: boolean; unlimitedApproval?: boolean; }; export type ResolveRequiredApprovalsArgs = { plan: TransactionPlan; chainId: number; account: Address; usePermit2?: boolean; unlimitedApproval?: boolean; }; export type EncodePullDebtArgs = { chainId: number; vault: Address; amount: bigint; from: Address; to: Address; enableController?: boolean; }; export type RepaySourceType = "wallet" | "collateral" | "savings"; export type EncodeRepayWithSwapArgs = { chainId: number; swapQuote: SwapQuote; maxWithdraw?: bigint; isMax?: boolean; disableControllerOnMax?: boolean; swapperMode?: SwapperMode; }; export type EncodeRepayFromWalletArgs = { chainId: number; liabilityVault: Address; liabilityAmount: bigint; sender: Address; receiver: Address; disableControllerOnMax?: boolean; isMax?: boolean; permit2?: Permit2Data; }; export type EncodeRepayFromDepositArgs = { chainId: number; liabilityVault: Address; liabilityAmount: bigint; from: Address; receiver: Address; fromVault: Address; fromAsset: Address; liabilityAsset: Address; swapQuote?: SwapQuote; swapParams?: Omit & { targetDebt?: bigint; deadline?: number; }; disableControllerOnMax?: boolean; isMax?: boolean; withdrawMax?: bigint; liabilityPermit2?: Permit2Data; }; export type EncodeDepositWithSwapFromWalletArgs = { chainId: number; swapQuote: SwapQuote; amount: bigint; sender: Address; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type EncodeSwapFromWalletArgs = { chainId: number; swapQuote: SwapQuote; amount: bigint; sender: Address; wrappedNativeInfo?: WrappedNativeInfo; }; export type EncodeSwapCollateralArgs = { chainId: number; swapQuote: SwapQuote; enableCollateral?: boolean; disableCollateralOnMax?: boolean; isMax?: boolean; swapperMode?: SwapperMode; }; export type EncodeSwapDebtArgs = { chainId: number; swapQuote: SwapQuote; enableController?: boolean; disableControllerOnMax?: boolean; isMax?: boolean; swapperMode?: SwapperMode; }; export type EncodeMigrateSameAssetCollateralArgs = { chainId: number; fromVault: Address; toVault: Address; amount: bigint; account: Address; isMax?: boolean; maxShares?: bigint; enableCollateralTo?: boolean; disableCollateralFrom?: boolean; }; export type EncodeMigrateSameAssetDebtArgs = { chainId: number; oldLiabilityVault: Address; newLiabilityVault: Address; amount: bigint; account: Address; enableController?: boolean; disableController?: boolean; sweepExcess?: boolean; transferRemainingSharesTo?: Address; }; export type EncodeTransferArgs = { chainId: number; vault: Address; to: Address; amount: bigint; from: Address; enableCollateralTo?: boolean; disableCollateralFrom?: boolean; }; export type EncodeMultiplyWithSwapArgs = { chainId: number; collateralVault: Address; collateralAmount: bigint; liabilityVault: Address; liabilityAmount: bigint; longVault: Address; owner: Address; receiver: Address; enableCollateral?: boolean; enableCollateralLong?: boolean; currentController?: Address; enableController?: boolean; collateralShareSource?: CollateralShareSource; collateralWrappedNativeInfo?: WrappedNativeInfo; collateralPermit2?: Permit2Data; swapQuote: SwapQuote; }; export type EncodeMultiplySameAssetArgs = { chainId: number; collateralVault: Address; collateralAmount: bigint; liabilityVault: Address; liabilityAmount: bigint; longVault: Address; owner: Address; receiver: Address; enableCollateral?: boolean; enableCollateralLong?: boolean; currentController?: Address; enableController?: boolean; collateralShareSource?: CollateralShareSource; collateralWrappedNativeInfo?: WrappedNativeInfo; collateralPermit2?: Permit2Data; }; export type EncodeSwapAndBorrowFromWalletArgs = { chainId: number; swapQuote: SwapQuote; amount: bigint; sender: Address; borrowAccount: Address; collateralVault: Address; borrowVault: Address; borrowAmount: bigint; receiver: Address; currentController?: Address; enableController?: boolean; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type EncodeSwapAndRepayFromWalletArgs = { chainId: number; swapQuote: SwapQuote; amount: bigint; sender: Address; liabilityVault: Address; repayAccount: Address; isMax?: boolean; disableControllerOnMax?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type EncodeWithdrawAndSwapArgs = { chainId: number; vault: Address; assets: bigint; owner: Address; sender?: Address; swapQuote: SwapQuote; }; export type EncodeRedeemAndSwapArgs = { chainId: number; vault: Address; shares: bigint; owner: Address; sender?: Address; swapQuote: SwapQuote; }; export type CollateralShareSource = { /** Sub-account or main account that already owns collateral vault shares. */ from: Address; /** Vault-share amount to transfer into the borrow/multiply sub-account. */ shares: bigint; /** Disable the source collateral flag before transferring shares when needed. */ disableCollateralFrom?: boolean; }; export type WrappedNativeInfo = { wrappedTokenAddress: Address; nativeAmount: bigint; }; export type EncodePermit2CallArgs = { chainId: number; message: PermitSingleMessage; signature: Hex; owner: Address; }; export type EncodeMigrationAuthorizationCallArgs = { chainId: number; signer: Address; typedDataHash: Hex; /** * Opaque application-authenticated metadata returned by * PositionMigrationService. The SDK does not establish its provenance. */ abiArgumentPath: readonly (string | number)[]; reviewedItem: EVCBatchItem; signature: Hex; }; export type GetPermit2TypedDataArgs = { chainId: number; token: Address; amount: bigint; spender: Address; nonce: number; sigDeadline?: bigint; expiration?: number; }; export type PermitSingleMessage = { details: PermitDetails; spender: Address; sigDeadline: bigint; }; export type PermitSingleTypedData = { domain: TypedDataDomain; types: typeof PERMIT2_TYPES; primaryType: "PermitSingle"; message: PermitSingleMessage; }; export type PermitDetails = { token: Address; amount: bigint; expiration: number; nonce: number; }; export type Permit2Data = { message: PermitSingleMessage; signature: Hex; }; export declare const PERMIT2_TYPES: { readonly PermitDetails: readonly [{ readonly name: "token"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint160"; }, { readonly name: "expiration"; readonly type: "uint48"; }, { readonly name: "nonce"; readonly type: "uint48"; }]; readonly PermitSingle: readonly [{ readonly name: "details"; readonly type: "PermitDetails"; }, { readonly name: "spender"; readonly type: "address"; }, { readonly name: "sigDeadline"; readonly type: "uint256"; }]; }; export type RequiredApproval = { type: "requiredApproval"; token: Address; owner: Address; spender: Address; amount: bigint; resolved?: (ApproveCall | Permit2DataToSign)[]; }; export type ApproveCall = { type: "approve"; token: Address; owner: Address; spender: Address; amount: bigint; data: Hex; }; export type Permit2DataToSign = { type: "permit2"; token: Address; amount: bigint; owner: Address; spender: Address; }; export type EVCBatch = { type: "evcBatch"; items: EVCBatchEntry[]; }; export type ContractCall = { type: "contractCall"; chainId: number; to: Address; abi: Abi; functionName: string; args: readonly unknown[]; value: bigint; /** * Opt in only when this call can be simulated against the pre-plan state and * does not depend on effects from earlier plan items. This lets a direct call * coexist with an EVC batch without accepting a partial simulation. * @see docs/simulations-and-state-overrides.md */ simulationMode?: "independent"; /** Metadata consumed when this call is converted into an EVC batch operation. */ walletBalanceTokens?: Address[]; }; export type CowSwapPlanKind = "openPosition" | "closePosition" | "swapCollateral" | "cancelClosePosition"; export type CowSwapPlanItem> = { type: "cowSwap"; kind: CowSwapPlanKind; chainId: number; params: TParams; }; export type TransactionPlanItem = RequiredApproval | EVCBatch | ContractCall | CowSwapPlanItem; export type TransactionPlan = TransactionPlanItem[]; /** * A transaction plan that has been through {@link ExecutionService.prepareTransactionPlan}: * plugins have been applied and every `requiredApproval` item has its `resolved` * array populated. The execution context (`chainId`, `account`, `usePermit2`, * `unlimitedApproval`) is carried alongside so simulate/execute can consume the * envelope directly without the caller re-passing context — and so they can * skip the internal plugin/approval-resolution pipeline that would otherwise * re-run on a raw plan. */ export type TransactionPlanPrepared = { readonly __prepared: true; plan: TransactionPlan; chainId: number; account: AddressOrAccount; usePermit2: boolean; unlimitedApproval: boolean; }; export declare function isPreparedTransactionPlan(value: unknown): value is TransactionPlanPrepared; export declare function isCowSwapPlanItem(item: TransactionPlanItem): item is CowSwapPlanItem; export declare function assertNoCowSwapPlanItems(plan: readonly TransactionPlanItem[], methodName: string): void; export type CowSwapOpenPositionPlanParams = { chainId: number; sellToken: Address; buyToken: Address; sellAmount: bigint; buyAmount: bigint; feeAmount: bigint; quoteId?: number; slippageBips: number; validTo: number; collateralToken: Address; wrapper: { owner: Address; account: Address; deadline: number; collateralVault: Address; borrowVault: Address; collateralAmount: bigint; borrowAmount: bigint; }; }; export type CowSwapCollateralSwapPlanParams = { chainId: number; sellToken: Address; buyToken: Address; sellAmount: bigint; buyAmount: bigint; feeAmount: bigint; quoteId?: number; slippageBips: number; validTo: number; wrapper: { owner: Address; account: Address; deadline: number; fromVault: Address; toVault: Address; fromAmount: bigint; disableSourceCollateral: boolean; }; }; export type CowSwapClosePositionPlanParams = { chainId: number; sellToken: Address; buyToken: Address; sellAmount: bigint; buyAmount: bigint; feeAmount: bigint; quoteId?: number; slippageBips: number; validTo: number; orderKind: "buy" | "sell"; wrapper: { owner: Address; account: Address; deadline: number; borrowVault: Address; collateralVault: Address; collateralAmount: bigint; }; }; export type CowSwapCancelClosePositionPlanParams = { chainId: number; owner: Address; nonce: bigint; nonceNamespace?: bigint; wrapperAddress?: Address; }; export type PlanDepositArgs = { vault: Address; amount: bigint; receiver: Address; account: Account; asset: Address; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type PlanMintArgs = { account: Account; vault: Address; shares: bigint; receiver: Address; asset: Address; enableCollateral?: boolean; sharesToAssetsExchangeRateWad?: bigint; wrappedNativeInfo?: WrappedNativeInfo; }; export type PlanWithdrawArgs = { account: Account; vault: Address; assets: bigint; owner: Address; receiver: Address; disableCollateral?: boolean; }; type PlanRedeemBaseArgs = { account: Account; vault: Address; owner: Address; receiver: Address; disableCollateral?: boolean; }; export type PlanRedeemArgs = PlanRedeemBaseArgs & ({ shares: bigint; assets?: never; } | { assets: bigint; shares?: never; }); export type PlanBorrowCollateral = { vault: Address; amount: bigint; asset: Address; source?: "wallet"; wrappedNativeInfo?: WrappedNativeInfo; } | { vault: Address; amount: bigint; source: "savings"; from: Address; disableCollateralFrom?: boolean; }; export type PlanBorrowArgs = { account: Account; vault: Address; amount: bigint; borrowAccount: Address; receiver: Address; collateral?: PlanBorrowCollateral; skipCleanup?: boolean; }; export type PlanCleanupArgs = { account: Account; subAccount: Address; }; export type PlanLiquidationArgs = { account: Account; liquidatorSubAccountAddress: Address; vault: Address; /** @deprecated Liquidation does not pull this asset from the wallet. */ asset?: Address; violator: Address; collateral: Address; repayAssets: bigint; minYieldBalance: bigint; }; export type PlanRepayFromWalletArgs = { account: Account; liabilityVault: Address; liabilityAmount: bigint; receiver: Address; cleanupOnMax?: boolean; }; export type PlanRepayFromDepositArgs = { account: Account; liabilityVault: Address; liabilityAmount: bigint; receiver: Address; fromVault: Address; fromAccount: Address; cleanupOnMax?: boolean; }; export type PlanRepayWithSwapArgs = { account: Account; swapQuote: SwapQuote; cleanupOnMax?: boolean; swapperMode?: SwapperMode; }; export type PlanDepositWithSwapFromWalletArgs = { account: Account; swapQuote: SwapQuote; amount: bigint; tokenIn: Address; enableCollateral?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type PlanSwapFromWalletArgs = { account: Account; swapQuote: SwapQuote; amount: bigint; tokenIn: Address; wrappedNativeInfo?: WrappedNativeInfo; }; export type PlanSwapCollateralArgs = { account: Account; swapQuote: SwapQuote; swapperMode?: SwapperMode; }; export type PlanSwapCollateralWithCoWArgs = { account: Account; swapQuote: SwapQuote; slippage?: number; validTo?: number; disableSourceCollateral?: boolean; }; export type PlanSwapDebtArgs = { account: Account; swapQuote: SwapQuote; swapperMode?: SwapperMode; }; export type PlanMigrateSameAssetCollateralArgs = { account: Account; fromVault: Address; toVault: Address; amount: bigint; positionAccount: Address; fromAsset?: Address; toAsset: Address; isMax?: boolean; maxShares?: bigint; enableCollateralTo?: boolean; disableCollateralFrom?: boolean; }; export type PlanMigrateSameAssetDebtArgs = { account: Account; oldLiabilityVault: Address; newLiabilityVault: Address; liabilityAccount: Address; liabilityAmount?: bigint; oldLiabilityAsset?: Address; newLiabilityAsset: Address; sweepExcess?: boolean; transferRemainingSharesToOwner?: boolean; }; export type PlanTransferArgs = { account: Account; vault: Address; from: Address; to: Address; amount: bigint; enableCollateralTo?: boolean; disableCollateralFrom?: boolean; }; export type PlanPullDebtArgs = { account: Account; vault: Address; from: Address; to: Address; amount: bigint; }; export type PlanMultiplyWithSwapArgs = { account: Account; collateralVault: Address; collateralAmount: bigint; collateralAsset: Address; collateralShareSource?: CollateralShareSource; collateralWrappedNativeInfo?: WrappedNativeInfo; swapQuote: SwapQuote; swapperMode?: SwapperMode; skipCleanup?: boolean; }; export type PlanOpenPositionWithCoWArgs = { account: Account; collateralVault: Address; collateralAmount: bigint; collateralAsset: Address; swapQuote: SwapQuote; slippage?: number; validTo?: number; }; export type PlanClosePositionWithCowArgs = { account: Account; swapQuote: SwapQuote; swapperMode?: SwapperMode; slippage?: number; validTo?: number; orderKind?: "buy" | "sell"; maxSellAmount?: bigint; }; export type PlanCancelClosePositionWithCowArgs = { chainId: number; owner: Address; nonce: bigint; nonceNamespace?: bigint; wrapperAddress?: Address; }; export type PlanMultiplySameAssetArgs = { account: Account; collateralVault: Address; collateralAmount: bigint; collateralAsset: Address; collateralShareSource?: CollateralShareSource; collateralWrappedNativeInfo?: WrappedNativeInfo; liabilityVault: Address; liabilityAmount: bigint; longVault: Address; receiver: Address; skipCleanup?: boolean; }; export type PlanSwapAndBorrowFromWalletArgs = { account: Account; swapQuote: SwapQuote; amount: bigint; tokenIn: Address; borrowVault: Address; borrowAmount: bigint; borrowAccount?: Address; receiver?: Address; collateralVault?: Address; wrappedNativeInfo?: WrappedNativeInfo; skipCleanup?: boolean; }; export type PlanSwapAndRepayFromWalletArgs = { account: Account; swapQuote: SwapQuote; amount: bigint; tokenIn: Address; liabilityVault?: Address; repayAccount?: Address; isMax?: boolean; cleanupOnMax?: boolean; wrappedNativeInfo?: WrappedNativeInfo; }; export type PlanWithdrawAndSwapArgs = { account: Account; vault: Address; assets: bigint; owner: Address; swapQuote: SwapQuote; }; export type PlanRedeemAndSwapArgs = { account: Account; vault: Address; shares: bigint; owner: Address; swapQuote: SwapQuote; }; export type BatchItemDescription = { targetContract: Address; onBehalfOfAccount: Address; functionName: string; args: Record; }; export type BatchOperationDescription = { type: "operation"; name: string; items: BatchItemDescription[]; }; export type BatchEntryDescription = BatchItemDescription | BatchOperationDescription; export {}; //# sourceMappingURL=executionServiceTypes.d.ts.map