Documentation
    Preparing search index...

    Class MarginManagerContract

    MarginManagerContract class for managing MarginManager operations.

    Index

    Constructors

    Methods

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the pool account data for the margin manager.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Check if the margin manager's account exists in the pool.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the open order IDs for the margin manager's account in the pool.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the balance manager ID for a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the underlying BalanceManager ID for a margin manager. Returns an ID (not a &BalanceManager), so it composes in PTBs unlike balanceManager.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the base asset balance of a margin manager

    • Parameters

      • managerKey: string

        The key to identify the manager

      • amount: number

        The amount to borrow

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Borrow base from a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get borrowed base shares

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get borrowed quote shares

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get borrowed shares for both base and quote assets

    • Parameters

      • managerKey: string

        The key to identify the manager

      • amount: number

        The amount to borrow

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Borrow quote from a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Calculate assets (base and quote) for a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • coinKey: string

        The key to identify the debt coin (base or quote)

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Calculate debts (base and quote) for a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      • price: number | bigint

        Limit price

      • quantity: number | bigint

        Order quantity (base units)

      • isBid: boolean

        True for bid, false for ask

      • payWithDeep: boolean

        Whether to pay fees in DEEP

      • expireTimestamp: number | bigint

        Order expiration timestamp (ms)

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Check whether a limit order can be placed given the manager's current state.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      • quantity: number | bigint

        Order quantity (base units)

      • isBid: boolean

        True for bid, false for ask

      • payWithDeep: boolean

        Whether to pay fees in DEEP

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Check whether a market order can be placed given the manager's current state.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the DEEP token balance of a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the DeepBook pool ID associated with a margin manager

    • Parameters

      • params: DepositParams

        The deposit parameters

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Deposit base into a margin manager

    • Parameters

      • params: DepositParams

        The deposit parameters

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Deposit deep into a margin manager

    • Parameters

      • params: DepositDuringInitParams

        The deposit parameters

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      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.

    • Parameters

      • params: DepositParams

        The deposit parameters

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Deposit quote into a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get full order details for the margin manager's account in the pool.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the BalanceManager referral ID for a pool (Option).

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Check if margin manager has base asset debt

    • Parameters

      • managerAddress: string

        The address of the manager to liquidate

      • poolKey: string

        The key to identify the pool

      • debtIsBase: boolean

        Whether the debt is in base

      • repayCoin: TransactionArgument

        The coin to repay

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Liquidate a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get locked balances (base, quote, deep) for the margin manager's account in the pool.

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get comprehensive state information for a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the margin pool ID (if any) associated with a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Create a new margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      Returns (
          tx: Transaction,
      ) => {
          initializer: { $kind: "NestedResult"; NestedResult: [number, number] };
          manager: { $kind: "NestedResult"; NestedResult: [number, number] };
      }

      A function that takes a Transaction object

      Create a new margin manager with an initializer

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the owner address of a margin manager

    • Parameters

      • poolKey: string

        The key to identify the pool

      • marginManagerId: string

        The ID of the margin manager

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Get the quote asset balance of a margin manager

    • Parameters

      • managerKey: string

        The key to identify the margin manager

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Register a margin manager back to the margin registry. Lets owners restore visibility of a manager that was unregistered by another platform.

    • Parameters

      • managerKey: string

        The key to identify the manager

      • Optionalamount: number

        The amount to repay

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Repay base from a margin manager

    • Parameters

      • managerKey: string

        The key to identify the manager

      • Optionalamount: number

        The amount to repay

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Repay quote from a margin manager

    • Parameters

      • managerKey: string

        The key to identify the margin manager

      • referral: string

        The referral (DeepBookPoolReferral) to set

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Set the referral for a margin manager (DeepBookPoolReferral)

    • Parameters

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Share a margin manager

    • Parameters

      • managerKey: string

        The key to identify the margin manager

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Unregister a margin manager from the margin registry. Aborts if the manager holds any outstanding debt or base/quote/DEEP balance.

    • Parameters

      • managerKey: string

        The key to identify the margin manager

      • poolKey: string

        The key of the pool to unset the referral for

      Returns (tx: Transaction) => void

      A function that takes a Transaction object

      Unset the referral for a margin manager

    • Parameters

      • managerKey: string

        The key to identify the manager

      • amount: number

        The amount to withdraw

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Withdraw base from a margin manager

    • Parameters

      • managerKey: string

        The key to identify the manager

      • amount: number

        The amount to withdraw

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Withdraw deep from a margin manager

    • Parameters

      • managerKey: string

        The key to identify the manager

      • amount: number

        The amount to withdraw

      Returns (tx: Transaction) => TransactionResult

      A function that takes a Transaction object

      Withdraw quote from a margin manager