{"version":3,"file":"deepbook.mjs","names":["#config","poolMoveCalls.placeLimitOrder","poolMoveCalls.placeMarketOrder","poolMoveCalls.modifyOrder","poolMoveCalls.cancelOrder","poolMoveCalls.cancelOrders","poolMoveCalls.cancelLiveOrder","poolMoveCalls.cancelLiveOrders","poolMoveCalls.cancelAllOrders","poolMoveCalls.withdrawSettledAmounts","poolMoveCalls.withdrawSettledAmountsPermissionless","poolMoveCalls.addDeepPricePoint","poolMoveCalls.claimRebates","poolMoveCalls.mintReferral","poolMoveCalls.updatePoolReferralMultiplier","poolMoveCalls.claimPoolReferralRewards","poolMoveCalls.updatePoolAllowedVersions","poolMoveCalls.getOrder","poolMoveCalls.getOrders","poolMoveCalls.burnDeep","poolMoveCalls.midPrice","poolMoveCalls.whitelisted","poolMoveCalls.getQuoteQuantityOut","poolMoveCalls.getBaseQuantityOut","poolMoveCalls.getQuantityOut","poolMoveCalls.accountOpenOrders","poolMoveCalls.getLevel2Range","poolMoveCalls.getLevel2TicksFromMid","poolMoveCalls.vaultBalances","poolMoveCalls.getPoolIdByAsset","poolMoveCalls.swapExactBaseForQuote","poolMoveCalls.swapExactQuoteForBase","poolMoveCalls.swapExactQuantity","poolMoveCalls.swapExactBaseForQuoteWithManager","poolMoveCalls.swapExactQuoteForBaseWithManager","poolMoveCalls.swapExactQuantityWithManager","poolMoveCalls.createPermissionlessPool","poolMoveCalls.poolTradeParams","poolMoveCalls.poolBookParams","poolMoveCalls.account","poolMoveCalls.lockedBalance","poolMoveCalls.getOrderDeepPrice","registryMoveCalls.getBalanceManagerIds","poolMoveCalls.getPoolReferralBalances","poolMoveCalls.poolReferralMultiplier","poolMoveCalls.stablePool","poolMoveCalls.registeredPool","poolMoveCalls.getQuoteQuantityOutInputFee","poolMoveCalls.getBaseQuantityOutInputFee","poolMoveCalls.getQuantityOutInputFee","poolMoveCalls.getBaseQuantityIn","poolMoveCalls.getQuoteQuantityIn","poolMoveCalls.getAccountOrderDetails","poolMoveCalls.getOrderDeepRequired","poolMoveCalls.accountExists","poolMoveCalls.poolTradeParamsNext","poolMoveCalls.quorum","poolMoveCalls.id","poolMoveCalls.canPlaceLimitOrder","poolMoveCalls.canPlaceMarketOrder","poolMoveCalls.checkMarketOrderParams","poolMoveCalls.checkLimitOrderParams"],"sources":["../../src/transactions/deepbook.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { coinWithBalance } from '@mysten/sui/transactions';\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport type {\n\tCanPlaceLimitOrderParams,\n\tCanPlaceMarketOrderParams,\n\tCreatePermissionlessPoolParams,\n\tPlaceLimitOrderParams,\n\tPlaceMarketOrderParams,\n\tSwapParams,\n\tSwapWithManagerParams,\n} from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport {\n\tDEEP_SCALAR,\n\tFLOAT_SCALAR,\n\tGAS_BUDGET,\n\tMAX_TIMESTAMP,\n\tPOOL_CREATION_FEE_DEEP,\n} from '../utils/config.js';\nimport { convertQuantity, convertPrice, convertRate } from '../utils/conversion.js';\nimport * as poolMoveCalls from '../contracts/deepbook/pool.js';\nimport * as registryMoveCalls from '../contracts/deepbook/registry.js';\n\n/**\n * DeepBookContract class for managing DeepBook operations.\n */\nexport class DeepBookContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @description Place a limit order\n\t * @param {PlaceLimitOrderParams} params Parameters for placing a limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceLimitOrder = (params: PlaceLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tbalanceManagerKey,\n\t\t\tclientOrderId,\n\t\t\tprice,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\texpiration = MAX_TIMESTAMP,\n\t\t\torderType = OrderType.NO_RESTRICTION,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.placeLimitOrder({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\ttradeProof,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\torderType,\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp: expiration,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Place a market order\n\t * @param {PlaceMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrder = (params: PlaceMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tbalanceManagerKey,\n\t\t\tclientOrderId,\n\t\t\tquantity,\n\t\t\tisBid,\n\t\t\tselfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,\n\t\t\tpayWithDeep = true,\n\t\t} = params;\n\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.placeMarketOrder({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\ttradeProof,\n\t\t\t\t\tclientOrderId: BigInt(clientOrderId),\n\t\t\t\t\tselfMatchingOption,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Modify an existing order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string} orderId Order ID to modify\n\t * @param {number} newQuantity New quantity for the order\n\t * @returns A function that takes a Transaction object\n\t */\n\tmodifyOrder =\n\t\t(poolKey: string, balanceManagerKey: string, orderId: string, newQuantity: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\t\t\tconst inputQuantity = convertQuantity(newQuantity, baseCoin.scalar);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.modifyOrder({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeProof,\n\t\t\t\t\t\torderId: BigInt(orderId),\n\t\t\t\t\t\tnewQuantity: inputQuantity,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Cancel an existing order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string} orderId Order ID to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrder =\n\t\t(poolKey: string, balanceManagerKey: string, orderId: string) => (tx: Transaction) => {\n\t\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.cancelOrder({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeProof,\n\t\t\t\t\t\torderId: BigInt(orderId),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Cancel multiple orders\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string[]} orderIds Array of order IDs to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrders =\n\t\t(poolKey: string, balanceManagerKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.cancelOrders({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeProof,\n\t\t\t\t\t\torderIds: orderIds.map(BigInt),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Cancel an existing order, no-op if the order is not currently in the\n\t * balance manager's open orders (e.g. already filled, cancelled, expired-and-swept,\n\t * or not owned by this balance manager). Unlike `cancelOrder`, this will not abort\n\t * on unknown order ids.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string} orderId Order ID to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelLiveOrder =\n\t\t(poolKey: string, balanceManagerKey: string, orderId: string) => (tx: Transaction) => {\n\t\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.cancelLiveOrder({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeProof,\n\t\t\t\t\t\torderId: BigInt(orderId),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Cancel multiple orders, skipping any order_id that is not currently in\n\t * the balance manager's open orders (e.g. already filled, cancelled, expired-and-swept,\n\t * or not owned by this balance manager). Duplicate ids in the input vector are handled\n\t * gracefully. Unlike `cancelOrders`, this will not abort on unknown order ids.\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @param {string[]} orderIds Array of order IDs to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelLiveOrders =\n\t\t(poolKey: string, balanceManagerKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.cancelLiveOrders({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeProof,\n\t\t\t\t\t\torderIds: orderIds.map(BigInt),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Cancel all open orders for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllOrders = (poolKey: string, balanceManagerKey: string) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.cancelAllOrders({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw settled amounts for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmounts = (poolKey: string, balanceManagerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.withdrawSettledAmounts({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Withdraw settled amounts permissionlessly for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmountsPermissionless =\n\t\t(poolKey: string, balanceManagerKey: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.withdrawSettledAmountsPermissionless({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, balanceManager: balanceManager.address },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Withdraw settled amounts permissionlessly for a balance manager by ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerId The object ID of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmountsManagerID =\n\t\t(poolKey: string, balanceManagerId: string) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.withdrawSettledAmountsPermissionless({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, balanceManager: balanceManagerId },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Add a deep price point for a target pool using a reference pool\n\t * @param {string} targetPoolKey The key to identify the target pool\n\t * @param {string} referencePoolKey The key to identify the reference pool\n\t * @returns A function that takes a Transaction object\n\t */\n\taddDeepPricePoint = (targetPoolKey: string, referencePoolKey: string) => (tx: Transaction) => {\n\t\tconst targetPool = this.#config.getPool(targetPoolKey);\n\t\tconst referencePool = this.#config.getPool(referencePoolKey);\n\t\tconst targetBaseCoin = this.#config.getCoin(targetPool.baseCoin);\n\t\tconst targetQuoteCoin = this.#config.getCoin(targetPool.quoteCoin);\n\t\tconst referenceBaseCoin = this.#config.getCoin(referencePool.baseCoin);\n\t\tconst referenceQuoteCoin = this.#config.getCoin(referencePool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.addDeepPricePoint({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { targetPool: targetPool.address, referencePool: referencePool.address },\n\t\t\t\ttypeArguments: [\n\t\t\t\t\ttargetBaseCoin.type,\n\t\t\t\t\ttargetQuoteCoin.type,\n\t\t\t\t\treferenceBaseCoin.type,\n\t\t\t\t\treferenceQuoteCoin.type,\n\t\t\t\t],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Claim rebates for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} balanceManagerKey The key to identify the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tclaimRebates = (poolKey: string, balanceManagerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.claimRebates({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: balanceManager.address, tradeProof },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Mint a referral for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} multiplier The multiplier for the referral\n\t * @returns A function that takes a Transaction object\n\t */\n\tmintReferral = (poolKey: string, multiplier: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.mintReferral({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, multiplier: adjustedNumber },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Update the referral multiplier for a pool (DeepBookPoolReferral)\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} referral The referral (DeepBookPoolReferral) to update\n\t * @param {number} multiplier The multiplier for the referral\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdatePoolReferralMultiplier =\n\t\t(poolKey: string, referral: string, multiplier: number) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst adjustedNumber = convertRate(multiplier, FLOAT_SCALAR);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.updatePoolReferralMultiplier({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, referral, multiplier: adjustedNumber },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Claim the rewards for a referral (DeepBookPoolReferral)\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} referral The referral (DeepBookPoolReferral) to claim the rewards for\n\t * @returns A function that takes a Transaction object\n\t */\n\tclaimPoolReferralRewards = (poolKey: string, referral: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst [baseRewards, quoteRewards, deepRewards] = tx.add(\n\t\t\tpoolMoveCalls.claimPoolReferralRewards({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, referral },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn { baseRewards, quoteRewards, deepRewards };\n\t};\n\n\t/**\n\t * @description Update the allowed versions for a pool\n\t * @param {string} poolKey The key of the pool to be updated\n\t * @returns A function that takes a Transaction object\n\t */\n\tupdatePoolAllowedVersions = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.updatePoolAllowedVersions({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, registry: this.#config.REGISTRY_ID },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Gets an order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} orderId Order ID to get\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetOrder = (poolKey: string, orderId: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getOrder({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, orderId: BigInt(orderId) },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Prepares a transaction to retrieve multiple orders from a specified pool.\n\t * @param {string} poolKey - The identifier key for the pool to retrieve orders from.\n\t * @param {string[]} orderIds - Array of order IDs to retrieve.\n\t * @returns {Function} A function that takes a Transaction object\n\t */\n\tgetOrders = (poolKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getOrders({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, orderIds: orderIds.map(BigInt) },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Burn DEEP tokens from the pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tburnDeep = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.burnDeep({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, treasuryCap: this.#config.DEEP_TREASURY_ID },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the mid price for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tmidPrice = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.midPrice({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if a pool is whitelisted\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\twhitelisted = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\ttx.add(\n\t\t\tpoolMoveCalls.whitelisted({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the quote quantity out for a given base quantity in\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetQuoteQuantityOut = (poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getQuoteQuantityOut({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbaseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the base quantity out for a given quote quantity in\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBaseQuantityOut = (poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getBaseQuantityOut({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tquoteQuantity: convertQuantity(quoteQuantity, quoteScalar),\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the quantity out for a given base or quote quantity\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetQuantityOut =\n\t\t(poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.getQuantityOut({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbaseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),\n\t\t\t\t\t\tquoteQuantity: convertQuantity(quoteQuantity, quoteScalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get open orders for a balance manager in a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} managerKey Key of the balance manager\n\t * @returns A function that takes a Transaction object\n\t */\n\taccountOpenOrders = (poolKey: string, managerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.accountOpenOrders({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: manager.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get level 2 order book specifying range of price\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} priceLow Lower bound of the price range\n\t * @param {number} priceHigh Upper bound of the price range\n\t * @param {boolean} isBid Whether to get bid or ask orders\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetLevel2Range =\n\t\t(poolKey: string, priceLow: number | bigint, priceHigh: number | bigint, isBid: boolean) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\ttx.add(\n\t\t\t\tpoolMoveCalls.getLevel2Range({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tpriceLow: convertPrice(priceLow, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar),\n\t\t\t\t\t\tpriceHigh: convertPrice(priceHigh, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar),\n\t\t\t\t\t\tisBid,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get level 2 order book ticks from mid-price for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} tickFromMid Number of ticks from mid-price\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetLevel2TicksFromMid = (poolKey: string, tickFromMid: number) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getLevel2TicksFromMid({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, ticks: tickFromMid },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the vault balances for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tvaultBalances = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.vaultBalances({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the pool ID by asset types\n\t * @param {string} baseType Type of the base asset\n\t * @param {string} quoteType Type of the quote asset\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetPoolIdByAssets = (baseType: string, quoteType: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getPoolIdByAsset({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { registry: this.#config.REGISTRY_ID },\n\t\t\t\ttypeArguments: [baseType, quoteType],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Swap exact base amount for quote amount\n\t * @param {SwapParams} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactBaseForQuote = (params: SwapParams) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\n\t\tif (params.quoteCoin) {\n\t\t\tthrow new Error('quoteCoin is not accepted for swapping base asset');\n\t\t}\n\t\tconst { poolKey, amount: baseAmount, deepAmount, minOut: minQuote } = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst deepCoinType = this.#config.getCoin('DEEP').type;\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseCoinInput =\n\t\t\tparams.baseCoin ??\n\t\t\tcoinWithBalance({\n\t\t\t\ttype: baseCoin.type,\n\t\t\t\tbalance: convertQuantity(baseAmount, baseCoin.scalar),\n\t\t\t});\n\n\t\tconst deepCoin =\n\t\t\tparams.deepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: convertQuantity(deepAmount, DEEP_SCALAR) });\n\n\t\tconst minQuoteInput = convertQuantity(minQuote, quoteCoin.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(\n\t\t\tpoolMoveCalls.swapExactBaseForQuote({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbaseIn: baseCoinInput,\n\t\t\t\t\tdeepIn: deepCoin,\n\t\t\t\t\tminQuoteOut: minQuoteInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn [baseCoinResult, quoteCoinResult, deepCoinResult] as const;\n\t};\n\n\t/**\n\t * @description Swap exact quote amount for base amount\n\t * @param {SwapParams} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactQuoteForBase = (params: SwapParams) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\n\t\tif (params.baseCoin) {\n\t\t\tthrow new Error('baseCoin is not accepted for swapping quote asset');\n\t\t}\n\t\tconst { poolKey, amount: quoteAmount, deepAmount, minOut: minBase } = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst deepCoinType = this.#config.getCoin('DEEP').type;\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst quoteCoinInput =\n\t\t\tparams.quoteCoin ??\n\t\t\tcoinWithBalance({\n\t\t\t\ttype: quoteCoin.type,\n\t\t\t\tbalance: convertQuantity(quoteAmount, quoteCoin.scalar),\n\t\t\t});\n\n\t\tconst deepCoin =\n\t\t\tparams.deepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: convertQuantity(deepAmount, DEEP_SCALAR) });\n\n\t\tconst minBaseInput = convertQuantity(minBase, baseCoin.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(\n\t\t\tpoolMoveCalls.swapExactQuoteForBase({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tquoteIn: quoteCoinInput,\n\t\t\t\t\tdeepIn: deepCoin,\n\t\t\t\t\tminBaseOut: minBaseInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn [baseCoinResult, quoteCoinResult, deepCoinResult] as const;\n\t};\n\n\t/**\n\t * @description Swap exact quantity without a balance manager\n\t * @param {SwapParams & {isBaseToCoin: boolean}} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactQuantity = (params: SwapParams & { isBaseToCoin: boolean }) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\n\t\tconst { poolKey, amount, deepAmount, minOut, baseCoin, quoteCoin, deepCoin, isBaseToCoin } =\n\t\t\tparams;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst deepCoinType = this.#config.getCoin('DEEP').type;\n\t\tconst baseCoinType = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoinType = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseCoinInput = isBaseToCoin\n\t\t\t? (baseCoin ??\n\t\t\t\tcoinWithBalance({\n\t\t\t\t\ttype: baseCoinType.type,\n\t\t\t\t\tbalance: convertQuantity(amount, baseCoinType.scalar),\n\t\t\t\t}))\n\t\t\t: coinWithBalance({ type: baseCoinType.type, balance: 0 });\n\n\t\tconst quoteCoinInput = isBaseToCoin\n\t\t\t? coinWithBalance({ type: quoteCoinType.type, balance: 0 })\n\t\t\t: (quoteCoin ??\n\t\t\t\tcoinWithBalance({\n\t\t\t\t\ttype: quoteCoinType.type,\n\t\t\t\t\tbalance: convertQuantity(amount, quoteCoinType.scalar),\n\t\t\t\t}));\n\n\t\tconst deepCoinInput =\n\t\t\tdeepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: convertQuantity(deepAmount, DEEP_SCALAR) });\n\n\t\tconst minOutInput = convertQuantity(\n\t\t\tminOut,\n\t\t\tisBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar,\n\t\t);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.add(\n\t\t\tpoolMoveCalls.swapExactQuantity({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbaseIn: baseCoinInput,\n\t\t\t\t\tquoteIn: quoteCoinInput,\n\t\t\t\t\tdeepIn: deepCoinInput,\n\t\t\t\t\tminOut: minOutInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn [baseCoinResult, quoteCoinResult, deepCoinResult] as const;\n\t};\n\n\t/**\n\t * @description Swap exact base for quote with a balance manager\n\t * @param {SwapWithManagerParams} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactBaseForQuoteWithManager = (params: SwapWithManagerParams) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tbalanceManagerKey,\n\t\t\ttradeCap,\n\t\t\tdepositCap,\n\t\t\twithdrawCap,\n\t\t\tamount: baseAmount,\n\t\t\tminOut: minQuote,\n\t\t\tbaseCoin,\n\t\t} = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoinType = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoinType = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst baseCoinInput =\n\t\t\tbaseCoin ??\n\t\t\tcoinWithBalance({\n\t\t\t\ttype: baseCoinType.type,\n\t\t\t\tbalance: convertQuantity(baseAmount, baseCoinType.scalar),\n\t\t\t});\n\t\tconst minQuoteInput = convertQuantity(minQuote, quoteCoinType.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult] = tx.add(\n\t\t\tpoolMoveCalls.swapExactBaseForQuoteWithManager({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\ttradeCap,\n\t\t\t\t\tdepositCap,\n\t\t\t\t\twithdrawCap,\n\t\t\t\t\tbaseIn: baseCoinInput,\n\t\t\t\t\tminQuoteOut: minQuoteInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn [baseCoinResult, quoteCoinResult] as const;\n\t};\n\n\t/**\n\t * @description Swap exact quote for base with a balance manager\n\t * @param {SwapWithManagerParams} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactQuoteForBaseWithManager = (params: SwapWithManagerParams) => (tx: Transaction) => {\n\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tbalanceManagerKey,\n\t\t\ttradeCap,\n\t\t\tdepositCap,\n\t\t\twithdrawCap,\n\t\t\tamount: quoteAmount,\n\t\t\tminOut: minBase,\n\t\t\tquoteCoin,\n\t\t} = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoinType = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoinType = this.#config.getCoin(pool.quoteCoin);\n\n\t\tconst quoteCoinInput =\n\t\t\tquoteCoin ??\n\t\t\tcoinWithBalance({\n\t\t\t\ttype: quoteCoinType.type,\n\t\t\t\tbalance: convertQuantity(quoteAmount, quoteCoinType.scalar),\n\t\t\t});\n\t\tconst minBaseInput = convertQuantity(minBase, baseCoinType.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult] = tx.add(\n\t\t\tpoolMoveCalls.swapExactQuoteForBaseWithManager({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\ttradeCap,\n\t\t\t\t\tdepositCap,\n\t\t\t\t\twithdrawCap,\n\t\t\t\t\tquoteIn: quoteCoinInput,\n\t\t\t\t\tminBaseOut: minBaseInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\n\t\t\t}),\n\t\t);\n\n\t\treturn [baseCoinResult, quoteCoinResult] as const;\n\t};\n\n\t/**\n\t * @description Swap exact quantity (base or quote) with a balance manager\n\t * @param {SwapWithManagerParams & {isBaseToCoin: boolean}} params Parameters for the swap\n\t * @returns A function that takes a Transaction object\n\t */\n\tswapExactQuantityWithManager =\n\t\t(params: SwapWithManagerParams & { isBaseToCoin: boolean }) => (tx: Transaction) => {\n\t\t\ttx.setGasBudgetIfNotSet(GAS_BUDGET);\n\t\t\tconst {\n\t\t\t\tpoolKey,\n\t\t\t\tbalanceManagerKey,\n\t\t\t\ttradeCap,\n\t\t\t\tdepositCap,\n\t\t\t\twithdrawCap,\n\t\t\t\tamount,\n\t\t\t\tminOut,\n\t\t\t\tbaseCoin,\n\t\t\t\tquoteCoin,\n\t\t\t\tisBaseToCoin,\n\t\t\t} = params;\n\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst balanceManager = this.#config.getBalanceManager(balanceManagerKey);\n\t\t\tconst baseCoinType = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoinType = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\tconst baseCoinInput = isBaseToCoin\n\t\t\t\t? (baseCoin ??\n\t\t\t\t\tcoinWithBalance({\n\t\t\t\t\t\ttype: baseCoinType.type,\n\t\t\t\t\t\tbalance: convertQuantity(amount, baseCoinType.scalar),\n\t\t\t\t\t}))\n\t\t\t\t: coinWithBalance({ type: baseCoinType.type, balance: 0 });\n\n\t\t\tconst quoteCoinInput = isBaseToCoin\n\t\t\t\t? coinWithBalance({ type: quoteCoinType.type, balance: 0 })\n\t\t\t\t: (quoteCoin ??\n\t\t\t\t\tcoinWithBalance({\n\t\t\t\t\t\ttype: quoteCoinType.type,\n\t\t\t\t\t\tbalance: convertQuantity(amount, quoteCoinType.scalar),\n\t\t\t\t\t}));\n\n\t\t\tconst minOutInput = convertQuantity(\n\t\t\t\tminOut,\n\t\t\t\tisBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar,\n\t\t\t);\n\n\t\t\tconst [baseCoinResult, quoteCoinResult] = tx.add(\n\t\t\t\tpoolMoveCalls.swapExactQuantityWithManager({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbalanceManager: balanceManager.address,\n\t\t\t\t\t\ttradeCap,\n\t\t\t\t\t\tdepositCap,\n\t\t\t\t\t\twithdrawCap,\n\t\t\t\t\t\tbaseIn: baseCoinInput,\n\t\t\t\t\t\tquoteIn: quoteCoinInput,\n\t\t\t\t\t\tminOut: minOutInput,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\n\t\t\t\t}),\n\t\t\t);\n\n\t\t\treturn [baseCoinResult, quoteCoinResult] as const;\n\t\t};\n\n\t/**\n\t * @description Create a new pool permissionlessly\n\t * @param {CreatePermissionlessPoolParams} params Parameters for creating permissionless pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePermissionlessPool = (params: CreatePermissionlessPoolParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, deepCoin } = params;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\t\tconst deepCoinType = this.#config.getCoin('DEEP').type;\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = convertPrice(tickSize, FLOAT_SCALAR, quoteScalar, baseScalar);\n\t\tconst adjustedLotSize = convertQuantity(lotSize, baseScalar);\n\t\tconst adjustedMinSize = convertQuantity(minSize, baseScalar);\n\n\t\tconst deepCoinInput =\n\t\t\tdeepCoin ??\n\t\t\tcoinWithBalance({\n\t\t\t\ttype: deepCoinType,\n\t\t\t\tbalance: POOL_CREATION_FEE_DEEP,\n\t\t\t});\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.createPermissionlessPool({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tregistry: this.#config.REGISTRY_ID,\n\t\t\t\t\ttickSize: adjustedTickSize,\n\t\t\t\t\tlotSize: adjustedLotSize,\n\t\t\t\t\tminSize: adjustedMinSize,\n\t\t\t\t\tcreationFee: deepCoinInput,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the trade parameters for a given pool, including taker fee, maker fee, and stake required.\n\t * @param {string} poolKey Key of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolTradeParams = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.poolTradeParams({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the book parameters for a given pool, including tick size, lot size, and min size.\n\t * @param {string} poolKey Key of the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolBookParams = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.poolBookParams({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the account information for a given pool and balance manager\n\t * @param {string} poolKey Key of the pool\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\taccount = (poolKey: string, managerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.account({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: managerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the locked balance for a given pool and balance manager\n\t * @param {string} poolKey Key of the pool\n\t * @param {string} managerKey The key of the BalanceManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tlockedBalance = (poolKey: string, managerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst managerId = this.#config.getBalanceManager(managerKey).address;\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.lockedBalance({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: managerId },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the DEEP price conversion for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetPoolDeepPrice = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\ttx.add(\n\t\t\tpoolMoveCalls.getOrderDeepPrice({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the balance manager IDs for a given owner\n\t * @param {string} owner The owner address to get balance manager IDs for\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBalanceManagerIds = (owner: string) => (tx: Transaction) => {\n\t\ttx.add(\n\t\t\tregistryMoveCalls.getBalanceManagerIds({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: this.#config.REGISTRY_ID, owner },\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the balances for a referral (DeepBookPoolReferral)\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} referral The referral (DeepBookPoolReferral) to get the balances for\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetPoolReferralBalances = (poolKey: string, referral: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.getPoolReferralBalances({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, referral },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the multiplier for a referral (DeepBookPoolReferral)\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolReferralMultiplier = (poolKey: string, referral: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.poolReferralMultiplier({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, referral },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if a pool is a stable pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tstablePool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.stablePool({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if a pool is registered\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tregisteredPool = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.registeredPool({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the quote quantity out for a given base quantity using input token as fee\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetQuoteQuantityOutInputFee =\n\t\t(poolKey: string, baseQuantity: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getQuoteQuantityOutInputFee({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbaseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the base quantity out for a given quote quantity using input token as fee\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBaseQuantityOutInputFee =\n\t\t(poolKey: string, quoteQuantity: number | bigint) => (tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getBaseQuantityOutInputFee({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tquoteQuantity: convertQuantity(quoteQuantity, quoteCoin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the quantity out for a given base or quote quantity using input token as fee\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} baseQuantity Base quantity to convert\n\t * @param {number} quoteQuantity Quote quantity to convert\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetQuantityOutInputFee =\n\t\t(poolKey: string, baseQuantity: number | bigint, quoteQuantity: number | bigint) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getQuantityOutInputFee({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tbaseQuantity: convertQuantity(baseQuantity, baseCoin.scalar),\n\t\t\t\t\t\tquoteQuantity: convertQuantity(quoteQuantity, quoteCoin.scalar),\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the base quantity needed to receive a target quote quantity\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} targetQuoteQuantity Target quote quantity\n\t * @param {boolean} payWithDeep Whether to pay fees with DEEP\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetBaseQuantityIn =\n\t\t(poolKey: string, targetQuoteQuantity: number | bigint, payWithDeep: boolean) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getBaseQuantityIn({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\ttargetQuoteQuantity: convertQuantity(targetQuoteQuantity, quoteCoin.scalar),\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get the quote quantity needed to receive a target base quantity\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} targetBaseQuantity Target base quantity\n\t * @param {boolean} payWithDeep Whether to pay fees with DEEP\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetQuoteQuantityIn =\n\t\t(poolKey: string, targetBaseQuantity: number | bigint, payWithDeep: boolean) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getQuoteQuantityIn({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\ttargetBaseQuantity: convertQuantity(targetBaseQuantity, baseCoin.scalar),\n\t\t\t\t\t\tpayWithDeep,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Get account order details for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} managerKey Key of the balance manager\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetAccountOrderDetails = (poolKey: string, managerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.getAccountOrderDetails({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: manager.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the DEEP required for an order\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} baseQuantity Base quantity\n\t * @param {number} price Price\n\t * @returns A function that takes a Transaction object\n\t */\n\tgetOrderDeepRequired =\n\t\t(poolKey: string, baseQuantity: number | bigint, price: number | bigint) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(baseQuantity, baseCoin.scalar);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.getOrderDeepRequired({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: { self: pool.address, baseQuantity: inputQuantity, price: inputPrice },\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n\n\t/**\n\t * @description Check if account exists for a balance manager\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {string} managerKey Key of the balance manager\n\t * @returns A function that takes a Transaction object\n\t */\n\taccountExists = (poolKey: string, managerKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getBalanceManager(managerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.accountExists({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, balanceManager: manager.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the next epoch trade parameters for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolTradeParamsNext = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.poolTradeParamsNext({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the quorum for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tquorum = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.quorum({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Get the pool ID\n\t * @param {string} poolKey The key to identify the pool\n\t * @returns A function that takes a Transaction object\n\t */\n\tpoolId = (poolKey: string) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.id({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if a limit order can be placed\n\t * @param {CanPlaceLimitOrderParams} params Parameters for checking limit order validity\n\t * @returns A function that takes a Transaction object\n\t */\n\tcanPlaceLimitOrder = (params: CanPlaceLimitOrderParams) => (tx: Transaction) => {\n\t\tconst { poolKey, balanceManagerKey, price, quantity, isBid, payWithDeep, expireTimestamp } =\n\t\t\tparams;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.canPlaceLimitOrder({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: manager.address,\n\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t\texpireTimestamp,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if a market order can be placed\n\t * @param {CanPlaceMarketOrderParams} params Parameters for checking market order validity\n\t * @returns A function that takes a Transaction object\n\t */\n\tcanPlaceMarketOrder = (params: CanPlaceMarketOrderParams) => (tx: Transaction) => {\n\t\tconst { poolKey, balanceManagerKey, quantity, isBid, payWithDeep } = params;\n\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getBalanceManager(balanceManagerKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.canPlaceMarketOrder({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: {\n\t\t\t\t\tself: pool.address,\n\t\t\t\t\tbalanceManager: manager.address,\n\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\tisBid,\n\t\t\t\t\tpayWithDeep,\n\t\t\t\t},\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if market order params are valid\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} quantity Quantity\n\t * @returns A function that takes a Transaction object\n\t */\n\tcheckMarketOrderParams = (poolKey: string, quantity: number | bigint) => (tx: Transaction) => {\n\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\treturn tx.add(\n\t\t\tpoolMoveCalls.checkMarketOrderParams({\n\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\targuments: { self: pool.address, quantity: inputQuantity },\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t}),\n\t\t);\n\t};\n\n\t/**\n\t * @description Check if limit order params are valid\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} price Price\n\t * @param {number} quantity Quantity\n\t * @param {number} expireTimestamp Expiration timestamp\n\t * @returns A function that takes a Transaction object\n\t */\n\tcheckLimitOrderParams =\n\t\t(poolKey: string, price: number | bigint, quantity: number | bigint, expireTimestamp: number) =>\n\t\t(tx: Transaction) => {\n\t\t\tconst pool = this.#config.getPool(poolKey);\n\t\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\t\tconst inputPrice = convertPrice(price, FLOAT_SCALAR, quoteCoin.scalar, baseCoin.scalar);\n\t\t\tconst inputQuantity = convertQuantity(quantity, baseCoin.scalar);\n\n\t\t\treturn tx.add(\n\t\t\t\tpoolMoveCalls.checkLimitOrderParams({\n\t\t\t\t\tpackage: this.#config.DEEPBOOK_PACKAGE_ID,\n\t\t\t\t\targuments: {\n\t\t\t\t\t\tself: pool.address,\n\t\t\t\t\t\tprice: inputPrice,\n\t\t\t\t\t\tquantity: inputQuantity,\n\t\t\t\t\t\texpireTimestamp,\n\t\t\t\t\t},\n\t\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t\t}),\n\t\t\t);\n\t\t};\n}\n"],"m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