@mysten/deepbook-v3 2.0.1 → 2.1.4

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 (276) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/PREDICT.md +256 -0
  3. package/README.md +116 -0
  4. package/dist/account.d.mts +139 -0
  5. package/dist/account.d.mts.map +1 -0
  6. package/dist/account.mjs +181 -0
  7. package/dist/account.mjs.map +1 -0
  8. package/dist/bcs/integers.mjs +23 -0
  9. package/dist/bcs/integers.mjs.map +1 -0
  10. package/dist/client.d.mts +2 -2
  11. package/dist/contracts/account/account.d.mts +382 -0
  12. package/dist/contracts/account/account.d.mts.map +1 -0
  13. package/dist/contracts/account/account.mjs +443 -0
  14. package/dist/contracts/account/account.mjs.map +1 -0
  15. package/dist/contracts/account/account_events.d.mts +41 -0
  16. package/dist/contracts/account/account_events.d.mts.map +1 -0
  17. package/dist/contracts/account/account_events.mjs +72 -0
  18. package/dist/contracts/account/account_events.mjs.map +1 -0
  19. package/dist/contracts/account/account_registry.d.mts +210 -0
  20. package/dist/contracts/account/account_registry.d.mts.map +1 -0
  21. package/dist/contracts/account/account_registry.mjs +263 -0
  22. package/dist/contracts/account/account_registry.mjs.map +1 -0
  23. package/dist/contracts/account/config-arguments.d.mts +10 -0
  24. package/dist/contracts/account/config-arguments.d.mts.map +1 -0
  25. package/dist/contracts/account/deps/sui/bag.mjs +44 -0
  26. package/dist/contracts/account/deps/sui/bag.mjs.map +1 -0
  27. package/dist/contracts/deepbook/account.d.mts +18 -18
  28. package/dist/contracts/deepbook/balances.d.mts +4 -4
  29. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  30. package/dist/contracts/deepbook/deep_price.d.mts.map +1 -1
  31. package/dist/contracts/deepbook/order.d.mts +12 -12
  32. package/dist/contracts/deepbook_predict/builder_code_events.mjs +38 -0
  33. package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -0
  34. package/dist/contracts/deepbook_predict/config-arguments.d.mts +13 -0
  35. package/dist/contracts/deepbook_predict/config-arguments.d.mts.map +1 -0
  36. package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs +25 -0
  37. package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs.map +1 -0
  38. package/dist/contracts/deepbook_predict/deps/sui/balance.mjs +25 -0
  39. package/dist/contracts/deepbook_predict/deps/sui/balance.mjs.map +1 -0
  40. package/dist/contracts/deepbook_predict/deps/sui/coin.mjs +24 -0
  41. package/dist/contracts/deepbook_predict/deps/sui/coin.mjs.map +1 -0
  42. package/dist/contracts/deepbook_predict/deps/sui/table.mjs +39 -0
  43. package/dist/contracts/deepbook_predict/deps/sui/table.mjs.map +1 -0
  44. package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs +26 -0
  45. package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs.map +1 -0
  46. package/dist/contracts/deepbook_predict/ewma.mjs +29 -0
  47. package/dist/contracts/deepbook_predict/ewma.mjs.map +1 -0
  48. package/dist/contracts/deepbook_predict/expiry_cash.mjs +27 -0
  49. package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -0
  50. package/dist/contracts/deepbook_predict/expiry_market.mjs +367 -0
  51. package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -0
  52. package/dist/contracts/deepbook_predict/lp_book.mjs +92 -0
  53. package/dist/contracts/deepbook_predict/lp_book.mjs.map +1 -0
  54. package/dist/contracts/deepbook_predict/market_manager.mjs +59 -0
  55. package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -0
  56. package/dist/contracts/deepbook_predict/order.mjs +26 -0
  57. package/dist/contracts/deepbook_predict/order.mjs.map +1 -0
  58. package/dist/contracts/deepbook_predict/order_events.mjs +84 -0
  59. package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -0
  60. package/dist/contracts/deepbook_predict/plp.mjs +284 -0
  61. package/dist/contracts/deepbook_predict/plp.mjs.map +1 -0
  62. package/dist/contracts/deepbook_predict/pool_accounting.mjs +58 -0
  63. package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -0
  64. package/dist/contracts/deepbook_predict/predict_account.mjs +106 -0
  65. package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -0
  66. package/dist/contracts/deepbook_predict/pricing.mjs +80 -0
  67. package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -0
  68. package/dist/contracts/deepbook_predict/range_codec.mjs +41 -0
  69. package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -0
  70. package/dist/contracts/deepbook_predict/registry.mjs +55 -0
  71. package/dist/contracts/deepbook_predict/registry.mjs.map +1 -0
  72. package/dist/contracts/deepbook_predict/strike_exposure.mjs +65 -0
  73. package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -0
  74. package/dist/contracts/deepbook_predict/strike_exposure_config.mjs +33 -0
  75. package/dist/contracts/deepbook_predict/strike_exposure_config.mjs.map +1 -0
  76. package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +72 -0
  77. package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -0
  78. package/dist/contracts/deepbook_predict/vault_events.mjs +184 -0
  79. package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -0
  80. package/dist/contracts/deepbook_sessions/config-arguments.d.mts +10 -0
  81. package/dist/contracts/deepbook_sessions/config-arguments.d.mts.map +1 -0
  82. package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs +37 -0
  83. package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs.map +1 -0
  84. package/dist/contracts/deepbook_sessions/session_config.d.mts +63 -0
  85. package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -0
  86. package/dist/contracts/deepbook_sessions/session_config.mjs +82 -0
  87. package/dist/contracts/deepbook_sessions/session_config.mjs.map +1 -0
  88. package/dist/contracts/deepbook_sessions/sessions.d.mts +275 -0
  89. package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -0
  90. package/dist/contracts/deepbook_sessions/sessions.mjs +443 -0
  91. package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -0
  92. package/dist/contracts/utils/index.d.mts +18 -1
  93. package/dist/contracts/utils/index.d.mts.map +1 -1
  94. package/dist/deployments/index.d.mts +31 -0
  95. package/dist/deployments/index.d.mts.map +1 -0
  96. package/dist/deployments/index.mjs +30 -0
  97. package/dist/deployments/index.mjs.map +1 -0
  98. package/dist/deployments/testnet.d.mts +14 -0
  99. package/dist/deployments/testnet.d.mts.map +1 -0
  100. package/dist/deployments/testnet.mjs +73 -0
  101. package/dist/deployments/testnet.mjs.map +1 -0
  102. package/dist/deployments/types.d.mts +36 -0
  103. package/dist/deployments/types.d.mts.map +1 -0
  104. package/dist/index.mjs +0 -1
  105. package/dist/predict/client.d.mts +255 -0
  106. package/dist/predict/client.d.mts.map +1 -0
  107. package/dist/predict/client.mjs +436 -0
  108. package/dist/predict/client.mjs.map +1 -0
  109. package/dist/predict/config/generated.d.mts +29 -0
  110. package/dist/predict/config/generated.d.mts.map +1 -0
  111. package/dist/predict/config/generated.mjs +16 -0
  112. package/dist/predict/config/generated.mjs.map +1 -0
  113. package/dist/predict/config/index.d.mts +10 -0
  114. package/dist/predict/config/index.d.mts.map +1 -0
  115. package/dist/predict/config/index.mjs +13 -0
  116. package/dist/predict/config/index.mjs.map +1 -0
  117. package/dist/predict/config/testnet.d.mts +17 -0
  118. package/dist/predict/config/testnet.d.mts.map +1 -0
  119. package/dist/predict/config/testnet.mjs +26 -0
  120. package/dist/predict/config/testnet.mjs.map +1 -0
  121. package/dist/predict/config/types.d.mts +55 -0
  122. package/dist/predict/config/types.d.mts.map +1 -0
  123. package/dist/predict/decode.d.mts +162 -0
  124. package/dist/predict/decode.d.mts.map +1 -0
  125. package/dist/predict/decode.mjs +175 -0
  126. package/dist/predict/decode.mjs.map +1 -0
  127. package/dist/predict/errors.d.mts +42 -0
  128. package/dist/predict/errors.d.mts.map +1 -0
  129. package/dist/predict/errors.mjs +37 -0
  130. package/dist/predict/errors.mjs.map +1 -0
  131. package/dist/predict/index.d.mts +18 -0
  132. package/dist/predict/index.mjs +14 -0
  133. package/dist/predict/pricing.d.mts +73 -0
  134. package/dist/predict/pricing.d.mts.map +1 -0
  135. package/dist/predict/pricing.mjs +129 -0
  136. package/dist/predict/pricing.mjs.map +1 -0
  137. package/dist/predict/reads/balances.mjs +41 -0
  138. package/dist/predict/reads/balances.mjs.map +1 -0
  139. package/dist/predict/reads/inspect.d.mts +8 -0
  140. package/dist/predict/reads/inspect.d.mts.map +1 -0
  141. package/dist/predict/reads/inspect.mjs +37 -0
  142. package/dist/predict/reads/inspect.mjs.map +1 -0
  143. package/dist/predict/reads/markets.mjs +130 -0
  144. package/dist/predict/reads/markets.mjs.map +1 -0
  145. package/dist/predict/reads/parse.mjs +20 -0
  146. package/dist/predict/reads/parse.mjs.map +1 -0
  147. package/dist/predict/reads/pool.mjs +26 -0
  148. package/dist/predict/reads/pool.mjs.map +1 -0
  149. package/dist/predict/reads/positions.d.mts +12 -0
  150. package/dist/predict/reads/positions.d.mts.map +1 -0
  151. package/dist/predict/reads/positions.mjs +77 -0
  152. package/dist/predict/reads/positions.mjs.map +1 -0
  153. package/dist/predict/reads/pricing.d.mts +20 -0
  154. package/dist/predict/reads/pricing.d.mts.map +1 -0
  155. package/dist/predict/reads/pricing.mjs +43 -0
  156. package/dist/predict/reads/pricing.mjs.map +1 -0
  157. package/dist/predict/ticks.d.mts +11 -0
  158. package/dist/predict/ticks.d.mts.map +1 -0
  159. package/dist/predict/ticks.mjs +21 -0
  160. package/dist/predict/ticks.mjs.map +1 -0
  161. package/dist/predict/tx/authed.mjs +18 -0
  162. package/dist/predict/tx/authed.mjs.map +1 -0
  163. package/dist/predict/tx/common.d.mts +18 -0
  164. package/dist/predict/tx/common.d.mts.map +1 -0
  165. package/dist/predict/tx/common.mjs +52 -0
  166. package/dist/predict/tx/common.mjs.map +1 -0
  167. package/dist/predict/tx/trade.d.mts +15 -0
  168. package/dist/predict/tx/trade.d.mts.map +1 -0
  169. package/dist/predict/tx/trade.mjs +86 -0
  170. package/dist/predict/tx/trade.mjs.map +1 -0
  171. package/dist/predict/units.d.mts +11 -0
  172. package/dist/predict/units.d.mts.map +1 -0
  173. package/dist/predict/units.mjs +44 -0
  174. package/dist/predict/units.mjs.map +1 -0
  175. package/dist/queries/accountQueries.mjs +0 -1
  176. package/dist/queries/accountQueries.mjs.map +1 -1
  177. package/dist/queries/orderQueries.mjs +0 -1
  178. package/dist/queries/orderQueries.mjs.map +1 -1
  179. package/dist/queries/registryQueries.mjs +0 -1
  180. package/dist/queries/registryQueries.mjs.map +1 -1
  181. package/dist/sessions.d.mts +244 -0
  182. package/dist/sessions.d.mts.map +1 -0
  183. package/dist/sessions.mjs +291 -0
  184. package/dist/sessions.mjs.map +1 -0
  185. package/dist/transactions/balanceManager.d.mts +12 -12
  186. package/dist/transactions/balanceManager.d.mts.map +1 -1
  187. package/dist/transactions/deepbook.d.mts +20 -20
  188. package/dist/transactions/deepbook.d.mts.map +1 -1
  189. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  190. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  191. package/dist/transactions/marginAdmin.d.mts +7 -7
  192. package/dist/transactions/marginLiquidations.d.mts +3 -3
  193. package/dist/transactions/marginMaintainer.d.mts +5 -5
  194. package/dist/transactions/marginManager.d.mts +32 -32
  195. package/dist/transactions/marginPool.d.mts +18 -18
  196. package/dist/transactions/marginRegistry.d.mts +16 -16
  197. package/dist/transactions/marginTPSL.d.mts +10 -10
  198. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  199. package/dist/transactions/poolProxy.d.mts +8 -8
  200. package/dist/transactions/poolProxy.d.mts.map +1 -1
  201. package/package.json +25 -4
  202. package/src/account.ts +239 -0
  203. package/src/bcs/integers.ts +35 -0
  204. package/src/contracts/account/account.ts +706 -0
  205. package/src/contracts/account/account_events.ts +64 -0
  206. package/src/contracts/account/account_registry.ts +468 -0
  207. package/src/contracts/account/config-arguments.ts +8 -0
  208. package/src/contracts/account/deps/sui/bag.ts +42 -0
  209. package/src/contracts/deepbook_predict/admin.ts +44 -0
  210. package/src/contracts/deepbook_predict/builder_code.ts +155 -0
  211. package/src/contracts/deepbook_predict/builder_code_events.ts +34 -0
  212. package/src/contracts/deepbook_predict/config-arguments.ts +11 -0
  213. package/src/contracts/deepbook_predict/config_events.ts +140 -0
  214. package/src/contracts/deepbook_predict/deps/fixed_math/i64.ts +21 -0
  215. package/src/contracts/deepbook_predict/deps/sui/balance.ts +25 -0
  216. package/src/contracts/deepbook_predict/deps/sui/coin.ts +20 -0
  217. package/src/contracts/deepbook_predict/deps/sui/table.ts +37 -0
  218. package/src/contracts/deepbook_predict/deps/sui/vec_set.ts +22 -0
  219. package/src/contracts/deepbook_predict/ewma.ts +26 -0
  220. package/src/contracts/deepbook_predict/ewma_config.ts +28 -0
  221. package/src/contracts/deepbook_predict/expiry_cash.ts +24 -0
  222. package/src/contracts/deepbook_predict/expiry_market.ts +1549 -0
  223. package/src/contracts/deepbook_predict/lp_book.ts +105 -0
  224. package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +75 -0
  225. package/src/contracts/deepbook_predict/market_manager.ts +218 -0
  226. package/src/contracts/deepbook_predict/order.ts +24 -0
  227. package/src/contracts/deepbook_predict/order_events.ts +129 -0
  228. package/src/contracts/deepbook_predict/pause_cap.ts +68 -0
  229. package/src/contracts/deepbook_predict/plp.ts +987 -0
  230. package/src/contracts/deepbook_predict/pool_accounting.ts +79 -0
  231. package/src/contracts/deepbook_predict/predict_account.ts +180 -0
  232. package/src/contracts/deepbook_predict/pricing.ts +124 -0
  233. package/src/contracts/deepbook_predict/pricing_config.ts +41 -0
  234. package/src/contracts/deepbook_predict/protocol_config.ts +1066 -0
  235. package/src/contracts/deepbook_predict/range_codec.ts +53 -0
  236. package/src/contracts/deepbook_predict/registry.ts +694 -0
  237. package/src/contracts/deepbook_predict/strike_exposure.ts +77 -0
  238. package/src/contracts/deepbook_predict/strike_exposure_config.ts +46 -0
  239. package/src/contracts/deepbook_predict/strike_payout_tree.ts +89 -0
  240. package/src/contracts/deepbook_predict/vault_events.ts +222 -0
  241. package/src/contracts/deepbook_sessions/config-arguments.ts +8 -0
  242. package/src/contracts/deepbook_sessions/deps/sui/vec_map.ts +33 -0
  243. package/src/contracts/deepbook_sessions/session_config.ts +130 -0
  244. package/src/contracts/deepbook_sessions/sessions.ts +663 -0
  245. package/src/contracts/propbook/block_scholes_store.ts +842 -0
  246. package/src/contracts/propbook/deps/sui/table.ts +37 -0
  247. package/src/contracts/propbook/oracle_lane.ts +170 -0
  248. package/src/contracts/propbook/pyth_feed.ts +414 -0
  249. package/src/contracts/propbook/registry.ts +596 -0
  250. package/src/deployments/index.ts +73 -0
  251. package/src/deployments/testnet.ts +107 -0
  252. package/src/deployments/types.ts +81 -0
  253. package/src/index.ts +5 -0
  254. package/src/predict/client.ts +941 -0
  255. package/src/predict/config/generated.ts +39 -0
  256. package/src/predict/config/index.ts +25 -0
  257. package/src/predict/config/testnet.ts +27 -0
  258. package/src/predict/config/types.ts +52 -0
  259. package/src/predict/decode.ts +476 -0
  260. package/src/predict/errors.ts +83 -0
  261. package/src/predict/index.ts +94 -0
  262. package/src/predict/pricing.ts +199 -0
  263. package/src/predict/reads/balances.ts +55 -0
  264. package/src/predict/reads/inspect.ts +78 -0
  265. package/src/predict/reads/markets.ts +222 -0
  266. package/src/predict/reads/parse.ts +30 -0
  267. package/src/predict/reads/pool.ts +37 -0
  268. package/src/predict/reads/positions.ts +144 -0
  269. package/src/predict/reads/pricing.ts +79 -0
  270. package/src/predict/ticks.ts +42 -0
  271. package/src/predict/tx/authed.ts +20 -0
  272. package/src/predict/tx/common.ts +92 -0
  273. package/src/predict/tx/trade.ts +183 -0
  274. package/src/predict/units.ts +49 -0
  275. package/src/sessions.ts +471 -0
  276. package/dist/types/bcs.mjs +0 -7
