@mysten/deepbook-v3 0.28.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (535) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/dist/client.d.mts +897 -0
  3. package/dist/client.d.mts.map +1 -0
  4. package/dist/client.mjs +2067 -0
  5. package/dist/client.mjs.map +1 -0
  6. package/dist/contracts/deepbook/account.d.mts +38 -0
  7. package/dist/contracts/deepbook/account.d.mts.map +1 -0
  8. package/dist/contracts/deepbook/account.mjs +31 -0
  9. package/dist/contracts/deepbook/account.mjs.map +1 -0
  10. package/dist/contracts/deepbook/balances.d.mts +13 -0
  11. package/dist/contracts/deepbook/balances.d.mts.map +1 -0
  12. package/dist/contracts/deepbook/balances.mjs +24 -0
  13. package/dist/contracts/deepbook/balances.mjs.map +1 -0
  14. package/dist/contracts/deepbook/deep_price.d.mts +13 -0
  15. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -0
  16. package/dist/contracts/deepbook/deep_price.mjs +49 -0
  17. package/dist/contracts/deepbook/deep_price.mjs.map +1 -0
  18. package/dist/contracts/deepbook/deps/sui/vec_set.d.mts +22 -0
  19. package/dist/contracts/deepbook/deps/sui/vec_set.d.mts.map +1 -0
  20. package/dist/contracts/deepbook/deps/sui/vec_set.mjs +26 -0
  21. package/dist/contracts/deepbook/deps/sui/vec_set.mjs.map +1 -0
  22. package/dist/contracts/deepbook/order.d.mts +24 -0
  23. package/dist/contracts/deepbook/order.d.mts.map +1 -0
  24. package/dist/contracts/deepbook/order.mjs +63 -0
  25. package/dist/contracts/deepbook/order.mjs.map +1 -0
  26. package/dist/contracts/pyth/data_source.mjs +20 -0
  27. package/dist/contracts/pyth/data_source.mjs.map +1 -0
  28. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
  29. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
  30. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
  31. package/dist/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
  32. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs +16 -0
  33. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.mjs.map +1 -0
  34. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs +16 -0
  35. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.mjs.map +1 -0
  36. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs +16 -0
  37. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.mjs.map +1 -0
  38. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs +16 -0
  39. package/dist/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.mjs.map +1 -0
  40. package/dist/contracts/pyth/i64.mjs +19 -0
  41. package/dist/contracts/pyth/i64.mjs.map +1 -0
  42. package/dist/contracts/pyth/price.mjs +22 -0
  43. package/dist/contracts/pyth/price.mjs.map +1 -0
  44. package/dist/contracts/pyth/price_feed.mjs +21 -0
  45. package/dist/contracts/pyth/price_feed.mjs.map +1 -0
  46. package/dist/contracts/pyth/price_identifier.mjs +16 -0
  47. package/dist/contracts/pyth/price_identifier.mjs.map +1 -0
  48. package/dist/contracts/pyth/price_info.mjs +28 -0
  49. package/dist/contracts/pyth/price_info.mjs.map +1 -0
  50. package/dist/contracts/pyth/state.mjs +36 -0
  51. package/dist/contracts/pyth/state.mjs.map +1 -0
  52. package/dist/contracts/utils/index.d.mts +34 -0
  53. package/dist/contracts/utils/index.d.mts.map +1 -0
  54. package/dist/contracts/utils/index.mjs +35 -0
  55. package/dist/contracts/utils/index.mjs.map +1 -0
  56. package/dist/index.d.mts +25 -0
  57. package/dist/index.mjs +26 -0
  58. package/dist/pyth/PriceServiceConnection.d.mts +26 -0
  59. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -0
  60. package/dist/pyth/PriceServiceConnection.mjs +35 -0
  61. package/dist/pyth/PriceServiceConnection.mjs.map +1 -0
  62. package/dist/pyth/pyth-helpers.mjs +18 -0
  63. package/dist/pyth/pyth-helpers.mjs.map +1 -0
  64. package/dist/pyth/pyth.d.mts +69 -0
  65. package/dist/pyth/pyth.d.mts.map +1 -0
  66. package/dist/pyth/pyth.mjs +223 -0
  67. package/dist/pyth/pyth.mjs.map +1 -0
  68. package/dist/transactions/balanceManager.d.mts +174 -0
  69. package/dist/transactions/balanceManager.d.mts.map +1 -0
  70. package/dist/transactions/balanceManager.mjs +233 -0
  71. package/dist/transactions/balanceManager.mjs.map +1 -0
  72. package/dist/transactions/deepbook.d.mts +490 -0
  73. package/dist/transactions/deepbook.d.mts.map +1 -0
  74. package/dist/transactions/deepbook.mjs +978 -0
  75. package/dist/transactions/deepbook.mjs.map +1 -0
  76. package/dist/transactions/deepbookAdmin.d.mts +111 -0
  77. package/dist/transactions/deepbookAdmin.d.mts.map +1 -0
  78. package/dist/transactions/deepbookAdmin.mjs +221 -0
  79. package/dist/transactions/deepbookAdmin.mjs.map +1 -0
  80. package/dist/transactions/flashLoans.d.mts +62 -0
  81. package/dist/transactions/flashLoans.d.mts.map +1 -0
  82. package/dist/transactions/flashLoans.mjs +75 -0
  83. package/dist/transactions/flashLoans.mjs.map +1 -0
  84. package/dist/transactions/governance.d.mts +48 -0
  85. package/dist/transactions/governance.d.mts.map +1 -0
  86. package/dist/transactions/governance.mjs +90 -0
  87. package/dist/transactions/governance.mjs.map +1 -0
  88. package/dist/transactions/marginAdmin.d.mts +139 -0
  89. package/dist/transactions/marginAdmin.d.mts.map +1 -0
  90. package/dist/transactions/marginAdmin.mjs +249 -0
  91. package/dist/transactions/marginAdmin.mjs.map +1 -0
  92. package/dist/transactions/marginLiquidations.d.mts +67 -0
  93. package/dist/transactions/marginLiquidations.d.mts.map +1 -0
  94. package/dist/transactions/marginLiquidations.mjs +109 -0
  95. package/dist/transactions/marginLiquidations.mjs.map +1 -0
  96. package/dist/transactions/marginMaintainer.d.mts +86 -0
  97. package/dist/transactions/marginMaintainer.d.mts.map +1 -0
  98. package/dist/transactions/marginMaintainer.mjs +160 -0
  99. package/dist/transactions/marginMaintainer.mjs.map +1 -0
  100. package/dist/transactions/marginManager.d.mts +255 -0
  101. package/dist/transactions/marginManager.d.mts.map +1 -0
  102. package/dist/transactions/marginManager.mjs +558 -0
  103. package/dist/transactions/marginManager.mjs.map +1 -0
  104. package/dist/transactions/marginPool.d.mts +140 -0
  105. package/dist/transactions/marginPool.d.mts.map +1 -0
  106. package/dist/transactions/marginPool.mjs +206 -0
  107. package/dist/transactions/marginPool.mjs.map +1 -0
  108. package/dist/transactions/marginRegistry.d.mts +100 -0
  109. package/dist/transactions/marginRegistry.d.mts.map +1 -0
  110. package/dist/transactions/marginRegistry.mjs +128 -0
  111. package/dist/transactions/marginRegistry.mjs.map +1 -0
  112. package/dist/transactions/marginTPSL.d.mts +99 -0
  113. package/dist/transactions/marginTPSL.d.mts.map +1 -0
  114. package/dist/transactions/marginTPSL.mjs +176 -0
  115. package/dist/transactions/marginTPSL.mjs.map +1 -0
  116. package/dist/transactions/poolProxy.d.mts +117 -0
  117. package/dist/transactions/poolProxy.d.mts.map +1 -0
  118. package/dist/transactions/poolProxy.mjs +318 -0
  119. package/dist/transactions/poolProxy.mjs.map +1 -0
  120. package/dist/types/bcs.d.mts +5 -0
  121. package/dist/types/bcs.mjs +7 -0
  122. package/dist/types/index.d.mts +237 -0
  123. package/dist/types/index.d.mts.map +1 -0
  124. package/dist/types/index.mjs +18 -0
  125. package/dist/types/index.mjs.map +1 -0
  126. package/dist/utils/config.d.mts +82 -0
  127. package/dist/utils/config.d.mts.map +1 -0
  128. package/dist/utils/config.mjs +88 -0
  129. package/dist/utils/config.mjs.map +1 -0
  130. package/dist/utils/constants.d.mts +81 -0
  131. package/dist/utils/constants.d.mts.map +1 -0
  132. package/dist/utils/constants.mjs +362 -0
  133. package/dist/utils/constants.mjs.map +1 -0
  134. package/dist/utils/errors.d.mts +46 -0
  135. package/dist/utils/errors.d.mts.map +1 -0
  136. package/dist/utils/errors.mjs +59 -0
  137. package/dist/utils/errors.mjs.map +1 -0
  138. package/dist/{cjs/utils/validation.d.ts → utils/validation.d.mts} +11 -7
  139. package/dist/utils/validation.d.mts.map +1 -0
  140. package/dist/utils/validation.mjs +76 -0
  141. package/dist/utils/validation.mjs.map +1 -0
  142. package/package.json +23 -21
  143. package/src/client.ts +577 -549
  144. package/src/contracts/deepbook/account.ts +14 -14
  145. package/src/contracts/deepbook/balance_manager.ts +340 -54
  146. package/src/contracts/deepbook/balances.ts +3 -2
  147. package/src/contracts/deepbook/big_vector.ts +5 -6
  148. package/src/contracts/deepbook/book.ts +3 -2
  149. package/src/contracts/deepbook/constants.ts +95 -3
  150. package/src/contracts/deepbook/deep_price.ts +7 -7
  151. package/src/contracts/deepbook/deps/std/type_name.ts +3 -2
  152. package/src/contracts/deepbook/deps/sui/bag.ts +4 -4
  153. package/src/contracts/deepbook/deps/sui/balance.ts +3 -2
  154. package/src/contracts/deepbook/deps/sui/object.ts +3 -2
  155. package/src/contracts/deepbook/deps/sui/table.ts +4 -4
  156. package/src/contracts/deepbook/deps/sui/vec_map.ts +4 -4
  157. package/src/contracts/deepbook/deps/sui/vec_set.ts +4 -4
  158. package/src/contracts/deepbook/deps/sui/versioned.ts +4 -4
  159. package/src/contracts/deepbook/ewma.ts +14 -3
  160. package/src/contracts/deepbook/fill.ts +21 -21
  161. package/src/contracts/deepbook/governance.ts +3 -2
  162. package/src/contracts/deepbook/history.ts +3 -2
  163. package/src/contracts/deepbook/math.ts +15 -15
  164. package/src/contracts/deepbook/order.ts +16 -16
  165. package/src/contracts/deepbook/order_info.ts +39 -27
  166. package/src/contracts/deepbook/order_query.ts +12 -12
  167. package/src/contracts/deepbook/pool.ts +876 -519
  168. package/src/contracts/deepbook/registry.ts +146 -35
  169. package/src/contracts/deepbook/state.ts +13 -2
  170. package/src/contracts/deepbook/trade_params.ts +3 -2
  171. package/src/contracts/deepbook/vault.ts +3 -2
  172. package/src/contracts/pyth/batch_price_attestation.ts +92 -0
  173. package/src/contracts/pyth/contract_upgrade.ts +54 -0
  174. package/src/contracts/pyth/data_source.ts +64 -0
  175. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/object.ts +12 -0
  176. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
  177. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
  178. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.ts +12 -0
  179. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.ts +13 -0
  180. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.ts +13 -0
  181. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.ts +12 -0
  182. package/src/contracts/pyth/deserialize.ts +117 -0
  183. package/src/contracts/pyth/event.ts +20 -0
  184. package/src/contracts/pyth/governance.ts +113 -0
  185. package/src/contracts/pyth/governance_action.ts +130 -0
  186. package/src/contracts/pyth/governance_instruction.ts +98 -0
  187. package/src/contracts/pyth/hot_potato_vector.ts +70 -0
  188. package/src/contracts/pyth/i64.ts +94 -0
  189. package/src/contracts/pyth/merkle_tree.ts +41 -0
  190. package/src/contracts/pyth/migrate.ts +29 -0
  191. package/src/contracts/pyth/price.ts +102 -0
  192. package/src/contracts/pyth/price_feed.ts +101 -0
  193. package/src/contracts/pyth/price_identifier.ts +46 -0
  194. package/src/contracts/pyth/price_info.ts +220 -0
  195. package/src/contracts/pyth/price_status.ts +74 -0
  196. package/src/contracts/pyth/pyth.ts +236 -0
  197. package/src/contracts/pyth/set.ts +93 -0
  198. package/src/contracts/pyth/set_data_sources.ts +14 -0
  199. package/src/contracts/pyth/set_fee_recipient.ts +13 -0
  200. package/src/contracts/pyth/set_governance_data_source.ts +16 -0
  201. package/src/contracts/pyth/set_stale_price_threshold.ts +13 -0
  202. package/src/contracts/pyth/set_update_fee.ts +14 -0
  203. package/src/contracts/pyth/setup.ts +12 -0
  204. package/src/contracts/pyth/state.ts +227 -0
  205. package/src/contracts/pyth/version_control.ts +25 -0
  206. package/src/contracts/utils/index.ts +99 -49
  207. package/src/index.ts +2 -2
  208. package/src/pyth/pyth.ts +39 -40
  209. package/src/transactions/deepbook.ts +19 -0
  210. package/src/transactions/marginAdmin.ts +1 -1
  211. package/src/transactions/poolProxy.ts +22 -0
  212. package/src/types/index.ts +0 -2
  213. package/src/utils/config.ts +11 -13
  214. package/src/utils/validation.ts +1 -1
  215. package/dist/cjs/client.d.ts +0 -882
  216. package/dist/cjs/client.js +0 -2003
  217. package/dist/cjs/client.js.map +0 -7
  218. package/dist/cjs/contracts/deepbook/account.d.ts +0 -105
  219. package/dist/cjs/contracts/deepbook/account.js +0 -163
  220. package/dist/cjs/contracts/deepbook/account.js.map +0 -7
  221. package/dist/cjs/contracts/deepbook/balance_manager.d.ts +0 -268
  222. package/dist/cjs/contracts/deepbook/balance_manager.js +0 -361
  223. package/dist/cjs/contracts/deepbook/balance_manager.js.map +0 -7
  224. package/dist/cjs/contracts/deepbook/balances.d.ts +0 -10
  225. package/dist/cjs/contracts/deepbook/balances.js +0 -35
  226. package/dist/cjs/contracts/deepbook/balances.js.map +0 -7
  227. package/dist/cjs/contracts/deepbook/big_vector.d.ts +0 -62
  228. package/dist/cjs/contracts/deepbook/big_vector.js +0 -80
  229. package/dist/cjs/contracts/deepbook/big_vector.js.map +0 -7
  230. package/dist/cjs/contracts/deepbook/book.d.ts +0 -34
  231. package/dist/cjs/contracts/deepbook/book.js +0 -50
  232. package/dist/cjs/contracts/deepbook/book.js.map +0 -7
  233. package/dist/cjs/contracts/deepbook/constants.d.ts +0 -176
  234. package/dist/cjs/contracts/deepbook/constants.js +0 -338
  235. package/dist/cjs/contracts/deepbook/constants.js.map +0 -7
  236. package/dist/cjs/contracts/deepbook/deep_price.d.ts +0 -60
  237. package/dist/cjs/contracts/deepbook/deep_price.js +0 -87
  238. package/dist/cjs/contracts/deepbook/deep_price.js.map +0 -7
  239. package/dist/cjs/contracts/deepbook/deps/std/type_name.d.ts +0 -14
  240. package/dist/cjs/contracts/deepbook/deps/std/type_name.js +0 -42
  241. package/dist/cjs/contracts/deepbook/deps/std/type_name.js.map +0 -7
  242. package/dist/cjs/contracts/deepbook/deps/sui/bag.d.ts +0 -33
  243. package/dist/cjs/contracts/deepbook/deps/sui/bag.js +0 -47
  244. package/dist/cjs/contracts/deepbook/deps/sui/bag.js.map +0 -7
  245. package/dist/cjs/contracts/deepbook/deps/sui/balance.d.ts +0 -9
  246. package/dist/cjs/contracts/deepbook/deps/sui/balance.js +0 -33
  247. package/dist/cjs/contracts/deepbook/deps/sui/balance.js.map +0 -7
  248. package/dist/cjs/contracts/deepbook/deps/sui/object.d.ts +0 -5
  249. package/dist/cjs/contracts/deepbook/deps/sui/object.js +0 -33
  250. package/dist/cjs/contracts/deepbook/deps/sui/object.js.map +0 -7
  251. package/dist/cjs/contracts/deepbook/deps/sui/table.d.ts +0 -28
  252. package/dist/cjs/contracts/deepbook/deps/sui/table.js +0 -47
  253. package/dist/cjs/contracts/deepbook/deps/sui/table.js.map +0 -7
  254. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
  255. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js +0 -45
  256. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
  257. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
  258. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js +0 -35
  259. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
  260. package/dist/cjs/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
  261. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js +0 -45
  262. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js.map +0 -7
  263. package/dist/cjs/contracts/deepbook/ewma.d.ts +0 -17
  264. package/dist/cjs/contracts/deepbook/ewma.js +0 -39
  265. package/dist/cjs/contracts/deepbook/ewma.js.map +0 -7
  266. package/dist/cjs/contracts/deepbook/fill.d.ts +0 -153
  267. package/dist/cjs/contracts/deepbook/fill.js +0 -251
  268. package/dist/cjs/contracts/deepbook/fill.js.map +0 -7
  269. package/dist/cjs/contracts/deepbook/governance.d.ts +0 -63
  270. package/dist/cjs/contracts/deepbook/governance.js +0 -79
  271. package/dist/cjs/contracts/deepbook/governance.js.map +0 -7
  272. package/dist/cjs/contracts/deepbook/history.d.ts +0 -60
  273. package/dist/cjs/contracts/deepbook/history.js +0 -78
  274. package/dist/cjs/contracts/deepbook/history.js.map +0 -7
  275. package/dist/cjs/contracts/deepbook/math.d.ts +0 -94
  276. package/dist/cjs/contracts/deepbook/math.js +0 -132
  277. package/dist/cjs/contracts/deepbook/math.js.map +0 -7
  278. package/dist/cjs/contracts/deepbook/order.d.ts +0 -135
  279. package/dist/cjs/contracts/deepbook/order.js +0 -218
  280. package/dist/cjs/contracts/deepbook/order.js.map +0 -7
  281. package/dist/cjs/contracts/deepbook/order_info.d.ts +0 -296
  282. package/dist/cjs/contracts/deepbook/order_info.js +0 -386
  283. package/dist/cjs/contracts/deepbook/order_info.js.map +0 -7
  284. package/dist/cjs/contracts/deepbook/order_query.d.ts +0 -85
  285. package/dist/cjs/contracts/deepbook/order_query.js +0 -96
  286. package/dist/cjs/contracts/deepbook/order_query.js.map +0 -7
  287. package/dist/cjs/contracts/deepbook/pool.d.ts +0 -1218
  288. package/dist/cjs/contracts/deepbook/pool.js +0 -1236
  289. package/dist/cjs/contracts/deepbook/pool.js.map +0 -7
  290. package/dist/cjs/contracts/deepbook/registry.d.ts +0 -134
  291. package/dist/cjs/contracts/deepbook/registry.js +0 -182
  292. package/dist/cjs/contracts/deepbook/registry.js.map +0 -7
  293. package/dist/cjs/contracts/deepbook/state.d.ts +0 -117
  294. package/dist/cjs/contracts/deepbook/state.js +0 -104
  295. package/dist/cjs/contracts/deepbook/state.js.map +0 -7
  296. package/dist/cjs/contracts/deepbook/trade_params.d.ts +0 -7
  297. package/dist/cjs/contracts/deepbook/trade_params.js +0 -35
  298. package/dist/cjs/contracts/deepbook/trade_params.js.map +0 -7
  299. package/dist/cjs/contracts/deepbook/vault.d.ts +0 -30
  300. package/dist/cjs/contracts/deepbook/vault.js +0 -65
  301. package/dist/cjs/contracts/deepbook/vault.js.map +0 -7
  302. package/dist/cjs/contracts/utils/index.d.ts +0 -25
  303. package/dist/cjs/contracts/utils/index.js +0 -148
  304. package/dist/cjs/contracts/utils/index.js.map +0 -7
  305. package/dist/cjs/index.d.ts +0 -24
  306. package/dist/cjs/index.js +0 -92
  307. package/dist/cjs/index.js.map +0 -7
  308. package/dist/cjs/package.json +0 -4
  309. package/dist/cjs/pyth/PriceServiceConnection.d.ts +0 -26
  310. package/dist/cjs/pyth/PriceServiceConnection.js +0 -68
  311. package/dist/cjs/pyth/PriceServiceConnection.js.map +0 -7
  312. package/dist/cjs/pyth/pyth-helpers.d.ts +0 -7
  313. package/dist/cjs/pyth/pyth-helpers.js +0 -36
  314. package/dist/cjs/pyth/pyth-helpers.js.map +0 -7
  315. package/dist/cjs/pyth/pyth.d.ts +0 -65
  316. package/dist/cjs/pyth/pyth.js +0 -269
  317. package/dist/cjs/pyth/pyth.js.map +0 -7
  318. package/dist/cjs/transactions/balanceManager.d.ts +0 -168
  319. package/dist/cjs/transactions/balanceManager.js +0 -384
  320. package/dist/cjs/transactions/balanceManager.js.map +0 -7
  321. package/dist/cjs/transactions/deepbook.d.ts +0 -477
  322. package/dist/cjs/transactions/deepbook.js +0 -1335
  323. package/dist/cjs/transactions/deepbook.js.map +0 -7
  324. package/dist/cjs/transactions/deepbookAdmin.d.ts +0 -105
  325. package/dist/cjs/transactions/deepbookAdmin.js +0 -334
  326. package/dist/cjs/transactions/deepbookAdmin.js.map +0 -7
  327. package/dist/cjs/transactions/flashLoans.d.ts +0 -56
  328. package/dist/cjs/transactions/flashLoans.js +0 -124
  329. package/dist/cjs/transactions/flashLoans.js.map +0 -7
  330. package/dist/cjs/transactions/governance.d.ts +0 -42
  331. package/dist/cjs/transactions/governance.js +0 -135
  332. package/dist/cjs/transactions/governance.js.map +0 -7
  333. package/dist/cjs/transactions/marginAdmin.d.ts +0 -133
  334. package/dist/cjs/transactions/marginAdmin.js +0 -396
  335. package/dist/cjs/transactions/marginAdmin.js.map +0 -7
  336. package/dist/cjs/transactions/marginLiquidations.d.ts +0 -61
  337. package/dist/cjs/transactions/marginLiquidations.js +0 -173
  338. package/dist/cjs/transactions/marginLiquidations.js.map +0 -7
  339. package/dist/cjs/transactions/marginMaintainer.d.ts +0 -80
  340. package/dist/cjs/transactions/marginMaintainer.js +0 -257
  341. package/dist/cjs/transactions/marginMaintainer.js.map +0 -7
  342. package/dist/cjs/transactions/marginManager.d.ts +0 -249
  343. package/dist/cjs/transactions/marginManager.js +0 -739
  344. package/dist/cjs/transactions/marginManager.js.map +0 -7
  345. package/dist/cjs/transactions/marginPool.d.ts +0 -134
  346. package/dist/cjs/transactions/marginPool.js +0 -330
  347. package/dist/cjs/transactions/marginPool.js.map +0 -7
  348. package/dist/cjs/transactions/marginRegistry.d.ts +0 -94
  349. package/dist/cjs/transactions/marginRegistry.js +0 -221
  350. package/dist/cjs/transactions/marginRegistry.js.map +0 -7
  351. package/dist/cjs/transactions/marginTPSL.d.ts +0 -93
  352. package/dist/cjs/transactions/marginTPSL.js +0 -286
  353. package/dist/cjs/transactions/marginTPSL.js.map +0 -7
  354. package/dist/cjs/transactions/poolProxy.d.ts +0 -104
  355. package/dist/cjs/transactions/poolProxy.js +0 -435
  356. package/dist/cjs/transactions/poolProxy.js.map +0 -7
  357. package/dist/cjs/types/bcs.d.ts +0 -5
  358. package/dist/cjs/types/bcs.js +0 -33
  359. package/dist/cjs/types/bcs.js.map +0 -7
  360. package/dist/cjs/types/index.d.ts +0 -247
  361. package/dist/cjs/types/index.js +0 -38
  362. package/dist/cjs/types/index.js.map +0 -7
  363. package/dist/cjs/utils/config.d.ts +0 -65
  364. package/dist/cjs/utils/config.js +0 -144
  365. package/dist/cjs/utils/config.js.map +0 -7
  366. package/dist/cjs/utils/constants.d.ts +0 -76
  367. package/dist/cjs/utils/constants.js +0 -392
  368. package/dist/cjs/utils/constants.js.map +0 -7
  369. package/dist/cjs/utils/errors.d.ts +0 -42
  370. package/dist/cjs/utils/errors.js +0 -70
  371. package/dist/cjs/utils/errors.js.map +0 -7
  372. package/dist/cjs/utils/validation.js +0 -67
  373. package/dist/cjs/utils/validation.js.map +0 -7
  374. package/dist/esm/client.d.ts +0 -882
  375. package/dist/esm/client.js +0 -1988
  376. package/dist/esm/client.js.map +0 -7
  377. package/dist/esm/contracts/deepbook/account.d.ts +0 -105
  378. package/dist/esm/contracts/deepbook/account.js +0 -133
  379. package/dist/esm/contracts/deepbook/account.js.map +0 -7
  380. package/dist/esm/contracts/deepbook/balance_manager.d.ts +0 -268
  381. package/dist/esm/contracts/deepbook/balance_manager.js +0 -331
  382. package/dist/esm/contracts/deepbook/balance_manager.js.map +0 -7
  383. package/dist/esm/contracts/deepbook/balances.d.ts +0 -10
  384. package/dist/esm/contracts/deepbook/balances.js +0 -15
  385. package/dist/esm/contracts/deepbook/balances.js.map +0 -7
  386. package/dist/esm/contracts/deepbook/big_vector.d.ts +0 -62
  387. package/dist/esm/contracts/deepbook/big_vector.js +0 -50
  388. package/dist/esm/contracts/deepbook/big_vector.js.map +0 -7
  389. package/dist/esm/contracts/deepbook/book.d.ts +0 -34
  390. package/dist/esm/contracts/deepbook/book.js +0 -20
  391. package/dist/esm/contracts/deepbook/book.js.map +0 -7
  392. package/dist/esm/contracts/deepbook/constants.d.ts +0 -176
  393. package/dist/esm/contracts/deepbook/constants.js +0 -318
  394. package/dist/esm/contracts/deepbook/constants.js.map +0 -7
  395. package/dist/esm/contracts/deepbook/deep_price.d.ts +0 -60
  396. package/dist/esm/contracts/deepbook/deep_price.js +0 -67
  397. package/dist/esm/contracts/deepbook/deep_price.js.map +0 -7
  398. package/dist/esm/contracts/deepbook/deps/std/type_name.d.ts +0 -14
  399. package/dist/esm/contracts/deepbook/deps/std/type_name.js +0 -22
  400. package/dist/esm/contracts/deepbook/deps/std/type_name.js.map +0 -7
  401. package/dist/esm/contracts/deepbook/deps/sui/bag.d.ts +0 -33
  402. package/dist/esm/contracts/deepbook/deps/sui/bag.js +0 -17
  403. package/dist/esm/contracts/deepbook/deps/sui/bag.js.map +0 -7
  404. package/dist/esm/contracts/deepbook/deps/sui/balance.d.ts +0 -9
  405. package/dist/esm/contracts/deepbook/deps/sui/balance.js +0 -13
  406. package/dist/esm/contracts/deepbook/deps/sui/balance.js.map +0 -7
  407. package/dist/esm/contracts/deepbook/deps/sui/object.d.ts +0 -5
  408. package/dist/esm/contracts/deepbook/deps/sui/object.js +0 -13
  409. package/dist/esm/contracts/deepbook/deps/sui/object.js.map +0 -7
  410. package/dist/esm/contracts/deepbook/deps/sui/table.d.ts +0 -28
  411. package/dist/esm/contracts/deepbook/deps/sui/table.js +0 -17
  412. package/dist/esm/contracts/deepbook/deps/sui/table.js.map +0 -7
  413. package/dist/esm/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
  414. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js +0 -25
  415. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
  416. package/dist/esm/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
  417. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js +0 -15
  418. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
  419. package/dist/esm/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
  420. package/dist/esm/contracts/deepbook/deps/sui/versioned.js +0 -15
  421. package/dist/esm/contracts/deepbook/deps/sui/versioned.js.map +0 -7
  422. package/dist/esm/contracts/deepbook/ewma.d.ts +0 -17
  423. package/dist/esm/contracts/deepbook/ewma.js +0 -19
  424. package/dist/esm/contracts/deepbook/ewma.js.map +0 -7
  425. package/dist/esm/contracts/deepbook/fill.d.ts +0 -153
  426. package/dist/esm/contracts/deepbook/fill.js +0 -221
  427. package/dist/esm/contracts/deepbook/fill.js.map +0 -7
  428. package/dist/esm/contracts/deepbook/governance.d.ts +0 -63
  429. package/dist/esm/contracts/deepbook/governance.js +0 -49
  430. package/dist/esm/contracts/deepbook/governance.js.map +0 -7
  431. package/dist/esm/contracts/deepbook/history.d.ts +0 -60
  432. package/dist/esm/contracts/deepbook/history.js +0 -48
  433. package/dist/esm/contracts/deepbook/history.js.map +0 -7
  434. package/dist/esm/contracts/deepbook/math.d.ts +0 -94
  435. package/dist/esm/contracts/deepbook/math.js +0 -112
  436. package/dist/esm/contracts/deepbook/math.js.map +0 -7
  437. package/dist/esm/contracts/deepbook/order.d.ts +0 -135
  438. package/dist/esm/contracts/deepbook/order.js +0 -188
  439. package/dist/esm/contracts/deepbook/order.js.map +0 -7
  440. package/dist/esm/contracts/deepbook/order_info.d.ts +0 -296
  441. package/dist/esm/contracts/deepbook/order_info.js +0 -356
  442. package/dist/esm/contracts/deepbook/order_info.js.map +0 -7
  443. package/dist/esm/contracts/deepbook/order_query.d.ts +0 -85
  444. package/dist/esm/contracts/deepbook/order_query.js +0 -66
  445. package/dist/esm/contracts/deepbook/order_query.js.map +0 -7
  446. package/dist/esm/contracts/deepbook/pool.d.ts +0 -1218
  447. package/dist/esm/contracts/deepbook/pool.js +0 -1206
  448. package/dist/esm/contracts/deepbook/pool.js.map +0 -7
  449. package/dist/esm/contracts/deepbook/registry.d.ts +0 -134
  450. package/dist/esm/contracts/deepbook/registry.js +0 -152
  451. package/dist/esm/contracts/deepbook/registry.js.map +0 -7
  452. package/dist/esm/contracts/deepbook/state.d.ts +0 -117
  453. package/dist/esm/contracts/deepbook/state.js +0 -74
  454. package/dist/esm/contracts/deepbook/state.js.map +0 -7
  455. package/dist/esm/contracts/deepbook/trade_params.d.ts +0 -7
  456. package/dist/esm/contracts/deepbook/trade_params.js +0 -15
  457. package/dist/esm/contracts/deepbook/trade_params.js.map +0 -7
  458. package/dist/esm/contracts/deepbook/vault.d.ts +0 -30
  459. package/dist/esm/contracts/deepbook/vault.js +0 -35
  460. package/dist/esm/contracts/deepbook/vault.js.map +0 -7
  461. package/dist/esm/contracts/utils/index.d.ts +0 -25
  462. package/dist/esm/contracts/utils/index.js +0 -128
  463. package/dist/esm/contracts/utils/index.js.map +0 -7
  464. package/dist/esm/index.d.ts +0 -24
  465. package/dist/esm/index.js +0 -103
  466. package/dist/esm/index.js.map +0 -7
  467. package/dist/esm/package.json +0 -4
  468. package/dist/esm/pyth/PriceServiceConnection.d.ts +0 -26
  469. package/dist/esm/pyth/PriceServiceConnection.js +0 -38
  470. package/dist/esm/pyth/PriceServiceConnection.js.map +0 -7
  471. package/dist/esm/pyth/pyth-helpers.d.ts +0 -7
  472. package/dist/esm/pyth/pyth-helpers.js +0 -16
  473. package/dist/esm/pyth/pyth-helpers.js.map +0 -7
  474. package/dist/esm/pyth/pyth.d.ts +0 -65
  475. package/dist/esm/pyth/pyth.js +0 -249
  476. package/dist/esm/pyth/pyth.js.map +0 -7
  477. package/dist/esm/transactions/balanceManager.d.ts +0 -168
  478. package/dist/esm/transactions/balanceManager.js +0 -364
  479. package/dist/esm/transactions/balanceManager.js.map +0 -7
  480. package/dist/esm/transactions/deepbook.d.ts +0 -477
  481. package/dist/esm/transactions/deepbook.js +0 -1321
  482. package/dist/esm/transactions/deepbook.js.map +0 -7
  483. package/dist/esm/transactions/deepbookAdmin.d.ts +0 -105
  484. package/dist/esm/transactions/deepbookAdmin.js +0 -314
  485. package/dist/esm/transactions/deepbookAdmin.js.map +0 -7
  486. package/dist/esm/transactions/flashLoans.d.ts +0 -56
  487. package/dist/esm/transactions/flashLoans.js +0 -104
  488. package/dist/esm/transactions/flashLoans.js.map +0 -7
  489. package/dist/esm/transactions/governance.d.ts +0 -42
  490. package/dist/esm/transactions/governance.js +0 -115
  491. package/dist/esm/transactions/governance.js.map +0 -7
  492. package/dist/esm/transactions/marginAdmin.d.ts +0 -133
  493. package/dist/esm/transactions/marginAdmin.js +0 -376
  494. package/dist/esm/transactions/marginAdmin.js.map +0 -7
  495. package/dist/esm/transactions/marginLiquidations.d.ts +0 -61
  496. package/dist/esm/transactions/marginLiquidations.js +0 -153
  497. package/dist/esm/transactions/marginLiquidations.js.map +0 -7
  498. package/dist/esm/transactions/marginMaintainer.d.ts +0 -80
  499. package/dist/esm/transactions/marginMaintainer.js +0 -237
  500. package/dist/esm/transactions/marginMaintainer.js.map +0 -7
  501. package/dist/esm/transactions/marginManager.d.ts +0 -249
  502. package/dist/esm/transactions/marginManager.js +0 -719
  503. package/dist/esm/transactions/marginManager.js.map +0 -7
  504. package/dist/esm/transactions/marginPool.d.ts +0 -134
  505. package/dist/esm/transactions/marginPool.js +0 -310
  506. package/dist/esm/transactions/marginPool.js.map +0 -7
  507. package/dist/esm/transactions/marginRegistry.d.ts +0 -94
  508. package/dist/esm/transactions/marginRegistry.js +0 -201
  509. package/dist/esm/transactions/marginRegistry.js.map +0 -7
  510. package/dist/esm/transactions/marginTPSL.d.ts +0 -93
  511. package/dist/esm/transactions/marginTPSL.js +0 -266
  512. package/dist/esm/transactions/marginTPSL.js.map +0 -7
  513. package/dist/esm/transactions/poolProxy.d.ts +0 -104
  514. package/dist/esm/transactions/poolProxy.js +0 -415
  515. package/dist/esm/transactions/poolProxy.js.map +0 -7
  516. package/dist/esm/types/bcs.d.ts +0 -5
  517. package/dist/esm/types/bcs.js +0 -13
  518. package/dist/esm/types/bcs.js.map +0 -7
  519. package/dist/esm/types/index.d.ts +0 -247
  520. package/dist/esm/types/index.js +0 -18
  521. package/dist/esm/types/index.js.map +0 -7
  522. package/dist/esm/utils/config.d.ts +0 -65
  523. package/dist/esm/utils/config.js +0 -135
  524. package/dist/esm/utils/config.js.map +0 -7
  525. package/dist/esm/utils/constants.d.ts +0 -76
  526. package/dist/esm/utils/constants.js +0 -372
  527. package/dist/esm/utils/constants.js.map +0 -7
  528. package/dist/esm/utils/errors.d.ts +0 -42
  529. package/dist/esm/utils/errors.js +0 -50
  530. package/dist/esm/utils/errors.js.map +0 -7
  531. package/dist/esm/utils/validation.d.ts +0 -50
  532. package/dist/esm/utils/validation.js +0 -47
  533. package/dist/esm/utils/validation.js.map +0 -7
  534. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  535. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepbook.mjs","names":["#config"],"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';\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 = Math.round((price * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar);\n\t\tconst inputQuantity = Math.round(quantity * baseCoin.scalar);\n\n\t\tconst tradeProof = tx.add(this.#config.balanceManager.generateProof(balanceManagerKey));\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::place_limit_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttradeProof,\n\t\t\t\ttx.pure.u64(clientOrderId),\n\t\t\t\ttx.pure.u8(orderType),\n\t\t\t\ttx.pure.u8(selfMatchingOption),\n\t\t\t\ttx.pure.u64(inputPrice),\n\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\ttx.pure.bool(isBid),\n\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\ttx.pure.u64(expiration),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round(quantity * baseCoin.scalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::place_market_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttradeProof,\n\t\t\t\ttx.pure.u64(clientOrderId),\n\t\t\t\ttx.pure.u8(selfMatchingOption),\n\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\ttx.pure.bool(isBid),\n\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round(newQuantity * baseCoin.scalar);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::modify_order`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\t\ttradeProof,\n\t\t\t\t\ttx.pure.u128(orderId),\n\t\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::cancel_order`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\t\ttradeProof,\n\t\t\t\t\ttx.pure.u128(orderId),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::cancel_orders`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\t\ttradeProof,\n\t\t\t\t\ttx.pure.vector('u128', orderIds),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::cancel_all_orders`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttradeProof,\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::withdraw_settled_amounts`,\n\t\t\targuments: [tx.object(pool.address), tx.object(balanceManager.address), tradeProof],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::withdraw_settled_amounts_permissionless`,\n\t\t\t\targuments: [tx.object(pool.address), tx.object(balanceManager.address)],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::withdraw_settled_amounts_permissionless`,\n\t\t\t\targuments: [tx.object(pool.address), tx.object(balanceManagerId)],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::add_deep_price_point`,\n\t\t\targuments: [\n\t\t\t\ttx.object(targetPool.address),\n\t\t\t\ttx.object(referencePool.address),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [\n\t\t\t\ttargetBaseCoin.type,\n\t\t\t\ttargetQuoteCoin.type,\n\t\t\t\treferenceBaseCoin.type,\n\t\t\t\treferenceQuoteCoin.type,\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::claim_rebates`,\n\t\t\targuments: [tx.object(pool.address), tx.object(balanceManager.address), tradeProof],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round(multiplier * FLOAT_SCALAR);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::mint_referral`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(adjustedNumber)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round(multiplier * FLOAT_SCALAR);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_pool_referral_multiplier`,\n\t\t\t\targuments: [tx.object(pool.address), tx.object(referral), tx.pure.u64(adjustedNumber)],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::claim_pool_referral_rewards`,\n\t\t\targuments: [tx.object(pool.address), tx.object(referral)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_pool_allowed_versions`,\n\t\t\targuments: [tx.object(pool.address), tx.object(this.#config.REGISTRY_ID)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_order`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u128(orderId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_orders`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.vector('u128', orderIds)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::burn_deep`,\n\t\t\targuments: [tx.object(pool.address), tx.object(this.#config.DEEP_TREASURY_ID)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::mid_price`,\n\t\t\targuments: [tx.object(pool.address), tx.object.clock()],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::whitelisted`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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) => (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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_out`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(baseQuantity * baseCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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) => (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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_out`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(quoteQuantity * quoteScalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, quoteQuantity: 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 quoteScalar = quoteCoin.scalar;\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quantity_out`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(Math.round(baseQuantity * baseCoin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(quoteQuantity * quoteScalar)),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::account_open_orders`,\n\t\t\targuments: [tx.object(pool.address), tx.object(manager.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, priceHigh: number, isBid: boolean) => (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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_level2_range`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(Math.round((priceLow * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round((priceHigh * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar)),\n\t\t\t\t\ttx.pure.bool(isBid),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_level2_ticks_from_mid`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(tickFromMid), tx.object.clock()],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::vault_balances`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_pool_id_by_asset`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID)],\n\t\t\ttypeArguments: [baseType, quoteType],\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({ type: baseCoin.type, balance: Math.round(baseAmount * baseCoin.scalar) });\n\n\t\tconst deepCoin =\n\t\t\tparams.deepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: Math.round(deepAmount * DEEP_SCALAR) });\n\n\t\tconst minQuoteInput = Math.round(minQuote * quoteCoin.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_base_for_quote`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\tbaseCoinInput,\n\t\t\t\tdeepCoin,\n\t\t\t\ttx.pure.u64(minQuoteInput),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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: Math.round(quoteAmount * quoteCoin.scalar),\n\t\t\t});\n\n\t\tconst deepCoin =\n\t\t\tparams.deepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: Math.round(deepAmount * DEEP_SCALAR) });\n\n\t\tconst minBaseInput = Math.round(minBase * baseCoin.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quote_for_base`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\tquoteCoinInput,\n\t\t\t\tdeepCoin,\n\t\t\t\ttx.pure.u64(minBaseInput),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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: Math.round(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: Math.round(amount * quoteCoinType.scalar),\n\t\t\t\t}));\n\n\t\tconst deepCoinInput =\n\t\t\tdeepCoin ??\n\t\t\tcoinWithBalance({ type: deepCoinType, balance: Math.round(deepAmount * DEEP_SCALAR) });\n\n\t\tconst minOutInput = Math.round(\n\t\t\tminOut * (isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar),\n\t\t);\n\n\t\tconst [baseCoinResult, quoteCoinResult, deepCoinResult] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quantity`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\tbaseCoinInput,\n\t\t\t\tquoteCoinInput,\n\t\t\t\tdeepCoinInput,\n\t\t\t\ttx.pure.u64(minOutInput),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\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: Math.round(baseAmount * baseCoinType.scalar),\n\t\t\t});\n\t\tconst minQuoteInput = Math.round(minQuote * quoteCoinType.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_base_for_quote_with_manager`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttx.object(tradeCap),\n\t\t\t\ttx.object(depositCap),\n\t\t\t\ttx.object(withdrawCap),\n\t\t\t\tbaseCoinInput,\n\t\t\t\ttx.pure.u64(minQuoteInput),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\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: Math.round(quoteAmount * quoteCoinType.scalar),\n\t\t\t});\n\t\tconst minBaseInput = Math.round(minBase * baseCoinType.scalar);\n\n\t\tconst [baseCoinResult, quoteCoinResult] = tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quote_for_base_with_manager`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\ttx.object(tradeCap),\n\t\t\t\ttx.object(depositCap),\n\t\t\t\ttx.object(withdrawCap),\n\t\t\t\tquoteCoinInput,\n\t\t\t\ttx.pure.u64(minBaseInput),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\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: Math.round(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: Math.round(amount * quoteCoinType.scalar),\n\t\t\t\t\t}));\n\n\t\t\tconst minOutInput = Math.round(\n\t\t\t\tminOut * (isBaseToCoin ? quoteCoinType.scalar : baseCoinType.scalar),\n\t\t\t);\n\n\t\t\tconst [baseCoinResult, quoteCoinResult] = tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::swap_exact_quantity_with_manager`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.object(balanceManager.address),\n\t\t\t\t\ttx.object(tradeCap),\n\t\t\t\t\ttx.object(depositCap),\n\t\t\t\t\ttx.object(withdrawCap),\n\t\t\t\t\tbaseCoinInput,\n\t\t\t\t\tquoteCoinInput,\n\t\t\t\t\ttx.pure.u64(minOutInput),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoinType.type, quoteCoinType.type],\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 = Math.round((tickSize * FLOAT_SCALAR * quoteScalar) / baseScalar);\n\t\tconst adjustedLotSize = Math.round(lotSize * baseScalar);\n\t\tconst adjustedMinSize = Math.round(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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_permissionless_pool`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID), // registry_id\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.pure.u64(adjustedLotSize), // adjusted lot_size\n\t\t\t\ttx.pure.u64(adjustedMinSize), // adjusted min_size\n\t\t\t\tdeepCoinInput,\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::pool_trade_params`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::pool_book_params`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::account`,\n\t\t\targuments: [tx.object(pool.address), tx.object(managerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::locked_balance`,\n\t\t\targuments: [tx.object(pool.address), tx.object(managerId)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_order_deep_price`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::get_balance_manager_ids`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.pure.address(owner)],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_pool_referral_balances`,\n\t\t\targuments: [tx.object(pool.address), tx.object(referral)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::pool_referral_multiplier`,\n\t\t\targuments: [tx.object(pool.address), tx.object(referral)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::stable_pool`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::registered_pool`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = (poolKey: string, baseQuantity: 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\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_out_input_fee`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(baseQuantity * baseCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\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 = (poolKey: string, quoteQuantity: 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\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_out_input_fee`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(Math.round(quoteQuantity * quoteCoin.scalar)),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\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, quoteQuantity: 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\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quantity_out_input_fee`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(Math.round(baseQuantity * baseCoin.scalar)),\n\t\t\t\t\ttx.pure.u64(Math.round(quoteQuantity * quoteCoin.scalar)),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, payWithDeep: boolean) => (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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_base_quantity_in`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(Math.round(targetQuoteQuantity * quoteCoin.scalar)),\n\t\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, payWithDeep: boolean) => (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.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_quote_quantity_in`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(Math.round(targetBaseQuantity * baseCoin.scalar)),\n\t\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_account_order_details`,\n\t\t\targuments: [tx.object(pool.address), tx.object(manager.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, price: 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 inputPrice = Math.round((price * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar);\n\t\t\tconst inputQuantity = Math.round(baseQuantity * baseCoin.scalar);\n\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::get_order_deep_required`,\n\t\t\t\targuments: [tx.object(pool.address), tx.pure.u64(inputQuantity), tx.pure.u64(inputPrice)],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::account_exists`,\n\t\t\targuments: [tx.object(pool.address), tx.object(manager.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::pool_trade_params_next`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::quorum`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::id`,\n\t\t\targuments: [tx.object(pool.address)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round((price * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar);\n\t\tconst inputQuantity = Math.round(quantity * baseCoin.scalar);\n\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::can_place_limit_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.pure.u64(inputPrice),\n\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\ttx.pure.bool(isBid),\n\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\ttx.pure.u64(expireTimestamp),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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 = Math.round(quantity * baseCoin.scalar);\n\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::can_place_market_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\ttx.pure.bool(isBid),\n\t\t\t\ttx.pure.bool(payWithDeep),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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) => (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 = Math.round(quantity * baseCoin.scalar);\n\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::check_market_order_params`,\n\t\t\targuments: [tx.object(pool.address), tx.pure.u64(inputQuantity)],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\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, quantity: number, 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 = Math.round((price * FLOAT_SCALAR * quoteCoin.scalar) / baseCoin.scalar);\n\t\t\tconst inputQuantity = Math.round(quantity * baseCoin.scalar);\n\n\t\t\treturn tx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::check_limit_order_params`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(inputPrice),\n\t\t\t\t\ttx.pure.u64(inputQuantity),\n\t\t\t\t\ttx.pure.u64(expireTimestamp),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n}\n"],"mappings":";;;;;;;;AA2BA,IAAa,mBAAb,MAA8B;CAC7B;;;;CAKA,YAAY,QAAwB;0BASjB,YAAmC,OAAoB;GACzE,MAAM,EACL,SACA,mBACA,eACA,OACA,UACA,OACA,aAAa,eACb,YAAY,UAAU,gBACtB,qBAAqB,oBAAoB,uBACzC,cAAc,SACX;AAEJ,MAAG,qB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AAG,OAAO,KAAK,QAAQ;KACvB,GAAG,KAAK,IAAI,WAAW;KACvB,GAAG,KAAK,IAAI,cAAc;KAC1B,GAAG,KAAK,IAAI,gBAAgB;KAC5B,GAAG,OAAO,OAAO;KACjB;IACD,eAAe,CAAC,SAAS,MAAM,UAAU,KAAK;IAC9C,CAAC;;AA79CH,QAAKA,SAAU"}
