import { DepositDuringInitParams, DepositParams } from "../types/index.mjs"; import { DeepBookConfig } from "../utils/config.mjs"; import * as _mysten_sui_transactions95 from "@mysten/sui/transactions"; import { Transaction, TransactionArgument } from "@mysten/sui/transactions"; //#region src/transactions/marginManager.d.ts /** * MarginManagerContract class for managing MarginManager operations. */ declare class MarginManagerContract { #private; /** * @param {DeepBookConfig} config Configuration for MarginManagerContract */ constructor(config: DeepBookConfig); /** * @description Create a new margin manager * @param {string} poolKey The key to identify the pool * @returns A function that takes a Transaction object */ newMarginManager: (poolKey: string) => (tx: Transaction) => void; /** * @description Create a new margin manager with an initializer * @param {string} poolKey The key to identify the pool * @returns A function that takes a Transaction object */ newMarginManagerWithInitializer: (poolKey: string) => (tx: Transaction) => { manager: { NestedResult: [number, number]; $kind: "NestedResult"; }; initializer: { NestedResult: [number, number]; $kind: "NestedResult"; }; }; /** * @description Share a margin manager * @param {string} poolKey The key to identify the pool * @param {TransactionArgument} manager The margin manager to share * @param {TransactionArgument} initializer The initializer for the manager * @returns A function that takes a Transaction object */ shareMarginManager: (poolKey: string, manager: TransactionArgument, initializer: TransactionArgument) => (tx: Transaction) => void; /** * @description Register a margin manager back to the margin registry. Lets * owners restore visibility of a manager that was unregistered by another * platform. * @param {string} managerKey The key to identify the margin manager * @returns A function that takes a Transaction object */ registerMarginManager: (managerKey: string) => (tx: Transaction) => void; /** * @description Unregister a margin manager from the margin registry. Aborts * if the manager holds any outstanding debt or base/quote/DEEP balance. * @param {string} managerKey The key to identify the margin manager * @returns A function that takes a Transaction object */ unregisterMarginManager: (managerKey: string) => (tx: Transaction) => void; /** * @description Deposit into a margin manager during initialization (before sharing). * Use this when you need to deposit funds into a newly created manager in the same transaction. * @param {DepositDuringInitParams} params The deposit parameters * @returns A function that takes a Transaction object */ depositDuringInitialization: (params: DepositDuringInitParams) => (tx: Transaction) => void; /** * @description Deposit base into a margin manager * @param {DepositParams} params The deposit parameters * @returns A function that takes a Transaction object */ depositBase: (params: DepositParams) => (tx: Transaction) => void; /** * @description Deposit quote into a margin manager * @param {DepositParams} params The deposit parameters * @returns A function that takes a Transaction object */ depositQuote: (params: DepositParams) => (tx: Transaction) => void; /** * @description Deposit deep into a margin manager * @param {DepositParams} params The deposit parameters * @returns A function that takes a Transaction object */ depositDeep: (params: DepositParams) => (tx: Transaction) => void; /** * @description Withdraw base from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to withdraw * @returns A function that takes a Transaction object */ withdrawBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Withdraw quote from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to withdraw * @returns A function that takes a Transaction object */ withdrawQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Withdraw deep from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to withdraw * @returns A function that takes a Transaction object */ withdrawDeep: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Borrow base from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to borrow * @returns A function that takes a Transaction object */ borrowBase: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Borrow quote from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to borrow * @returns A function that takes a Transaction object */ borrowQuote: (managerKey: string, amount: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Repay base from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to repay * @returns A function that takes a Transaction object */ repayBase: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Repay quote from a margin manager * @param {string} managerKey The key to identify the manager * @param {number} amount The amount to repay * @returns A function that takes a Transaction object */ repayQuote: (managerKey: string, amount?: number) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Liquidate a margin manager * @param {string} managerAddress The address of the manager to liquidate * @param {string} poolKey The key to identify the pool * @param {boolean} debtIsBase Whether the debt is in base * @param {TransactionArgument} repayCoin The coin to repay * @returns A function that takes a Transaction object */ liquidate: (managerAddress: string, poolKey: string, debtIsBase: boolean, repayCoin: TransactionArgument) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Set the referral for a margin manager (DeepBookPoolReferral) * @param {string} managerKey The key to identify the margin manager * @param {string} referral The referral (DeepBookPoolReferral) to set * @returns A function that takes a Transaction object */ setMarginManagerReferral: (managerKey: string, referral: string) => (tx: Transaction) => void; /** * @description Unset the referral for a margin manager * @param {string} managerKey The key to identify the margin manager * @param {string} poolKey The key of the pool to unset the referral for * @returns A function that takes a Transaction object */ unsetMarginManagerReferral: (managerKey: string, poolKey: string) => (tx: Transaction) => void; /** * @description Get the owner address of 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 */ ownerByPoolKey: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the DeepBook pool ID associated with 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 */ deepbookPool: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the margin pool ID (if any) associated with 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 */ marginPoolId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get borrowed shares for both base and quote assets * @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 */ borrowedShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get borrowed base shares * @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 */ borrowedBaseShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get borrowed quote shares * @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 */ borrowedQuoteShares: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Check if margin manager has base asset debt * @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 */ hasBaseDebt: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the balance manager ID 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 */ balanceManager: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Calculate assets (base and quote) 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 */ calculateAssets: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Calculate debts (base and quote) for a margin manager * @param {string} poolKey The key to identify the pool * @param {string} coinKey The key to identify the debt coin (base or quote) * @param {string} marginManagerId The ID of the margin manager * @returns A function that takes a Transaction object */ calculateDebts: (poolKey: string, coinKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get comprehensive state information 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 * @returns Returns (manager_id, deepbook_pool_id, risk_ratio, base_asset, quote_asset, * base_debt, quote_debt, base_pyth_price, base_pyth_decimals, * quote_pyth_price, quote_pyth_decimals) */ managerState: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the base asset balance of 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 */ baseBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the quote asset balance of 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 */ quoteBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the DEEP token balance of 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 */ deepBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the underlying BalanceManager ID for a margin manager. * Returns an ID (not a `&BalanceManager`), so it composes in PTBs unlike * `balanceManager`. * @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 */ balanceManagerId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the BalanceManager referral ID for a pool (Option). * @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 */ getBalanceManagerReferralId: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Check if the margin manager's account exists in the pool. * @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 */ accountExists: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the pool account data for the 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 */ account: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get the open order IDs for the margin manager's account in * the pool. * @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 */ accountOpenOrders: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get full order details for the margin manager's account in * the pool. * @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 */ getAccountOrderDetails: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Get locked balances (base, quote, deep) for the margin * manager's account in the pool. * @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 */ lockedBalance: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Check whether a limit order can be placed given the * manager's current state. * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @param {number | bigint} price Limit price * @param {number | bigint} quantity Order quantity (base units) * @param {boolean} isBid True for bid, false for ask * @param {boolean} payWithDeep Whether to pay fees in DEEP * @param {number | bigint} expireTimestamp Order expiration timestamp (ms) * @returns A function that takes a Transaction object */ canPlaceLimitOrder: (poolKey: string, marginManagerId: string, price: number | bigint, quantity: number | bigint, isBid: boolean, payWithDeep: boolean, expireTimestamp: number | bigint) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; /** * @description Check whether a market order can be placed given the * manager's current state. * @param {string} poolKey The key to identify the pool * @param {string} marginManagerId The ID of the margin manager * @param {number | bigint} quantity Order quantity (base units) * @param {boolean} isBid True for bid, false for ask * @param {boolean} payWithDeep Whether to pay fees in DEEP * @returns A function that takes a Transaction object */ canPlaceMarketOrder: (poolKey: string, marginManagerId: string, quantity: number | bigint, isBid: boolean, payWithDeep: boolean) => (tx: Transaction) => _mysten_sui_transactions95.TransactionResult; } //#endregion export { MarginManagerContract }; //# sourceMappingURL=marginManager.d.mts.map