@haneullabs/deepbook-v3 0.1.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 (378) hide show
  1. package/CHANGELOG.md +984 -0
  2. package/README.md +1 -0
  3. package/dist/cjs/client.d.ts +861 -0
  4. package/dist/cjs/client.js +1982 -0
  5. package/dist/cjs/client.js.map +7 -0
  6. package/dist/cjs/contracts/deepbook/account.d.ts +105 -0
  7. package/dist/cjs/contracts/deepbook/account.js +163 -0
  8. package/dist/cjs/contracts/deepbook/account.js.map +7 -0
  9. package/dist/cjs/contracts/deepbook/balance_manager.d.ts +268 -0
  10. package/dist/cjs/contracts/deepbook/balance_manager.js +361 -0
  11. package/dist/cjs/contracts/deepbook/balance_manager.js.map +7 -0
  12. package/dist/cjs/contracts/deepbook/balances.d.ts +10 -0
  13. package/dist/cjs/contracts/deepbook/balances.js +35 -0
  14. package/dist/cjs/contracts/deepbook/balances.js.map +7 -0
  15. package/dist/cjs/contracts/deepbook/big_vector.d.ts +62 -0
  16. package/dist/cjs/contracts/deepbook/big_vector.js +80 -0
  17. package/dist/cjs/contracts/deepbook/big_vector.js.map +7 -0
  18. package/dist/cjs/contracts/deepbook/book.d.ts +34 -0
  19. package/dist/cjs/contracts/deepbook/book.js +50 -0
  20. package/dist/cjs/contracts/deepbook/book.js.map +7 -0
  21. package/dist/cjs/contracts/deepbook/constants.d.ts +176 -0
  22. package/dist/cjs/contracts/deepbook/constants.js +338 -0
  23. package/dist/cjs/contracts/deepbook/constants.js.map +7 -0
  24. package/dist/cjs/contracts/deepbook/deep_price.d.ts +60 -0
  25. package/dist/cjs/contracts/deepbook/deep_price.js +87 -0
  26. package/dist/cjs/contracts/deepbook/deep_price.js.map +7 -0
  27. package/dist/cjs/contracts/deepbook/deps/std/type_name.d.ts +14 -0
  28. package/dist/cjs/contracts/deepbook/deps/std/type_name.js +42 -0
  29. package/dist/cjs/contracts/deepbook/deps/std/type_name.js.map +7 -0
  30. package/dist/cjs/contracts/deepbook/deps/sui/bag.d.ts +33 -0
  31. package/dist/cjs/contracts/deepbook/deps/sui/bag.js +47 -0
  32. package/dist/cjs/contracts/deepbook/deps/sui/bag.js.map +7 -0
  33. package/dist/cjs/contracts/deepbook/deps/sui/balance.d.ts +9 -0
  34. package/dist/cjs/contracts/deepbook/deps/sui/balance.js +33 -0
  35. package/dist/cjs/contracts/deepbook/deps/sui/balance.js.map +7 -0
  36. package/dist/cjs/contracts/deepbook/deps/sui/object.d.ts +5 -0
  37. package/dist/cjs/contracts/deepbook/deps/sui/object.js +33 -0
  38. package/dist/cjs/contracts/deepbook/deps/sui/object.js.map +7 -0
  39. package/dist/cjs/contracts/deepbook/deps/sui/table.d.ts +28 -0
  40. package/dist/cjs/contracts/deepbook/deps/sui/table.js +47 -0
  41. package/dist/cjs/contracts/deepbook/deps/sui/table.js.map +7 -0
  42. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.d.ts +27 -0
  43. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js +45 -0
  44. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js.map +7 -0
  45. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.d.ts +15 -0
  46. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js +35 -0
  47. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js.map +7 -0
  48. package/dist/cjs/contracts/deepbook/deps/sui/versioned.d.ts +7 -0
  49. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js +45 -0
  50. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js.map +7 -0
  51. package/dist/cjs/contracts/deepbook/ewma.d.ts +17 -0
  52. package/dist/cjs/contracts/deepbook/ewma.js +39 -0
  53. package/dist/cjs/contracts/deepbook/ewma.js.map +7 -0
  54. package/dist/cjs/contracts/deepbook/fill.d.ts +153 -0
  55. package/dist/cjs/contracts/deepbook/fill.js +251 -0
  56. package/dist/cjs/contracts/deepbook/fill.js.map +7 -0
  57. package/dist/cjs/contracts/deepbook/governance.d.ts +63 -0
  58. package/dist/cjs/contracts/deepbook/governance.js +79 -0
  59. package/dist/cjs/contracts/deepbook/governance.js.map +7 -0
  60. package/dist/cjs/contracts/deepbook/history.d.ts +60 -0
  61. package/dist/cjs/contracts/deepbook/history.js +78 -0
  62. package/dist/cjs/contracts/deepbook/history.js.map +7 -0
  63. package/dist/cjs/contracts/deepbook/math.d.ts +94 -0
  64. package/dist/cjs/contracts/deepbook/math.js +132 -0
  65. package/dist/cjs/contracts/deepbook/math.js.map +7 -0
  66. package/dist/cjs/contracts/deepbook/order.d.ts +135 -0
  67. package/dist/cjs/contracts/deepbook/order.js +218 -0
  68. package/dist/cjs/contracts/deepbook/order.js.map +7 -0
  69. package/dist/cjs/contracts/deepbook/order_info.d.ts +296 -0
  70. package/dist/cjs/contracts/deepbook/order_info.js +386 -0
  71. package/dist/cjs/contracts/deepbook/order_info.js.map +7 -0
  72. package/dist/cjs/contracts/deepbook/order_query.d.ts +85 -0
  73. package/dist/cjs/contracts/deepbook/order_query.js +96 -0
  74. package/dist/cjs/contracts/deepbook/order_query.js.map +7 -0
  75. package/dist/cjs/contracts/deepbook/pool.d.ts +1218 -0
  76. package/dist/cjs/contracts/deepbook/pool.js +1236 -0
  77. package/dist/cjs/contracts/deepbook/pool.js.map +7 -0
  78. package/dist/cjs/contracts/deepbook/registry.d.ts +134 -0
  79. package/dist/cjs/contracts/deepbook/registry.js +182 -0
  80. package/dist/cjs/contracts/deepbook/registry.js.map +7 -0
  81. package/dist/cjs/contracts/deepbook/state.d.ts +117 -0
  82. package/dist/cjs/contracts/deepbook/state.js +104 -0
  83. package/dist/cjs/contracts/deepbook/state.js.map +7 -0
  84. package/dist/cjs/contracts/deepbook/trade_params.d.ts +7 -0
  85. package/dist/cjs/contracts/deepbook/trade_params.js +35 -0
  86. package/dist/cjs/contracts/deepbook/trade_params.js.map +7 -0
  87. package/dist/cjs/contracts/deepbook/vault.d.ts +30 -0
  88. package/dist/cjs/contracts/deepbook/vault.js +65 -0
  89. package/dist/cjs/contracts/deepbook/vault.js.map +7 -0
  90. package/dist/cjs/contracts/utils/index.d.ts +25 -0
  91. package/dist/cjs/contracts/utils/index.js +148 -0
  92. package/dist/cjs/contracts/utils/index.js.map +7 -0
  93. package/dist/cjs/index.d.ts +23 -0
  94. package/dist/cjs/index.js +81 -0
  95. package/dist/cjs/index.js.map +7 -0
  96. package/dist/cjs/package.json +4 -0
  97. package/dist/cjs/pyth/PriceServiceConnection.d.ts +26 -0
  98. package/dist/cjs/pyth/PriceServiceConnection.js +68 -0
  99. package/dist/cjs/pyth/PriceServiceConnection.js.map +7 -0
  100. package/dist/cjs/pyth/pyth-helpers.d.ts +7 -0
  101. package/dist/cjs/pyth/pyth-helpers.js +36 -0
  102. package/dist/cjs/pyth/pyth-helpers.js.map +7 -0
  103. package/dist/cjs/pyth/pyth.d.ts +65 -0
  104. package/dist/cjs/pyth/pyth.js +269 -0
  105. package/dist/cjs/pyth/pyth.js.map +7 -0
  106. package/dist/cjs/transactions/balanceManager.d.ts +168 -0
  107. package/dist/cjs/transactions/balanceManager.js +384 -0
  108. package/dist/cjs/transactions/balanceManager.js.map +7 -0
  109. package/dist/cjs/transactions/deepbook.d.ts +477 -0
  110. package/dist/cjs/transactions/deepbook.js +1335 -0
  111. package/dist/cjs/transactions/deepbook.js.map +7 -0
  112. package/dist/cjs/transactions/deepbookAdmin.d.ts +105 -0
  113. package/dist/cjs/transactions/deepbookAdmin.js +334 -0
  114. package/dist/cjs/transactions/deepbookAdmin.js.map +7 -0
  115. package/dist/cjs/transactions/flashLoans.d.ts +56 -0
  116. package/dist/cjs/transactions/flashLoans.js +124 -0
  117. package/dist/cjs/transactions/flashLoans.js.map +7 -0
  118. package/dist/cjs/transactions/governance.d.ts +42 -0
  119. package/dist/cjs/transactions/governance.js +135 -0
  120. package/dist/cjs/transactions/governance.js.map +7 -0
  121. package/dist/cjs/transactions/marginAdmin.d.ts +133 -0
  122. package/dist/cjs/transactions/marginAdmin.js +393 -0
  123. package/dist/cjs/transactions/marginAdmin.js.map +7 -0
  124. package/dist/cjs/transactions/marginLiquidations.d.ts +61 -0
  125. package/dist/cjs/transactions/marginLiquidations.js +173 -0
  126. package/dist/cjs/transactions/marginLiquidations.js.map +7 -0
  127. package/dist/cjs/transactions/marginMaintainer.d.ts +80 -0
  128. package/dist/cjs/transactions/marginMaintainer.js +251 -0
  129. package/dist/cjs/transactions/marginMaintainer.js.map +7 -0
  130. package/dist/cjs/transactions/marginManager.d.ts +236 -0
  131. package/dist/cjs/transactions/marginManager.js +688 -0
  132. package/dist/cjs/transactions/marginManager.js.map +7 -0
  133. package/dist/cjs/transactions/marginPool.d.ts +134 -0
  134. package/dist/cjs/transactions/marginPool.js +330 -0
  135. package/dist/cjs/transactions/marginPool.js.map +7 -0
  136. package/dist/cjs/transactions/marginRegistry.d.ts +94 -0
  137. package/dist/cjs/transactions/marginRegistry.js +221 -0
  138. package/dist/cjs/transactions/marginRegistry.js.map +7 -0
  139. package/dist/cjs/transactions/marginTPSL.d.ts +93 -0
  140. package/dist/cjs/transactions/marginTPSL.js +286 -0
  141. package/dist/cjs/transactions/marginTPSL.js.map +7 -0
  142. package/dist/cjs/transactions/poolProxy.d.ts +104 -0
  143. package/dist/cjs/transactions/poolProxy.js +435 -0
  144. package/dist/cjs/transactions/poolProxy.js.map +7 -0
  145. package/dist/cjs/types/bcs.d.ts +5 -0
  146. package/dist/cjs/types/bcs.js +33 -0
  147. package/dist/cjs/types/bcs.js.map +7 -0
  148. package/dist/cjs/types/index.d.ts +218 -0
  149. package/dist/cjs/types/index.js +38 -0
  150. package/dist/cjs/types/index.js.map +7 -0
  151. package/dist/cjs/utils/config.d.ts +65 -0
  152. package/dist/cjs/utils/config.js +144 -0
  153. package/dist/cjs/utils/config.js.map +7 -0
  154. package/dist/cjs/utils/constants.d.ts +76 -0
  155. package/dist/cjs/utils/constants.js +382 -0
  156. package/dist/cjs/utils/constants.js.map +7 -0
  157. package/dist/cjs/utils/errors.d.ts +42 -0
  158. package/dist/cjs/utils/errors.js +70 -0
  159. package/dist/cjs/utils/errors.js.map +7 -0
  160. package/dist/cjs/utils/validation.d.ts +50 -0
  161. package/dist/cjs/utils/validation.js +67 -0
  162. package/dist/cjs/utils/validation.js.map +7 -0
  163. package/dist/esm/client.d.ts +861 -0
  164. package/dist/esm/client.js +1967 -0
  165. package/dist/esm/client.js.map +7 -0
  166. package/dist/esm/contracts/deepbook/account.d.ts +105 -0
  167. package/dist/esm/contracts/deepbook/account.js +133 -0
  168. package/dist/esm/contracts/deepbook/account.js.map +7 -0
  169. package/dist/esm/contracts/deepbook/balance_manager.d.ts +268 -0
  170. package/dist/esm/contracts/deepbook/balance_manager.js +331 -0
  171. package/dist/esm/contracts/deepbook/balance_manager.js.map +7 -0
  172. package/dist/esm/contracts/deepbook/balances.d.ts +10 -0
  173. package/dist/esm/contracts/deepbook/balances.js +15 -0
  174. package/dist/esm/contracts/deepbook/balances.js.map +7 -0
  175. package/dist/esm/contracts/deepbook/big_vector.d.ts +62 -0
  176. package/dist/esm/contracts/deepbook/big_vector.js +50 -0
  177. package/dist/esm/contracts/deepbook/big_vector.js.map +7 -0
  178. package/dist/esm/contracts/deepbook/book.d.ts +34 -0
  179. package/dist/esm/contracts/deepbook/book.js +20 -0
  180. package/dist/esm/contracts/deepbook/book.js.map +7 -0
  181. package/dist/esm/contracts/deepbook/constants.d.ts +176 -0
  182. package/dist/esm/contracts/deepbook/constants.js +318 -0
  183. package/dist/esm/contracts/deepbook/constants.js.map +7 -0
  184. package/dist/esm/contracts/deepbook/deep_price.d.ts +60 -0
  185. package/dist/esm/contracts/deepbook/deep_price.js +67 -0
  186. package/dist/esm/contracts/deepbook/deep_price.js.map +7 -0
  187. package/dist/esm/contracts/deepbook/deps/std/type_name.d.ts +14 -0
  188. package/dist/esm/contracts/deepbook/deps/std/type_name.js +22 -0
  189. package/dist/esm/contracts/deepbook/deps/std/type_name.js.map +7 -0
  190. package/dist/esm/contracts/deepbook/deps/sui/bag.d.ts +33 -0
  191. package/dist/esm/contracts/deepbook/deps/sui/bag.js +17 -0
  192. package/dist/esm/contracts/deepbook/deps/sui/bag.js.map +7 -0
  193. package/dist/esm/contracts/deepbook/deps/sui/balance.d.ts +9 -0
  194. package/dist/esm/contracts/deepbook/deps/sui/balance.js +13 -0
  195. package/dist/esm/contracts/deepbook/deps/sui/balance.js.map +7 -0
  196. package/dist/esm/contracts/deepbook/deps/sui/object.d.ts +5 -0
  197. package/dist/esm/contracts/deepbook/deps/sui/object.js +13 -0
  198. package/dist/esm/contracts/deepbook/deps/sui/object.js.map +7 -0
  199. package/dist/esm/contracts/deepbook/deps/sui/table.d.ts +28 -0
  200. package/dist/esm/contracts/deepbook/deps/sui/table.js +17 -0
  201. package/dist/esm/contracts/deepbook/deps/sui/table.js.map +7 -0
  202. package/dist/esm/contracts/deepbook/deps/sui/vec_map.d.ts +27 -0
  203. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js +25 -0
  204. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js.map +7 -0
  205. package/dist/esm/contracts/deepbook/deps/sui/vec_set.d.ts +15 -0
  206. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js +15 -0
  207. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js.map +7 -0
  208. package/dist/esm/contracts/deepbook/deps/sui/versioned.d.ts +7 -0
  209. package/dist/esm/contracts/deepbook/deps/sui/versioned.js +15 -0
  210. package/dist/esm/contracts/deepbook/deps/sui/versioned.js.map +7 -0
  211. package/dist/esm/contracts/deepbook/ewma.d.ts +17 -0
  212. package/dist/esm/contracts/deepbook/ewma.js +19 -0
  213. package/dist/esm/contracts/deepbook/ewma.js.map +7 -0
  214. package/dist/esm/contracts/deepbook/fill.d.ts +153 -0
  215. package/dist/esm/contracts/deepbook/fill.js +221 -0
  216. package/dist/esm/contracts/deepbook/fill.js.map +7 -0
  217. package/dist/esm/contracts/deepbook/governance.d.ts +63 -0
  218. package/dist/esm/contracts/deepbook/governance.js +49 -0
  219. package/dist/esm/contracts/deepbook/governance.js.map +7 -0
  220. package/dist/esm/contracts/deepbook/history.d.ts +60 -0
  221. package/dist/esm/contracts/deepbook/history.js +48 -0
  222. package/dist/esm/contracts/deepbook/history.js.map +7 -0
  223. package/dist/esm/contracts/deepbook/math.d.ts +94 -0
  224. package/dist/esm/contracts/deepbook/math.js +112 -0
  225. package/dist/esm/contracts/deepbook/math.js.map +7 -0
  226. package/dist/esm/contracts/deepbook/order.d.ts +135 -0
  227. package/dist/esm/contracts/deepbook/order.js +188 -0
  228. package/dist/esm/contracts/deepbook/order.js.map +7 -0
  229. package/dist/esm/contracts/deepbook/order_info.d.ts +296 -0
  230. package/dist/esm/contracts/deepbook/order_info.js +356 -0
  231. package/dist/esm/contracts/deepbook/order_info.js.map +7 -0
  232. package/dist/esm/contracts/deepbook/order_query.d.ts +85 -0
  233. package/dist/esm/contracts/deepbook/order_query.js +66 -0
  234. package/dist/esm/contracts/deepbook/order_query.js.map +7 -0
  235. package/dist/esm/contracts/deepbook/pool.d.ts +1218 -0
  236. package/dist/esm/contracts/deepbook/pool.js +1206 -0
  237. package/dist/esm/contracts/deepbook/pool.js.map +7 -0
  238. package/dist/esm/contracts/deepbook/registry.d.ts +134 -0
  239. package/dist/esm/contracts/deepbook/registry.js +152 -0
  240. package/dist/esm/contracts/deepbook/registry.js.map +7 -0
  241. package/dist/esm/contracts/deepbook/state.d.ts +117 -0
  242. package/dist/esm/contracts/deepbook/state.js +74 -0
  243. package/dist/esm/contracts/deepbook/state.js.map +7 -0
  244. package/dist/esm/contracts/deepbook/trade_params.d.ts +7 -0
  245. package/dist/esm/contracts/deepbook/trade_params.js +15 -0
  246. package/dist/esm/contracts/deepbook/trade_params.js.map +7 -0
  247. package/dist/esm/contracts/deepbook/vault.d.ts +30 -0
  248. package/dist/esm/contracts/deepbook/vault.js +35 -0
  249. package/dist/esm/contracts/deepbook/vault.js.map +7 -0
  250. package/dist/esm/contracts/utils/index.d.ts +25 -0
  251. package/dist/esm/contracts/utils/index.js +128 -0
  252. package/dist/esm/contracts/utils/index.js.map +7 -0
  253. package/dist/esm/index.d.ts +23 -0
  254. package/dist/esm/index.js +81 -0
  255. package/dist/esm/index.js.map +7 -0
  256. package/dist/esm/package.json +4 -0
  257. package/dist/esm/pyth/PriceServiceConnection.d.ts +26 -0
  258. package/dist/esm/pyth/PriceServiceConnection.js +38 -0
  259. package/dist/esm/pyth/PriceServiceConnection.js.map +7 -0
  260. package/dist/esm/pyth/pyth-helpers.d.ts +7 -0
  261. package/dist/esm/pyth/pyth-helpers.js +16 -0
  262. package/dist/esm/pyth/pyth-helpers.js.map +7 -0
  263. package/dist/esm/pyth/pyth.d.ts +65 -0
  264. package/dist/esm/pyth/pyth.js +249 -0
  265. package/dist/esm/pyth/pyth.js.map +7 -0
  266. package/dist/esm/transactions/balanceManager.d.ts +168 -0
  267. package/dist/esm/transactions/balanceManager.js +364 -0
  268. package/dist/esm/transactions/balanceManager.js.map +7 -0
  269. package/dist/esm/transactions/deepbook.d.ts +477 -0
  270. package/dist/esm/transactions/deepbook.js +1321 -0
  271. package/dist/esm/transactions/deepbook.js.map +7 -0
  272. package/dist/esm/transactions/deepbookAdmin.d.ts +105 -0
  273. package/dist/esm/transactions/deepbookAdmin.js +314 -0
  274. package/dist/esm/transactions/deepbookAdmin.js.map +7 -0
  275. package/dist/esm/transactions/flashLoans.d.ts +56 -0
  276. package/dist/esm/transactions/flashLoans.js +104 -0
  277. package/dist/esm/transactions/flashLoans.js.map +7 -0
  278. package/dist/esm/transactions/governance.d.ts +42 -0
  279. package/dist/esm/transactions/governance.js +115 -0
  280. package/dist/esm/transactions/governance.js.map +7 -0
  281. package/dist/esm/transactions/marginAdmin.d.ts +133 -0
  282. package/dist/esm/transactions/marginAdmin.js +373 -0
  283. package/dist/esm/transactions/marginAdmin.js.map +7 -0
  284. package/dist/esm/transactions/marginLiquidations.d.ts +61 -0
  285. package/dist/esm/transactions/marginLiquidations.js +153 -0
  286. package/dist/esm/transactions/marginLiquidations.js.map +7 -0
  287. package/dist/esm/transactions/marginMaintainer.d.ts +80 -0
  288. package/dist/esm/transactions/marginMaintainer.js +231 -0
  289. package/dist/esm/transactions/marginMaintainer.js.map +7 -0
  290. package/dist/esm/transactions/marginManager.d.ts +236 -0
  291. package/dist/esm/transactions/marginManager.js +668 -0
  292. package/dist/esm/transactions/marginManager.js.map +7 -0
  293. package/dist/esm/transactions/marginPool.d.ts +134 -0
  294. package/dist/esm/transactions/marginPool.js +310 -0
  295. package/dist/esm/transactions/marginPool.js.map +7 -0
  296. package/dist/esm/transactions/marginRegistry.d.ts +94 -0
  297. package/dist/esm/transactions/marginRegistry.js +201 -0
  298. package/dist/esm/transactions/marginRegistry.js.map +7 -0
  299. package/dist/esm/transactions/marginTPSL.d.ts +93 -0
  300. package/dist/esm/transactions/marginTPSL.js +266 -0
  301. package/dist/esm/transactions/marginTPSL.js.map +7 -0
  302. package/dist/esm/transactions/poolProxy.d.ts +104 -0
  303. package/dist/esm/transactions/poolProxy.js +415 -0
  304. package/dist/esm/transactions/poolProxy.js.map +7 -0
  305. package/dist/esm/types/bcs.d.ts +5 -0
  306. package/dist/esm/types/bcs.js +13 -0
  307. package/dist/esm/types/bcs.js.map +7 -0
  308. package/dist/esm/types/index.d.ts +218 -0
  309. package/dist/esm/types/index.js +18 -0
  310. package/dist/esm/types/index.js.map +7 -0
  311. package/dist/esm/utils/config.d.ts +65 -0
  312. package/dist/esm/utils/config.js +135 -0
  313. package/dist/esm/utils/config.js.map +7 -0
  314. package/dist/esm/utils/constants.d.ts +76 -0
  315. package/dist/esm/utils/constants.js +362 -0
  316. package/dist/esm/utils/constants.js.map +7 -0
  317. package/dist/esm/utils/errors.d.ts +42 -0
  318. package/dist/esm/utils/errors.js +50 -0
  319. package/dist/esm/utils/errors.js.map +7 -0
  320. package/dist/esm/utils/validation.d.ts +50 -0
  321. package/dist/esm/utils/validation.js +47 -0
  322. package/dist/esm/utils/validation.js.map +7 -0
  323. package/dist/tsconfig.esm.tsbuildinfo +1 -0
  324. package/dist/tsconfig.tsbuildinfo +1 -0
  325. package/package.json +63 -0
  326. package/src/client.ts +2451 -0
  327. package/src/contracts/deepbook/account.ts +199 -0
  328. package/src/contracts/deepbook/balance_manager.ts +532 -0
  329. package/src/contracts/deepbook/balances.ts +19 -0
  330. package/src/contracts/deepbook/big_vector.ts +74 -0
  331. package/src/contracts/deepbook/book.ts +24 -0
  332. package/src/contracts/deepbook/constants.ts +458 -0
  333. package/src/contracts/deepbook/deep_price.ts +84 -0
  334. package/src/contracts/deepbook/deps/std/type_name.ts +23 -0
  335. package/src/contracts/deepbook/deps/sui/bag.ts +41 -0
  336. package/src/contracts/deepbook/deps/sui/balance.ts +18 -0
  337. package/src/contracts/deepbook/deps/sui/object.ts +14 -0
  338. package/src/contracts/deepbook/deps/sui/table.ts +36 -0
  339. package/src/contracts/deepbook/deps/sui/vec_map.ts +33 -0
  340. package/src/contracts/deepbook/deps/sui/vec_set.ts +22 -0
  341. package/src/contracts/deepbook/deps/sui/versioned.ts +13 -0
  342. package/src/contracts/deepbook/ewma.ts +26 -0
  343. package/src/contracts/deepbook/fill.ts +336 -0
  344. package/src/contracts/deepbook/governance.ts +52 -0
  345. package/src/contracts/deepbook/history.ts +51 -0
  346. package/src/contracts/deepbook/math.ts +210 -0
  347. package/src/contracts/deepbook/order.ts +269 -0
  348. package/src/contracts/deepbook/order_info.ts +513 -0
  349. package/src/contracts/deepbook/order_query.ts +115 -0
  350. package/src/contracts/deepbook/pool.ts +2269 -0
  351. package/src/contracts/deepbook/registry.ts +242 -0
  352. package/src/contracts/deepbook/state.ts +74 -0
  353. package/src/contracts/deepbook/trade_params.ts +16 -0
  354. package/src/contracts/deepbook/vault.ts +37 -0
  355. package/src/contracts/utils/index.ts +184 -0
  356. package/src/index.ts +95 -0
  357. package/src/pyth/PriceServiceConnection.ts +48 -0
  358. package/src/pyth/pyth-helpers.ts +23 -0
  359. package/src/pyth/pyth.ts +305 -0
  360. package/src/transactions/balanceManager.ts +399 -0
  361. package/src/transactions/deepbook.ts +1519 -0
  362. package/src/transactions/deepbookAdmin.ts +332 -0
  363. package/src/transactions/flashLoans.ts +123 -0
  364. package/src/transactions/governance.ts +123 -0
  365. package/src/transactions/marginAdmin.ts +396 -0
  366. package/src/transactions/marginLiquidations.ts +175 -0
  367. package/src/transactions/marginMaintainer.ts +280 -0
  368. package/src/transactions/marginManager.ts +708 -0
  369. package/src/transactions/marginPool.ts +339 -0
  370. package/src/transactions/marginRegistry.ts +212 -0
  371. package/src/transactions/marginTPSL.ts +296 -0
  372. package/src/transactions/poolProxy.ts +438 -0
  373. package/src/types/bcs.ts +8 -0
  374. package/src/types/index.ts +255 -0
  375. package/src/utils/config.ts +177 -0
  376. package/src/utils/constants.ts +374 -0
  377. package/src/utils/errors.ts +67 -0
  378. package/src/utils/validation.ts +91 -0