@@ -0,0 +1,111 @@
1
+ import { CreatePoolAdminParams, SetEwmaParams } from "../types/index.mjs";
2
+ import { DeepBookConfig } from "../utils/config.mjs";
3
+ import * as _mysten_sui_transactions29 from "@mysten/sui/transactions";
4
+ import { Transaction } from "@mysten/sui/transactions";
5
+
6
+ //#region src/transactions/deepbookAdmin.d.ts
7
+ /**
8
+ * DeepBookAdminContract class for managing admin actions.
9
+ */
10
+ declare class DeepBookAdminContract {
11
+ #private;
12
+ /**
13
+ * @param {DeepBookConfig} config Configuration for DeepBookAdminContract
14
+ */
15
+ constructor(config: DeepBookConfig);
16
+ /**
17
+ * @description Create a new pool as admin
18
+ * @param {CreatePoolAdminParams} params Parameters for creating pool as admin
19
+ * @returns A function that takes a Transaction object
20
+ */
21
+ createPoolAdmin: (params: CreatePoolAdminParams) => (tx: Transaction) => void;
22
+ /**
23
+ * @description Unregister a pool as admin
24
+ * @param {string} poolKey The key of the pool to be unregistered by admin
25
+ * @returns A function that takes a Transaction object
26
+ */
27
+ unregisterPoolAdmin: (poolKey: string) => (tx: Transaction) => void;
28
+ /**
29
+ * @description Update the allowed versions for a pool
30
+ * @param {string} poolKey The key of the pool to be updated
31
+ * @returns A function that takes a Transaction object
32
+ */
33
+ updateAllowedVersions: (poolKey: string) => (tx: Transaction) => void;
34
+ /**
35
+ * @description Enable a specific version
36
+ * @param {number} version The version to be enabled
37
+ * @returns A function that takes a Transaction object
38
+ */
39
+ enableVersion: (version: number) => (tx: Transaction) => void;
40
+ /**
41
+ * @description Disable a specific version
42
+ * @param {number} version The version to be disabled
43
+ * @returns A function that takes a Transaction object
44
+ */
45
+ disableVersion: (version: number) => (tx: Transaction) => void;
46
+ /**
47
+ * @description Sets the treasury address where pool creation fees will be sent
48
+ * @param {string} treasuryAddress The treasury address
49
+ * @returns A function that takes a Transaction object
50
+ */
51
+ setTreasuryAddress: (treasuryAddress: string) => (tx: Transaction) => void;
52
+ /**
53
+ * @description Add a coin to whitelist of stable coins
54
+ * @param {string} stableCoinKey The name of the stable coin to be added
55
+ * @returns A function that takes a Transaction object
56
+ */
57
+ addStableCoin: (stableCoinKey: string) => (tx: Transaction) => void;
58
+ /**
59
+ * @description Remove a coin from whitelist of stable coins
60
+ * @param {string} stableCoinKey The name of the stable coin to be removed
61
+ * @returns A function that takes a Transaction object
62
+ */
63
+ removeStableCoin: (stableCoinKey: string) => (tx: Transaction) => void;
64
+ /**
65
+ * @description Adjust the tick size of a pool
66
+ * @param {string} poolKey The key to identify the pool
67
+ * @param {number} newTickSize The new tick size
68
+ * @returns A function that takes a Transaction object
69
+ */
70
+ adjustTickSize: (poolKey: string, newTickSize: number) => (tx: Transaction) => void;
71
+ /**
72
+ * @description Adjust the lot size and min size of a pool
73
+ * @param {string} poolKey The key to identify the pool
74
+ * @param {number} newLotSize The new lot size
75
+ * @param {number} newMinSize The new min size
76
+ * @returns A function that takes a Transaction object
77
+ */
78
+ adjustMinLotSize: (poolKey: string, newLotSize: number, newMinSize: number) => (tx: Transaction) => void;
79
+ /**
80
+ * @description Initialize the balance manager map
81
+ * @returns A function that takes a Transaction object
82
+ */
83
+ initBalanceManagerMap: () => (tx: Transaction) => void;
84
+ /**
85
+ * @description Set the EWMA parameters for a pool
86
+ * @param {string} poolKey The key to identify the pool
87
+ * @param {SetEwmaParamsParams} params The parameters to set
88
+ * @returns A function that takes a Transaction object
89
+ */
90
+ setEwmaParams: (poolKey: string, params: SetEwmaParams) => (tx: Transaction) => void;
91
+ /**
92
+ * @description Enable or disable the EWMA state for a pool
93
+ * @param {string} poolKey The key to identify the pool
94
+ * @param {boolean} enable Whether to enable or disable the EWMA state
95
+ * @returns A function that takes a Transaction object
96
+ */
97
+ enableEwmaState: (poolKey: string, enable: boolean) => (tx: Transaction) => void;
98
+ /**
99
+ * @description Authorize the MarginApp to access protected features of DeepBook
100
+ * @returns A function that takes a Transaction object
101
+ */
102
+ authorizeMarginApp: () => (tx: Transaction) => void;
103
+ /**
104
+ * @description Deauthorize the MarginApp by removing its authorization key
105
+ * @returns A function that takes a Transaction object and returns a bool
106
+ */
107
+ deauthorizeMarginApp: () => (tx: Transaction) => _mysten_sui_transactions29.TransactionResult;
108
+ }
109
+ //#endregion
110
+ export { DeepBookAdminContract };
111
+ //# sourceMappingURL=deepbookAdmin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepbookAdmin.d.mts","names":[],"sources":["../../src/transactions/deepbookAdmin.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAYa,cAAA,qBAAA,CAAqB;EAMb,CAAA,OAAA;EAqBO;;;EAsDuB,WAAA,CAAA,MAAA,EA3E9B,cA2E8B;EAoBR;;;;;EA6EsB,eAAA,EAAA,CAAA,MAAA,EAvJrC,qBAuJqC,EAAA,GAAA,CAAA,EAAA,EAvJN,WAuJM,EAAA,GAAA,IAAA;EA+BG;;;;;EA2FnC,mBAAA,EAAA,CAAA,OAAA,EAAA,MAAA,EAAA,GAAA,CAAA,EAAA,EA/OgB,WA+OhB,EAAA,GAAA,IAAA;EAYE;;;;;mDAvOgB;;;;;;2CAoBR;;;;;;4CAgBC;;;;;;wDAgBY;;;;;;iDAgBP;;;;;;oDAcG;;;;;;;iEAea;;;;;;;;sFA+BG;;;;;oCA4BhC;;;;;;;2CAaO,uBAAuB;;;;;;;8DA6BJ;;;;;iCAqB7B;;;;;mCAYE,gBAAW,0BAAA,CAAA"}
@@ -0,0 +1,221 @@
1
+ import { FLOAT_SCALAR } from "../utils/config.mjs";
2
+
3
+ //#region src/transactions/deepbookAdmin.ts
4
+ /**
5
+ * DeepBookAdminContract class for managing admin actions.
6
+ */
7
+ var DeepBookAdminContract = class {
8
+ #config;
9
+ /**
10
+ * @param {DeepBookConfig} config Configuration for DeepBookAdminContract
11
+ */
12
+ constructor(config) {
13
+ this.createPoolAdmin = (params) => (tx) => {
14
+ tx.setSenderIfNotSet(this.#config.address);
15
+ const { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } = params;
16
+ const baseCoin = this.#config.getCoin(baseCoinKey);
17
+ const quoteCoin = this.#config.getCoin(quoteCoinKey);
18
+ const baseScalar = baseCoin.scalar;
19
+ const quoteScalar = quoteCoin.scalar;
20
+ const adjustedTickSize = Math.round(tickSize * FLOAT_SCALAR * quoteScalar / baseScalar);
21
+ const adjustedLotSize = Math.round(lotSize * baseScalar);
22
+ const adjustedMinSize = Math.round(minSize * baseScalar);
23
+ tx.moveCall({
24
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,
25
+ arguments: [
26
+ tx.object(this.#config.REGISTRY_ID),
27
+ tx.pure.u64(adjustedTickSize),
28
+ tx.pure.u64(adjustedLotSize),
29
+ tx.pure.u64(adjustedMinSize),
30
+ tx.pure.bool(whitelisted),
31
+ tx.pure.bool(stablePool),
32
+ tx.object(this.#adminCap())
33
+ ],
34
+ typeArguments: [baseCoin.type, quoteCoin.type]
35
+ });
36
+ };
37
+ this.unregisterPoolAdmin = (poolKey) => (tx) => {
38
+ const pool = this.#config.getPool(poolKey);
39
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
40
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
41
+ tx.moveCall({
42
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,
43
+ arguments: [
44
+ tx.object(pool.address),
45
+ tx.object(this.#config.REGISTRY_ID),
46
+ tx.object(this.#adminCap())
47
+ ],
48
+ typeArguments: [baseCoin.type, quoteCoin.type]
49
+ });
50
+ };
51
+ this.updateAllowedVersions = (poolKey) => (tx) => {
52
+ const pool = this.#config.getPool(poolKey);
53
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
54
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
55
+ tx.moveCall({
56
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,
57
+ arguments: [
58
+ tx.object(pool.address),
59
+ tx.object(this.#config.REGISTRY_ID),
60
+ tx.object(this.#adminCap())
61
+ ],
62
+ typeArguments: [baseCoin.type, quoteCoin.type]
63
+ });
64
+ };
65
+ this.enableVersion = (version) => (tx) => {
66
+ tx.moveCall({
67
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,
68
+ arguments: [
69
+ tx.object(this.#config.REGISTRY_ID),
70
+ tx.pure.u64(version),
71
+ tx.object(this.#adminCap())
72
+ ]
73
+ });
74
+ };
75
+ this.disableVersion = (version) => (tx) => {
76
+ tx.moveCall({
77
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version`,
78
+ arguments: [
79
+ tx.object(this.#config.REGISTRY_ID),
80
+ tx.pure.u64(version),
81
+ tx.object(this.#adminCap())
82
+ ]
83
+ });
84
+ };
85
+ this.setTreasuryAddress = (treasuryAddress) => (tx) => {
86
+ tx.moveCall({
87
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::set_treasury_address`,
88
+ arguments: [
89
+ tx.object(this.#config.REGISTRY_ID),
90
+ tx.pure.address(treasuryAddress),
91
+ tx.object(this.#adminCap())
92
+ ]
93
+ });
94
+ };
95
+ this.addStableCoin = (stableCoinKey) => (tx) => {
96
+ const stableCoinType = this.#config.getCoin(stableCoinKey).type;
97
+ tx.moveCall({
98
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::add_stablecoin`,
99
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
100
+ typeArguments: [stableCoinType]
101
+ });
102
+ };
103
+ this.removeStableCoin = (stableCoinKey) => (tx) => {
104
+ const stableCoinType = this.#config.getCoin(stableCoinKey).type;
105
+ tx.moveCall({
106
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::remove_stablecoin`,
107
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
108
+ typeArguments: [stableCoinType]
109
+ });
110
+ };
111
+ this.adjustTickSize = (poolKey, newTickSize) => (tx) => {
112
+ tx.setSenderIfNotSet(this.#config.address);
113
+ const pool = this.#config.getPool(poolKey);
114
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
115
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
116
+ const baseScalar = baseCoin.scalar;
117
+ const quoteScalar = quoteCoin.scalar;
118
+ const adjustedTickSize = Math.round(newTickSize * FLOAT_SCALAR * quoteScalar / baseScalar);
119
+ tx.moveCall({
120
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_tick_size_admin`,
121
+ arguments: [
122
+ tx.object(pool.address),
123
+ tx.pure.u64(adjustedTickSize),
124
+ tx.object(this.#adminCap()),
125
+ tx.object.clock()
126
+ ],
127
+ typeArguments: [baseCoin.type, quoteCoin.type]
128
+ });
129
+ };
130
+ this.adjustMinLotSize = (poolKey, newLotSize, newMinSize) => (tx) => {
131
+ tx.setSenderIfNotSet(this.#config.address);
132
+ const pool = this.#config.getPool(poolKey);
133
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
134
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
135
+ const baseScalar = baseCoin.scalar;
136
+ const adjustedLotSize = Math.round(newLotSize * baseScalar);
137
+ const adjustedMinSize = Math.round(newMinSize * baseScalar);
138
+ tx.moveCall({
139
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_min_lot_size_admin`,
140
+ arguments: [
141
+ tx.object(pool.address),
142
+ tx.pure.u64(adjustedLotSize),
143
+ tx.pure.u64(adjustedMinSize),
144
+ tx.object(this.#adminCap()),
145
+ tx.object.clock()
146
+ ],
147
+ typeArguments: [baseCoin.type, quoteCoin.type]
148
+ });
149
+ };
150
+ this.initBalanceManagerMap = () => (tx) => {
151
+ tx.moveCall({
152
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::init_balance_manager_map`,
153
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())]
154
+ });
155
+ };
156
+ this.setEwmaParams = (poolKey, params) => (tx) => {
157
+ const { alpha, zScoreThreshold, additionalTakerFee } = params;
158
+ const adjustedAlpha = Math.round(alpha * FLOAT_SCALAR);
159
+ const adjustedZScoreThreshold = Math.round(zScoreThreshold * FLOAT_SCALAR);
160
+ const adjustedAdditionalTakerFee = Math.round(additionalTakerFee * FLOAT_SCALAR);
161
+ const pool = this.#config.getPool(poolKey);
162
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
163
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
164
+ tx.moveCall({
165
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::set_ewma_params`,
166
+ arguments: [
167
+ tx.object(pool.address),
168
+ tx.object(this.#adminCap()),
169
+ tx.pure.u64(adjustedAlpha),
170
+ tx.pure.u64(adjustedZScoreThreshold),
171
+ tx.pure.u64(adjustedAdditionalTakerFee),
172
+ tx.object.clock()
173
+ ],
174
+ typeArguments: [baseCoin.type, quoteCoin.type]
175
+ });
176
+ };
177
+ this.enableEwmaState = (poolKey, enable) => (tx) => {
178
+ const pool = this.#config.getPool(poolKey);
179
+ const baseCoin = this.#config.getCoin(pool.baseCoin);
180
+ const quoteCoin = this.#config.getCoin(pool.quoteCoin);
181
+ tx.moveCall({
182
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::enable_ewma_state`,
183
+ arguments: [
184
+ tx.object(pool.address),
185
+ tx.object(this.#adminCap()),
186
+ tx.pure.bool(enable),
187
+ tx.object.clock()
188
+ ],
189
+ typeArguments: [baseCoin.type, quoteCoin.type]
190
+ });
191
+ };
192
+ this.authorizeMarginApp = () => (tx) => {
193
+ tx.moveCall({
194
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,
195
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
196
+ typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`]
197
+ });
198
+ };
199
+ this.deauthorizeMarginApp = () => (tx) => {
200
+ return tx.moveCall({
201
+ target: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::deauthorize_app`,
202
+ arguments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],
203
+ typeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`]
204
+ });
205
+ };
206
+ this.#config = config;
207
+ }
208
+ /**
209
+ * @returns The admin capability required for admin operations
210
+ * @throws Error if the admin capability is not set
211
+ */
212
+ #adminCap() {
213
+ const adminCap = this.#config.adminCap;
214
+ if (!adminCap) throw new Error("ADMIN_CAP environment variable not set");
215
+ return adminCap;
216
+ }
217
+ };
218
+
219
+ //#endregion
220
+ export { DeepBookAdminContract };
221
+ //# sourceMappingURL=deepbookAdmin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deepbookAdmin.mjs","names":["#config","#adminCap"],"sources":["../../src/transactions/deepbookAdmin.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Transaction } from '@mysten/sui/transactions';\n\nimport type { CreatePoolAdminParams, SetEwmaParams } from '../types/index.js';\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * DeepBookAdminContract class for managing admin actions.\n */\nexport class DeepBookAdminContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for DeepBookAdminContract\n\t */\n\tconstructor(config: DeepBookConfig) {\n\t\tthis.#config = config;\n\t}\n\n\t/**\n\t * @returns The admin capability required for admin operations\n\t * @throws Error if the admin capability is not set\n\t */\n\t#adminCap() {\n\t\tconst adminCap = this.#config.adminCap;\n\t\tif (!adminCap) {\n\t\t\tthrow new Error('ADMIN_CAP environment variable not set');\n\t\t}\n\t\treturn adminCap;\n\t}\n\n\t/**\n\t * @description Create a new pool as admin\n\t * @param {CreatePoolAdminParams} params Parameters for creating pool as admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tcreatePoolAdmin = (params: CreatePoolAdminParams) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\n\t\tconst { baseCoinKey, quoteCoinKey, tickSize, lotSize, minSize, whitelisted, stablePool } =\n\t\t\tparams;\n\t\tconst baseCoin = this.#config.getCoin(baseCoinKey);\n\t\tconst quoteCoin = this.#config.getCoin(quoteCoinKey);\n\n\t\tconst baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = Math.round((tickSize * FLOAT_SCALAR * quoteScalar) / baseScalar);\n\t\tconst adjustedLotSize = Math.round(lotSize * baseScalar);\n\t\tconst adjustedMinSize = Math.round(minSize * baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::create_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID), // registry_id\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.pure.u64(adjustedLotSize), // adjusted lot_size\n\t\t\t\ttx.pure.u64(adjustedMinSize), // adjusted min_size\n\t\t\t\ttx.pure.bool(whitelisted),\n\t\t\t\ttx.pure.bool(stablePool),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unregister a pool as admin\n\t * @param {string} poolKey The key of the pool to be unregistered by admin\n\t * @returns A function that takes a Transaction object\n\t */\n\tunregisterPoolAdmin = (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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::unregister_pool_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\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\tupdateAllowedVersions = (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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::update_allowed_versions`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable a specific version\n\t * @param {number} version The version to be enabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::enable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Disable a specific version\n\t * @param {number} version The version to be disabled\n\t * @returns A function that takes a Transaction object\n\t */\n\tdisableVersion = (version: number) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::disable_version`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.u64(version),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Sets the treasury address where pool creation fees will be sent\n\t * @param {string} treasuryAddress The treasury address\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetTreasuryAddress = (treasuryAddress: string) => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::set_treasury_address`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.REGISTRY_ID),\n\t\t\t\ttx.pure.address(treasuryAddress),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t],\n\t\t});\n\t};\n\n\t/**\n\t * @description Add a coin to whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be added\n\t * @returns A function that takes a Transaction object\n\t */\n\taddStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::add_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Remove a coin from whitelist of stable coins\n\t * @param {string} stableCoinKey The name of the stable coin to be removed\n\t * @returns A function that takes a Transaction object\n\t */\n\tremoveStableCoin = (stableCoinKey: string) => (tx: Transaction) => {\n\t\tconst stableCoinType = this.#config.getCoin(stableCoinKey).type;\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::remove_stablecoin`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [stableCoinType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the tick size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newTickSize The new tick size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustTickSize = (poolKey: string, newTickSize: number) => (tx: Transaction) => {\n\t\ttx.setSenderIfNotSet(this.#config.address);\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 baseScalar = baseCoin.scalar;\n\t\tconst quoteScalar = quoteCoin.scalar;\n\n\t\tconst adjustedTickSize = Math.round((newTickSize * FLOAT_SCALAR * quoteScalar) / baseScalar);\n\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_tick_size_admin`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\ttx.pure.u64(adjustedTickSize), // adjusted tick_size\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Adjust the lot size and min size of a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {number} newLotSize The new lot size\n\t * @param {number} newMinSize The new min size\n\t * @returns A function that takes a Transaction object\n\t */\n\tadjustMinLotSize =\n\t\t(poolKey: string, newLotSize: number, newMinSize: number) => (tx: Transaction) => {\n\t\t\ttx.setSenderIfNotSet(this.#config.address);\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\tconst baseScalar = baseCoin.scalar;\n\n\t\t\tconst adjustedLotSize = Math.round(newLotSize * baseScalar);\n\t\t\tconst adjustedMinSize = Math.round(newMinSize * baseScalar);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::adjust_min_lot_size_admin`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(pool.address), // pool address\n\t\t\t\t\ttx.pure.u64(adjustedLotSize),\n\t\t\t\t\ttx.pure.u64(adjustedMinSize),\n\t\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\t\ttx.object.clock(),\n\t\t\t\t],\n\t\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t\t});\n\t\t};\n\n\t/**\n\t * @description Initialize the balance manager map\n\t * @returns A function that takes a Transaction object\n\t */\n\tinitBalanceManagerMap = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::init_balance_manager_map`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t});\n\t};\n\n\t/**\n\t * @description Set the EWMA parameters for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {SetEwmaParamsParams} params The parameters to set\n\t * @returns A function that takes a Transaction object\n\t */\n\tsetEwmaParams = (poolKey: string, params: SetEwmaParams) => (tx: Transaction) => {\n\t\tconst { alpha, zScoreThreshold, additionalTakerFee } = params;\n\t\tconst adjustedAlpha = Math.round(alpha * FLOAT_SCALAR);\n\t\tconst adjustedZScoreThreshold = Math.round(zScoreThreshold * FLOAT_SCALAR);\n\t\tconst adjustedAdditionalTakerFee = Math.round(additionalTakerFee * FLOAT_SCALAR);\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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::set_ewma_params`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.u64(adjustedAlpha),\n\t\t\t\ttx.pure.u64(adjustedZScoreThreshold),\n\t\t\t\ttx.pure.u64(adjustedAdditionalTakerFee),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Enable or disable the EWMA state for a pool\n\t * @param {string} poolKey The key to identify the pool\n\t * @param {boolean} enable Whether to enable or disable the EWMA state\n\t * @returns A function that takes a Transaction object\n\t */\n\tenableEwmaState = (poolKey: string, enable: boolean) => (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.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::pool::enable_ewma_state`,\n\t\t\targuments: [\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(this.#adminCap()),\n\t\t\t\ttx.pure.bool(enable),\n\t\t\t\ttx.object.clock(),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Authorize the MarginApp to access protected features of DeepBook\n\t * @returns A function that takes a Transaction object\n\t */\n\tauthorizeMarginApp = () => (tx: Transaction) => {\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_PACKAGE_ID}::registry::authorize_app`,\n\t\t\targuments: [tx.object(this.#config.REGISTRY_ID), tx.object(this.#adminCap())],\n\t\t\ttypeArguments: [`${this.#config.MARGIN_PACKAGE_ID}::margin_manager::MarginApp`],\n\t\t});\n\t};\n\n\t/**\n\t * @description Deauthorize the MarginApp by removing its authorization key\n\t * @returns A function that takes a Transaction object and returns a bool\n\t */\n\tdeauthorizeMarginApp = () => (tx: Transaction) => {\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.DEEPBOOK_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AKA,OAAQ;AAC9B,MAAI,CAAC,SACJ,OAAM,IAAI,MAAM,yCAAyC;AAE1D,SAAO"}
@@ -0,0 +1,62 @@
1
+ import { DeepBookConfig } from "../utils/config.mjs";
2
+ import { Transaction, TransactionObjectArgument } from "@mysten/sui/transactions";
3
+
4
+ //#region src/transactions/flashLoans.d.ts
5
+
6
+ /**
7
+ * FlashLoanContract class for managing flash loans.
8
+ */
9
+ declare class FlashLoanContract {
10
+ #private;
11
+ /**
12
+ * @param {DeepBookConfig} config Configuration object for DeepBook
13
+ */
14
+ constructor(config: DeepBookConfig);
15
+ /**
16
+ * @description Borrow base asset from the pool
17
+ * @param {string} poolKey The key to identify the pool
18
+ * @param {number} borrowAmount The amount to borrow
19
+ * @returns A function that takes a Transaction object
20
+ */
21
+ borrowBaseAsset: (poolKey: string, borrowAmount: number) => (tx: Transaction) => readonly [{
22
+ NestedResult: [number, number];
23
+ $kind: "NestedResult";
24
+ }, {
25
+ NestedResult: [number, number];
26
+ $kind: "NestedResult";
27
+ }];
28
+ /**
29
+ * @description Return base asset to the pool after a flash loan.
30
+ * @param {string} poolKey The key to identify the pool
31
+ * @param {number} borrowAmount The amount of the base asset to return
32
+ * @param {TransactionObjectArgument} baseCoinInput Coin object representing the base asset to be returned
33
+ * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
34
+ * @returns A function that takes a Transaction object
35
+ */
36
+ returnBaseAsset: (poolKey: string, borrowAmount: number, baseCoinInput: TransactionObjectArgument, flashLoan: TransactionObjectArgument) => (tx: Transaction) => TransactionObjectArgument;
37
+ /**
38
+ * @description Borrow quote asset from the pool
39
+ * @param {string} poolKey The key to identify the pool
40
+ * @param {number} borrowAmount The amount to borrow
41
+ * @returns A function that takes a Transaction object
42
+ */
43
+ borrowQuoteAsset: (poolKey: string, borrowAmount: number) => (tx: Transaction) => readonly [{
44
+ NestedResult: [number, number];
45
+ $kind: "NestedResult";
46
+ }, {
47
+ NestedResult: [number, number];
48
+ $kind: "NestedResult";
49
+ }];
50
+ /**
51
+ * @description Return quote asset to the pool after a flash loan.
52
+ * @param {string} poolKey The key to identify the pool
53
+ * @param {number} borrowAmount The amount of the quote asset to return
54
+ * @param {TransactionObjectArgument} quoteCoinInput Coin object representing the quote asset to be returned
55
+ * @param {TransactionObjectArgument} flashLoan FlashLoan object representing the loan to be settled
56
+ * @returns A function that takes a Transaction object
57
+ */
58
+ returnQuoteAsset: (poolKey: string, borrowAmount: number, quoteCoinInput: TransactionObjectArgument, flashLoan: TransactionObjectArgument) => (tx: Transaction) => TransactionObjectArgument;
59
+ }
60
+ //#endregion
61
+ export { FlashLoanContract };
62
+ //# sourceMappingURL=flashLoans.d.mts.map