@haneullabs/deepbook-v3 0.1.0 → 1.0.11

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 (568) hide show
  1. package/CHANGELOG.md +268 -81
  2. package/dist/client.d.mts +957 -0
  3. package/dist/client.d.mts.map +1 -0
  4. package/dist/client.mjs +2293 -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/haneul/vec_set.d.mts +22 -0
  19. package/dist/contracts/deepbook/deps/haneul/vec_set.d.mts.map +1 -0
  20. package/dist/contracts/deepbook/deps/haneul/vec_set.mjs +26 -0
  21. package/dist/contracts/deepbook/deps/haneul/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/contracts/wormhole/bytes32.mjs +16 -0
  57. package/dist/contracts/wormhole/bytes32.mjs.map +1 -0
  58. package/dist/contracts/wormhole/consumed_vaas.mjs +16 -0
  59. package/dist/contracts/wormhole/consumed_vaas.mjs.map +1 -0
  60. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs +16 -0
  61. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.mjs.map +1 -0
  62. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs +21 -0
  63. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.mjs.map +1 -0
  64. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs +19 -0
  65. package/dist/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.mjs.map +1 -0
  66. package/dist/contracts/wormhole/external_address.mjs +16 -0
  67. package/dist/contracts/wormhole/external_address.mjs.map +1 -0
  68. package/dist/contracts/wormhole/fee_collector.mjs +20 -0
  69. package/dist/contracts/wormhole/fee_collector.mjs.map +1 -0
  70. package/dist/contracts/wormhole/set.mjs +16 -0
  71. package/dist/contracts/wormhole/set.mjs.map +1 -0
  72. package/dist/contracts/wormhole/state.mjs +31 -0
  73. package/dist/contracts/wormhole/state.mjs.map +1 -0
  74. package/dist/index.d.mts +25 -0
  75. package/dist/index.mjs +26 -0
  76. package/dist/pyth/PriceServiceConnection.d.mts +26 -0
  77. package/dist/pyth/PriceServiceConnection.d.mts.map +1 -0
  78. package/dist/pyth/PriceServiceConnection.mjs +35 -0
  79. package/dist/pyth/PriceServiceConnection.mjs.map +1 -0
  80. package/dist/pyth/pyth-helpers.mjs +18 -0
  81. package/dist/pyth/pyth-helpers.mjs.map +1 -0
  82. package/dist/pyth/pyth.d.mts +69 -0
  83. package/dist/pyth/pyth.d.mts.map +1 -0
  84. package/dist/pyth/pyth.mjs +220 -0
  85. package/dist/pyth/pyth.mjs.map +1 -0
  86. package/dist/transactions/balanceManager.d.mts +174 -0
  87. package/dist/transactions/balanceManager.d.mts.map +1 -0
  88. package/dist/transactions/balanceManager.mjs +233 -0
  89. package/dist/transactions/balanceManager.mjs.map +1 -0
  90. package/dist/transactions/deepbook.d.mts +490 -0
  91. package/dist/transactions/deepbook.d.mts.map +1 -0
  92. package/dist/transactions/deepbook.mjs +978 -0
  93. package/dist/transactions/deepbook.mjs.map +1 -0
  94. package/dist/transactions/deepbookAdmin.d.mts +111 -0
  95. package/dist/transactions/deepbookAdmin.d.mts.map +1 -0
  96. package/dist/transactions/deepbookAdmin.mjs +221 -0
  97. package/dist/transactions/deepbookAdmin.mjs.map +1 -0
  98. package/dist/transactions/flashLoans.d.mts +62 -0
  99. package/dist/transactions/flashLoans.d.mts.map +1 -0
  100. package/dist/transactions/flashLoans.mjs +75 -0
  101. package/dist/transactions/flashLoans.mjs.map +1 -0
  102. package/dist/transactions/governance.d.mts +48 -0
  103. package/dist/transactions/governance.d.mts.map +1 -0
  104. package/dist/transactions/governance.mjs +90 -0
  105. package/dist/transactions/governance.mjs.map +1 -0
  106. package/dist/transactions/marginAdmin.d.mts +139 -0
  107. package/dist/transactions/marginAdmin.d.mts.map +1 -0
  108. package/dist/transactions/marginAdmin.mjs +249 -0
  109. package/dist/transactions/marginAdmin.mjs.map +1 -0
  110. package/dist/transactions/marginLiquidations.d.mts +67 -0
  111. package/dist/transactions/marginLiquidations.d.mts.map +1 -0
  112. package/dist/transactions/marginLiquidations.mjs +109 -0
  113. package/dist/transactions/marginLiquidations.mjs.map +1 -0
  114. package/dist/transactions/marginMaintainer.d.mts +86 -0
  115. package/dist/transactions/marginMaintainer.d.mts.map +1 -0
  116. package/dist/transactions/marginMaintainer.mjs +160 -0
  117. package/dist/transactions/marginMaintainer.mjs.map +1 -0
  118. package/dist/transactions/marginManager.d.mts +255 -0
  119. package/dist/transactions/marginManager.d.mts.map +1 -0
  120. package/dist/transactions/marginManager.mjs +558 -0
  121. package/dist/transactions/marginManager.mjs.map +1 -0
  122. package/dist/transactions/marginPool.d.mts +140 -0
  123. package/dist/transactions/marginPool.d.mts.map +1 -0
  124. package/dist/transactions/marginPool.mjs +206 -0
  125. package/dist/transactions/marginPool.mjs.map +1 -0
  126. package/dist/transactions/marginRegistry.d.mts +100 -0
  127. package/dist/transactions/marginRegistry.d.mts.map +1 -0
  128. package/dist/transactions/marginRegistry.mjs +128 -0
  129. package/dist/transactions/marginRegistry.mjs.map +1 -0
  130. package/dist/transactions/marginTPSL.d.mts +100 -0
  131. package/dist/transactions/marginTPSL.d.mts.map +1 -0
  132. package/dist/transactions/marginTPSL.mjs +175 -0
  133. package/dist/transactions/marginTPSL.mjs.map +1 -0
  134. package/dist/transactions/poolProxy.d.mts +123 -0
  135. package/dist/transactions/poolProxy.d.mts.map +1 -0
  136. package/dist/transactions/poolProxy.mjs +336 -0
  137. package/dist/transactions/poolProxy.mjs.map +1 -0
  138. package/dist/types/bcs.d.mts +5 -0
  139. package/dist/types/bcs.mjs +7 -0
  140. package/dist/types/index.d.mts +237 -0
  141. package/dist/types/index.d.mts.map +1 -0
  142. package/dist/types/index.mjs +18 -0
  143. package/dist/types/index.mjs.map +1 -0
  144. package/dist/utils/config.d.mts +82 -0
  145. package/dist/utils/config.d.mts.map +1 -0
  146. package/dist/utils/config.mjs +88 -0
  147. package/dist/utils/config.mjs.map +1 -0
  148. package/dist/utils/constants.d.mts +85 -0
  149. package/dist/utils/constants.d.mts.map +1 -0
  150. package/dist/utils/constants.mjs +384 -0
  151. package/dist/utils/constants.mjs.map +1 -0
  152. package/dist/utils/errors.d.mts +46 -0
  153. package/dist/utils/errors.d.mts.map +1 -0
  154. package/dist/utils/errors.mjs +59 -0
  155. package/dist/utils/errors.mjs.map +1 -0
  156. package/dist/{cjs/utils/validation.d.ts → utils/validation.d.mts} +11 -7
  157. package/dist/utils/validation.d.mts.map +1 -0
  158. package/dist/utils/validation.mjs +76 -0
  159. package/dist/utils/validation.mjs.map +1 -0
  160. package/package.json +29 -26
  161. package/src/client.ts +1016 -545
  162. package/src/contracts/deepbook/account.ts +15 -15
  163. package/src/contracts/deepbook/balance_manager.ts +343 -57
  164. package/src/contracts/deepbook/balances.ts +3 -2
  165. package/src/contracts/deepbook/big_vector.ts +6 -7
  166. package/src/contracts/deepbook/book.ts +3 -2
  167. package/src/contracts/deepbook/constants.ts +95 -3
  168. package/src/contracts/deepbook/deep_price.ts +7 -7
  169. package/src/contracts/deepbook/deps/{sui → haneul}/bag.ts +8 -8
  170. package/src/contracts/deepbook/deps/{sui → haneul}/balance.ts +4 -3
  171. package/src/contracts/deepbook/deps/{sui → haneul}/table.ts +6 -6
  172. package/src/contracts/deepbook/deps/{sui → haneul}/vec_map.ts +4 -4
  173. package/src/contracts/deepbook/deps/{sui → haneul}/vec_set.ts +4 -4
  174. package/src/contracts/deepbook/deps/{sui → haneul}/versioned.ts +4 -4
  175. package/src/contracts/deepbook/deps/std/type_name.ts +3 -2
  176. package/src/contracts/deepbook/ewma.ts +14 -3
  177. package/src/contracts/deepbook/fill.ts +21 -21
  178. package/src/contracts/deepbook/governance.ts +4 -3
  179. package/src/contracts/deepbook/history.ts +4 -3
  180. package/src/contracts/deepbook/math.ts +15 -15
  181. package/src/contracts/deepbook/order.ts +16 -16
  182. package/src/contracts/deepbook/order_info.ts +39 -27
  183. package/src/contracts/deepbook/order_query.ts +12 -12
  184. package/src/contracts/deepbook/pool.ts +883 -526
  185. package/src/contracts/deepbook/registry.ts +149 -38
  186. package/src/contracts/deepbook/state.ts +14 -3
  187. package/src/contracts/deepbook/trade_params.ts +3 -2
  188. package/src/contracts/deepbook/vault.ts +5 -4
  189. package/src/contracts/pyth/batch_price_attestation.ts +92 -0
  190. package/src/contracts/pyth/contract_upgrade.ts +54 -0
  191. package/src/contracts/pyth/data_source.ts +64 -0
  192. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
  193. package/src/contracts/pyth/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
  194. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/bytes32.ts +12 -0
  195. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/consumed_vaas.ts +13 -0
  196. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/external_address.ts +13 -0
  197. package/src/contracts/pyth/deps/0xf47329f4344f3bf0f8e436e2f7b485466cff300f12a166563995d3888c296a94/set.ts +12 -0
  198. package/src/contracts/pyth/deserialize.ts +117 -0
  199. package/src/contracts/pyth/event.ts +20 -0
  200. package/src/contracts/pyth/governance.ts +113 -0
  201. package/src/contracts/pyth/governance_action.ts +130 -0
  202. package/src/contracts/pyth/governance_instruction.ts +98 -0
  203. package/src/contracts/pyth/hot_potato_vector.ts +70 -0
  204. package/src/contracts/pyth/i64.ts +94 -0
  205. package/src/contracts/pyth/merkle_tree.ts +41 -0
  206. package/src/contracts/pyth/migrate.ts +29 -0
  207. package/src/contracts/pyth/price.ts +102 -0
  208. package/src/contracts/pyth/price_feed.ts +101 -0
  209. package/src/contracts/pyth/price_identifier.ts +46 -0
  210. package/src/contracts/pyth/price_info.ts +220 -0
  211. package/src/contracts/pyth/price_status.ts +74 -0
  212. package/src/contracts/pyth/pyth.ts +236 -0
  213. package/src/contracts/pyth/set.ts +93 -0
  214. package/src/contracts/pyth/set_data_sources.ts +14 -0
  215. package/src/contracts/pyth/set_fee_recipient.ts +13 -0
  216. package/src/contracts/pyth/set_governance_data_source.ts +16 -0
  217. package/src/contracts/pyth/set_stale_price_threshold.ts +13 -0
  218. package/src/contracts/pyth/set_update_fee.ts +14 -0
  219. package/src/contracts/pyth/setup.ts +12 -0
  220. package/src/contracts/pyth/state.ts +227 -0
  221. package/src/contracts/pyth/version_control.ts +25 -0
  222. package/src/contracts/utils/index.ts +100 -50
  223. package/src/contracts/wormhole/bytes32.ts +12 -0
  224. package/src/contracts/wormhole/consumed_vaas.ts +13 -0
  225. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/balance.ts +12 -0
  226. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/package.ts +15 -0
  227. package/src/contracts/wormhole/deps/0x0000000000000000000000000000000000000000000000000000000000000002/table.ts +13 -0
  228. package/src/contracts/wormhole/external_address.ts +13 -0
  229. package/src/contracts/wormhole/fee_collector.ts +15 -0
  230. package/src/contracts/wormhole/set.ts +12 -0
  231. package/src/contracts/wormhole/state.ts +25 -0
  232. package/src/index.ts +17 -3
  233. package/src/pyth/pyth.ts +51 -50
  234. package/src/transactions/deepbook.ts +31 -12
  235. package/src/transactions/deepbookAdmin.ts +3 -3
  236. package/src/transactions/marginAdmin.ts +11 -8
  237. package/src/transactions/marginMaintainer.ts +23 -12
  238. package/src/transactions/marginManager.ts +104 -28
  239. package/src/transactions/marginPool.ts +5 -6
  240. package/src/transactions/marginTPSL.ts +5 -5
  241. package/src/transactions/poolProxy.ts +50 -0
  242. package/src/types/bcs.ts +1 -1
  243. package/src/types/index.ts +19 -2
  244. package/src/utils/config.ts +12 -14
  245. package/src/utils/constants.ts +44 -12
  246. package/src/utils/validation.ts +1 -1
  247. package/dist/cjs/client.d.ts +0 -861
  248. package/dist/cjs/client.js +0 -1982
  249. package/dist/cjs/client.js.map +0 -7
  250. package/dist/cjs/contracts/deepbook/account.d.ts +0 -105
  251. package/dist/cjs/contracts/deepbook/account.js +0 -163
  252. package/dist/cjs/contracts/deepbook/account.js.map +0 -7
  253. package/dist/cjs/contracts/deepbook/balance_manager.d.ts +0 -268
  254. package/dist/cjs/contracts/deepbook/balance_manager.js +0 -361
  255. package/dist/cjs/contracts/deepbook/balance_manager.js.map +0 -7
  256. package/dist/cjs/contracts/deepbook/balances.d.ts +0 -10
  257. package/dist/cjs/contracts/deepbook/balances.js +0 -35
  258. package/dist/cjs/contracts/deepbook/balances.js.map +0 -7
  259. package/dist/cjs/contracts/deepbook/big_vector.d.ts +0 -62
  260. package/dist/cjs/contracts/deepbook/big_vector.js +0 -80
  261. package/dist/cjs/contracts/deepbook/big_vector.js.map +0 -7
  262. package/dist/cjs/contracts/deepbook/book.d.ts +0 -34
  263. package/dist/cjs/contracts/deepbook/book.js +0 -50
  264. package/dist/cjs/contracts/deepbook/book.js.map +0 -7
  265. package/dist/cjs/contracts/deepbook/constants.d.ts +0 -176
  266. package/dist/cjs/contracts/deepbook/constants.js +0 -338
  267. package/dist/cjs/contracts/deepbook/constants.js.map +0 -7
  268. package/dist/cjs/contracts/deepbook/deep_price.d.ts +0 -60
  269. package/dist/cjs/contracts/deepbook/deep_price.js +0 -87
  270. package/dist/cjs/contracts/deepbook/deep_price.js.map +0 -7
  271. package/dist/cjs/contracts/deepbook/deps/std/type_name.d.ts +0 -14
  272. package/dist/cjs/contracts/deepbook/deps/std/type_name.js +0 -42
  273. package/dist/cjs/contracts/deepbook/deps/std/type_name.js.map +0 -7
  274. package/dist/cjs/contracts/deepbook/deps/sui/bag.d.ts +0 -33
  275. package/dist/cjs/contracts/deepbook/deps/sui/bag.js +0 -47
  276. package/dist/cjs/contracts/deepbook/deps/sui/bag.js.map +0 -7
  277. package/dist/cjs/contracts/deepbook/deps/sui/balance.d.ts +0 -9
  278. package/dist/cjs/contracts/deepbook/deps/sui/balance.js +0 -33
  279. package/dist/cjs/contracts/deepbook/deps/sui/balance.js.map +0 -7
  280. package/dist/cjs/contracts/deepbook/deps/sui/object.d.ts +0 -5
  281. package/dist/cjs/contracts/deepbook/deps/sui/object.js +0 -33
  282. package/dist/cjs/contracts/deepbook/deps/sui/object.js.map +0 -7
  283. package/dist/cjs/contracts/deepbook/deps/sui/table.d.ts +0 -28
  284. package/dist/cjs/contracts/deepbook/deps/sui/table.js +0 -47
  285. package/dist/cjs/contracts/deepbook/deps/sui/table.js.map +0 -7
  286. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
  287. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js +0 -45
  288. package/dist/cjs/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
  289. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
  290. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js +0 -35
  291. package/dist/cjs/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
  292. package/dist/cjs/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
  293. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js +0 -45
  294. package/dist/cjs/contracts/deepbook/deps/sui/versioned.js.map +0 -7
  295. package/dist/cjs/contracts/deepbook/ewma.d.ts +0 -17
  296. package/dist/cjs/contracts/deepbook/ewma.js +0 -39
  297. package/dist/cjs/contracts/deepbook/ewma.js.map +0 -7
  298. package/dist/cjs/contracts/deepbook/fill.d.ts +0 -153
  299. package/dist/cjs/contracts/deepbook/fill.js +0 -251
  300. package/dist/cjs/contracts/deepbook/fill.js.map +0 -7
  301. package/dist/cjs/contracts/deepbook/governance.d.ts +0 -63
  302. package/dist/cjs/contracts/deepbook/governance.js +0 -79
  303. package/dist/cjs/contracts/deepbook/governance.js.map +0 -7
  304. package/dist/cjs/contracts/deepbook/history.d.ts +0 -60
  305. package/dist/cjs/contracts/deepbook/history.js +0 -78
  306. package/dist/cjs/contracts/deepbook/history.js.map +0 -7
  307. package/dist/cjs/contracts/deepbook/math.d.ts +0 -94
  308. package/dist/cjs/contracts/deepbook/math.js +0 -132
  309. package/dist/cjs/contracts/deepbook/math.js.map +0 -7
  310. package/dist/cjs/contracts/deepbook/order.d.ts +0 -135
  311. package/dist/cjs/contracts/deepbook/order.js +0 -218
  312. package/dist/cjs/contracts/deepbook/order.js.map +0 -7
  313. package/dist/cjs/contracts/deepbook/order_info.d.ts +0 -296
  314. package/dist/cjs/contracts/deepbook/order_info.js +0 -386
  315. package/dist/cjs/contracts/deepbook/order_info.js.map +0 -7
  316. package/dist/cjs/contracts/deepbook/order_query.d.ts +0 -85
  317. package/dist/cjs/contracts/deepbook/order_query.js +0 -96
  318. package/dist/cjs/contracts/deepbook/order_query.js.map +0 -7
  319. package/dist/cjs/contracts/deepbook/pool.d.ts +0 -1218
  320. package/dist/cjs/contracts/deepbook/pool.js +0 -1236
  321. package/dist/cjs/contracts/deepbook/pool.js.map +0 -7
  322. package/dist/cjs/contracts/deepbook/registry.d.ts +0 -134
  323. package/dist/cjs/contracts/deepbook/registry.js +0 -182
  324. package/dist/cjs/contracts/deepbook/registry.js.map +0 -7
  325. package/dist/cjs/contracts/deepbook/state.d.ts +0 -117
  326. package/dist/cjs/contracts/deepbook/state.js +0 -104
  327. package/dist/cjs/contracts/deepbook/state.js.map +0 -7
  328. package/dist/cjs/contracts/deepbook/trade_params.d.ts +0 -7
  329. package/dist/cjs/contracts/deepbook/trade_params.js +0 -35
  330. package/dist/cjs/contracts/deepbook/trade_params.js.map +0 -7
  331. package/dist/cjs/contracts/deepbook/vault.d.ts +0 -30
  332. package/dist/cjs/contracts/deepbook/vault.js +0 -65
  333. package/dist/cjs/contracts/deepbook/vault.js.map +0 -7
  334. package/dist/cjs/contracts/utils/index.d.ts +0 -25
  335. package/dist/cjs/contracts/utils/index.js +0 -148
  336. package/dist/cjs/contracts/utils/index.js.map +0 -7
  337. package/dist/cjs/index.d.ts +0 -23
  338. package/dist/cjs/index.js +0 -81
  339. package/dist/cjs/index.js.map +0 -7
  340. package/dist/cjs/package.json +0 -4
  341. package/dist/cjs/pyth/PriceServiceConnection.d.ts +0 -26
  342. package/dist/cjs/pyth/PriceServiceConnection.js +0 -68
  343. package/dist/cjs/pyth/PriceServiceConnection.js.map +0 -7
  344. package/dist/cjs/pyth/pyth-helpers.d.ts +0 -7
  345. package/dist/cjs/pyth/pyth-helpers.js +0 -36
  346. package/dist/cjs/pyth/pyth-helpers.js.map +0 -7
  347. package/dist/cjs/pyth/pyth.d.ts +0 -65
  348. package/dist/cjs/pyth/pyth.js +0 -269
  349. package/dist/cjs/pyth/pyth.js.map +0 -7
  350. package/dist/cjs/transactions/balanceManager.d.ts +0 -168
  351. package/dist/cjs/transactions/balanceManager.js +0 -384
  352. package/dist/cjs/transactions/balanceManager.js.map +0 -7
  353. package/dist/cjs/transactions/deepbook.d.ts +0 -477
  354. package/dist/cjs/transactions/deepbook.js +0 -1335
  355. package/dist/cjs/transactions/deepbook.js.map +0 -7
  356. package/dist/cjs/transactions/deepbookAdmin.d.ts +0 -105
  357. package/dist/cjs/transactions/deepbookAdmin.js +0 -334
  358. package/dist/cjs/transactions/deepbookAdmin.js.map +0 -7
  359. package/dist/cjs/transactions/flashLoans.d.ts +0 -56
  360. package/dist/cjs/transactions/flashLoans.js +0 -124
  361. package/dist/cjs/transactions/flashLoans.js.map +0 -7
  362. package/dist/cjs/transactions/governance.d.ts +0 -42
  363. package/dist/cjs/transactions/governance.js +0 -135
  364. package/dist/cjs/transactions/governance.js.map +0 -7
  365. package/dist/cjs/transactions/marginAdmin.d.ts +0 -133
  366. package/dist/cjs/transactions/marginAdmin.js +0 -393
  367. package/dist/cjs/transactions/marginAdmin.js.map +0 -7
  368. package/dist/cjs/transactions/marginLiquidations.d.ts +0 -61
  369. package/dist/cjs/transactions/marginLiquidations.js +0 -173
  370. package/dist/cjs/transactions/marginLiquidations.js.map +0 -7
  371. package/dist/cjs/transactions/marginMaintainer.d.ts +0 -80
  372. package/dist/cjs/transactions/marginMaintainer.js +0 -251
  373. package/dist/cjs/transactions/marginMaintainer.js.map +0 -7
  374. package/dist/cjs/transactions/marginManager.d.ts +0 -236
  375. package/dist/cjs/transactions/marginManager.js +0 -688
  376. package/dist/cjs/transactions/marginManager.js.map +0 -7
  377. package/dist/cjs/transactions/marginPool.d.ts +0 -134
  378. package/dist/cjs/transactions/marginPool.js +0 -330
  379. package/dist/cjs/transactions/marginPool.js.map +0 -7
  380. package/dist/cjs/transactions/marginRegistry.d.ts +0 -94
  381. package/dist/cjs/transactions/marginRegistry.js +0 -221
  382. package/dist/cjs/transactions/marginRegistry.js.map +0 -7
  383. package/dist/cjs/transactions/marginTPSL.d.ts +0 -93
  384. package/dist/cjs/transactions/marginTPSL.js +0 -286
  385. package/dist/cjs/transactions/marginTPSL.js.map +0 -7
  386. package/dist/cjs/transactions/poolProxy.d.ts +0 -104
  387. package/dist/cjs/transactions/poolProxy.js +0 -435
  388. package/dist/cjs/transactions/poolProxy.js.map +0 -7
  389. package/dist/cjs/types/bcs.d.ts +0 -5
  390. package/dist/cjs/types/bcs.js +0 -33
  391. package/dist/cjs/types/bcs.js.map +0 -7
  392. package/dist/cjs/types/index.d.ts +0 -218
  393. package/dist/cjs/types/index.js +0 -38
  394. package/dist/cjs/types/index.js.map +0 -7
  395. package/dist/cjs/utils/config.d.ts +0 -65
  396. package/dist/cjs/utils/config.js +0 -144
  397. package/dist/cjs/utils/config.js.map +0 -7
  398. package/dist/cjs/utils/constants.d.ts +0 -76
  399. package/dist/cjs/utils/constants.js +0 -382
  400. package/dist/cjs/utils/constants.js.map +0 -7
  401. package/dist/cjs/utils/errors.d.ts +0 -42
  402. package/dist/cjs/utils/errors.js +0 -70
  403. package/dist/cjs/utils/errors.js.map +0 -7
  404. package/dist/cjs/utils/validation.js +0 -67
  405. package/dist/cjs/utils/validation.js.map +0 -7
  406. package/dist/esm/client.d.ts +0 -861
  407. package/dist/esm/client.js +0 -1967
  408. package/dist/esm/client.js.map +0 -7
  409. package/dist/esm/contracts/deepbook/account.d.ts +0 -105
  410. package/dist/esm/contracts/deepbook/account.js +0 -133
  411. package/dist/esm/contracts/deepbook/account.js.map +0 -7
  412. package/dist/esm/contracts/deepbook/balance_manager.d.ts +0 -268
  413. package/dist/esm/contracts/deepbook/balance_manager.js +0 -331
  414. package/dist/esm/contracts/deepbook/balance_manager.js.map +0 -7
  415. package/dist/esm/contracts/deepbook/balances.d.ts +0 -10
  416. package/dist/esm/contracts/deepbook/balances.js +0 -15
  417. package/dist/esm/contracts/deepbook/balances.js.map +0 -7
  418. package/dist/esm/contracts/deepbook/big_vector.d.ts +0 -62
  419. package/dist/esm/contracts/deepbook/big_vector.js +0 -50
  420. package/dist/esm/contracts/deepbook/big_vector.js.map +0 -7
  421. package/dist/esm/contracts/deepbook/book.d.ts +0 -34
  422. package/dist/esm/contracts/deepbook/book.js +0 -20
  423. package/dist/esm/contracts/deepbook/book.js.map +0 -7
  424. package/dist/esm/contracts/deepbook/constants.d.ts +0 -176
  425. package/dist/esm/contracts/deepbook/constants.js +0 -318
  426. package/dist/esm/contracts/deepbook/constants.js.map +0 -7
  427. package/dist/esm/contracts/deepbook/deep_price.d.ts +0 -60
  428. package/dist/esm/contracts/deepbook/deep_price.js +0 -67
  429. package/dist/esm/contracts/deepbook/deep_price.js.map +0 -7
  430. package/dist/esm/contracts/deepbook/deps/std/type_name.d.ts +0 -14
  431. package/dist/esm/contracts/deepbook/deps/std/type_name.js +0 -22
  432. package/dist/esm/contracts/deepbook/deps/std/type_name.js.map +0 -7
  433. package/dist/esm/contracts/deepbook/deps/sui/bag.d.ts +0 -33
  434. package/dist/esm/contracts/deepbook/deps/sui/bag.js +0 -17
  435. package/dist/esm/contracts/deepbook/deps/sui/bag.js.map +0 -7
  436. package/dist/esm/contracts/deepbook/deps/sui/balance.d.ts +0 -9
  437. package/dist/esm/contracts/deepbook/deps/sui/balance.js +0 -13
  438. package/dist/esm/contracts/deepbook/deps/sui/balance.js.map +0 -7
  439. package/dist/esm/contracts/deepbook/deps/sui/object.d.ts +0 -5
  440. package/dist/esm/contracts/deepbook/deps/sui/object.js +0 -13
  441. package/dist/esm/contracts/deepbook/deps/sui/object.js.map +0 -7
  442. package/dist/esm/contracts/deepbook/deps/sui/table.d.ts +0 -28
  443. package/dist/esm/contracts/deepbook/deps/sui/table.js +0 -17
  444. package/dist/esm/contracts/deepbook/deps/sui/table.js.map +0 -7
  445. package/dist/esm/contracts/deepbook/deps/sui/vec_map.d.ts +0 -27
  446. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js +0 -25
  447. package/dist/esm/contracts/deepbook/deps/sui/vec_map.js.map +0 -7
  448. package/dist/esm/contracts/deepbook/deps/sui/vec_set.d.ts +0 -15
  449. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js +0 -15
  450. package/dist/esm/contracts/deepbook/deps/sui/vec_set.js.map +0 -7
  451. package/dist/esm/contracts/deepbook/deps/sui/versioned.d.ts +0 -7
  452. package/dist/esm/contracts/deepbook/deps/sui/versioned.js +0 -15
  453. package/dist/esm/contracts/deepbook/deps/sui/versioned.js.map +0 -7
  454. package/dist/esm/contracts/deepbook/ewma.d.ts +0 -17
  455. package/dist/esm/contracts/deepbook/ewma.js +0 -19
  456. package/dist/esm/contracts/deepbook/ewma.js.map +0 -7
  457. package/dist/esm/contracts/deepbook/fill.d.ts +0 -153
  458. package/dist/esm/contracts/deepbook/fill.js +0 -221
  459. package/dist/esm/contracts/deepbook/fill.js.map +0 -7
  460. package/dist/esm/contracts/deepbook/governance.d.ts +0 -63
  461. package/dist/esm/contracts/deepbook/governance.js +0 -49
  462. package/dist/esm/contracts/deepbook/governance.js.map +0 -7
  463. package/dist/esm/contracts/deepbook/history.d.ts +0 -60
  464. package/dist/esm/contracts/deepbook/history.js +0 -48
  465. package/dist/esm/contracts/deepbook/history.js.map +0 -7
  466. package/dist/esm/contracts/deepbook/math.d.ts +0 -94
  467. package/dist/esm/contracts/deepbook/math.js +0 -112
  468. package/dist/esm/contracts/deepbook/math.js.map +0 -7
  469. package/dist/esm/contracts/deepbook/order.d.ts +0 -135
  470. package/dist/esm/contracts/deepbook/order.js +0 -188
  471. package/dist/esm/contracts/deepbook/order.js.map +0 -7
  472. package/dist/esm/contracts/deepbook/order_info.d.ts +0 -296
  473. package/dist/esm/contracts/deepbook/order_info.js +0 -356
  474. package/dist/esm/contracts/deepbook/order_info.js.map +0 -7
  475. package/dist/esm/contracts/deepbook/order_query.d.ts +0 -85
  476. package/dist/esm/contracts/deepbook/order_query.js +0 -66
  477. package/dist/esm/contracts/deepbook/order_query.js.map +0 -7
  478. package/dist/esm/contracts/deepbook/pool.d.ts +0 -1218
  479. package/dist/esm/contracts/deepbook/pool.js +0 -1206
  480. package/dist/esm/contracts/deepbook/pool.js.map +0 -7
  481. package/dist/esm/contracts/deepbook/registry.d.ts +0 -134
  482. package/dist/esm/contracts/deepbook/registry.js +0 -152
  483. package/dist/esm/contracts/deepbook/registry.js.map +0 -7
  484. package/dist/esm/contracts/deepbook/state.d.ts +0 -117
  485. package/dist/esm/contracts/deepbook/state.js +0 -74
  486. package/dist/esm/contracts/deepbook/state.js.map +0 -7
  487. package/dist/esm/contracts/deepbook/trade_params.d.ts +0 -7
  488. package/dist/esm/contracts/deepbook/trade_params.js +0 -15
  489. package/dist/esm/contracts/deepbook/trade_params.js.map +0 -7
  490. package/dist/esm/contracts/deepbook/vault.d.ts +0 -30
  491. package/dist/esm/contracts/deepbook/vault.js +0 -35
  492. package/dist/esm/contracts/deepbook/vault.js.map +0 -7
  493. package/dist/esm/contracts/utils/index.d.ts +0 -25
  494. package/dist/esm/contracts/utils/index.js +0 -128
  495. package/dist/esm/contracts/utils/index.js.map +0 -7
  496. package/dist/esm/index.d.ts +0 -23
  497. package/dist/esm/index.js +0 -81
  498. package/dist/esm/index.js.map +0 -7
  499. package/dist/esm/package.json +0 -4
  500. package/dist/esm/pyth/PriceServiceConnection.d.ts +0 -26
  501. package/dist/esm/pyth/PriceServiceConnection.js +0 -38
  502. package/dist/esm/pyth/PriceServiceConnection.js.map +0 -7
  503. package/dist/esm/pyth/pyth-helpers.d.ts +0 -7
  504. package/dist/esm/pyth/pyth-helpers.js +0 -16
  505. package/dist/esm/pyth/pyth-helpers.js.map +0 -7
  506. package/dist/esm/pyth/pyth.d.ts +0 -65
  507. package/dist/esm/pyth/pyth.js +0 -249
  508. package/dist/esm/pyth/pyth.js.map +0 -7
  509. package/dist/esm/transactions/balanceManager.d.ts +0 -168
  510. package/dist/esm/transactions/balanceManager.js +0 -364
  511. package/dist/esm/transactions/balanceManager.js.map +0 -7
  512. package/dist/esm/transactions/deepbook.d.ts +0 -477
  513. package/dist/esm/transactions/deepbook.js +0 -1321
  514. package/dist/esm/transactions/deepbook.js.map +0 -7
  515. package/dist/esm/transactions/deepbookAdmin.d.ts +0 -105
  516. package/dist/esm/transactions/deepbookAdmin.js +0 -314
  517. package/dist/esm/transactions/deepbookAdmin.js.map +0 -7
  518. package/dist/esm/transactions/flashLoans.d.ts +0 -56
  519. package/dist/esm/transactions/flashLoans.js +0 -104
  520. package/dist/esm/transactions/flashLoans.js.map +0 -7
  521. package/dist/esm/transactions/governance.d.ts +0 -42
  522. package/dist/esm/transactions/governance.js +0 -115
  523. package/dist/esm/transactions/governance.js.map +0 -7
  524. package/dist/esm/transactions/marginAdmin.d.ts +0 -133
  525. package/dist/esm/transactions/marginAdmin.js +0 -373
  526. package/dist/esm/transactions/marginAdmin.js.map +0 -7
  527. package/dist/esm/transactions/marginLiquidations.d.ts +0 -61
  528. package/dist/esm/transactions/marginLiquidations.js +0 -153
  529. package/dist/esm/transactions/marginLiquidations.js.map +0 -7
  530. package/dist/esm/transactions/marginMaintainer.d.ts +0 -80
  531. package/dist/esm/transactions/marginMaintainer.js +0 -231
  532. package/dist/esm/transactions/marginMaintainer.js.map +0 -7
  533. package/dist/esm/transactions/marginManager.d.ts +0 -236
  534. package/dist/esm/transactions/marginManager.js +0 -668
  535. package/dist/esm/transactions/marginManager.js.map +0 -7
  536. package/dist/esm/transactions/marginPool.d.ts +0 -134
  537. package/dist/esm/transactions/marginPool.js +0 -310
  538. package/dist/esm/transactions/marginPool.js.map +0 -7
  539. package/dist/esm/transactions/marginRegistry.d.ts +0 -94
  540. package/dist/esm/transactions/marginRegistry.js +0 -201
  541. package/dist/esm/transactions/marginRegistry.js.map +0 -7
  542. package/dist/esm/transactions/marginTPSL.d.ts +0 -93
  543. package/dist/esm/transactions/marginTPSL.js +0 -266
  544. package/dist/esm/transactions/marginTPSL.js.map +0 -7
  545. package/dist/esm/transactions/poolProxy.d.ts +0 -104
  546. package/dist/esm/transactions/poolProxy.js +0 -415
  547. package/dist/esm/transactions/poolProxy.js.map +0 -7
  548. package/dist/esm/types/bcs.d.ts +0 -5
  549. package/dist/esm/types/bcs.js +0 -13
  550. package/dist/esm/types/bcs.js.map +0 -7
  551. package/dist/esm/types/index.d.ts +0 -218
  552. package/dist/esm/types/index.js +0 -18
  553. package/dist/esm/types/index.js.map +0 -7
  554. package/dist/esm/utils/config.d.ts +0 -65
  555. package/dist/esm/utils/config.js +0 -135
  556. package/dist/esm/utils/config.js.map +0 -7
  557. package/dist/esm/utils/constants.d.ts +0 -76
  558. package/dist/esm/utils/constants.js +0 -362
  559. package/dist/esm/utils/constants.js.map +0 -7
  560. package/dist/esm/utils/errors.d.ts +0 -42
  561. package/dist/esm/utils/errors.js +0 -50
  562. package/dist/esm/utils/errors.js.map +0 -7
  563. package/dist/esm/utils/validation.d.ts +0 -50
  564. package/dist/esm/utils/validation.js +0 -47
  565. package/dist/esm/utils/validation.js.map +0 -7
  566. package/dist/tsconfig.esm.tsbuildinfo +0 -1
  567. package/dist/tsconfig.tsbuildinfo +0 -1
  568. package/src/contracts/deepbook/deps/sui/object.ts +0 -14