@@ -1,5 +1,5 @@
1
1
  import { DeepBookConfig } from "../utils/config.mjs";
2
- import * as _mysten_sui_transactions106 from "@mysten/sui/transactions";
2
+ import * as _mysten_sui_transactions177 from "@mysten/sui/transactions";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
 
5
5
  //#region src/transactions/marginRegistry.d.ts
@@ -17,90 +17,90 @@ declare class MarginRegistryContract {
17
17
  * @param {string} poolKey The key to identify the pool
18
18
  * @returns A function that takes a Transaction object
19
19
  */
20
- poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
20
+ poolEnabled: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
21
21
  /**
22
22
  * @description Get the margin pool ID for a given asset
23
23
  * @param {string} coinKey The key to identify the coin
24
24
  * @returns A function that takes a Transaction object
25
25
  */
26
- getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
26
+ getMarginPoolId: (coinKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
27
27
  /**
28
28
  * @description Get the margin pool IDs (base and quote) for a deepbook pool
29
29
  * @param {string} poolKey The key to identify the pool
30
30
  * @returns A function that takes a Transaction object
31
31
  */
32
- getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
32
+ getDeepbookPoolMarginPoolIds: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
33
33
  /**
34
34
  * @description Get the margin manager IDs for a given owner
35
35
  * @param {string} owner The owner address
36
36
  * @returns A function that takes a Transaction object
37
37
  */
38
- getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
38
+ getMarginManagerIds: (owner: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
39
39
  /**
40
40
  * @description Get the base margin pool ID for a deepbook pool
41
41
  * @param {string} poolKey The key to identify the pool
42
42
  * @returns A function that takes a Transaction object
43
43
  */
44
- baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
44
+ baseMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
45
45
  /**
46
46
  * @description Get the quote margin pool ID for a deepbook pool
47
47
  * @param {string} poolKey The key to identify the pool
48
48
  * @returns A function that takes a Transaction object
49
49
  */
50
- quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
50
+ quoteMarginPoolId: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
51
51
  /**
52
52
  * @description Get the minimum withdraw risk ratio for a deepbook pool
53
53
  * @param {string} poolKey The key to identify the pool
54
54
  * @returns A function that takes a Transaction object
55
55
  */
56
- minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
56
+ minWithdrawRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
57
57
  /**
58
58
  * @description Get the minimum borrow risk ratio for a deepbook pool
59
59
  * @param {string} poolKey The key to identify the pool
60
60
  * @returns A function that takes a Transaction object
61
61
  */
62
- minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
62
+ minBorrowRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
63
63
  /**
64
64
  * @description Get the minimum risk ratio required to open a new position on
65
65
  * a deepbook pool. Distinct from `minBorrowRiskRatio`, which gates borrowing.
66
66
  * @param {string} poolKey The key to identify the pool
67
67
  * @returns A function that takes a Transaction object
68
68
  */
69
- minOpenRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
69
+ minOpenRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
70
70
  /**
71
71
  * @description Get the liquidation risk ratio for a deepbook pool
72
72
  * @param {string} poolKey The key to identify the pool
73
73
  * @returns A function that takes a Transaction object
74
74
  */
75
- liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
75
+ liquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
76
76
  /**
77
77
  * @description Get the target liquidation risk ratio for a deepbook pool
78
78
  * @param {string} poolKey The key to identify the pool
79
79
  * @returns A function that takes a Transaction object
80
80
  */
81
- targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
81
+ targetLiquidationRiskRatio: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
82
82
  /**
83
83
  * @description Get the user liquidation reward for a deepbook pool
84
84
  * @param {string} poolKey The key to identify the pool
85
85
  * @returns A function that takes a Transaction object
86
86
  */
87
- userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
87
+ userLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
88
88
  /**
89
89
  * @description Get the pool liquidation reward for a deepbook pool
90
90
  * @param {string} poolKey The key to identify the pool
91
91
  * @returns A function that takes a Transaction object
92
92
  */
93
- poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
93
+ poolLiquidationReward: (poolKey: string) => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
94
94
  /**
95
95
  * @description Get all allowed maintainer cap IDs
96
96
  * @returns A function that takes a Transaction object
97
97
  */
98
- allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
98
+ allowedMaintainers: () => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
99
99
  /**
100
100
  * @description Get all allowed pause cap IDs
101
101
  * @returns A function that takes a Transaction object
102
102
  */
103
- allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
103
+ allowedPauseCaps: () => (tx: Transaction) => _mysten_sui_transactions177.TransactionResult;
104
104
  }
105
105
  //#endregion
106
106
  export { MarginRegistryContract };
@@ -1,6 +1,6 @@
1
1
  import { AddConditionalOrderParams, PendingLimitOrderParams, PendingMarketOrderParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions33 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions113 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/marginTPSL.d.ts
@@ -20,21 +20,21 @@ declare class MarginTPSLContract {
20
20
  * @param {number} triggerPrice The price at which to trigger the order
21
21
  * @returns A function that takes a Transaction object
22
22
  */
23
- newCondition: (poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
23
+ newCondition: (poolKey: string, triggerBelowPrice: boolean, triggerPrice: number | bigint) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
24
24
  /**
25
25
  * @description Create a new pending limit order for use in conditional orders
26
26
  * @param {string} poolKey The key to identify the pool
27
27
  * @param {PendingLimitOrderParams} params Parameters for the pending limit order
28
28
  * @returns A function that takes a Transaction object
29
29
  */
30
- newPendingLimitOrder: (poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
30
+ newPendingLimitOrder: (poolKey: string, params: PendingLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
31
31
  /**
32
32
  * @description Create a new pending market order for use in conditional orders
33
33
  * @param {string} poolKey The key to identify the pool
34
34
  * @param {PendingMarketOrderParams} params Parameters for the pending market order
35
35
  * @returns A function that takes a Transaction object
36
36
  */
37
- newPendingMarketOrder: (poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
37
+ newPendingMarketOrder: (poolKey: string, params: PendingMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
38
38
  /**
39
39
  * @description Add a conditional order (take profit or stop loss)
40
40
  * @param {AddConditionalOrderParams} params Parameters for adding the conditional order
@@ -65,7 +65,7 @@ declare class MarginTPSLContract {
65
65
  * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call
66
66
  * @returns A function that takes a Transaction object
67
67
  */
68
- executeConditionalOrders: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
68
+ executeConditionalOrders: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
69
69
  /**
70
70
  * @description Execute conditional orders, deleveraging on each market-type
71
71
  * fill. Permissionless, with the same trigger and cancellation handling as
@@ -83,14 +83,14 @@ declare class MarginTPSLContract {
83
83
  * @param {number} maxOrdersToExecute Maximum number of orders to execute in this call
84
84
  * @returns A function that takes a Transaction object
85
85
  */
86
- executeConditionalOrdersV3: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
86
+ executeConditionalOrdersV3: (managerAddress: string, poolKey: string, maxOrdersToExecute: number) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
87
87
  /**
88
88
  * @description Get all conditional order IDs for a margin manager
89
89
  * @param {string} poolKey The key to identify the pool
90
90
  * @param {string} marginManagerId The ID of the margin manager
91
91
  * @returns A function that takes a Transaction object
92
92
  */
93
- conditionalOrderIds: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
93
+ conditionalOrderIds: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
94
94
  /**
95
95
  * @description Get a specific conditional order by ID
96
96
  * @param {string} poolKey The key to identify the pool
@@ -98,7 +98,7 @@ declare class MarginTPSLContract {
98
98
  * @param {string} conditionalOrderId The ID of the conditional order
99
99
  * @returns A function that takes a Transaction object
100
100
  */
101
- conditionalOrder: (poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
101
+ conditionalOrder: (poolKey: string, marginManagerId: string, conditionalOrderId: string) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
102
102
  /**
103
103
  * @description Get the lowest trigger price for trigger_above orders
104
104
  * Returns constants::max_u64() if there are no trigger_above orders
@@ -106,7 +106,7 @@ declare class MarginTPSLContract {
106
106
  * @param {string} marginManagerId The ID of the margin manager
107
107
  * @returns A function that takes a Transaction object
108
108
  */
109
- lowestTriggerAbovePrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
109
+ lowestTriggerAbovePrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
110
110
  /**
111
111
  * @description Get the highest trigger price for trigger_below orders
112
112
  * Returns 0 if there are no trigger_below orders
@@ -114,7 +114,7 @@ declare class MarginTPSLContract {
114
114
  * @param {string} marginManagerId The ID of the margin manager
115
115
  * @returns A function that takes a Transaction object
116
116
  */
117
- highestTriggerBelowPrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions33.TransactionResult;
117
+ highestTriggerBelowPrice: (poolKey: string, marginManagerId: string) => (tx: Transaction) => _mysten_sui_transactions113.TransactionResult;
118
118
  }
119
119
  //#endregion
120
120
  export { MarginTPSLContract };
@@ -1 +1 @@
1
- {"version":3,"file":"marginTPSL.d.mts","names":[],"sources":["../../src/transactions/marginTPSL.ts"],"mappings":";;;;;;;;;cAoBa,kBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAiDO;;;;;;;EA3B3B,YAAA,GACE,OAAA,UAAiB,iBAAA,WAA4B,YAAA,uBAC7C,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAyI+C;;;;;;EAjHhE,oBAAA,GACE,OAAA,UAAiB,MAAA,EAAQ,uBAAA,MAA6B,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAyOa;;;;;;EAlMpF,qBAAA,GACE,OAAA,UAAiB,MAAA,EAAQ,wBAAA,MAA8B,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rderParams, PlaceMarginMarketOrderParams } from "../types/index.mjs";
2
2
  import { DeepBookConfig } from "../utils/config.mjs";
3
- import * as _mysten_sui_transactions99 from "@mysten/sui/transactions";
3
+ import * as _mysten_sui_transactions106 from "@mysten/sui/transactions";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
 
6
6
  //#region src/transactions/poolProxy.d.ts
@@ -20,7 +20,7 @@ declare class PoolProxyContract {
20
20
  * @param {PlaceMarginLimitOrderParams} params Parameters for placing a limit order
21
21
  * @returns A function that takes a Transaction object
22
22
  */
23
- placeLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
23
+ placeLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
24
24
  /**
25
25
  * @description Place a market order. Enforces a post-trade `risk_ratio >=
26
26
  * min_borrow_risk_ratio` invariant on the manager (skipped when the manager
@@ -28,7 +28,7 @@ declare class PoolProxyContract {
28
28
  * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order
29
29
  * @returns A function that takes a Transaction object
30
30
  */
31
- placeMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
31
+ placeMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
32
32
  /**
33
33
  * @description Place a reduce only limit order. Requires the manager to have
34
34
  * debt on the relevant side; enforces a monotonic `risk_ratio_after >=
@@ -37,7 +37,7 @@ declare class PoolProxyContract {
37
37
  * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order
38
38
  * @returns A function that takes a Transaction object
39
39
  */
40
- placeReduceOnlyLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
40
+ placeReduceOnlyLimitOrder: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
41
41
  /**
42
42
  * @description Place a reduce only market order. Requires the manager to
43
43
  * have debt on the relevant side; enforces a monotonic `risk_ratio_after >=
@@ -46,7 +46,7 @@ declare class PoolProxyContract {
46
46
  * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order
47
47
  * @returns A function that takes a Transaction object
48
48
  */
49
- placeReduceOnlyMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
49
+ placeReduceOnlyMarketOrder: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
50
50
  /**
51
51
  * @description Place a market order and repay the loan from the fill proceeds.
52
52
  * The taker fill settles into the manager's balance, so the proceeds (plus any
@@ -58,7 +58,7 @@ declare class PoolProxyContract {
58
58
  * @param {PlaceMarginMarketOrderParams} params Parameters for placing a market order
59
59
  * @returns A function that takes a Transaction object
60
60
  */
61
- placeMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
61
+ placeMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
62
62
  /**
63
63
  * @description Place a reduce only limit order and repay the loan from the
64
64
  * fill proceeds. Requires debt on the relevant side (a bid needs base debt; an
@@ -68,7 +68,7 @@ declare class PoolProxyContract {
68
68
  * @param {PlaceMarginLimitOrderParams} params Parameters for placing a reduce only limit order
69
69
  * @returns A function that takes a Transaction object
70
70
  */
71
- placeReduceOnlyLimitOrderAndRepayLoan: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
71
+ placeReduceOnlyLimitOrderAndRepayLoan: (params: PlaceMarginLimitOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
72
72
  /**
73
73
  * @description Place a reduce only market order and repay the loan from the
74
74
  * fill proceeds. Same reduce-only direction guard as
@@ -78,7 +78,7 @@ declare class PoolProxyContract {
78
78
  * @param {PlaceMarginMarketOrderParams} params Parameters for placing a reduce only market order
79
79
  * @returns A function that takes a Transaction object
80
80
  */
81
- placeReduceOnlyMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions99.TransactionResult;
81
+ placeReduceOnlyMarketOrderAndRepayLoan: (params: PlaceMarginMarketOrderParams) => (tx: Transaction) => _mysten_sui_transactions106.TransactionResult;
82
82
  /**
83
83
  * @description Modify an existing order
84
84
  * @param {string} marginManagerKey The key to identify the MarginManager
@@ -1 +1 @@
1
- {"version":3,"file":"poolProxy.d.mts","names":[],"sources":["../../src/transactions/poolProxy.ts"],"mappings":";;;;;;;;;cAmBa,iBAAA;EAAA;;;;cAMA,MAAA,EAAQ,cAAA;EAoBuD;;;;;;;EAA3E,eAAA,GAAmB,MAAA,EAAQ,2BAAA,MAAiC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EA0JC;;;;;;;EArG5E,gBAAA,GAAoB,MAAA,EAAQ,4BAAA,MAAkC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAgQnE;;;;;;;;EAjNV,yBAAA,GAA6B,MAAA,EAAQ,2BAAA,MAAiC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAsZxC;;;;;;;;EAhW7C,0BAAA,GAA8B,MAAA,EAAQ,4BAAA,MAAkC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;;;;;;;;;;;;EAkDvF,4BAAA,GAAgC,MAAA,EAAQ,4BAAA,MAAkC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAvJrE;;;;;;;;;EAuMpB,qCAAA,GACE,MAAA,EAAQ,2BAAA,MAAiC,EAAA,EAAI,WAAA,KAAW,0BAAA,CAAA,iBAAA;EAnG1D;;;;;;;;;EA0JA,sCAAA,GACE,MAAA,EAAQ,4BAAA,MAAkC,EAAA,EAAI,WAAA,KAAW,0BA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;;;EAAR,IAAA,GAAQ,gBAAA,UAA0B,UAAA,cAAwB,EAAA,EAAI,WAAA;EAwBjB;;;;;EAA7C,WAAA,GAAe,gBAAA,cAA8B,EAAA,EAAI,WAAA;EA+CjD;;;;;;EAvBA,4BAAA,GACE,OAAA,UAAiB,eAAA,cAA6B,EAAA,EAAI,WAAA;;;;;;EAsBpD,kBAAA,GAAsB,OAAA,cAAqB,EAAA,EAAI,WAAA;AAAA"}
package/package.json CHANGED
@@ -2,9 +2,10 @@
2
2
  "name": "@mysten/deepbook-v3",
3
3
  "author": "Mysten Labs <build@mystenlabs.com>",
4
4
  "description": "Sui Deepbook SDK",
5
- "version": "2.0.1",
5
+ "version": "2.1.4",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
8
+ "sideEffects": false,
8
9
  "main": "./dist/index.mjs",
9
10
  "types": "./dist/index.d.mts",
10
11
  "exports": {
@@ -12,10 +13,26 @@
12
13
  "types": "./dist/index.d.mts",
13
14
  "import": "./dist/index.mjs",
14
15
  "default": "./dist/index.mjs"
16
+ },
17
+ "./account": {
18
+ "types": "./dist/account.d.mts",
19
+ "import": "./dist/account.mjs",
20
+ "default": "./dist/account.mjs"
21
+ },
22
+ "./sessions": {
23
+ "types": "./dist/sessions.d.mts",
24
+ "import": "./dist/sessions.mjs",
25
+ "default": "./dist/sessions.mjs"
26
+ },
27
+ "./predict": {
28
+ "types": "./dist/predict/index.d.mts",
29
+ "import": "./dist/predict/index.mjs",
30
+ "default": "./dist/predict/index.mjs"
15
31
  }
16
32
  },
17
33
  "files": [
18
34
  "CHANGELOG.md",
35
+ "PREDICT.md",
19
36
  "dist",
20
37
  "src"
21
38
  ],
@@ -48,7 +65,7 @@
48
65
  "wait-on": "^9.1.0"
49
66
  },
50
67
  "peerDependencies": {
51
- "@mysten/sui": "^2.26.2"
68
+ "@mysten/sui": "^2.29.0"
52
69
  },
53
70
  "scripts": {
54
71
  "clean": "rm -rf tsconfig.tsbuildinfo ./dist",
@@ -58,8 +75,12 @@
58
75
  "prettier:fix": "prettier -w --ignore-unknown .",
59
76
  "oxlint:check": "oxlint .",
60
77
  "oxlint:fix": "oxlint --fix",
61
- "test": "vitest run",
78
+ "test": "pnpm run config:typecheck && vitest run",
62
79
  "lint": "pnpm run oxlint:check && pnpm run prettier:check",
63
- "lint:fix": "pnpm run oxlint:fix && pnpm run prettier:fix"
80
+ "lint:fix": "pnpm run oxlint:fix && pnpm run prettier:fix",
81
+ "sync-deployment": "tsx scripts/sync-deployment.ts",
82
+ "sync-deployment:format": "prettier --write src/deployments",
83
+ "test:e2e": "PREDICT_SDK_TESTNET=1 vitest run test/predict/testnet",
84
+ "config:typecheck": "tsc --noEmit -p tsconfig.config.json"
64
85
  }
65
86
  }
package/src/account.ts ADDED
@@ -0,0 +1,239 @@
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { bcs } from '@mysten/sui/bcs';
4
+ import type {
5
+ Transaction,
6
+ TransactionObjectArgument,
7
+ TransactionResult,
8
+ } from '@mysten/sui/transactions';
9
+ import { deriveObjectID } from '@mysten/sui/utils';
10
+
11
+ import * as account from './contracts/account/account.js';
12
+ import * as accountRegistry from './contracts/account/account_registry.js';
13
+ import type { AccountConfig as GeneratedAccountConfig } from './contracts/account/config-arguments.js';
14
+ import { TESTNET_ACCOUNT } from './deployments/testnet.js';
15
+ import type { NetworkArg } from './deployments/index.js';
16
+
17
+ // Provenance: which on-chain deployment the ids above came from. Re-exported so a consumer
18
+ // can answer "which deploy is this build pinned to?" without reaching for another subpath.
19
+ export { getDeployment, getUnits, TESTNET_DEPLOYMENT, TESTNET_UNITS } from './deployments/index.js';
20
+ export type { NetworkArg } from './deployments/index.js';
21
+ export type { DeployedNetwork } from './deployments/index.js';
22
+
23
+ /**
24
+ * The deployed ids of the shared `account` package this contract builds against.
25
+ *
26
+ * Kept deliberately minimal — ids only — so any consumer of the shared account primitive
27
+ * (DeepBook core's account wrapper, Predict, …) can drive these builders with its OWN
28
+ * deployment's ids without constructing a full product-SDK config.
29
+ *
30
+ * Extends the codegen-generated config interface so there is exactly one config shape and
31
+ * casing: the generated bindings resolve `options.config` against these same keys, and if
32
+ * codegen adds, drops, or renames a key this file stops compiling instead of silently
33
+ * building a PTB against the wrong object. The ids are narrowed to `string` — codegen types
34
+ * the package id as optional and the registry as the wider `ConfigValue`, but the
35
+ * wrapper-address derivation needs plain ids.
36
+ */
37
+ export interface AccountConfig extends GeneratedAccountConfig {
38
+ /** The `account` Move package id. */
39
+ accountPackageId: string;
40
+ /** The shared `AccountRegistry` object id. */
41
+ accountRegistry: string;
42
+ }
43
+
44
+ /**
45
+ * @description The deployed `account` ids for `network`, so a caller does not transcribe
46
+ * them. Generated from the deploy manifest — see `src/deployments/`.
47
+ * @throws if the network has no recorded deployment, rather than returning placeholder ids
48
+ * that would fail as a confusing on-chain abort.
49
+ *
50
+ * ```ts
51
+ * const account = new AccountContract(getAccountConfig('testnet'));
52
+ * ```
53
+ */
54
+ export function getAccountConfig(network: NetworkArg): AccountConfig {
55
+ if (network === 'testnet') return TESTNET_ACCOUNT;
56
+ throw new Error(
57
+ `@mysten/deepbook-v3/account: no account deployment recorded for network '${network}'. ` +
58
+ 'The account primitive is testnet-only today; for your own deployment pass ' +
59
+ '`{ accountPackageId, accountRegistry }` to AccountContract directly.',
60
+ );
61
+ }
62
+
63
+ // `AccountWrapperKey(address)` is a one-field positional struct, so its BCS is just the
64
+ // owner's 32-byte address. See `packages/account/sources/account_registry.move`.
65
+ const AccountWrapperKey = bcs.struct('AccountWrapperKey', {
66
+ pos0: bcs.Address,
67
+ });
68
+
69
+ /**
70
+ * AccountContract — the reusable on-chain account primitive (`packages/account`).
71
+ *
72
+ * An owner has one canonical `AccountWrapper`, a *derived* object of the account registry,
73
+ * so its id is computable off-chain (no read). The wrapper holds an `Account` whose custody
74
+ * balances apps deposit into and withdraw from; app-specific data hangs off it under an
75
+ * app-keyed slot. Authority is a hot-potato `Auth` minted from the tx sender and consumed
76
+ * by the very next account-loading call.
77
+ */
78
+ export class AccountContract {
79
+ #config: AccountConfig;
80
+
81
+ /**
82
+ * @param {AccountConfig} config Deployed ids of the shared `account` package
83
+ */
84
+ constructor(config: AccountConfig) {
85
+ this.#config = config;
86
+ }
87
+
88
+ /**
89
+ * @description The deterministic id of an owner's canonical account wrapper — no chain
90
+ * read needed. The wrapper is a derived object of the account registry, so its id is
91
+ * `derive_address(registry, AccountWrapperKey(owner))`.
92
+ * @param {string} owner Owner address
93
+ * @returns The wrapper object id
94
+ */
95
+ deriveAccountWrapperId(owner: string): string {
96
+ const key = AccountWrapperKey.serialize({ pos0: owner }).toBytes();
97
+ return deriveObjectID(
98
+ this.#config.accountRegistry,
99
+ `${this.#config.accountPackageId}::account_registry::AccountWrapperKey`,
100
+ key,
101
+ );
102
+ }
103
+
104
+ /**
105
+ * @description Mint owner authority for the transaction sender. A hot-potato `Auth`
106
+ * consumed by the very next account-loading call (`load_account_mut` inside
107
+ * `deposit_funds` / `withdraw_funds` / an app's own entrypoints).
108
+ * @returns A function that takes a Transaction object
109
+ */
110
+ generateAuth() {
111
+ return (tx: Transaction): TransactionResult =>
112
+ tx.add(account.generateAuth({ config: this.#config }));
113
+ }
114
+
115
+ /**
116
+ * @description Create the sender's canonical account wrapper and share it. `new` derives
117
+ * the wrapper at its deterministic address (see `deriveAccountWrapperId`) and aborts if
118
+ * it already exists; `share` publishes the shared object apps borrow against.
119
+ * @returns A function that takes a Transaction object
120
+ */
121
+ createAccount() {
122
+ return (tx: Transaction): void => {
123
+ const wrapper = tx.add(accountRegistry._new({ config: this.#config }));
124
+ tx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));
125
+ };
126
+ }
127
+
128
+ /**
129
+ * @description First-time funding in ONE PTB: create the sender's wrapper, deposit
130
+ * `coin` through the fresh handle, then `share` LAST (once shared, by-value use of the
131
+ * handle is over). This cannot be split into `createAccount` + `depositFunds`: an object
132
+ * input can only address an object that pre-exists the PTB, so a wrapper created inside
133
+ * it is reachable only through `new`'s result handle.
134
+ * @param {object} params Coin to deposit and its coin type
135
+ * @returns A function that takes a Transaction object
136
+ */
137
+ createAccountAndDeposit(params: { coin: TransactionObjectArgument; coinType: string }) {
138
+ return (tx: Transaction): void => {
139
+ const wrapper = tx.add(accountRegistry._new({ config: this.#config }));
140
+ const auth = tx.add(this.generateAuth());
141
+ tx.add(
142
+ account.depositFunds({
143
+ config: this.#config,
144
+ arguments: { wrapper, auth, coin: params.coin },
145
+ typeArguments: [params.coinType],
146
+ }),
147
+ );
148
+ tx.add(account.share({ config: this.#config, arguments: { self: wrapper } }));
149
+ };
150
+ }
151
+
152
+ /**
153
+ * @description Deposit a caller-provided `coin` into the account's stored balance via the
154
+ * PTB-callable `deposit_funds` (folds settle → authorize → load → deposit; clock and
155
+ * accumulator root auto-injected). The caller owns coin sourcing.
156
+ * @param {object} params Wrapper id, coin to deposit, and its coin type
157
+ * @returns A function that takes a Transaction object
158
+ */
159
+ depositFunds(params: { wrapperId: string; coin: TransactionObjectArgument; coinType: string }) {
160
+ return (tx: Transaction): void => {
161
+ const auth = tx.add(this.generateAuth());
162
+ tx.add(
163
+ account.depositFunds({
164
+ config: this.#config,
165
+ arguments: { wrapper: params.wrapperId, auth, coin: params.coin },
166
+ typeArguments: [params.coinType],
167
+ }),
168
+ );
169
+ };
170
+ }
171
+
172
+ /**
173
+ * @description Withdraw `amount` (raw u64 units) from the account's stored balance via
174
+ * the PTB-callable `withdraw_funds` (folds settle → authorize → load → withdraw; clock
175
+ * and accumulator root auto-injected), returning the minted `Coin<T>` for the caller to
176
+ * transfer or compose.
177
+ * @param {object} params Wrapper id, raw amount, and coin type
178
+ * @returns A function that takes a Transaction object and returns the `Coin<T>`
179
+ */
180
+ withdrawFunds(params: { wrapperId: string; amount: bigint; coinType: string }) {
181
+ return (tx: Transaction): TransactionResult => {
182
+ const auth = tx.add(this.generateAuth());
183
+ return tx.add(
184
+ account.withdrawFunds({
185
+ config: this.#config,
186
+ arguments: { wrapper: params.wrapperId, auth, amount: params.amount },
187
+ typeArguments: [params.coinType],
188
+ }),
189
+ );
190
+ };
191
+ }
192
+
193
+ /**
194
+ * @description Borrow the `Account` out of its wrapper — the read-side entry point apps
195
+ * chain their own getters onto (`account::balance<T>`, an app's own data accessors).
196
+ * @param {object} params Wrapper id
197
+ * @returns A function that takes a Transaction object and returns the `Account`
198
+ */
199
+ loadAccount(params: { wrapperId: string }) {
200
+ return (tx: Transaction): TransactionResult =>
201
+ tx.add(account.loadAccount({ config: this.#config, arguments: { self: params.wrapperId } }));
202
+ }
203
+
204
+ /**
205
+ * @description Read an owner's stored custody balance for a coin type: chains
206
+ * `load_account(wrapper)` → `balance<T>(account, root, clock)`. Compose in a
207
+ * dev-inspect/simulate PTB and read the u64 return of the LAST command.
208
+ * @param {object} params Owner address and coin type
209
+ * @returns A function that takes a Transaction object
210
+ */
211
+ balance(params: { owner: string; coinType: string }) {
212
+ return (tx: Transaction): TransactionResult => {
213
+ const acct = tx.add(
214
+ this.loadAccount({ wrapperId: this.deriveAccountWrapperId(params.owner) }),
215
+ );
216
+ return tx.add(
217
+ account.balance({
218
+ config: this.#config,
219
+ typeArguments: [params.coinType],
220
+ arguments: { self: acct },
221
+ }),
222
+ );
223
+ };
224
+ }
225
+ }
226
+
227
+ // === Generated bindings ===
228
+ // The move-call thunks and BCS structs, for consumers composing their own PTBs or
229
+ // parsing account objects/events (e.g. `AccountWrapper.parse`, the event layouts).
230
+ //
231
+ // NOTE: `Account` here is the shared account primitive's custody account
232
+ // (`account::account::Account`). It is deliberately NOT re-exported from this
233
+ // package's root — the root already exports a different `Account`
234
+ // (`@deepbook/core::account::Account`, the per-pool trading account) and the two
235
+ // have unrelated layouts. Keep them separated by subpath.
236
+ export * as accountMoveCalls from './contracts/account/account.js';
237
+ export * as accountRegistryMoveCalls from './contracts/account/account_registry.js';
238
+ export * as accountEvents from './contracts/account/account_events.js';
239
+ export { Account, AccountWrapper } from './contracts/account/account.js';
@@ -0,0 +1,35 @@
1
+ // Copyright (c) Mysten Labs, Inc.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Replacement BCS integer types for the generated Move bindings (wired up in
5
+ // `sui-codegen.config.ts` under `bcsOverrides`).
6
+ //
7
+ // `@mysten/sui/bcs` parses the wide integers to decimal *strings*; these parse straight to bigint
8
+ // instead. Serialization still accepts what the plain types accept, so tx builders and test
9
+ // fixtures are unaffected.
10
+ //
11
+ // Representation only — deliberately no scaling. A field's Move type does not determine its
12
+ // scale (custody balances are raw coin units while an app's own fields may be rates), and the
13
+ // exact on-chain integers are what consumers decoding account state and events want.
14
+
15
+ import { bcs } from '@mysten/sui/bcs';
16
+
17
+ const toBigInt = (value: string) => BigInt(value);
18
+
19
+ /** `u64` parsed as a bigint rather than a decimal string. */
20
+ export const U64 = bcs.u64().transform({
21
+ input: (value: number | bigint | string) => value.toString(),
22
+ output: toBigInt,
23
+ });
24
+
25
+ /** `u128` parsed as a bigint rather than a decimal string. */
26
+ export const U128 = bcs.u128().transform({
27
+ input: (value: number | bigint | string) => value.toString(),
28
+ output: toBigInt,
29
+ });
30
+
31
+ /** `u256` parsed as a bigint rather than a decimal string. */
32
+ export const U256 = bcs.u256().transform({
33
+ input: (value: number | bigint | string) => value.toString(),
34
+ output: toBigInt,
35
+ });