@@ -0,0 +1,415 @@
1
+ var __typeError = (msg) => {
2
+ throw TypeError(msg);
3
+ };
4
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
7
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
8
+ var _config;
9
+ import { OrderType, SelfMatchingOptions } from "../types/index.js";
10
+ import { MAX_TIMESTAMP, FLOAT_SCALAR } from "../utils/config.js";
11
+ class PoolProxyContract {
12
+ /**
13
+ * @param {DeepBookConfig} config Configuration for PoolProxyContract
14
+ */
15
+ constructor(config) {
16
+ __privateAdd(this, _config);
17
+ /**
18
+ * @description Place a limit order
19
+ * @param {PlaceMarginLimitOrderParams} params Parameters for placing a limit order
20
+ * @returns A function that takes a Transaction object
21
+ */
22
+ this.placeLimitOrder = (params) => (tx) => {
23
+ const {
24
+ poolKey,
25
+ marginManagerKey,
26
+ clientOrderId,
27
+ price,
28
+ quantity,
29
+ isBid,
30
+ expiration = MAX_TIMESTAMP,
31
+ orderType = OrderType.NO_RESTRICTION,
32
+ selfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,
33
+ payWithDeep = true
34
+ } = params;
35
+ const pool = __privateGet(this, _config).getPool(poolKey);
36
+ const manager = __privateGet(this, _config).getMarginManager(marginManagerKey);
37
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
38
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
39
+ const inputPrice = Math.round(price * FLOAT_SCALAR * quoteCoin.scalar / baseCoin.scalar);
40
+ const inputQuantity = Math.round(quantity * baseCoin.scalar);
41
+ return tx.moveCall({
42
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::place_limit_order`,
43
+ arguments: [
44
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
45
+ tx.object(manager.address),
46
+ tx.object(pool.address),
47
+ tx.pure.u64(clientOrderId),
48
+ tx.pure.u8(orderType),
49
+ tx.pure.u8(selfMatchingOption),
50
+ tx.pure.u64(inputPrice),
51
+ tx.pure.u64(inputQuantity),
52
+ tx.pure.bool(isBid),
53
+ tx.pure.bool(payWithDeep),
54
+ tx.pure.u64(expiration),
55
+ tx.object.clock()
56
+ ],
57
+ typeArguments: [baseCoin.type, quoteCoin.type]
58
+ });
59
+ };
60
+ /**
61
+ * @description Place a market order
62
+ * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order
63
+ * @returns A function that takes a Transaction object
64
+ */
65
+ this.placeMarketOrder = (params) => (tx) => {
66
+ const {
67
+ poolKey,
68
+ marginManagerKey,
69
+ clientOrderId,
70
+ quantity,
71
+ isBid,
72
+ selfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,
73
+ payWithDeep = true
74
+ } = params;
75
+ const pool = __privateGet(this, _config).getPool(poolKey);
76
+ const manager = __privateGet(this, _config).getMarginManager(marginManagerKey);
77
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
78
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
79
+ const inputQuantity = Math.round(quantity * baseCoin.scalar);
80
+ return tx.moveCall({
81
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::place_market_order`,
82
+ arguments: [
83
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
84
+ tx.object(manager.address),
85
+ tx.object(pool.address),
86
+ tx.pure.u64(clientOrderId),
87
+ tx.pure.u8(selfMatchingOption),
88
+ tx.pure.u64(inputQuantity),
89
+ tx.pure.bool(isBid),
90
+ tx.pure.bool(payWithDeep),
91
+ tx.object.clock()
92
+ ],
93
+ typeArguments: [baseCoin.type, quoteCoin.type]
94
+ });
95
+ };
96
+ /**
97
+ * @description Place a reduce only limit order
98
+ * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order
99
+ * @returns A function that takes a Transaction object
100
+ */
101
+ this.placeReduceOnlyLimitOrder = (params) => (tx) => {
102
+ const {
103
+ poolKey,
104
+ marginManagerKey,
105
+ clientOrderId,
106
+ price,
107
+ quantity,
108
+ isBid,
109
+ expiration = MAX_TIMESTAMP,
110
+ orderType = OrderType.NO_RESTRICTION,
111
+ selfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,
112
+ payWithDeep = true
113
+ } = params;
114
+ const pool = __privateGet(this, _config).getPool(poolKey);
115
+ const manager = __privateGet(this, _config).getMarginManager(marginManagerKey);
116
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
117
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
118
+ const inputPrice = Math.round(price * FLOAT_SCALAR * quoteCoin.scalar / baseCoin.scalar);
119
+ const inputQuantity = Math.round(quantity * baseCoin.scalar);
120
+ const marginPool = isBid ? __privateGet(this, _config).getMarginPool(pool.baseCoin) : __privateGet(this, _config).getMarginPool(pool.quoteCoin);
121
+ const debtType = isBid ? baseCoin.type : quoteCoin.type;
122
+ return tx.moveCall({
123
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::place_reduce_only_limit_order`,
124
+ arguments: [
125
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
126
+ tx.object(manager.address),
127
+ tx.object(pool.address),
128
+ tx.object(marginPool.address),
129
+ tx.pure.u64(clientOrderId),
130
+ tx.pure.u8(orderType),
131
+ tx.pure.u8(selfMatchingOption),
132
+ tx.pure.u64(inputPrice),
133
+ tx.pure.u64(inputQuantity),
134
+ tx.pure.bool(isBid),
135
+ tx.pure.bool(payWithDeep),
136
+ tx.pure.u64(expiration),
137
+ tx.object.clock()
138
+ ],
139
+ typeArguments: [baseCoin.type, quoteCoin.type, debtType]
140
+ });
141
+ };
142
+ /**
143
+ * @description Place a reduce only market order
144
+ * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order
145
+ * @returns A function that takes a Transaction object
146
+ */
147
+ this.placeReduceOnlyMarketOrder = (params) => (tx) => {
148
+ const {
149
+ poolKey,
150
+ marginManagerKey,
151
+ clientOrderId,
152
+ quantity,
153
+ isBid,
154
+ selfMatchingOption = SelfMatchingOptions.SELF_MATCHING_ALLOWED,
155
+ payWithDeep = true
156
+ } = params;
157
+ const pool = __privateGet(this, _config).getPool(poolKey);
158
+ const manager = __privateGet(this, _config).getMarginManager(marginManagerKey);
159
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
160
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
161
+ const inputQuantity = Math.round(quantity * baseCoin.scalar);
162
+ const marginPool = isBid ? __privateGet(this, _config).getMarginPool(pool.baseCoin) : __privateGet(this, _config).getMarginPool(pool.quoteCoin);
163
+ const debtType = isBid ? baseCoin.type : quoteCoin.type;
164
+ return tx.moveCall({
165
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::place_reduce_only_market_order`,
166
+ arguments: [
167
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
168
+ tx.object(manager.address),
169
+ tx.object(pool.address),
170
+ tx.object(marginPool.address),
171
+ tx.pure.u64(clientOrderId),
172
+ tx.pure.u8(selfMatchingOption),
173
+ tx.pure.u64(inputQuantity),
174
+ tx.pure.bool(isBid),
175
+ tx.pure.bool(payWithDeep),
176
+ tx.object.clock()
177
+ ],
178
+ typeArguments: [baseCoin.type, quoteCoin.type, debtType]
179
+ });
180
+ };
181
+ /**
182
+ * @description Modify an existing order
183
+ * @param {string} marginManagerKey The key to identify the MarginManager
184
+ * @param {string} orderId Order ID to modify
185
+ * @param {number} newQuantity New quantity for the order
186
+ * @returns A function that takes a Transaction object
187
+ */
188
+ this.modifyOrder = (marginManagerKey, orderId, newQuantity) => (tx) => {
189
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
190
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
191
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
192
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
193
+ const inputQuantity = Math.round(newQuantity * baseCoin.scalar);
194
+ tx.moveCall({
195
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::modify_order`,
196
+ arguments: [
197
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
198
+ tx.object(marginManager.address),
199
+ tx.object(pool.address),
200
+ tx.pure.u128(orderId),
201
+ tx.pure.u64(inputQuantity),
202
+ tx.object.clock()
203
+ ],
204
+ typeArguments: [baseCoin.type, quoteCoin.type]
205
+ });
206
+ };
207
+ /**
208
+ * @description Cancel an existing order
209
+ * @param {string} marginManagerKey The key to identify the MarginManager
210
+ * @param {string} orderId Order ID to cancel
211
+ * @returns A function that takes a Transaction object
212
+ */
213
+ this.cancelOrder = (marginManagerKey, orderId) => (tx) => {
214
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
215
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
216
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
217
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
218
+ tx.moveCall({
219
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::cancel_order`,
220
+ arguments: [
221
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
222
+ tx.object(marginManager.address),
223
+ tx.object(pool.address),
224
+ tx.pure.u128(orderId),
225
+ tx.object.clock()
226
+ ],
227
+ typeArguments: [baseCoin.type, quoteCoin.type]
228
+ });
229
+ };
230
+ /**
231
+ * @description Cancel multiple existing orders
232
+ * @param {string} marginManagerKey The key to identify the MarginManager
233
+ * @param {string[]} orderIds Order IDs to cancel
234
+ * @returns A function that takes a Transaction object
235
+ */
236
+ this.cancelOrders = (marginManagerKey, orderIds) => (tx) => {
237
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
238
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
239
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
240
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
241
+ tx.moveCall({
242
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::cancel_orders`,
243
+ arguments: [
244
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
245
+ tx.object(marginManager.address),
246
+ tx.object(pool.address),
247
+ tx.pure.vector("u128", orderIds),
248
+ tx.object.clock()
249
+ ],
250
+ typeArguments: [baseCoin.type, quoteCoin.type]
251
+ });
252
+ };
253
+ /**
254
+ * @description Cancel all existing orders
255
+ * @param {string} marginManagerKey The key to identify the MarginManager
256
+ * @returns A function that takes a Transaction object
257
+ */
258
+ this.cancelAllOrders = (marginManagerKey) => (tx) => {
259
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
260
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
261
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
262
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
263
+ tx.moveCall({
264
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::cancel_all_orders`,
265
+ arguments: [
266
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
267
+ tx.object(marginManager.address),
268
+ tx.object(pool.address),
269
+ tx.object.clock()
270
+ ],
271
+ typeArguments: [baseCoin.type, quoteCoin.type]
272
+ });
273
+ };
274
+ /**
275
+ * @description Withdraw settled amounts
276
+ * @param {string} marginManagerKey The key to identify the MarginManager
277
+ * @returns A function that takes a Transaction object
278
+ */
279
+ this.withdrawSettledAmounts = (marginManagerKey) => (tx) => {
280
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
281
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
282
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
283
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
284
+ tx.moveCall({
285
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::withdraw_settled_amounts`,
286
+ arguments: [
287
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
288
+ tx.object(marginManager.address),
289
+ tx.object(pool.address)
290
+ ],
291
+ typeArguments: [baseCoin.type, quoteCoin.type]
292
+ });
293
+ };
294
+ /**
295
+ * @description Stake in the pool
296
+ * @param {string} marginManagerKey The key to identify the MarginManager
297
+ * @param {number} stakeAmount The amount to stake
298
+ * @returns A function that takes a Transaction object
299
+ */
300
+ this.stake = (marginManagerKey, stakeAmount) => (tx) => {
301
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
302
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
303
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
304
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
305
+ const deepCoin = __privateGet(this, _config).getCoin("DEEP");
306
+ const stakeInput = Math.round(stakeAmount * deepCoin.scalar);
307
+ tx.moveCall({
308
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::stake`,
309
+ arguments: [
310
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
311
+ tx.object(marginManager.address),
312
+ tx.object(pool.address),
313
+ tx.pure.u64(stakeInput)
314
+ ],
315
+ typeArguments: [baseCoin.type, quoteCoin.type]
316
+ });
317
+ };
318
+ /**
319
+ * @description Unstake from the pool
320
+ * @param {string} marginManagerKey The key to identify the MarginManager
321
+ * @returns A function that takes a Transaction object
322
+ */
323
+ this.unstake = (marginManagerKey) => (tx) => {
324
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
325
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
326
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
327
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
328
+ tx.moveCall({
329
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::unstake`,
330
+ arguments: [
331
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
332
+ tx.object(marginManager.address),
333
+ tx.object(pool.address)
334
+ ],
335
+ typeArguments: [baseCoin.type, quoteCoin.type]
336
+ });
337
+ };
338
+ /**
339
+ * @description Submit a proposal
340
+ * @param {string} marginManagerKey The key to identify the MarginManager
341
+ * @param {MarginProposalParams} params Parameters for the proposal
342
+ * @returns A function that takes a Transaction object
343
+ */
344
+ this.submitProposal = (marginManagerKey, params) => (tx) => {
345
+ const { takerFee, makerFee, stakeRequired } = params;
346
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
347
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
348
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
349
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
350
+ const stakeInput = Math.round(stakeRequired * FLOAT_SCALAR);
351
+ const takerFeeInput = Math.round(takerFee * FLOAT_SCALAR);
352
+ const makerFeeInput = Math.round(makerFee * FLOAT_SCALAR);
353
+ tx.moveCall({
354
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::submit_proposal`,
355
+ arguments: [
356
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
357
+ tx.object(marginManager.address),
358
+ tx.object(pool.address),
359
+ tx.pure.u64(takerFeeInput),
360
+ tx.pure.u64(makerFeeInput),
361
+ tx.pure.u64(stakeInput)
362
+ ],
363
+ typeArguments: [baseCoin.type, quoteCoin.type]
364
+ });
365
+ };
366
+ /**
367
+ * @description Vote on a proposal
368
+ * @param {string} marginManagerKey The key to identify the MarginManager
369
+ * @param {string} proposalId The ID of the proposal to vote on
370
+ * @returns A function that takes a Transaction object
371
+ */
372
+ this.vote = (marginManagerKey, proposalId) => (tx) => {
373
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
374
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
375
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
376
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
377
+ tx.moveCall({
378
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::vote`,
379
+ arguments: [
380
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
381
+ tx.object(marginManager.address),
382
+ tx.object(pool.address),
383
+ tx.pure.id(proposalId)
384
+ ],
385
+ typeArguments: [baseCoin.type, quoteCoin.type]
386
+ });
387
+ };
388
+ /**
389
+ * @description Claim a rebate from a pool
390
+ * @param {string} marginManagerKey The key to identify the MarginManager
391
+ * @returns A function that takes a Transaction object
392
+ */
393
+ this.claimRebate = (marginManagerKey) => (tx) => {
394
+ const marginManager = __privateGet(this, _config).getMarginManager(marginManagerKey);
395
+ const pool = __privateGet(this, _config).getPool(marginManager.poolKey);
396
+ const baseCoin = __privateGet(this, _config).getCoin(pool.baseCoin);
397
+ const quoteCoin = __privateGet(this, _config).getCoin(pool.quoteCoin);
398
+ tx.moveCall({
399
+ target: `${__privateGet(this, _config).MARGIN_PACKAGE_ID}::pool_proxy::claim_rebate`,
400
+ arguments: [
401
+ tx.object(__privateGet(this, _config).MARGIN_REGISTRY_ID),
402
+ tx.object(marginManager.address),
403
+ tx.object(pool.address)
404
+ ],
405
+ typeArguments: [baseCoin.type, quoteCoin.type]
406
+ });
407
+ };
408
+ __privateSet(this, _config, config);
409
+ }
410
+ }
411
+ _config = new WeakMap();
412
+ export {
413
+ PoolProxyContract
414
+ };
415
+ //# sourceMappingURL=poolProxy.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/transactions/poolProxy.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport type { Transaction } from '@haneullabs/haneul/transactions';\nimport type {\n\tPlaceMarginLimitOrderParams,\n\tPlaceMarginMarketOrderParams,\n\tMarginProposalParams,\n} from '../types/index.js';\n\nimport type { DeepBookConfig } from '../utils/config.js';\nimport { OrderType, SelfMatchingOptions } from '../types/index.js';\nimport { MAX_TIMESTAMP, FLOAT_SCALAR } from '../utils/config.js';\n\n/**\n * PoolProxyContract class for managing PoolProxy operations.\n */\nexport class PoolProxyContract {\n\t#config: DeepBookConfig;\n\n\t/**\n\t * @param {DeepBookConfig} config Configuration for PoolProxyContract\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 {PlaceMarginLimitOrderParams} params Parameters for placing a limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\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\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::place_limit_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(pool.address),\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 {PlaceMarginMarketOrderParams} params Parameters for placing a market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\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\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::place_market_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(pool.address),\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 Place a reduce only limit order\n\t * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyLimitOrder = (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\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\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\tconst marginPool = isBid\n\t\t\t? this.#config.getMarginPool(pool.baseCoin)\n\t\t\t: this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst debtType = isBid ? baseCoin.type : quoteCoin.type;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::place_reduce_only_limit_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(marginPool.address),\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, debtType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Place a reduce only market order\n\t * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order\n\t * @returns A function that takes a Transaction object\n\t */\n\tplaceReduceOnlyMarketOrder = (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => {\n\t\tconst {\n\t\t\tpoolKey,\n\t\t\tmarginManagerKey,\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\t\tconst pool = this.#config.getPool(poolKey);\n\t\tconst manager = this.#config.getMarginManager(marginManagerKey);\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\t\tconst marginPool = isBid\n\t\t\t? this.#config.getMarginPool(pool.baseCoin)\n\t\t\t: this.#config.getMarginPool(pool.quoteCoin);\n\t\tconst debtType = isBid ? baseCoin.type : quoteCoin.type;\n\t\treturn tx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::place_reduce_only_market_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(manager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.object(marginPool.address),\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, debtType],\n\t\t});\n\t};\n\n\t/**\n\t * @description Modify an existing order\n\t * @param {string} marginManagerKey The key to identify the MarginManager\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(marginManagerKey: string, orderId: string, newQuantity: number) => (tx: Transaction) => {\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 inputQuantity = Math.round(newQuantity * baseCoin.scalar);\n\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::modify_order`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.object(marginManager.address),\n\t\t\t\t\ttx.object(pool.address),\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} marginManagerKey The key to identify the MarginManager\n\t * @param {string} orderId Order ID to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrder = (marginManagerKey: string, orderId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::cancel_order`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u128(orderId),\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 Cancel multiple existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string[]} orderIds Order IDs to cancel\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelOrders = (marginManagerKey: string, orderIds: string[]) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::cancel_orders`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.vector('u128', orderIds),\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 Cancel all existing orders\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tcancelAllOrders = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::cancel_all_orders`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\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\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\twithdrawSettledAmounts = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::withdraw_settled_amounts`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Stake in the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {number} stakeAmount The amount to stake\n\t * @returns A function that takes a Transaction object\n\t */\n\tstake = (marginManagerKey: string, stakeAmount: number) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.poolKey);\n\t\tconst baseCoin = this.#config.getCoin(pool.baseCoin);\n\t\tconst quoteCoin = this.#config.getCoin(pool.quoteCoin);\n\t\tconst deepCoin = this.#config.getCoin('DEEP');\n\t\tconst stakeInput = Math.round(stakeAmount * deepCoin.scalar);\n\t\ttx.moveCall({\n\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::stake`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.u64(stakeInput),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Unstake from the pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tunstake = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::unstake`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Submit a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {MarginProposalParams} params Parameters for the proposal\n\t * @returns A function that takes a Transaction object\n\t */\n\tsubmitProposal =\n\t\t(marginManagerKey: string, params: MarginProposalParams) => (tx: Transaction) => {\n\t\t\tconst { takerFee, makerFee, stakeRequired } = params;\n\t\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\t\tconst pool = this.#config.getPool(marginManager.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 stakeInput = Math.round(stakeRequired * FLOAT_SCALAR);\n\t\t\tconst takerFeeInput = Math.round(takerFee * FLOAT_SCALAR);\n\t\t\tconst makerFeeInput = Math.round(makerFee * FLOAT_SCALAR);\n\t\t\ttx.moveCall({\n\t\t\t\ttarget: `${this.#config.MARGIN_PACKAGE_ID}::pool_proxy::submit_proposal`,\n\t\t\t\targuments: [\n\t\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\t\ttx.object(marginManager.address),\n\t\t\t\t\ttx.object(pool.address),\n\t\t\t\t\ttx.pure.u64(takerFeeInput),\n\t\t\t\t\ttx.pure.u64(makerFeeInput),\n\t\t\t\t\ttx.pure.u64(stakeInput),\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 Vote on a proposal\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @param {string} proposalId The ID of the proposal to vote on\n\t * @returns A function that takes a Transaction object\n\t */\n\tvote = (marginManagerKey: string, proposalId: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::vote`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t\ttx.pure.id(proposalId),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n\n\t/**\n\t * @description Claim a rebate from a pool\n\t * @param {string} marginManagerKey The key to identify the MarginManager\n\t * @returns A function that takes a Transaction object\n\t */\n\tclaimRebate = (marginManagerKey: string) => (tx: Transaction) => {\n\t\tconst marginManager = this.#config.getMarginManager(marginManagerKey);\n\t\tconst pool = this.#config.getPool(marginManager.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.MARGIN_PACKAGE_ID}::pool_proxy::claim_rebate`,\n\t\t\targuments: [\n\t\t\t\ttx.object(this.#config.MARGIN_REGISTRY_ID),\n\t\t\t\ttx.object(marginManager.address),\n\t\t\t\ttx.object(pool.address),\n\t\t\t],\n\t\t\ttypeArguments: [baseCoin.type, quoteCoin.type],\n\t\t});\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;AAAA;AAUA,SAAS,WAAW,2BAA2B;AAC/C,SAAS,eAAe,oBAAoB;AAKrC,MAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA,EAM9B,YAAY,QAAwB;AALpC;AAcA;AAAA;AAAA;AAAA;AAA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C,GAAG,OAAO,cAAc,OAAO;AAAA,UAC/B,GAAG,OAAO,KAAK,OAAO;AAAA,QACvB;AAAA,QACA,eAAe,CAAC,SAAS,MAAM,UAAU,IAAI;AAAA,MAC9C,CAAC;AAAA,IACF;AA7ZC,uBAAK,SAAU;AAAA,EAChB;AA6ZD;AApaC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ export { Account } from '../contracts/deepbook/account.js';
2
+ export { Balances } from '../contracts/deepbook/balances.js';
3
+ export { OrderDeepPrice } from '../contracts/deepbook/deep_price.js';
4
+ export { Order } from '../contracts/deepbook/order.js';
5
+ export { VecSet } from '../contracts/deepbook/deps/sui/vec_set.js';
@@ -0,0 +1,13 @@
1
+ import { Account } from "../contracts/deepbook/account.js";
2
+ import { Balances } from "../contracts/deepbook/balances.js";
3
+ import { OrderDeepPrice } from "../contracts/deepbook/deep_price.js";
4
+ import { Order } from "../contracts/deepbook/order.js";
5
+ import { VecSet } from "../contracts/deepbook/deps/sui/vec_set.js";
6
+ export {
7
+ Account,
8
+ Balances,
9
+ Order,
10
+ OrderDeepPrice,
11
+ VecSet
12
+ };
13
+ //# sourceMappingURL=bcs.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/bcs.ts"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport { Account } from '../contracts/deepbook/account.js';\nexport { Balances } from '../contracts/deepbook/balances.js';\nexport { OrderDeepPrice } from '../contracts/deepbook/deep_price.js';\nexport { Order } from '../contracts/deepbook/order.js';\nexport { VecSet } from '../contracts/deepbook/deps/sui/vec_set.js';\n"],
5
+ "mappings": "AAGA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,cAAc;",
6
+ "names": []
7
+ }