@@ -0,0 +1,957 @@
1
+ import { BalanceManager, CanPlaceLimitOrderParams, CanPlaceMarketOrderParams, MarginManager } from "./types/index.mjs";
2
+ import { CoinMap, PoolMap } from "./utils/constants.mjs";
3
+ import { BalanceManagerContract } from "./transactions/balanceManager.mjs";
4
+ import { DeepBookContract } from "./transactions/deepbook.mjs";
5
+ import { DeepBookAdminContract } from "./transactions/deepbookAdmin.mjs";
6
+ import { FlashLoanContract } from "./transactions/flashLoans.mjs";
7
+ import { GovernanceContract } from "./transactions/governance.mjs";
8
+ import { MarginAdminContract } from "./transactions/marginAdmin.mjs";
9
+ import { MarginMaintainerContract } from "./transactions/marginMaintainer.mjs";
10
+ import { MarginPoolContract } from "./transactions/marginPool.mjs";
11
+ import { MarginManagerContract } from "./transactions/marginManager.mjs";
12
+ import { MarginRegistryContract } from "./transactions/marginRegistry.mjs";
13
+ import { MarginLiquidationsContract } from "./transactions/marginLiquidations.mjs";
14
+ import { PoolProxyContract } from "./transactions/poolProxy.mjs";
15
+ import { MarginTPSLContract } from "./transactions/marginTPSL.mjs";
16
+ import { Transaction } from "@haneullabs/haneul/transactions";
17
+ import { ClientWithCoreApi, HaneulClientRegistration, HaneulClientTypes } from "@haneullabs/haneul/client";
18
+
19
+ //#region src/client.d.ts
20
+ interface DeepBookCompatibleClient extends ClientWithCoreApi {}
21
+ interface DeepBookOptions<Name = 'deepbook'> {
22
+ address: string;
23
+ balanceManagers?: {
24
+ [key: string]: BalanceManager;
25
+ };
26
+ marginManagers?: {
27
+ [key: string]: MarginManager;
28
+ };
29
+ coins?: CoinMap;
30
+ pools?: PoolMap;
31
+ adminCap?: string;
32
+ marginAdminCap?: string;
33
+ marginMaintainerCap?: string;
34
+ name?: Name;
35
+ }
36
+ interface DeepBookClientOptions extends DeepBookOptions {
37
+ client: DeepBookCompatibleClient;
38
+ network: HaneulClientTypes.Network;
39
+ }
40
+ declare function deepbook<Name extends string = 'deepbook'>({
41
+ name,
42
+ ...options
43
+ }: DeepBookOptions<Name>): HaneulClientRegistration<DeepBookCompatibleClient, Name, DeepBookClient>;
44
+ /**
45
+ * DeepBookClient class for managing DeepBook operations.
46
+ */
47
+ declare class DeepBookClient {
48
+ #private;
49
+ balanceManager: BalanceManagerContract;
50
+ deepBook: DeepBookContract;
51
+ deepBookAdmin: DeepBookAdminContract;
52
+ flashLoans: FlashLoanContract;
53
+ governance: GovernanceContract;
54
+ marginAdmin: MarginAdminContract;
55
+ marginMaintainer: MarginMaintainerContract;
56
+ marginPool: MarginPoolContract;
57
+ marginManager: MarginManagerContract;
58
+ marginRegistry: MarginRegistryContract;
59
+ marginLiquidations: MarginLiquidationsContract;
60
+ poolProxy: PoolProxyContract;
61
+ marginTPSL: MarginTPSLContract;
62
+ /**
63
+ * Creates a new DeepBookClient instance
64
+ */
65
+ constructor({
66
+ client,
67
+ address,
68
+ network,
69
+ balanceManagers,
70
+ marginManagers,
71
+ coins,
72
+ pools,
73
+ adminCap,
74
+ marginAdminCap,
75
+ marginMaintainerCap
76
+ }: DeepBookClientOptions);
77
+ /**
78
+ * @description Check the balance of a balance manager for a specific coin
79
+ * @param {string} managerKey Key of the balance manager
80
+ * @param {string} coinKey Key of the coin
81
+ * @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance
82
+ */
83
+ checkManagerBalance(managerKey: string, coinKey: string): Promise<{
84
+ coinType: string;
85
+ balance: number;
86
+ }>;
87
+ /**
88
+ * @description Check the balance of a BalanceManager by its address directly
89
+ * @param {string} managerAddress The on-chain address of the BalanceManager
90
+ * @param {string} coinKey Key of the coin
91
+ * @returns {Promise<{ coinType: string, balance: number }>} An object with coin type and balance
92
+ */
93
+ checkManagerBalanceWithAddress(managerAddress: string, coinKey: string): Promise<{
94
+ coinType: string;
95
+ balance: number;
96
+ }>;
97
+ /**
98
+ * @description Check multiple coin balances for multiple balance managers by address in a single dry run call
99
+ * @param {string[]} managerAddresses The on-chain addresses of the BalanceManagers
100
+ * @param {string[]} coinKeys Keys of the coins to check balances for
101
+ * @returns {Promise<Record<string, Record<string, number>>>} Object keyed by manager address, mapping coinType to balance
102
+ */
103
+ checkManagerBalancesWithAddress(managerAddresses: string[], coinKeys: string[]): Promise<Record<string, Record<string, number>>>;
104
+ /**
105
+ * @description Check if a pool is whitelisted
106
+ * @param {string} poolKey Key of the pool
107
+ * @returns {Promise<boolean>} Boolean indicating if the pool is whitelisted
108
+ */
109
+ whitelisted(poolKey: string): Promise<boolean>;
110
+ /**
111
+ * @description Get the quote quantity out for a given base quantity
112
+ * @param {string} poolKey Key of the pool
113
+ * @param {number} baseQuantity Base quantity to convert
114
+ * @returns {Promise<{ baseQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
115
+ * An object with base quantity, base out, quote out, and deep required for the dry run
116
+ */
117
+ getQuoteQuantityOut(poolKey: string, baseQuantity: number): Promise<{
118
+ baseQuantity: number;
119
+ baseOut: number;
120
+ quoteOut: number;
121
+ deepRequired: number;
122
+ }>;
123
+ /**
124
+ * @description Get the base quantity out for a given quote quantity
125
+ * @param {string} poolKey Key of the pool
126
+ * @param {number} quoteQuantity Quote quantity to convert
127
+ * @returns {Promise<{ quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
128
+ * An object with quote quantity, base out, quote out, and deep required for the dry run
129
+ */
130
+ getBaseQuantityOut(poolKey: string, quoteQuantity: number): Promise<{
131
+ quoteQuantity: number;
132
+ baseOut: number;
133
+ quoteOut: number;
134
+ deepRequired: number;
135
+ }>;
136
+ /**
137
+ * @description Get the output quantities for given base and quote quantities. Only one quantity can be non-zero
138
+ * @param {string} poolKey Key of the pool
139
+ * @param {number} baseQuantity Base quantity to convert
140
+ * @param {number} quoteQuantity Quote quantity to convert
141
+ * @returns {Promise<{ baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number }>}
142
+ * An object with base quantity, quote quantity, base out, quote out, and deep required for the dry run
143
+ */
144
+ getQuantityOut(poolKey: string, baseQuantity: number, quoteQuantity: number): Promise<{
145
+ baseQuantity: number;
146
+ quoteQuantity: number;
147
+ baseOut: number;
148
+ quoteOut: number;
149
+ deepRequired: number;
150
+ }>;
151
+ /**
152
+ * @description Get open orders for a balance manager in a pool
153
+ * @param {string} poolKey Key of the pool
154
+ * @param {string} managerKey Key of the balance manager
155
+ * @returns {Promise<Array>} An array of open order IDs
156
+ */
157
+ accountOpenOrders(poolKey: string, managerKey: string): Promise<string[]>;
158
+ /**
159
+ * @description Get the order information for a specific order in a pool
160
+ * @param {string} poolKey Key of the pool
161
+ * @param {string} orderId Order ID
162
+ * @returns {Promise<Object>} A promise that resolves to an object containing the order information
163
+ */
164
+ getOrder(poolKey: string, orderId: string): Promise<{
165
+ balance_manager_id: string;
166
+ order_id: string;
167
+ client_order_id: string;
168
+ quantity: string;
169
+ filled_quantity: string;
170
+ fee_is_deep: boolean;
171
+ order_deep_price: {
172
+ asset_is_base: boolean;
173
+ deep_per_asset: string;
174
+ };
175
+ epoch: string;
176
+ status: number;
177
+ expire_timestamp: string;
178
+ } | null>;
179
+ /**
180
+ * @description Get the order information for a specific order in a pool, with normalized price
181
+ * @param {string} poolKey Key of the pool
182
+ * @param {string} orderId Order ID
183
+ * @returns {Promise<Object>} A promise that resolves to an object containing the order information with normalized price
184
+ */
185
+ getOrderNormalized(poolKey: string, orderId: string): Promise<{
186
+ quantity: string;
187
+ filled_quantity: string;
188
+ order_deep_price: {
189
+ deep_per_asset: string;
190
+ asset_is_base: boolean;
191
+ };
192
+ isBid: boolean;
193
+ normalized_price: string;
194
+ balance_manager_id: string;
195
+ order_id: string;
196
+ client_order_id: string;
197
+ fee_is_deep: boolean;
198
+ epoch: string;
199
+ status: number;
200
+ expire_timestamp: string;
201
+ } | null>;
202
+ /**
203
+ * @description Retrieves information for multiple specific orders in a pool.
204
+ * @param {string} poolKey - The key identifying the pool from which to retrieve order information.
205
+ * @param {string[]} orderIds - List of order IDs to retrieve information for.
206
+ * @returns {Promise<Object[] | null>} A promise that resolves to an array of order objects, each containing details such as
207
+ * balance manager ID, order ID, client order ID, quantity, filled quantity, fee information, order price, epoch, status,
208
+ * and expiration timestamp. Returns `null` if the retrieval fails.
209
+ */
210
+ getOrders(poolKey: string, orderIds: string[]): Promise<{
211
+ balance_manager_id: string;
212
+ order_id: string;
213
+ client_order_id: string;
214
+ quantity: string;
215
+ filled_quantity: string;
216
+ fee_is_deep: boolean;
217
+ order_deep_price: {
218
+ asset_is_base: boolean;
219
+ deep_per_asset: string;
220
+ };
221
+ epoch: string;
222
+ status: number;
223
+ expire_timestamp: string;
224
+ }[] | null>;
225
+ /**
226
+ * @description Get level 2 order book specifying range of price
227
+ * @param {string} poolKey Key of the pool
228
+ * @param {number} priceLow Lower bound of the price range
229
+ * @param {number} priceHigh Upper bound of the price range
230
+ * @param {boolean} isBid Whether to get bid or ask orders
231
+ * @returns {Promise<{ prices: Array<number>, quantities: Array<number> }>}
232
+ * An object with arrays of prices and quantities
233
+ */
234
+ getLevel2Range(poolKey: string, priceLow: number, priceHigh: number, isBid: boolean): Promise<{
235
+ prices: number[];
236
+ quantities: number[];
237
+ }>;
238
+ /**
239
+ * @description Get level 2 order book ticks from mid-price for a pool
240
+ * @param {string} poolKey Key of the pool
241
+ * @param {number} ticks Number of ticks from mid-price
242
+ * @returns {Promise<{ bid_prices: Array<number>, bid_quantities: Array<number>, ask_prices: Array<number>, ask_quantities: Array<number> }>}
243
+ * An object with arrays of prices and quantities
244
+ */
245
+ getLevel2TicksFromMid(poolKey: string, ticks: number): Promise<{
246
+ bid_prices: number[];
247
+ bid_quantities: number[];
248
+ ask_prices: number[];
249
+ ask_quantities: number[];
250
+ }>;
251
+ /**
252
+ * @description Get the vault balances for a pool
253
+ * @param {string} poolKey Key of the pool
254
+ * @returns {Promise<{ base: number, quote: number, deep: number }>}
255
+ * An object with base, quote, and deep balances in the vault
256
+ */
257
+ vaultBalances(poolKey: string): Promise<{
258
+ base: number;
259
+ quote: number;
260
+ deep: number;
261
+ }>;
262
+ /**
263
+ * @description Get the pool ID by asset types
264
+ * @param {string} baseType Type of the base asset
265
+ * @param {string} quoteType Type of the quote asset
266
+ * @returns {Promise<string>} The address of the pool
267
+ */
268
+ getPoolIdByAssets(baseType: string, quoteType: string): Promise<string>;
269
+ /**
270
+ * @description Get the mid price for a pool
271
+ * @param {string} poolKey Key of the pool
272
+ * @returns {Promise<number>} The mid price
273
+ */
274
+ midPrice(poolKey: string): Promise<number>;
275
+ /**
276
+ * @description Get the trade parameters for a given pool, including taker fee, maker fee, and stake required.
277
+ * @param {string} poolKey Key of the pool
278
+ * @returns {Promise<{ takerFee: number, makerFee: number, stakeRequired: number }>}
279
+ */
280
+ poolTradeParams(poolKey: string): Promise<{
281
+ takerFee: number;
282
+ makerFee: number;
283
+ stakeRequired: number;
284
+ }>;
285
+ /**
286
+ * @description Get the trade parameters for a given pool, including tick size, lot size, and min size.
287
+ * @param {string} poolKey Key of the pool
288
+ * @returns {Promise<{ tickSize: number, lotSize: number, minSize: number }>}
289
+ */
290
+ poolBookParams(poolKey: string): Promise<{
291
+ tickSize: number;
292
+ lotSize: number;
293
+ minSize: number;
294
+ }>;
295
+ /**
296
+ * @description Get the account information for a given pool and balance manager
297
+ * @param {string} poolKey Key of the pool
298
+ * @param {string} managerKey The key of the BalanceManager
299
+ * @returns {Promise<Object>} A promise that resolves to an object containing the account information
300
+ */
301
+ account(poolKey: string, managerKey: string): Promise<{
302
+ epoch: string;
303
+ open_orders: {
304
+ contents: string[];
305
+ };
306
+ taker_volume: number;
307
+ maker_volume: number;
308
+ active_stake: number;
309
+ inactive_stake: number;
310
+ created_proposal: boolean;
311
+ voted_proposal: string | null;
312
+ unclaimed_rebates: {
313
+ base: number;
314
+ quote: number;
315
+ deep: number;
316
+ };
317
+ settled_balances: {
318
+ base: number;
319
+ quote: number;
320
+ deep: number;
321
+ };
322
+ owed_balances: {
323
+ base: number;
324
+ quote: number;
325
+ deep: number;
326
+ };
327
+ }>;
328
+ /**
329
+ * @description Get the locked balances for a pool and balance manager
330
+ * @param {string} poolKey Key of the pool
331
+ * @param {string} managerKey The key of the BalanceManager
332
+ * @returns {Promise<{ base: number, quote: number, deep: number }>}
333
+ * An object with base, quote, and deep locked for the balance manager in the pool
334
+ */
335
+ lockedBalance(poolKey: string, balanceManagerKey: string): Promise<{
336
+ base: number;
337
+ quote: number;
338
+ deep: number;
339
+ }>;
340
+ /**
341
+ * @description Get the DEEP price conversion for a pool
342
+ * @param {string} poolKey Key of the pool
343
+ * @returns {Promise<{ asset_is_base: bool, deep_per_quote: number }>} Deep price conversion
344
+ */
345
+ getPoolDeepPrice(poolKey: string): Promise<{
346
+ asset_is_base: true;
347
+ deep_per_base: number;
348
+ deep_per_quote?: undefined;
349
+ } | {
350
+ asset_is_base: false;
351
+ deep_per_quote: number;
352
+ deep_per_base?: undefined;
353
+ }>;
354
+ /**
355
+ * @description Decode the order ID to get bid/ask status, price, and orderId
356
+ * @param {bigint} encodedOrderId Encoded order ID
357
+ * @returns {Object} Object containing isBid, price, and orderId
358
+ */
359
+ decodeOrderId(encodedOrderId: bigint): {
360
+ isBid: boolean;
361
+ price: number;
362
+ orderId: number;
363
+ };
364
+ /**
365
+ * @description Get all balance manager IDs for a given owner
366
+ * @param {string} owner The owner address to get balance manager IDs for
367
+ * @returns {Promise<string[]>} Array of balance manager ID strings
368
+ */
369
+ getBalanceManagerIds(owner: string): Promise<string[]>;
370
+ /**
371
+ * @description Get the owner of the referral (DeepBookPoolReferral)
372
+ * @param {string} referral The ID of the referral to get the owner of
373
+ * @returns {Promise<string>} The owner of the referral
374
+ */
375
+ balanceManagerReferralOwner(referral: string): Promise<string>;
376
+ /**
377
+ * @description Get the referral balances for a pool and referral (DeepBookPoolReferral)
378
+ * @param {string} poolKey Key of the pool
379
+ * @param {string} referral The referral ID to get balances for
380
+ * @returns {Promise<{ base: number, quote: number, deep: number }>} Object with base, quote, and deep balances
381
+ */
382
+ getPoolReferralBalances(poolKey: string, referral: string): Promise<{
383
+ base: number;
384
+ quote: number;
385
+ deep: number;
386
+ }>;
387
+ /**
388
+ * @description Get the pool ID associated with a referral (DeepBookPoolReferral)
389
+ * @param {string} referral The referral (DeepBookPoolReferral) to get the pool ID for
390
+ * @returns {Promise<string>} The pool ID
391
+ */
392
+ balanceManagerReferralPoolId(referral: string): Promise<string>;
393
+ /**
394
+ * @description Get the multiplier for a referral (DeepBookPoolReferral)
395
+ * @param {string} poolKey Key of the pool
396
+ * @param {string} referral The referral (DeepBookPoolReferral) to get the multiplier for
397
+ * @returns {Promise<number>} The multiplier value
398
+ */
399
+ poolReferralMultiplier(poolKey: string, referral: string): Promise<number>;
400
+ /**
401
+ * @description Get the referral ID from a balance manager for a specific pool
402
+ * @param {string} managerKey Key of the balance manager
403
+ * @param {string} poolKey Key of the pool to get the referral for
404
+ * @returns {Promise<string | null>} The referral ID or null if not set
405
+ */
406
+ getBalanceManagerReferralId(managerKey: string, poolKey: string): Promise<string | null>;
407
+ getPriceInfoObject(tx: Transaction, coinKey: string): Promise<string>;
408
+ /**
409
+ * @description Batch update price info objects for multiple coins. Only updates stale feeds.
410
+ * This is more efficient than calling getPriceInfoObject multiple times as it:
411
+ * 1. Batch fetches all price info object ages in one RPC call
412
+ * 2. Fetches all stale price updates from Pyth in a single API call
413
+ * @param {Transaction} tx Transaction to add price update commands to
414
+ * @param {string[]} coinKeys Array of coin keys to update prices for
415
+ * @returns {Promise<Record<string, string>>} Map of coinKey -> priceInfoObjectId
416
+ */
417
+ getPriceInfoObjects(tx: Transaction, coinKeys: string[]): Promise<Record<string, string>>;
418
+ /**
419
+ * @description Get the age of the price info object for a specific coin
420
+ * @param {string} coinKey Key of the coin
421
+ * @returns {Promise<number>} The arrival time of the price info object
422
+ */
423
+ getPriceInfoObjectAge(coinKey: string): Promise<number>;
424
+ /**
425
+ * @description Get the margin pool ID
426
+ * @param {string} coinKey The key to identify the margin pool
427
+ * @returns {Promise<string>} The margin pool ID
428
+ */
429
+ getMarginPoolId(coinKey: string): Promise<string>;
430
+ /**
431
+ * @description Check if a deepbook pool is allowed for borrowing from margin pool
432
+ * @param {string} coinKey The key to identify the margin pool
433
+ * @param {string} deepbookPoolId The ID of the deepbook pool
434
+ * @returns {Promise<boolean>} Whether the deepbook pool is allowed
435
+ */
436
+ isDeepbookPoolAllowed(coinKey: string, deepbookPoolId: string): Promise<boolean>;
437
+ /**
438
+ * @description Get the total supply amount in the margin pool
439
+ * @param {string} coinKey The key to identify the margin pool
440
+ * @param {number} decimals Number of decimal places to show (default: 6)
441
+ * @returns {Promise<string>} The total supply amount as a string
442
+ */
443
+ getMarginPoolTotalSupply(coinKey: string, decimals?: number): Promise<string>;
444
+ /**
445
+ * @description Get the total supply shares in the margin pool
446
+ * @param {string} coinKey The key to identify the margin pool
447
+ * @param {number} decimals Number of decimal places to show (default: 6)
448
+ * @returns {Promise<string>} The total supply shares as a string
449
+ */
450
+ getMarginPoolSupplyShares(coinKey: string, decimals?: number): Promise<string>;
451
+ /**
452
+ * @description Get the total borrow amount in the margin pool
453
+ * @param {string} coinKey The key to identify the margin pool
454
+ * @param {number} decimals Number of decimal places to show (default: 6)
455
+ * @returns {Promise<string>} The total borrow amount as a string
456
+ */
457
+ getMarginPoolTotalBorrow(coinKey: string, decimals?: number): Promise<string>;
458
+ /**
459
+ * @description Get the total borrow shares in the margin pool
460
+ * @param {string} coinKey The key to identify the margin pool
461
+ * @param {number} decimals Number of decimal places to show (default: 6)
462
+ * @returns {Promise<string>} The total borrow shares as a string
463
+ */
464
+ getMarginPoolBorrowShares(coinKey: string, decimals?: number): Promise<string>;
465
+ /**
466
+ * @description Get the last update timestamp of the margin pool
467
+ * @param {string} coinKey The key to identify the margin pool
468
+ * @returns {Promise<number>} The last update timestamp in milliseconds
469
+ */
470
+ getMarginPoolLastUpdateTimestamp(coinKey: string): Promise<number>;
471
+ /**
472
+ * @description Get the supply cap of the margin pool
473
+ * @param {string} coinKey The key to identify the margin pool
474
+ * @param {number} decimals Number of decimal places to show (default: 6)
475
+ * @returns {Promise<string>} The supply cap as a string
476
+ */
477
+ getMarginPoolSupplyCap(coinKey: string, decimals?: number): Promise<string>;
478
+ /**
479
+ * @description Get the max utilization rate of the margin pool
480
+ * @param {string} coinKey The key to identify the margin pool
481
+ * @returns {Promise<number>} The max utilization rate (as a decimal, e.g., 0.95 for 95%)
482
+ */
483
+ getMarginPoolMaxUtilizationRate(coinKey: string): Promise<number>;
484
+ /**
485
+ * @description Get the protocol spread of the margin pool
486
+ * @param {string} coinKey The key to identify the margin pool
487
+ * @returns {Promise<number>} The protocol spread (as a decimal)
488
+ */
489
+ getMarginPoolProtocolSpread(coinKey: string): Promise<number>;
490
+ /**
491
+ * @description Get the minimum borrow amount for the margin pool
492
+ * @param {string} coinKey The key to identify the margin pool
493
+ * @param {number} decimals Number of decimal places to show (default: 6)
494
+ * @returns {Promise<string>} The minimum borrow amount as a string
495
+ */
496
+ getMarginPoolMinBorrow(coinKey: string, decimals?: number): Promise<string>;
497
+ /**
498
+ * @description Get the current interest rate of the margin pool
499
+ * @param {string} coinKey The key to identify the margin pool
500
+ * @returns {Promise<number>} The current interest rate (as a decimal)
501
+ */
502
+ getMarginPoolInterestRate(coinKey: string): Promise<number>;
503
+ /**
504
+ * @description Get user supply shares for a supplier cap
505
+ * @param {string} coinKey The key to identify the margin pool
506
+ * @param {string} supplierCapId The ID of the supplier cap
507
+ * @param {number} decimals Number of decimal places to show (default: 6)
508
+ * @returns {Promise<string>} The user's supply shares as a string
509
+ */
510
+ getUserSupplyShares(coinKey: string, supplierCapId: string, decimals?: number): Promise<string>;
511
+ /**
512
+ * @description Get user supply amount for a supplier cap
513
+ * @param {string} coinKey The key to identify the margin pool
514
+ * @param {string} supplierCapId The ID of the supplier cap
515
+ * @param {number} decimals Number of decimal places to show (default: 6)
516
+ * @returns {Promise<string>} The user's supply amount as a string
517
+ */
518
+ getUserSupplyAmount(coinKey: string, supplierCapId: string, decimals?: number): Promise<string>;
519
+ /**
520
+ * @description Get the owner address of a margin manager
521
+ * @param {string} marginManagerKey The key to identify the margin manager
522
+ * @returns {Promise<string>} The owner address
523
+ */
524
+ getMarginManagerOwner(marginManagerKey: string): Promise<string>;
525
+ /**
526
+ * @description Get the DeepBook pool ID associated with a margin manager
527
+ * @param {string} marginManagerKey The key to identify the margin manager
528
+ * @returns {Promise<string>} The DeepBook pool ID
529
+ */
530
+ getMarginManagerDeepbookPool(marginManagerKey: string): Promise<string>;
531
+ /**
532
+ * @description Get the margin pool ID (if any) associated with a margin manager
533
+ * @param {string} marginManagerKey The key to identify the margin manager
534
+ * @returns {Promise<string | null>} The margin pool ID or null if no active loan
535
+ */
536
+ getMarginManagerMarginPoolId(marginManagerKey: string): Promise<string | null>;
537
+ /**
538
+ * @description Get borrowed shares for both base and quote assets
539
+ * @param {string} marginManagerKey The key to identify the margin manager
540
+ * @returns {Promise<{baseShares: string, quoteShares: string}>} The borrowed shares
541
+ */
542
+ getMarginManagerBorrowedShares(marginManagerKey: string): Promise<{
543
+ baseShares: string;
544
+ quoteShares: string;
545
+ }>;
546
+ /**
547
+ * @description Get borrowed base shares
548
+ * @param {string} marginManagerKey The key to identify the margin manager
549
+ * @returns {Promise<string>} The borrowed base shares
550
+ */
551
+ getMarginManagerBorrowedBaseShares(marginManagerKey: string): Promise<string>;
552
+ /**
553
+ * @description Get borrowed quote shares
554
+ * @param {string} marginManagerKey The key to identify the margin manager
555
+ * @returns {Promise<string>} The borrowed quote shares
556
+ */
557
+ getMarginManagerBorrowedQuoteShares(marginManagerKey: string): Promise<string>;
558
+ /**
559
+ * @description Check if margin manager has base asset debt
560
+ * @param {string} marginManagerKey The key to identify the margin manager
561
+ * @returns {Promise<boolean>} True if has base debt, false otherwise
562
+ */
563
+ getMarginManagerHasBaseDebt(marginManagerKey: string): Promise<boolean>;
564
+ /**
565
+ * @description Get the balance manager ID for a margin manager
566
+ * @param {string} marginManagerKey The key to identify the margin manager
567
+ * @returns {Promise<string>} The balance manager ID
568
+ */
569
+ getMarginManagerBalanceManagerId(marginManagerKey: string): Promise<string>;
570
+ /**
571
+ * @description Calculate assets (base and quote) for a margin manager
572
+ * @param {string} marginManagerKey The key to identify the margin manager
573
+ * @param {number} decimals Number of decimal places to show (default: 6)
574
+ * @returns {Promise<{baseAsset: string, quoteAsset: string}>} The base and quote assets
575
+ */
576
+ getMarginManagerAssets(marginManagerKey: string, decimals?: number): Promise<{
577
+ baseAsset: string;
578
+ quoteAsset: string;
579
+ }>;
580
+ /**
581
+ * @description Calculate debts (base and quote) for a margin manager
582
+ * NOTE: This function automatically determines whether to use base or quote margin pool
583
+ * based on hasBaseDebt. You don't need to specify the debt coin type.
584
+ * @param {string} marginManagerKey The key to identify the margin manager
585
+ * @param {number} decimals Number of decimal places to show (default: 6)
586
+ * @returns {Promise<{baseDebt: string, quoteDebt: string}>} The base and quote debts
587
+ */
588
+ getMarginManagerDebts(marginManagerKey: string, decimals?: number): Promise<{
589
+ baseDebt: string;
590
+ quoteDebt: string;
591
+ }>;
592
+ /**
593
+ * @description Get comprehensive state information for a margin manager
594
+ * @param {string} marginManagerKey The key to identify the margin manager
595
+ * @param {number} decimals Number of decimal places to show (default: 6)
596
+ * @returns {Promise<{
597
+ * managerId: string,
598
+ * deepbookPoolId: string,
599
+ * riskRatio: number,
600
+ * baseAsset: string,
601
+ * quoteAsset: string,
602
+ * baseDebt: string,
603
+ * quoteDebt: string,
604
+ * basePythPrice: string,
605
+ * basePythDecimals: number,
606
+ * quotePythPrice: string,
607
+ * quotePythDecimals: number
608
+ * }>} Comprehensive margin manager state
609
+ */
610
+ getMarginManagerState(marginManagerKey: string, decimals?: number): Promise<{
611
+ managerId: string;
612
+ deepbookPoolId: string;
613
+ riskRatio: number;
614
+ baseAsset: string;
615
+ quoteAsset: string;
616
+ baseDebt: string;
617
+ quoteDebt: string;
618
+ basePythPrice: string;
619
+ basePythDecimals: number;
620
+ quotePythPrice: string;
621
+ quotePythDecimals: number;
622
+ currentPrice: bigint;
623
+ lowestTriggerAbovePrice: bigint;
624
+ highestTriggerBelowPrice: bigint;
625
+ }>;
626
+ /**
627
+ * @description Get comprehensive state information for multiple margin managers.
628
+ * @param {Record<string, string>} marginManagers Map of marginManagerId -> poolKey
629
+ * @param {number} decimals Number of decimal places for formatting (default: 6)
630
+ * @returns {Promise<Record<string, {...}>>} Object keyed by managerId with state data
631
+ */
632
+ getMarginManagerStates(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, {
633
+ managerId: string;
634
+ deepbookPoolId: string;
635
+ riskRatio: number;
636
+ baseAsset: string;
637
+ quoteAsset: string;
638
+ baseDebt: string;
639
+ quoteDebt: string;
640
+ basePythPrice: string;
641
+ basePythDecimals: number;
642
+ quotePythPrice: string;
643
+ quotePythDecimals: number;
644
+ currentPrice: bigint;
645
+ lowestTriggerAbovePrice: bigint;
646
+ highestTriggerBelowPrice: bigint;
647
+ }>>;
648
+ /**
649
+ * @description Get the base asset balance of a margin manager
650
+ * @param {string} marginManagerKey The key to identify the margin manager
651
+ * @param {number} decimals Number of decimal places to show (default: 6)
652
+ * @returns {Promise<string>} The base asset balance
653
+ */
654
+ getMarginManagerBaseBalance(marginManagerKey: string, decimals?: number): Promise<string>;
655
+ /**
656
+ * @description Get the quote asset balance of a margin manager
657
+ * @param {string} marginManagerKey The key to identify the margin manager
658
+ * @param {number} decimals Number of decimal places to show (default: 6)
659
+ * @returns {Promise<string>} The quote asset balance
660
+ */
661
+ getMarginManagerQuoteBalance(marginManagerKey: string, decimals?: number): Promise<string>;
662
+ /**
663
+ * @description Get the DEEP token balance of a margin manager
664
+ * @param {string} marginManagerKey The key to identify the margin manager
665
+ * @param {number} decimals Number of decimal places to show (default: 6)
666
+ * @returns {Promise<string>} The DEEP token balance
667
+ */
668
+ getMarginManagerDeepBalance(marginManagerKey: string, decimals?: number): Promise<string>;
669
+ /**
670
+ * @description Get base, quote, and DEEP balances for multiple margin managers in a single dry run call
671
+ * @param {Record<string, string>} marginManagers Map of marginManagerId -> poolKey
672
+ * @param {number} decimals Number of decimal places for formatting (default: 9)
673
+ * @returns {Promise<Record<string, { base: string, quote: string, deep: string }>>} Object keyed by managerId
674
+ */
675
+ getMarginManagerBalances(marginManagers: Record<string, string>, decimals?: number): Promise<Record<string, {
676
+ base: string;
677
+ quote: string;
678
+ deep: string;
679
+ }>>;
680
+ /**
681
+ * @description Get account order details for a margin manager.
682
+ * This retrieves the balance manager from the margin manager and returns order details.
683
+ * @param {string} marginManagerKey The key to identify the margin manager
684
+ * @returns {Promise<Array>} Array of order details
685
+ */
686
+ getMarginAccountOrderDetails(marginManagerKey: string): Promise<{
687
+ balance_manager_id: string;
688
+ order_id: string;
689
+ client_order_id: string;
690
+ quantity: string;
691
+ filled_quantity: string;
692
+ fee_is_deep: boolean;
693
+ order_deep_price: {
694
+ asset_is_base: boolean;
695
+ deep_per_asset: string;
696
+ };
697
+ epoch: string;
698
+ status: number;
699
+ expire_timestamp: string;
700
+ }[]>;
701
+ /**
702
+ * @description Get all conditional order IDs for a margin manager
703
+ * @param {string} marginManagerKey The key to identify the margin manager
704
+ * @returns {Promise<string[]>} Array of conditional order IDs
705
+ */
706
+ getConditionalOrderIds(marginManagerKey: string): Promise<string[]>;
707
+ /**
708
+ * @description Get the lowest trigger price for trigger_above orders
709
+ * Returns MAX_U64 if there are no trigger_above orders
710
+ * @param {string} marginManagerKey The key to identify the margin manager
711
+ * @returns {Promise<bigint>} The lowest trigger above price
712
+ */
713
+ getLowestTriggerAbovePrice(marginManagerKey: string): Promise<bigint>;
714
+ /**
715
+ * @description Get the highest trigger price for trigger_below orders
716
+ * Returns 0 if there are no trigger_below orders
717
+ * @param {string} marginManagerKey The key to identify the margin manager
718
+ * @returns {Promise<bigint>} The highest trigger below price
719
+ */
720
+ getHighestTriggerBelowPrice(marginManagerKey: string): Promise<bigint>;
721
+ /**
722
+ * @description Check if a deepbook pool is enabled for margin trading
723
+ * @param {string} poolKey The key to identify the pool
724
+ * @returns {Promise<boolean>} True if the pool is enabled for margin trading
725
+ */
726
+ isPoolEnabledForMargin(poolKey: string): Promise<boolean>;
727
+ /**
728
+ * @description Get the margin manager IDs for a given owner address
729
+ * @param {string} owner The owner address
730
+ * @returns {Promise<string[]>} Array of margin manager IDs
731
+ */
732
+ getMarginManagerIdsForOwner(owner: string): Promise<string[]>;
733
+ /**
734
+ * @description Get the base margin pool ID for a deepbook pool
735
+ * @param {string} poolKey The key to identify the pool
736
+ * @returns {Promise<string>} The base margin pool ID
737
+ */
738
+ getBaseMarginPoolId(poolKey: string): Promise<string>;
739
+ /**
740
+ * @description Get the quote margin pool ID for a deepbook pool
741
+ * @param {string} poolKey The key to identify the pool
742
+ * @returns {Promise<string>} The quote margin pool ID
743
+ */
744
+ getQuoteMarginPoolId(poolKey: string): Promise<string>;
745
+ /**
746
+ * @description Get the minimum withdraw risk ratio for a deepbook pool
747
+ * @param {string} poolKey The key to identify the pool
748
+ * @returns {Promise<number>} The minimum withdraw risk ratio as a decimal (e.g., 1.5 for 150%)
749
+ */
750
+ getMinWithdrawRiskRatio(poolKey: string): Promise<number>;
751
+ /**
752
+ * @description Get the minimum borrow risk ratio for a deepbook pool
753
+ * @param {string} poolKey The key to identify the pool
754
+ * @returns {Promise<number>} The minimum borrow risk ratio as a decimal (e.g., 1.25 for 125%)
755
+ */
756
+ getMinBorrowRiskRatio(poolKey: string): Promise<number>;
757
+ /**
758
+ * @description Get the liquidation risk ratio for a deepbook pool
759
+ * @param {string} poolKey The key to identify the pool
760
+ * @returns {Promise<number>} The liquidation risk ratio as a decimal (e.g., 1.125 for 112.5%)
761
+ */
762
+ getLiquidationRiskRatio(poolKey: string): Promise<number>;
763
+ /**
764
+ * @description Get the target liquidation risk ratio for a deepbook pool
765
+ * @param {string} poolKey The key to identify the pool
766
+ * @returns {Promise<number>} The target liquidation risk ratio as a decimal (e.g., 1.25 for 125%)
767
+ */
768
+ getTargetLiquidationRiskRatio(poolKey: string): Promise<number>;
769
+ /**
770
+ * @description Get the user liquidation reward for a deepbook pool
771
+ * @param {string} poolKey The key to identify the pool
772
+ * @returns {Promise<number>} The user liquidation reward as a decimal (e.g., 0.05 for 5%)
773
+ */
774
+ getUserLiquidationReward(poolKey: string): Promise<number>;
775
+ /**
776
+ * @description Get the pool liquidation reward for a deepbook pool
777
+ * @param {string} poolKey The key to identify the pool
778
+ * @returns {Promise<number>} The pool liquidation reward as a decimal (e.g., 0.05 for 5%)
779
+ */
780
+ getPoolLiquidationReward(poolKey: string): Promise<number>;
781
+ /**
782
+ * @description Get all allowed maintainer cap IDs
783
+ * @returns {Promise<string[]>} Array of allowed maintainer cap IDs
784
+ */
785
+ getAllowedMaintainers(): Promise<string[]>;
786
+ /**
787
+ * @description Get all allowed pause cap IDs
788
+ * @returns {Promise<string[]>} Array of allowed pause cap IDs
789
+ */
790
+ getAllowedPauseCaps(): Promise<string[]>;
791
+ /**
792
+ * @description Check if a pool is a stable pool
793
+ * @param {string} poolKey Key of the pool
794
+ * @returns {Promise<boolean>} Whether the pool is a stable pool
795
+ */
796
+ stablePool(poolKey: string): Promise<boolean>;
797
+ /**
798
+ * @description Check if a pool is registered
799
+ * @param {string} poolKey Key of the pool
800
+ * @returns {Promise<boolean>} Whether the pool is registered
801
+ */
802
+ registeredPool(poolKey: string): Promise<boolean>;
803
+ /**
804
+ * @description Get the quote quantity out using input token as fee
805
+ * @param {string} poolKey Key of the pool
806
+ * @param {number} baseQuantity Base quantity
807
+ * @returns {Promise<{baseQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
808
+ */
809
+ getQuoteQuantityOutInputFee(poolKey: string, baseQuantity: number): Promise<{
810
+ baseQuantity: number;
811
+ baseOut: number;
812
+ quoteOut: number;
813
+ deepRequired: number;
814
+ }>;
815
+ /**
816
+ * @description Get the base quantity out using input token as fee
817
+ * @param {string} poolKey Key of the pool
818
+ * @param {number} quoteQuantity Quote quantity
819
+ * @returns {Promise<{quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
820
+ */
821
+ getBaseQuantityOutInputFee(poolKey: string, quoteQuantity: number): Promise<{
822
+ quoteQuantity: number;
823
+ baseOut: number;
824
+ quoteOut: number;
825
+ deepRequired: number;
826
+ }>;
827
+ /**
828
+ * @description Get the quantity out using input token as fee
829
+ * @param {string} poolKey Key of the pool
830
+ * @param {number} baseQuantity Base quantity
831
+ * @param {number} quoteQuantity Quote quantity
832
+ * @returns {Promise<{baseQuantity: number, quoteQuantity: number, baseOut: number, quoteOut: number, deepRequired: number}>}
833
+ */
834
+ getQuantityOutInputFee(poolKey: string, baseQuantity: number, quoteQuantity: number): Promise<{
835
+ baseQuantity: number;
836
+ quoteQuantity: number;
837
+ baseOut: number;
838
+ quoteOut: number;
839
+ deepRequired: number;
840
+ }>;
841
+ /**
842
+ * @description Get the base quantity needed to receive target quote quantity
843
+ * @param {string} poolKey Key of the pool
844
+ * @param {number} targetQuoteQuantity Target quote quantity
845
+ * @param {boolean} payWithDeep Whether to pay fees with DEEP
846
+ * @returns {Promise<{baseIn: number, quoteOut: number, deepRequired: number}>}
847
+ */
848
+ getBaseQuantityIn(poolKey: string, targetQuoteQuantity: number, payWithDeep: boolean): Promise<{
849
+ baseIn: number;
850
+ quoteOut: number;
851
+ deepRequired: number;
852
+ }>;
853
+ /**
854
+ * @description Get the quote quantity needed to receive target base quantity
855
+ * @param {string} poolKey Key of the pool
856
+ * @param {number} targetBaseQuantity Target base quantity
857
+ * @param {boolean} payWithDeep Whether to pay fees with DEEP
858
+ * @returns {Promise<{baseOut: number, quoteIn: number, deepRequired: number}>}
859
+ */
860
+ getQuoteQuantityIn(poolKey: string, targetBaseQuantity: number, payWithDeep: boolean): Promise<{
861
+ baseOut: number;
862
+ quoteIn: number;
863
+ deepRequired: number;
864
+ }>;
865
+ /**
866
+ * @description Get account order details for a balance manager
867
+ * @param {string} poolKey Key of the pool
868
+ * @param {string} managerKey Key of the balance manager
869
+ * @returns {Promise<Array>} Array of order details
870
+ */
871
+ getAccountOrderDetails(poolKey: string, managerKey: string): Promise<{
872
+ balance_manager_id: string;
873
+ order_id: string;
874
+ client_order_id: string;
875
+ quantity: string;
876
+ filled_quantity: string;
877
+ fee_is_deep: boolean;
878
+ order_deep_price: {
879
+ asset_is_base: boolean;
880
+ deep_per_asset: string;
881
+ };
882
+ epoch: string;
883
+ status: number;
884
+ expire_timestamp: string;
885
+ }[]>;
886
+ /**
887
+ * @description Get the DEEP required for an order
888
+ * @param {string} poolKey Key of the pool
889
+ * @param {number} baseQuantity Base quantity
890
+ * @param {number} price Price
891
+ * @returns {Promise<{deepRequiredTaker: number, deepRequiredMaker: number}>}
892
+ */
893
+ getOrderDeepRequired(poolKey: string, baseQuantity: number, price: number): Promise<{
894
+ deepRequiredTaker: number;
895
+ deepRequiredMaker: number;
896
+ }>;
897
+ /**
898
+ * @description Check if account exists for a balance manager
899
+ * @param {string} poolKey Key of the pool
900
+ * @param {string} managerKey Key of the balance manager
901
+ * @returns {Promise<boolean>} Whether account exists
902
+ */
903
+ accountExists(poolKey: string, managerKey: string): Promise<boolean>;
904
+ /**
905
+ * @description Get the next epoch trade parameters
906
+ * @param {string} poolKey Key of the pool
907
+ * @returns {Promise<{takerFee: number, makerFee: number, stakeRequired: number}>}
908
+ */
909
+ poolTradeParamsNext(poolKey: string): Promise<{
910
+ takerFee: number;
911
+ makerFee: number;
912
+ stakeRequired: number;
913
+ }>;
914
+ /**
915
+ * @description Get the quorum for a pool
916
+ * @param {string} poolKey Key of the pool
917
+ * @returns {Promise<number>} The quorum amount in DEEP
918
+ */
919
+ quorum(poolKey: string): Promise<number>;
920
+ /**
921
+ * @description Get the pool ID
922
+ * @param {string} poolKey Key of the pool
923
+ * @returns {Promise<string>} The pool ID
924
+ */
925
+ poolId(poolKey: string): Promise<string>;
926
+ /**
927
+ * @description Check if a limit order can be placed
928
+ * @param {CanPlaceLimitOrderParams} params Parameters for checking limit order placement
929
+ * @returns {Promise<boolean>} Whether order can be placed
930
+ */
931
+ canPlaceLimitOrder(params: CanPlaceLimitOrderParams): Promise<boolean>;
932
+ /**
933
+ * @description Check if a market order can be placed
934
+ * @param {CanPlaceMarketOrderParams} params Parameters for checking market order placement
935
+ * @returns {Promise<boolean>} Whether order can be placed
936
+ */
937
+ canPlaceMarketOrder(params: CanPlaceMarketOrderParams): Promise<boolean>;
938
+ /**
939
+ * @description Check if market order params are valid
940
+ * @param {string} poolKey Key of the pool
941
+ * @param {number} quantity Quantity
942
+ * @returns {Promise<boolean>} Whether params are valid
943
+ */
944
+ checkMarketOrderParams(poolKey: string, quantity: number): Promise<boolean>;
945
+ /**
946
+ * @description Check if limit order params are valid
947
+ * @param {string} poolKey Key of the pool
948
+ * @param {number} price Price
949
+ * @param {number} quantity Quantity
950
+ * @param {number} expireTimestamp Expiration timestamp
951
+ * @returns {Promise<boolean>} Whether params are valid
952
+ */
953
+ checkLimitOrderParams(poolKey: string, price: number, quantity: number, expireTimestamp: number): Promise<boolean>;
954
+ }
955
+ //#endregion
956
+ export { DeepBookClient, DeepBookClientOptions, DeepBookCompatibleClient, DeepBookOptions, deepbook };
957
+ //# sourceMappingURL=client.d.mts.map