import type { Address } from 'viem'; import type { GauntletClient } from '../client'; import { type SyncRedeemRate } from './aeraContracts/v2'; /** Epoch capacity accounting for the global sync redeem cap. */ export interface SyncWithdrawCapacity { /** Effective epoch cap (min of relative and absolute), in numeraire. */ epochCapNumeraire: bigint; /** Numeraire already redeemed globally in the current epoch. */ epochRedeemedNumeraire: bigint; /** Remaining global sync redeem capacity this epoch, in numeraire. */ remainingNumeraire: bigint; /** Remaining capacity expressed in the withdraw token. */ remainingTokens: bigint; /** This redemption's size in numeraire (matches the on-chain epoch accounting). */ requestNumeraire: bigint; /** True when this redemption alone exceeds remaining epoch capacity (the tx would revert). */ exceedsCapacity: boolean; } export type SyncWithdrawQuoteRequest = { mode: 'amount'; amount: bigint; } | { mode: 'shares'; shares: bigint; } | { mode: 'entireAmount'; account: Address; }; export interface SyncWithdrawQuoteContext { vaultId: string; chainId: number; tokenAddress: Address; /** Account used for balance and lock reads when the quote is account-scoped. */ account?: Address; /** Slippage tolerance used to derive `minTokensOut` or `maxUnitsIn`. */ slippageBps: number; /** Block snapshot used for all quote reads. */ blockNumber: bigint; /** Exact sizing request that produced this quote. */ request: SyncWithdrawQuoteRequest; } interface SyncWithdrawQuoteDetails { /** Vault units (shares) burned: exact for `'redeem'`, estimated for `'withdraw'`. */ shares: bigint; /** Upper bound on shares burned after slippage (equals `shares` for `'redeem'`). */ maxUnitsIn: bigint; /** Tokens received: exact (requested) for `'withdraw'`, estimated for `'redeem'`. */ tokensOut: bigint; /** Lower bound on tokens received after slippage (equals `tokensOut` for `'withdraw'`). */ minTokensOut: bigint; /** Live multiplier breakdown (base, dynamic premium, effective), in bps. */ rate: SyncRedeemRate; capacity: SyncWithdrawCapacity; /** Timestamp until which the account's units are locked; undefined when no account was quoted. */ unitsLockedUntil?: bigint; /** Context that must match any transaction build using these quote bounds. */ context: SyncWithdrawQuoteContext; } /** Bounds consumed by one of the two on-chain sync withdraw entry points. */ export type SyncWithdrawQuoteBounds = { kind: 'redeem'; shares: bigint; minTokensOut: bigint; context: SyncWithdrawQuoteContext; } | { kind: 'withdraw'; tokensOut: bigint; maxUnitsIn: bigint; context: SyncWithdrawQuoteContext; }; /** * A live quote for an instant (sync) withdraw. * * `kind` distinguishes the two on-chain entry points: * - `'redeem'`: exact shares burned, estimated tokens out (used for by-shares / entire-balance exits) * - `'withdraw'`: exact tokens out, estimated shares burned (used for by-token-amount exits) */ export type SyncWithdrawQuote = (SyncWithdrawQuoteDetails & { kind: 'redeem'; }) | (SyncWithdrawQuoteDetails & { kind: 'withdraw'; }); type SyncWithdrawQuoteBaseParams = { vaultId: string; /** EVM chain ID. Defaults to the vault's primary chain (Base for current multichain vaults). */ chainId?: number; /** Required for multiasset vaults. */ assetSymbol?: string; /** Optional for explicit amount/shares quotes; required for full-position quotes. */ account?: Address; /** * Slippage tolerance in basis points (e.g. 100 = 1%). Defaults to 100. * A value of 10000 is invalid for share-sized quotes because it makes `minTokensOut` zero. */ slippageBps?: number; }; export type SyncWithdrawQuoteParams = (SyncWithdrawQuoteBaseParams & { shares: bigint; amount?: never; entireAmount?: never; }) | (SyncWithdrawQuoteBaseParams & { amount: bigint; shares?: never; entireAmount?: never; }) | (SyncWithdrawQuoteBaseParams & { account: Address; entireAmount: true; shares?: never; amount?: never; }); /** * Builds a live quote for an instant (sync) withdraw without sending a transaction. * * Surfaces everything the on-chain `redeem`/`withdraw` would apply or check but that a plain * transaction build does not pre-validate: the effective rate (including the price-age dynamic * premium), slippage bounds, the global per-epoch redeem capacity, and whether the caller's units * are still locked from a recent sync deposit. * * @throws {VaultNotFoundError} If the vault ID is not found. * @throws {UnsupportedAssetError} If the asset symbol is not accepted by the vault. * @throws {UnsupportedFeatureError} If the vault is not an Aera V2 deployment. * @throws {UnsupportedDepositModeError} If sync redeem is not enabled for the token. * @throws {StalePriceError} If the oracle price is too stale for an instant redeem. */ export declare function getSyncWithdrawQuote(client: GauntletClient, params: SyncWithdrawQuoteParams): Promise; export {}; //# sourceMappingURL=withdrawQuote.d.ts.map