import { AddConditionalOrderParams, PendingLimitOrderParams, PendingMarketOrderParams } from "../types/index.mjs"; import { DeepBookConfig } from "../utils/config.mjs"; import * as _mysten_sui_transactions193 from "@mysten/sui/transactions"; import { Transaction } from "@mysten/sui/transactions"; //#region src/transactions/marginTPSL.d.ts /** * MarginTPSLContract class for managing Take Profit / Stop Loss operations. */ declare class MarginTPSLContract { #private; /** * @param {DeepBookConfig} config Configuration for MarginTPSLContract */ constructor(config: DeepBookConfig); /** * @description Create a new condition for a conditional order * @param {string} poolKey The key to identify the pool * @param {boolean} triggerBelowPrice Whether to trigger when price is below trigger price * @param {number} triggerPrice The price at which to trigger the order * @returns A function that takes a Transaction object */ newCondition: (poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Create a new pending limit order for use in conditional orders * @param {string} poolKey The key to identify the pool * @param {PendingLimitOrderParams} params Parameters for the pending limit order * @returns A function that takes a Transaction object */ newPendingLimitOrder: (poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Create a new pending market order for use in conditional orders * @param {string} poolKey The key to identify the pool * @param {PendingMarketOrderParams} params Parameters for the pending market order * @returns A function that takes a Transaction object */ newPendingMarketOrder: (poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Add a conditional order (take profit or stop loss) * @param {AddConditionalOrderParams} params Parameters for adding the conditional order * @returns A function that takes a Transaction object */ addConditionalOrder: (params: AddConditionalOrderParams) => (tx: Transaction) => void; /** * @description Cancel all conditional orders for a margin manager * @param {string} marginManagerKey The key to identify the margin manager * @returns A function that takes a Transaction object */ cancelAllConditionalOrders: (marginManagerKey: string) => (tx: Transaction) => void; /** * @description Cancel a specific conditional order * @param {string} marginManagerKey The key to identify the margin manager * @param {string} conditionalOrderId The ID of the conditional order to cancel * @returns A function that takes a Transaction object */ cancelConditionalOrder: (marginManagerKey: string, conditionalOrderId: string) => (tx: Transaction) => void; /** * @description Execute conditional orders that have been triggered. * Permissionless — anyone can call this. After the inner fill loop, the * manager's post-trade `risk_ratio` is checked against * `min_borrow_risk_ratio`; if any triggered fill breaches that floor, the * whole txn aborts (no partial-state landing). * @param {string} managerAddress The address of the margin manager * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC') * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call * @returns A function that takes a Transaction object */ executeConditionalOrders: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Execute conditional orders, deleveraging on each market-type * fill. Permissionless, with the same trigger and cancellation handling as * {@link executeConditionalOrders}, but the market proceeds are repaid into * the loan before the risk check, and the gate is the *net* post-repay * `risk_ratio` being at least the pre-fill ratio. * * This is what lets a stop-loss fire in the `liquidation..min_borrow` danger * band: a swap alone only lowers the oracle-valued ratio (so the v2 * borrow-floor gate rejects it), while repaying actually improves it. If a * single triggered fill would worsen net solvency the whole txn aborts — no * partial-state landing. * @param {string} managerAddress The address of the margin manager * @param {string} poolKey The key to identify the pool (e.g., 'SUI_USDC') * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call * @returns A function that takes a Transaction object */ executeConditionalOrdersV3: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Get all conditional order IDs for a margin manager * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @returns A function that takes a Transaction object */ conditionalOrderIds: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Get a specific conditional order by ID * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @param {string} conditionalOrderId The ID of the conditional order * @returns A function that takes a Transaction object */ conditionalOrder: (poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Get the lowest trigger price for trigger_above orders * Returns constants::max_u64() if there are no trigger_above orders * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @returns A function that takes a Transaction object */ lowestTriggerAbovePrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; /** * @description Get the highest trigger price for trigger_below orders * Returns 0 if there are no trigger_below orders * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @returns A function that takes a Transaction object */ highestTriggerBelowPrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions193.TransactionResult; } //#endregion export { MarginTPSLContract }; //# sourceMappingURL=marginTPSL.d.mts.map