Documentation

    DeepBookClient class for managing DeepBook operations.

    Index

    Constructors

    • Parameters

      • __namedParameters: {
            address: string;
            adminCap?: string;
            balanceManagers?: { [key: string]: BalanceManager };
            client: SuiClient;
            coins?: CoinMap;
            env: Environment;
            pools?: PoolMap;
        }

      Returns DeepBookClient

    Properties

    balanceManager: BalanceManagerContract
    client: SuiClient
    deepBookAdmin: DeepBookAdminContract
    flashLoans: FlashLoanContract
    governance: GovernanceContract

    Methods

    • Parameters

      • poolKey: string

        Key of the pool

      • managerKey: string

        The key of the BalanceManager

      Returns Promise<
          {
              active_stake: number;
              created_proposal: boolean;
              epoch: string;
              inactive_stake: number;
              maker_volume: number;
              open_orders: { constants: string[] };
              owed_balances: { base: number; deep: number; quote: number };
              settled_balances: { base: number; deep: number; quote: number };
              taker_volume: number;
              unclaimed_rebates: { base: number; deep: number; quote: number };
              voted_proposal: null | { bytes: string };
          },
      >

      A promise that resolves to an object containing the account information

      Get the account information for a given pool and balance manager

    • Parameters

      • poolKey: string

        Key of the pool

      • managerKey: string

        Key of the balance manager

      Returns Promise<string[]>

      An array of open order IDs

      Get open orders for a balance manager in a pool

    • Parameters

      • managerKey: string

        Key of the balance manager

      • coinKey: string

        Key of the coin

      Returns Promise<{ balance: number; coinType: string }>

      An object with coin type and balance

      Check the balance of a balance manager for a specific coin

    • Parameters

      • encodedOrderId: bigint

        Encoded order ID

      Returns { isBid: boolean; orderId: number; price: number }

      Object containing isBid, price, and orderId

      Decode the order ID to get bid/ask status, price, and orderId

    • Parameters

      • poolKey: string

        Key of the pool

      • quoteQuantity: number

        Quote quantity to convert

      Returns Promise<
          {
              baseOut: number;
              deepRequired: number;
              quoteOut: number;
              quoteQuantity: number;
          },
      >

      An object with quote quantity, base out, quote out, and deep required for the dry run

      Get the base quantity out for a given quote quantity

    • Parameters

      • poolKey: string

        Key of the pool

      • priceLow: number

        Lower bound of the price range

      • priceHigh: number

        Upper bound of the price range

      • isBid: boolean

        Whether to get bid or ask orders

      Returns Promise<{ prices: number[]; quantities: number[] }>

      An object with arrays of prices and quantities

      Get level 2 order book specifying range of price

    • Parameters

      • poolKey: string

        Key of the pool

      • ticks: number

        Number of ticks from mid-price

      Returns Promise<
          {
              ask_prices: number[];
              ask_quantities: number[];
              bid_prices: number[];
              bid_quantities: number[];
          },
      >

      An object with arrays of prices and quantities

      Get level 2 order book ticks from mid-price for a pool

    • Parameters

      • poolKey: string

        Key of the pool

      • orderId: string

        Order ID

      Returns Promise<
          | null
          | {
              balance_manager_id: { bytes: string };
              client_order_id: string;
              epoch: string;
              expire_timestamp: string;
              fee_is_deep: boolean;
              filled_quantity: string;
              order_deep_price: { asset_is_base: boolean; deep_per_asset: string };
              order_id: string;
              quantity: string;
              status: number;
          },
      >

      A promise that resolves to an object containing the order information

      Get the order information for a specific order in a pool

    • Parameters

      • poolKey: string

        Key of the pool

      • orderId: string

        Order ID

      Returns Promise<
          | null
          | {
              balance_manager_id: { bytes: string };
              client_order_id: string;
              epoch: string;
              expire_timestamp: string;
              fee_is_deep: boolean;
              filled_quantity: string;
              isBid: boolean;
              normalized_price: string;
              order_deep_price: { asset_is_base: boolean; deep_per_asset: string };
              order_id: string;
              quantity: string;
              status: number;
          },
      >

      A promise that resolves to an object containing the order information with normalized price

      Get the order information for a specific order in a pool, with normalized price

    • Parameters

      • poolKey: string

        The key identifying the pool from which to retrieve order information.

      • orderIds: string[]

        List of order IDs to retrieve information for.

      Returns Promise<
          | null
          | {
              balance_manager_id: { bytes: string };
              client_order_id: string;
              epoch: string;
              expire_timestamp: string;
              fee_is_deep: boolean;
              filled_quantity: string;
              order_deep_price: { asset_is_base: boolean; deep_per_asset: string };
              order_id: string;
              quantity: string;
              status: number;
          }[],
      >

      A promise that resolves to an array of order objects, each containing details such as balance manager ID, order ID, client order ID, quantity, filled quantity, fee information, order price, epoch, status, and expiration timestamp. Returns null if the retrieval fails.

      Retrieves information for multiple specific orders in a pool.

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<
          | {
              asset_is_base: true;
              deep_per_base: number;
              deep_per_quote?: undefined;
          }
          | {
              asset_is_base: false;
              deep_per_base?: undefined;
              deep_per_quote: number;
          },
      >

      Deep price conversion

      Get the DEEP price conversion for a pool

    • Parameters

      • baseType: string

        Type of the base asset

      • quoteType: string

        Type of the quote asset

      Returns Promise<string>

      The address of the pool

      Get the pool ID by asset types

    • Parameters

      • poolKey: string

        Key of the pool

      • baseQuantity: number

        Base quantity to convert

      • quoteQuantity: number

        Quote quantity to convert

      Returns Promise<
          {
              baseOut: number;
              baseQuantity: number;
              deepRequired: number;
              quoteOut: number;
              quoteQuantity: number;
          },
      >

      An object with base quantity, quote quantity, base out, quote out, and deep required for the dry run

      Get the output quantities for given base and quote quantities. Only one quantity can be non-zero

    • Parameters

      • poolKey: string

        Key of the pool

      • baseQuantity: number

        Base quantity to convert

      Returns Promise<
          {
              baseOut: number;
              baseQuantity: number;
              deepRequired: number;
              quoteOut: number;
          },
      >

      An object with base quantity, base out, quote out, and deep required for the dry run

      Get the quote quantity out for a given base quantity

    • Parameters

      • poolKey: string

        Key of the pool

      • balanceManagerKey: string

      Returns Promise<{ base: number; deep: number; quote: number }>

      An object with base, quote, and deep locked for the balance manager in the pool

      Get the locked balances for a pool and balance manager

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<number>

      The mid price

      Get the mid price for a pool

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<{ lotSize: number; minSize: number; tickSize: number }>

      Get the trade parameters for a given pool, including tick size, lot size, and min size.

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<{ makerFee: number; stakeRequired: number; takerFee: number }>

      Get the trade parameters for a given pool, including taker fee, maker fee, and stake required.

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<{ base: number; deep: number; quote: number }>

      An object with base, quote, and deep balances in the vault

      Get the vault balances for a pool

    • Parameters

      • poolKey: string

        Key of the pool

      Returns Promise<boolean>

      Boolean indicating if the pool is whitelisted

      Check if a pool is whitelisted

    MMNEPVFCICPMFPCPTTAAATR