@mysten/deepbook-v3 1.5.9 → 1.6.2

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 (177) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dist/client.d.mts +5 -0
  3. package/dist/client.d.mts.map +1 -1
  4. package/dist/client.mjs +7 -0
  5. package/dist/client.mjs.map +1 -1
  6. package/dist/contracts/deepbook/balance_manager.mjs +413 -0
  7. package/dist/contracts/deepbook/balance_manager.mjs.map +1 -0
  8. package/dist/contracts/deepbook/balances.d.mts +4 -4
  9. package/dist/contracts/deepbook/big_vector.mjs +43 -0
  10. package/dist/contracts/deepbook/big_vector.mjs.map +1 -0
  11. package/dist/contracts/deepbook/book.mjs +29 -0
  12. package/dist/contracts/deepbook/book.mjs.map +1 -0
  13. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  14. package/dist/contracts/deepbook/deep_price.mjs +1 -1
  15. package/dist/contracts/deepbook/deps/std/type_name.mjs +17 -0
  16. package/dist/contracts/deepbook/deps/std/type_name.mjs.map +1 -0
  17. package/dist/contracts/deepbook/deps/sui/bag.mjs +43 -0
  18. package/dist/contracts/deepbook/deps/sui/bag.mjs.map +1 -0
  19. package/dist/contracts/deepbook/deps/sui/balance.mjs +21 -0
  20. package/dist/contracts/deepbook/deps/sui/balance.mjs.map +1 -0
  21. package/dist/contracts/deepbook/deps/sui/table.mjs +38 -0
  22. package/dist/contracts/deepbook/deps/sui/table.mjs.map +1 -0
  23. package/dist/contracts/deepbook/deps/sui/vec_map.mjs +37 -0
  24. package/dist/contracts/deepbook/deps/sui/vec_map.mjs.map +1 -0
  25. package/dist/contracts/deepbook/deps/sui/versioned.mjs +19 -0
  26. package/dist/contracts/deepbook/deps/sui/versioned.mjs.map +1 -0
  27. package/dist/contracts/deepbook/governance.mjs +49 -0
  28. package/dist/contracts/deepbook/governance.mjs.map +1 -0
  29. package/dist/contracts/deepbook/history.mjs +56 -0
  30. package/dist/contracts/deepbook/history.mjs.map +1 -0
  31. package/dist/contracts/deepbook/order.d.mts +12 -12
  32. package/dist/contracts/deepbook/pool.mjs +1739 -0
  33. package/dist/contracts/deepbook/pool.mjs.map +1 -0
  34. package/dist/contracts/deepbook/registry.mjs +295 -0
  35. package/dist/contracts/deepbook/registry.mjs.map +1 -0
  36. package/dist/contracts/deepbook/state.mjs +89 -0
  37. package/dist/contracts/deepbook/state.mjs.map +1 -0
  38. package/dist/contracts/deepbook/trade_params.mjs +21 -0
  39. package/dist/contracts/deepbook/trade_params.mjs.map +1 -0
  40. package/dist/contracts/deepbook/vault.mjs +42 -0
  41. package/dist/contracts/deepbook/vault.mjs.map +1 -0
  42. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs +53 -0
  43. package/dist/contracts/deepbook_margin/deps/deepbook/balance_manager.mjs.map +1 -0
  44. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs +17 -0
  45. package/dist/contracts/deepbook_margin/deps/std/type_name.mjs.map +1 -0
  46. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs +43 -0
  47. package/dist/contracts/deepbook_margin/deps/sui/bag.mjs.map +1 -0
  48. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs +21 -0
  49. package/dist/contracts/deepbook_margin/deps/sui/balance.mjs.map +1 -0
  50. package/dist/contracts/deepbook_margin/deps/sui/table.mjs +38 -0
  51. package/dist/contracts/deepbook_margin/deps/sui/table.mjs.map +1 -0
  52. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs +37 -0
  53. package/dist/contracts/deepbook_margin/deps/sui/vec_map.mjs.map +1 -0
  54. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs +26 -0
  55. package/dist/contracts/deepbook_margin/deps/sui/vec_set.mjs.map +1 -0
  56. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs +19 -0
  57. package/dist/contracts/deepbook_margin/deps/sui/versioned.mjs.map +1 -0
  58. package/dist/contracts/deepbook_margin/margin_manager.mjs +989 -0
  59. package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -0
  60. package/dist/contracts/deepbook_margin/margin_pool.mjs +550 -0
  61. package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -0
  62. package/dist/contracts/deepbook_margin/margin_registry.mjs +786 -0
  63. package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -0
  64. package/dist/contracts/deepbook_margin/margin_state.mjs +30 -0
  65. package/dist/contracts/deepbook_margin/margin_state.mjs.map +1 -0
  66. package/dist/contracts/deepbook_margin/oracle.mjs +82 -0
  67. package/dist/contracts/deepbook_margin/oracle.mjs.map +1 -0
  68. package/dist/contracts/deepbook_margin/pool_proxy.mjs +644 -0
  69. package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -0
  70. package/dist/contracts/deepbook_margin/position_manager.mjs +32 -0
  71. package/dist/contracts/deepbook_margin/position_manager.mjs.map +1 -0
  72. package/dist/contracts/deepbook_margin/protocol_config.mjs +122 -0
  73. package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -0
  74. package/dist/contracts/deepbook_margin/protocol_fees.mjs +58 -0
  75. package/dist/contracts/deepbook_margin/protocol_fees.mjs.map +1 -0
  76. package/dist/contracts/deepbook_margin/rate_limiter.mjs +26 -0
  77. package/dist/contracts/deepbook_margin/rate_limiter.mjs.map +1 -0
  78. package/dist/contracts/deepbook_margin/tpsl.mjs +171 -0
  79. package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -0
  80. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs +43 -0
  81. package/dist/contracts/margin_liquidation/deps/sui/bag.mjs.map +1 -0
  82. package/dist/contracts/margin_liquidation/liquidation_vault.mjs +179 -0
  83. package/dist/contracts/margin_liquidation/liquidation_vault.mjs.map +1 -0
  84. package/dist/contracts/utils/index.d.mts +1 -1
  85. package/dist/contracts/utils/index.mjs +92 -3
  86. package/dist/contracts/utils/index.mjs.map +1 -1
  87. package/dist/queries/registryQueries.mjs +13 -0
  88. package/dist/queries/registryQueries.mjs.map +1 -1
  89. package/dist/transactions/balanceManager.d.mts.map +1 -1
  90. package/dist/transactions/balanceManager.mjs +119 -100
  91. package/dist/transactions/balanceManager.mjs.map +1 -1
  92. package/dist/transactions/deepbook.d.mts.map +1 -1
  93. package/dist/transactions/deepbook.mjs +464 -439
  94. package/dist/transactions/deepbook.mjs.map +1 -1
  95. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  96. package/dist/transactions/deepbookAdmin.mjs +151 -135
  97. package/dist/transactions/deepbookAdmin.mjs.map +1 -1
  98. package/dist/transactions/flashLoans.d.mts.map +1 -1
  99. package/dist/transactions/flashLoans.mjs +29 -22
  100. package/dist/transactions/flashLoans.mjs.map +1 -1
  101. package/dist/transactions/governance.d.mts.map +1 -1
  102. package/dist/transactions/governance.mjs +34 -33
  103. package/dist/transactions/governance.mjs.map +1 -1
  104. package/dist/transactions/marginAdmin.d.mts +10 -0
  105. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  106. package/dist/transactions/marginAdmin.mjs +186 -169
  107. package/dist/transactions/marginAdmin.mjs.map +1 -1
  108. package/dist/transactions/marginLiquidations.d.mts +3 -3
  109. package/dist/transactions/marginLiquidations.d.mts.map +1 -1
  110. package/dist/transactions/marginLiquidations.mjs +53 -54
  111. package/dist/transactions/marginLiquidations.mjs.map +1 -1
  112. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  113. package/dist/transactions/marginMaintainer.mjs +83 -83
  114. package/dist/transactions/marginMaintainer.mjs.map +1 -1
  115. package/dist/transactions/marginManager.d.mts.map +1 -1
  116. package/dist/transactions/marginManager.mjs +330 -311
  117. package/dist/transactions/marginManager.mjs.map +1 -1
  118. package/dist/transactions/marginPool.d.mts.map +1 -1
  119. package/dist/transactions/marginPool.mjs +93 -89
  120. package/dist/transactions/marginPool.mjs.map +1 -1
  121. package/dist/transactions/marginRegistry.d.mts +22 -15
  122. package/dist/transactions/marginRegistry.d.mts.map +1 -1
  123. package/dist/transactions/marginRegistry.mjs +101 -68
  124. package/dist/transactions/marginRegistry.mjs.map +1 -1
  125. package/dist/transactions/marginTPSL.d.mts +27 -9
  126. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  127. package/dist/transactions/marginTPSL.mjs +108 -82
  128. package/dist/transactions/marginTPSL.mjs.map +1 -1
  129. package/dist/transactions/poolProxy.d.mts +32 -0
  130. package/dist/transactions/poolProxy.d.mts.map +1 -1
  131. package/dist/transactions/poolProxy.mjs +269 -189
  132. package/dist/transactions/poolProxy.mjs.map +1 -1
  133. package/dist/utils/constants.mjs +4 -4
  134. package/dist/utils/constants.mjs.map +1 -1
  135. package/package.json +2 -2
  136. package/src/client.ts +8 -0
  137. package/src/contracts/deepbook/balance_manager.ts +46 -5
  138. package/src/contracts/deepbook/constants.ts +13 -0
  139. package/src/contracts/deepbook/pool.ts +133 -0
  140. package/src/contracts/deepbook/registry.ts +136 -1
  141. package/src/contracts/deepbook_margin/deps/deepbook/balance_manager.ts +49 -0
  142. package/src/contracts/deepbook_margin/deps/std/type_name.ts +24 -0
  143. package/src/contracts/deepbook_margin/deps/sui/bag.ts +41 -0
  144. package/src/contracts/deepbook_margin/deps/sui/balance.ts +19 -0
  145. package/src/contracts/deepbook_margin/deps/sui/table.ts +36 -0
  146. package/src/contracts/deepbook_margin/deps/sui/vec_map.ts +33 -0
  147. package/src/contracts/deepbook_margin/deps/sui/vec_set.ts +22 -0
  148. package/src/contracts/deepbook_margin/deps/sui/versioned.ts +13 -0
  149. package/src/contracts/deepbook_margin/margin_constants.ts +329 -0
  150. package/src/contracts/deepbook_margin/margin_manager.ts +1772 -0
  151. package/src/contracts/deepbook_margin/margin_pool.ts +1129 -0
  152. package/src/contracts/deepbook_margin/margin_registry.ts +1207 -0
  153. package/src/contracts/deepbook_margin/margin_state.ts +26 -0
  154. package/src/contracts/deepbook_margin/oracle.ts +99 -0
  155. package/src/contracts/deepbook_margin/pool_proxy.ts +1298 -0
  156. package/src/contracts/deepbook_margin/position_manager.ts +28 -0
  157. package/src/contracts/deepbook_margin/protocol_config.ts +163 -0
  158. package/src/contracts/deepbook_margin/protocol_fees.ts +153 -0
  159. package/src/contracts/deepbook_margin/rate_limiter.ts +80 -0
  160. package/src/contracts/deepbook_margin/tpsl.ts +559 -0
  161. package/src/contracts/margin_liquidation/deps/sui/bag.ts +41 -0
  162. package/src/contracts/margin_liquidation/liquidation_vault.ts +401 -0
  163. package/src/queries/registryQueries.ts +15 -0
  164. package/src/transactions/balanceManager.ts +140 -90
  165. package/src/transactions/deepbook.ts +586 -494
  166. package/src/transactions/deepbookAdmin.ts +154 -146
  167. package/src/transactions/flashLoans.ts +29 -20
  168. package/src/transactions/governance.ts +50 -37
  169. package/src/transactions/marginAdmin.ts +247 -188
  170. package/src/transactions/marginLiquidations.ts +70 -55
  171. package/src/transactions/marginMaintainer.ts +106 -88
  172. package/src/transactions/marginManager.ts +414 -348
  173. package/src/transactions/marginPool.ts +140 -103
  174. package/src/transactions/marginRegistry.ts +103 -70
  175. package/src/transactions/marginTPSL.ts +151 -87
  176. package/src/transactions/poolProxy.ts +384 -205
  177. package/src/utils/constants.ts +4 -4
@@ -0,0 +1,1739 @@
1
+ import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
2
+ import { VecSet } from "./deps/sui/vec_set.mjs";
3
+ import { DeepPrice } from "./deep_price.mjs";
4
+ import { Versioned } from "./deps/sui/versioned.mjs";
5
+ import { Book } from "./book.mjs";
6
+ import { State } from "./state.mjs";
7
+ import { Balance } from "./deps/sui/balance.mjs";
8
+ import { Vault } from "./vault.mjs";
9
+ import { bcs } from "@mysten/sui/bcs";
10
+
11
+ //#region src/contracts/deepbook/pool.ts
12
+ /**************************************************************
13
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
14
+ **************************************************************/
15
+ /** Public-facing interface for the package. */
16
+ const $moduleName = "@deepbook/core::pool";
17
+ const Pool = new MoveStruct({
18
+ name: `${$moduleName}::Pool<phantom BaseAsset, phantom QuoteAsset>`,
19
+ fields: {
20
+ id: bcs.Address,
21
+ inner: Versioned
22
+ }
23
+ });
24
+ const PoolInner = new MoveStruct({
25
+ name: `${$moduleName}::PoolInner<phantom BaseAsset, phantom QuoteAsset>`,
26
+ fields: {
27
+ allowed_versions: VecSet(bcs.u64()),
28
+ pool_id: bcs.Address,
29
+ book: Book,
30
+ state: State,
31
+ vault: Vault,
32
+ deep_price: DeepPrice,
33
+ registered_pool: bcs.bool()
34
+ }
35
+ });
36
+ const PoolCreated = new MoveStruct({
37
+ name: `${$moduleName}::PoolCreated<phantom BaseAsset, phantom QuoteAsset>`,
38
+ fields: {
39
+ pool_id: bcs.Address,
40
+ taker_fee: bcs.u64(),
41
+ maker_fee: bcs.u64(),
42
+ tick_size: bcs.u64(),
43
+ lot_size: bcs.u64(),
44
+ min_size: bcs.u64(),
45
+ whitelisted_pool: bcs.bool(),
46
+ treasury_address: bcs.Address
47
+ }
48
+ });
49
+ const BookParamsUpdated = new MoveStruct({
50
+ name: `${$moduleName}::BookParamsUpdated<phantom BaseAsset, phantom QuoteAsset>`,
51
+ fields: {
52
+ pool_id: bcs.Address,
53
+ tick_size: bcs.u64(),
54
+ lot_size: bcs.u64(),
55
+ min_size: bcs.u64(),
56
+ timestamp: bcs.u64()
57
+ }
58
+ });
59
+ const DeepBurned = new MoveStruct({
60
+ name: `${$moduleName}::DeepBurned<phantom BaseAsset, phantom QuoteAsset>`,
61
+ fields: {
62
+ pool_id: bcs.Address,
63
+ deep_burned: bcs.u64()
64
+ }
65
+ });
66
+ const ReferralRewards = new MoveStruct({
67
+ name: `${$moduleName}::ReferralRewards<phantom BaseAsset, phantom QuoteAsset>`,
68
+ fields: {
69
+ multiplier: bcs.u64(),
70
+ base: Balance,
71
+ quote: Balance,
72
+ deep: Balance
73
+ }
74
+ });
75
+ const ReferralClaimedEvent = new MoveStruct({
76
+ name: `${$moduleName}::ReferralClaimedEvent<phantom BaseAsset, phantom QuoteAsset>`,
77
+ fields: {
78
+ referral_id: bcs.Address,
79
+ owner: bcs.Address,
80
+ base_amount: bcs.u64(),
81
+ quote_amount: bcs.u64(),
82
+ deep_amount: bcs.u64()
83
+ }
84
+ });
85
+ const ReferralClaimed = new MoveStruct({
86
+ name: `${$moduleName}::ReferralClaimed`,
87
+ fields: {
88
+ pool_id: bcs.Address,
89
+ referral_id: bcs.Address,
90
+ owner: bcs.Address,
91
+ base_amount: bcs.u64(),
92
+ quote_amount: bcs.u64(),
93
+ deep_amount: bcs.u64()
94
+ }
95
+ });
96
+ const ReferralFeeEvent = new MoveStruct({
97
+ name: `${$moduleName}::ReferralFeeEvent`,
98
+ fields: {
99
+ pool_id: bcs.Address,
100
+ referral_id: bcs.Address,
101
+ base_fee: bcs.u64(),
102
+ quote_fee: bcs.u64(),
103
+ deep_fee: bcs.u64()
104
+ }
105
+ });
106
+ /**
107
+ * Create a new pool. The pool is registered in the registry. Checks are performed
108
+ * to ensure the tick size, lot size, and min size are valid. The creation fee is
109
+ * transferred to the treasury address. Returns the id of the pool created
110
+ */
111
+ function createPermissionlessPool(options) {
112
+ const packageAddress = options.package ?? "@deepbook/core";
113
+ const argumentsTypes = [
114
+ null,
115
+ "u64",
116
+ "u64",
117
+ "u64",
118
+ null
119
+ ];
120
+ const parameterNames = [
121
+ "registry",
122
+ "tickSize",
123
+ "lotSize",
124
+ "minSize",
125
+ "creationFee"
126
+ ];
127
+ return (tx) => tx.moveCall({
128
+ package: packageAddress,
129
+ module: "pool",
130
+ function: "create_permissionless_pool",
131
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
132
+ typeArguments: options.typeArguments
133
+ });
134
+ }
135
+ /**
136
+ * Place a limit order. Quantity is in base asset terms. For current version
137
+ * pay_with_deep must be true, so the fee will be paid with DEEP tokens.
138
+ */
139
+ function placeLimitOrder(options) {
140
+ const packageAddress = options.package ?? "@deepbook/core";
141
+ const argumentsTypes = [
142
+ null,
143
+ null,
144
+ null,
145
+ "u64",
146
+ "u8",
147
+ "u8",
148
+ "u64",
149
+ "u64",
150
+ "bool",
151
+ "bool",
152
+ "u64",
153
+ "0x2::clock::Clock"
154
+ ];
155
+ const parameterNames = [
156
+ "self",
157
+ "balanceManager",
158
+ "tradeProof",
159
+ "clientOrderId",
160
+ "orderType",
161
+ "selfMatchingOption",
162
+ "price",
163
+ "quantity",
164
+ "isBid",
165
+ "payWithDeep",
166
+ "expireTimestamp"
167
+ ];
168
+ return (tx) => tx.moveCall({
169
+ package: packageAddress,
170
+ module: "pool",
171
+ function: "place_limit_order",
172
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
173
+ typeArguments: options.typeArguments
174
+ });
175
+ }
176
+ /**
177
+ * Place a market order. Quantity is in base asset terms. Calls place_limit_order
178
+ * with a price of MAX_PRICE for bids and MIN_PRICE for asks. Any quantity not
179
+ * filled is cancelled.
180
+ */
181
+ function placeMarketOrder(options) {
182
+ const packageAddress = options.package ?? "@deepbook/core";
183
+ const argumentsTypes = [
184
+ null,
185
+ null,
186
+ null,
187
+ "u64",
188
+ "u8",
189
+ "u64",
190
+ "bool",
191
+ "bool",
192
+ "0x2::clock::Clock"
193
+ ];
194
+ const parameterNames = [
195
+ "self",
196
+ "balanceManager",
197
+ "tradeProof",
198
+ "clientOrderId",
199
+ "selfMatchingOption",
200
+ "quantity",
201
+ "isBid",
202
+ "payWithDeep"
203
+ ];
204
+ return (tx) => tx.moveCall({
205
+ package: packageAddress,
206
+ module: "pool",
207
+ function: "place_market_order",
208
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
209
+ typeArguments: options.typeArguments
210
+ });
211
+ }
212
+ /**
213
+ * Swap exact base quantity without needing a `balance_manager`. DEEP quantity can
214
+ * be overestimated. Returns three `Coin` objects: base, quote, and deep. Some base
215
+ * quantity may be left over, if the input quantity is not divisible by lot size.
216
+ */
217
+ function swapExactBaseForQuote(options) {
218
+ const packageAddress = options.package ?? "@deepbook/core";
219
+ const argumentsTypes = [
220
+ null,
221
+ null,
222
+ null,
223
+ "u64",
224
+ "0x2::clock::Clock"
225
+ ];
226
+ const parameterNames = [
227
+ "self",
228
+ "baseIn",
229
+ "deepIn",
230
+ "minQuoteOut"
231
+ ];
232
+ return (tx) => tx.moveCall({
233
+ package: packageAddress,
234
+ module: "pool",
235
+ function: "swap_exact_base_for_quote",
236
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
237
+ typeArguments: options.typeArguments
238
+ });
239
+ }
240
+ /**
241
+ * Swap exact base for quote with a `balance_manager`. Assumes fees are paid in
242
+ * DEEP. Assumes balance manager has enough DEEP for fees.
243
+ */
244
+ function swapExactBaseForQuoteWithManager(options) {
245
+ const packageAddress = options.package ?? "@deepbook/core";
246
+ const argumentsTypes = [
247
+ null,
248
+ null,
249
+ null,
250
+ null,
251
+ null,
252
+ null,
253
+ "u64",
254
+ "0x2::clock::Clock"
255
+ ];
256
+ const parameterNames = [
257
+ "self",
258
+ "balanceManager",
259
+ "tradeCap",
260
+ "depositCap",
261
+ "withdrawCap",
262
+ "baseIn",
263
+ "minQuoteOut"
264
+ ];
265
+ return (tx) => tx.moveCall({
266
+ package: packageAddress,
267
+ module: "pool",
268
+ function: "swap_exact_base_for_quote_with_manager",
269
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
270
+ typeArguments: options.typeArguments
271
+ });
272
+ }
273
+ /**
274
+ * Swap exact quote quantity without needing a `balance_manager`. DEEP quantity can
275
+ * be overestimated. Returns three `Coin` objects: base, quote, and deep. Some
276
+ * quote quantity may be left over if the input quantity is not divisible by lot
277
+ * size.
278
+ */
279
+ function swapExactQuoteForBase(options) {
280
+ const packageAddress = options.package ?? "@deepbook/core";
281
+ const argumentsTypes = [
282
+ null,
283
+ null,
284
+ null,
285
+ "u64",
286
+ "0x2::clock::Clock"
287
+ ];
288
+ const parameterNames = [
289
+ "self",
290
+ "quoteIn",
291
+ "deepIn",
292
+ "minBaseOut"
293
+ ];
294
+ return (tx) => tx.moveCall({
295
+ package: packageAddress,
296
+ module: "pool",
297
+ function: "swap_exact_quote_for_base",
298
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
299
+ typeArguments: options.typeArguments
300
+ });
301
+ }
302
+ /**
303
+ * Swap exact quote for base with a `balance_manager`. Assumes fees are paid in
304
+ * DEEP. Assumes balance manager has enough DEEP for fees.
305
+ */
306
+ function swapExactQuoteForBaseWithManager(options) {
307
+ const packageAddress = options.package ?? "@deepbook/core";
308
+ const argumentsTypes = [
309
+ null,
310
+ null,
311
+ null,
312
+ null,
313
+ null,
314
+ null,
315
+ "u64",
316
+ "0x2::clock::Clock"
317
+ ];
318
+ const parameterNames = [
319
+ "self",
320
+ "balanceManager",
321
+ "tradeCap",
322
+ "depositCap",
323
+ "withdrawCap",
324
+ "quoteIn",
325
+ "minBaseOut"
326
+ ];
327
+ return (tx) => tx.moveCall({
328
+ package: packageAddress,
329
+ module: "pool",
330
+ function: "swap_exact_quote_for_base_with_manager",
331
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
332
+ typeArguments: options.typeArguments
333
+ });
334
+ }
335
+ /** Swap exact quantity without needing a balance_manager. */
336
+ function swapExactQuantity(options) {
337
+ const packageAddress = options.package ?? "@deepbook/core";
338
+ const argumentsTypes = [
339
+ null,
340
+ null,
341
+ null,
342
+ null,
343
+ "u64",
344
+ "0x2::clock::Clock"
345
+ ];
346
+ const parameterNames = [
347
+ "self",
348
+ "baseIn",
349
+ "quoteIn",
350
+ "deepIn",
351
+ "minOut"
352
+ ];
353
+ return (tx) => tx.moveCall({
354
+ package: packageAddress,
355
+ module: "pool",
356
+ function: "swap_exact_quantity",
357
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
358
+ typeArguments: options.typeArguments
359
+ });
360
+ }
361
+ /**
362
+ * Swap exact quantity with a `balance_manager`. Assumes fees are paid in DEEP.
363
+ * Assumes balance manager has enough DEEP for fees.
364
+ */
365
+ function swapExactQuantityWithManager(options) {
366
+ const packageAddress = options.package ?? "@deepbook/core";
367
+ const argumentsTypes = [
368
+ null,
369
+ null,
370
+ null,
371
+ null,
372
+ null,
373
+ null,
374
+ null,
375
+ "u64",
376
+ "0x2::clock::Clock"
377
+ ];
378
+ const parameterNames = [
379
+ "self",
380
+ "balanceManager",
381
+ "tradeCap",
382
+ "depositCap",
383
+ "withdrawCap",
384
+ "baseIn",
385
+ "quoteIn",
386
+ "minOut"
387
+ ];
388
+ return (tx) => tx.moveCall({
389
+ package: packageAddress,
390
+ module: "pool",
391
+ function: "swap_exact_quantity_with_manager",
392
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
393
+ typeArguments: options.typeArguments
394
+ });
395
+ }
396
+ /**
397
+ * Modifies an order given order_id and new_quantity. New quantity must be less
398
+ * than the original quantity and more than the filled quantity. Order must not
399
+ * have already expired.
400
+ */
401
+ function modifyOrder(options) {
402
+ const packageAddress = options.package ?? "@deepbook/core";
403
+ const argumentsTypes = [
404
+ null,
405
+ null,
406
+ null,
407
+ "u128",
408
+ "u64",
409
+ "0x2::clock::Clock"
410
+ ];
411
+ const parameterNames = [
412
+ "self",
413
+ "balanceManager",
414
+ "tradeProof",
415
+ "orderId",
416
+ "newQuantity"
417
+ ];
418
+ return (tx) => tx.moveCall({
419
+ package: packageAddress,
420
+ module: "pool",
421
+ function: "modify_order",
422
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
423
+ typeArguments: options.typeArguments
424
+ });
425
+ }
426
+ /**
427
+ * Cancel an order. The order must be owned by the balance_manager. The order is
428
+ * removed from the book and the balance_manager's open orders. The
429
+ * balance_manager's balance is updated with the order's remaining quantity. Order
430
+ * canceled event is emitted.
431
+ */
432
+ function cancelOrder(options) {
433
+ const packageAddress = options.package ?? "@deepbook/core";
434
+ const argumentsTypes = [
435
+ null,
436
+ null,
437
+ null,
438
+ "u128",
439
+ "0x2::clock::Clock"
440
+ ];
441
+ const parameterNames = [
442
+ "self",
443
+ "balanceManager",
444
+ "tradeProof",
445
+ "orderId"
446
+ ];
447
+ return (tx) => tx.moveCall({
448
+ package: packageAddress,
449
+ module: "pool",
450
+ function: "cancel_order",
451
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
452
+ typeArguments: options.typeArguments
453
+ });
454
+ }
455
+ /**
456
+ * Cancel multiple orders within a vector. The orders must be owned by the
457
+ * balance_manager. The orders are removed from the book and the balance_manager's
458
+ * open orders. Order canceled events are emitted. If any order fails to cancel, no
459
+ * orders will be cancelled.
460
+ */
461
+ function cancelOrders(options) {
462
+ const packageAddress = options.package ?? "@deepbook/core";
463
+ const argumentsTypes = [
464
+ null,
465
+ null,
466
+ null,
467
+ "vector<u128>",
468
+ "0x2::clock::Clock"
469
+ ];
470
+ const parameterNames = [
471
+ "self",
472
+ "balanceManager",
473
+ "tradeProof",
474
+ "orderIds"
475
+ ];
476
+ return (tx) => tx.moveCall({
477
+ package: packageAddress,
478
+ module: "pool",
479
+ function: "cancel_orders",
480
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
481
+ typeArguments: options.typeArguments
482
+ });
483
+ }
484
+ /**
485
+ * Cancel a single order, no-op if the order_id is not currently in the
486
+ * balance_manager's open orders (e.g. already filled, cancelled, or not owned by
487
+ * this balance_manager). If the order is present, it must be owned by the
488
+ * balance_manager. On a successful cancel the order is removed from the book and
489
+ * the balance_manager's open orders, and an order canceled event is emitted.
490
+ */
491
+ function cancelLiveOrder(options) {
492
+ const packageAddress = options.package ?? "@deepbook/core";
493
+ const argumentsTypes = [
494
+ null,
495
+ null,
496
+ null,
497
+ "u128",
498
+ "0x2::clock::Clock"
499
+ ];
500
+ const parameterNames = [
501
+ "self",
502
+ "balanceManager",
503
+ "tradeProof",
504
+ "orderId"
505
+ ];
506
+ return (tx) => tx.moveCall({
507
+ package: packageAddress,
508
+ module: "pool",
509
+ function: "cancel_live_order",
510
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
511
+ typeArguments: options.typeArguments
512
+ });
513
+ }
514
+ /**
515
+ * Cancel multiple orders within a vector, skipping any order_id that is not
516
+ * currently in the balance_manager's open orders (e.g. already filled, cancelled,
517
+ * or not owned by this balance_manager). Orders that are present must be owned by
518
+ * the balance_manager. The live orders are removed from the book and the
519
+ * balance_manager's open orders. Order canceled events are emitted for each
520
+ * cancelled order.
521
+ */
522
+ function cancelLiveOrders(options) {
523
+ const packageAddress = options.package ?? "@deepbook/core";
524
+ const argumentsTypes = [
525
+ null,
526
+ null,
527
+ null,
528
+ "vector<u128>",
529
+ "0x2::clock::Clock"
530
+ ];
531
+ const parameterNames = [
532
+ "self",
533
+ "balanceManager",
534
+ "tradeProof",
535
+ "orderIds"
536
+ ];
537
+ return (tx) => tx.moveCall({
538
+ package: packageAddress,
539
+ module: "pool",
540
+ function: "cancel_live_orders",
541
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
542
+ typeArguments: options.typeArguments
543
+ });
544
+ }
545
+ /** Cancel all open orders placed by the balance manager in the pool. */
546
+ function cancelAllOrders(options) {
547
+ const packageAddress = options.package ?? "@deepbook/core";
548
+ const argumentsTypes = [
549
+ null,
550
+ null,
551
+ null,
552
+ "0x2::clock::Clock"
553
+ ];
554
+ const parameterNames = [
555
+ "self",
556
+ "balanceManager",
557
+ "tradeProof"
558
+ ];
559
+ return (tx) => tx.moveCall({
560
+ package: packageAddress,
561
+ module: "pool",
562
+ function: "cancel_all_orders",
563
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
564
+ typeArguments: options.typeArguments
565
+ });
566
+ }
567
+ /** Withdraw settled amounts to the `balance_manager`. */
568
+ function withdrawSettledAmounts(options) {
569
+ const packageAddress = options.package ?? "@deepbook/core";
570
+ const argumentsTypes = [
571
+ null,
572
+ null,
573
+ null
574
+ ];
575
+ const parameterNames = [
576
+ "self",
577
+ "balanceManager",
578
+ "tradeProof"
579
+ ];
580
+ return (tx) => tx.moveCall({
581
+ package: packageAddress,
582
+ module: "pool",
583
+ function: "withdraw_settled_amounts",
584
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
585
+ typeArguments: options.typeArguments
586
+ });
587
+ }
588
+ /** Withdraw settled amounts permissionlessly to the `balance_manager`. */
589
+ function withdrawSettledAmountsPermissionless(options) {
590
+ const packageAddress = options.package ?? "@deepbook/core";
591
+ const argumentsTypes = [null, null];
592
+ const parameterNames = ["self", "balanceManager"];
593
+ return (tx) => tx.moveCall({
594
+ package: packageAddress,
595
+ module: "pool",
596
+ function: "withdraw_settled_amounts_permissionless",
597
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
598
+ typeArguments: options.typeArguments
599
+ });
600
+ }
601
+ /**
602
+ * Stake DEEP tokens to the pool. The balance_manager must have enough DEEP tokens.
603
+ * The balance_manager's data is updated with the staked amount.
604
+ */
605
+ function stake(options) {
606
+ const packageAddress = options.package ?? "@deepbook/core";
607
+ const argumentsTypes = [
608
+ null,
609
+ null,
610
+ null,
611
+ "u64"
612
+ ];
613
+ const parameterNames = [
614
+ "self",
615
+ "balanceManager",
616
+ "tradeProof",
617
+ "amount"
618
+ ];
619
+ return (tx) => tx.moveCall({
620
+ package: packageAddress,
621
+ module: "pool",
622
+ function: "stake",
623
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
624
+ typeArguments: options.typeArguments
625
+ });
626
+ }
627
+ /**
628
+ * Unstake DEEP tokens from the pool. The balance_manager must have enough staked
629
+ * DEEP tokens. The balance_manager's data is updated with the unstaked amount.
630
+ * Balance is transferred to the balance_manager immediately.
631
+ */
632
+ function unstake(options) {
633
+ const packageAddress = options.package ?? "@deepbook/core";
634
+ const argumentsTypes = [
635
+ null,
636
+ null,
637
+ null
638
+ ];
639
+ const parameterNames = [
640
+ "self",
641
+ "balanceManager",
642
+ "tradeProof"
643
+ ];
644
+ return (tx) => tx.moveCall({
645
+ package: packageAddress,
646
+ module: "pool",
647
+ function: "unstake",
648
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
649
+ typeArguments: options.typeArguments
650
+ });
651
+ }
652
+ /**
653
+ * Submit a proposal to change the taker fee, maker fee, and stake required. The
654
+ * balance_manager must have enough staked DEEP tokens to participate. Each
655
+ * balance_manager can only submit one proposal per epoch. If the maximum proposal
656
+ * is reached, the proposal with the lowest vote is removed. If the balance_manager
657
+ * has less voting power than the lowest voted proposal, the proposal is not added.
658
+ */
659
+ function submitProposal(options) {
660
+ const packageAddress = options.package ?? "@deepbook/core";
661
+ const argumentsTypes = [
662
+ null,
663
+ null,
664
+ null,
665
+ "u64",
666
+ "u64",
667
+ "u64"
668
+ ];
669
+ const parameterNames = [
670
+ "self",
671
+ "balanceManager",
672
+ "tradeProof",
673
+ "takerFee",
674
+ "makerFee",
675
+ "stakeRequired"
676
+ ];
677
+ return (tx) => tx.moveCall({
678
+ package: packageAddress,
679
+ module: "pool",
680
+ function: "submit_proposal",
681
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
682
+ typeArguments: options.typeArguments
683
+ });
684
+ }
685
+ /**
686
+ * Vote on a proposal. The balance_manager must have enough staked DEEP tokens to
687
+ * participate. Full voting power of the balance_manager is used. Voting for a new
688
+ * proposal will remove the vote from the previous proposal.
689
+ */
690
+ function vote(options) {
691
+ const packageAddress = options.package ?? "@deepbook/core";
692
+ const argumentsTypes = [
693
+ null,
694
+ null,
695
+ null,
696
+ "0x2::object::ID"
697
+ ];
698
+ const parameterNames = [
699
+ "self",
700
+ "balanceManager",
701
+ "tradeProof",
702
+ "proposalId"
703
+ ];
704
+ return (tx) => tx.moveCall({
705
+ package: packageAddress,
706
+ module: "pool",
707
+ function: "vote",
708
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
709
+ typeArguments: options.typeArguments
710
+ });
711
+ }
712
+ /**
713
+ * Claim the rewards for the balance_manager. The balance_manager must have rewards
714
+ * to claim. The balance_manager's data is updated with the claimed rewards.
715
+ */
716
+ function claimRebates(options) {
717
+ const packageAddress = options.package ?? "@deepbook/core";
718
+ const argumentsTypes = [
719
+ null,
720
+ null,
721
+ null
722
+ ];
723
+ const parameterNames = [
724
+ "self",
725
+ "balanceManager",
726
+ "tradeProof"
727
+ ];
728
+ return (tx) => tx.moveCall({
729
+ package: packageAddress,
730
+ module: "pool",
731
+ function: "claim_rebates",
732
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
733
+ typeArguments: options.typeArguments
734
+ });
735
+ }
736
+ /**
737
+ * Borrow base assets from the Pool. A hot potato is returned, forcing the borrower
738
+ * to return the assets within the same transaction.
739
+ */
740
+ function borrowFlashloanBase(options) {
741
+ const packageAddress = options.package ?? "@deepbook/core";
742
+ const argumentsTypes = [null, "u64"];
743
+ const parameterNames = ["self", "baseAmount"];
744
+ return (tx) => tx.moveCall({
745
+ package: packageAddress,
746
+ module: "pool",
747
+ function: "borrow_flashloan_base",
748
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
749
+ typeArguments: options.typeArguments
750
+ });
751
+ }
752
+ /**
753
+ * Borrow quote assets from the Pool. A hot potato is returned, forcing the
754
+ * borrower to return the assets within the same transaction.
755
+ */
756
+ function borrowFlashloanQuote(options) {
757
+ const packageAddress = options.package ?? "@deepbook/core";
758
+ const argumentsTypes = [null, "u64"];
759
+ const parameterNames = ["self", "quoteAmount"];
760
+ return (tx) => tx.moveCall({
761
+ package: packageAddress,
762
+ module: "pool",
763
+ function: "borrow_flashloan_quote",
764
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
765
+ typeArguments: options.typeArguments
766
+ });
767
+ }
768
+ /**
769
+ * Return the flashloaned base assets to the Pool. FlashLoan object will only be
770
+ * unwrapped if the assets are returned, otherwise the transaction will fail.
771
+ */
772
+ function returnFlashloanBase(options) {
773
+ const packageAddress = options.package ?? "@deepbook/core";
774
+ const argumentsTypes = [
775
+ null,
776
+ null,
777
+ null
778
+ ];
779
+ const parameterNames = [
780
+ "self",
781
+ "coin",
782
+ "flashLoan"
783
+ ];
784
+ return (tx) => tx.moveCall({
785
+ package: packageAddress,
786
+ module: "pool",
787
+ function: "return_flashloan_base",
788
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
789
+ typeArguments: options.typeArguments
790
+ });
791
+ }
792
+ /**
793
+ * Return the flashloaned quote assets to the Pool. FlashLoan object will only be
794
+ * unwrapped if the assets are returned, otherwise the transaction will fail.
795
+ */
796
+ function returnFlashloanQuote(options) {
797
+ const packageAddress = options.package ?? "@deepbook/core";
798
+ const argumentsTypes = [
799
+ null,
800
+ null,
801
+ null
802
+ ];
803
+ const parameterNames = [
804
+ "self",
805
+ "coin",
806
+ "flashLoan"
807
+ ];
808
+ return (tx) => tx.moveCall({
809
+ package: packageAddress,
810
+ module: "pool",
811
+ function: "return_flashloan_quote",
812
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
813
+ typeArguments: options.typeArguments
814
+ });
815
+ }
816
+ /**
817
+ * Adds a price point along with a timestamp to the deep price. Allows for the
818
+ * calculation of deep price per base asset.
819
+ */
820
+ function addDeepPricePoint(options) {
821
+ const packageAddress = options.package ?? "@deepbook/core";
822
+ const argumentsTypes = [
823
+ null,
824
+ null,
825
+ "0x2::clock::Clock"
826
+ ];
827
+ const parameterNames = ["targetPool", "referencePool"];
828
+ return (tx) => tx.moveCall({
829
+ package: packageAddress,
830
+ module: "pool",
831
+ function: "add_deep_price_point",
832
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
833
+ typeArguments: options.typeArguments
834
+ });
835
+ }
836
+ /** Burns DEEP tokens from the pool. Amount to burn is within history */
837
+ function burnDeep(options) {
838
+ const packageAddress = options.package ?? "@deepbook/core";
839
+ const argumentsTypes = [null, null];
840
+ const parameterNames = ["self", "treasuryCap"];
841
+ return (tx) => tx.moveCall({
842
+ package: packageAddress,
843
+ module: "pool",
844
+ function: "burn_deep",
845
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
846
+ typeArguments: options.typeArguments
847
+ });
848
+ }
849
+ /** Mint a DeepBookReferral and set the additional bps for the referral. */
850
+ function mintReferral(options) {
851
+ const packageAddress = options.package ?? "@deepbook/core";
852
+ const argumentsTypes = [null, "u64"];
853
+ const parameterNames = ["self", "multiplier"];
854
+ return (tx) => tx.moveCall({
855
+ package: packageAddress,
856
+ module: "pool",
857
+ function: "mint_referral",
858
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
859
+ typeArguments: options.typeArguments
860
+ });
861
+ }
862
+ /** Update the multiplier for the referral. */
863
+ function updatePoolReferralMultiplier(options) {
864
+ const packageAddress = options.package ?? "@deepbook/core";
865
+ const argumentsTypes = [
866
+ null,
867
+ null,
868
+ "u64"
869
+ ];
870
+ const parameterNames = [
871
+ "self",
872
+ "referral",
873
+ "multiplier"
874
+ ];
875
+ return (tx) => tx.moveCall({
876
+ package: packageAddress,
877
+ module: "pool",
878
+ function: "update_pool_referral_multiplier",
879
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
880
+ typeArguments: options.typeArguments
881
+ });
882
+ }
883
+ /** Claim the rewards for the referral. */
884
+ function claimPoolReferralRewards(options) {
885
+ const packageAddress = options.package ?? "@deepbook/core";
886
+ const argumentsTypes = [null, null];
887
+ const parameterNames = ["self", "referral"];
888
+ return (tx) => tx.moveCall({
889
+ package: packageAddress,
890
+ module: "pool",
891
+ function: "claim_pool_referral_rewards",
892
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
893
+ typeArguments: options.typeArguments
894
+ });
895
+ }
896
+ /**
897
+ * Create a new pool. The pool is registered in the registry. Checks are performed
898
+ * to ensure the tick size, lot size, and min size are valid. Returns the id of the
899
+ * pool created
900
+ */
901
+ function createPoolAdmin(options) {
902
+ const packageAddress = options.package ?? "@deepbook/core";
903
+ const argumentsTypes = [
904
+ null,
905
+ "u64",
906
+ "u64",
907
+ "u64",
908
+ "bool",
909
+ "bool",
910
+ null
911
+ ];
912
+ const parameterNames = [
913
+ "registry",
914
+ "tickSize",
915
+ "lotSize",
916
+ "minSize",
917
+ "whitelistedPool",
918
+ "stablePool",
919
+ "Cap"
920
+ ];
921
+ return (tx) => tx.moveCall({
922
+ package: packageAddress,
923
+ module: "pool",
924
+ function: "create_pool_admin",
925
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
926
+ typeArguments: options.typeArguments
927
+ });
928
+ }
929
+ /** Unregister a pool in case it needs to be redeployed. */
930
+ function unregisterPoolAdmin(options) {
931
+ const packageAddress = options.package ?? "@deepbook/core";
932
+ const argumentsTypes = [
933
+ null,
934
+ null,
935
+ null
936
+ ];
937
+ const parameterNames = [
938
+ "self",
939
+ "registry",
940
+ "Cap"
941
+ ];
942
+ return (tx) => tx.moveCall({
943
+ package: packageAddress,
944
+ module: "pool",
945
+ function: "unregister_pool_admin",
946
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
947
+ typeArguments: options.typeArguments
948
+ });
949
+ }
950
+ /**
951
+ * Takes the registry and updates the allowed version within pool Only admin can
952
+ * update the allowed versions This function does not have version restrictions
953
+ */
954
+ function updateAllowedVersions(options) {
955
+ const packageAddress = options.package ?? "@deepbook/core";
956
+ const argumentsTypes = [
957
+ null,
958
+ null,
959
+ null
960
+ ];
961
+ const parameterNames = [
962
+ "self",
963
+ "registry",
964
+ "Cap"
965
+ ];
966
+ return (tx) => tx.moveCall({
967
+ package: packageAddress,
968
+ module: "pool",
969
+ function: "update_allowed_versions",
970
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
971
+ typeArguments: options.typeArguments
972
+ });
973
+ }
974
+ /**
975
+ * Takes the registry and updates the allowed version within pool Permissionless
976
+ * equivalent of `update_allowed_versions` This function does not have version
977
+ * restrictions
978
+ */
979
+ function updatePoolAllowedVersions(options) {
980
+ const packageAddress = options.package ?? "@deepbook/core";
981
+ const argumentsTypes = [null, null];
982
+ const parameterNames = ["self", "registry"];
983
+ return (tx) => tx.moveCall({
984
+ package: packageAddress,
985
+ module: "pool",
986
+ function: "update_pool_allowed_versions",
987
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
988
+ typeArguments: options.typeArguments
989
+ });
990
+ }
991
+ /** Adjust the tick size of the pool. Only admin can adjust the tick size. */
992
+ function adjustTickSizeAdmin(options) {
993
+ const packageAddress = options.package ?? "@deepbook/core";
994
+ const argumentsTypes = [
995
+ null,
996
+ "u64",
997
+ null,
998
+ "0x2::clock::Clock"
999
+ ];
1000
+ const parameterNames = [
1001
+ "self",
1002
+ "newTickSize",
1003
+ "Cap"
1004
+ ];
1005
+ return (tx) => tx.moveCall({
1006
+ package: packageAddress,
1007
+ module: "pool",
1008
+ function: "adjust_tick_size_admin",
1009
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1010
+ typeArguments: options.typeArguments
1011
+ });
1012
+ }
1013
+ /**
1014
+ * Adjust and lot size and min size of the pool. New lot size must be smaller than
1015
+ * current lot size. Only admin can adjust the min size and lot size.
1016
+ */
1017
+ function adjustMinLotSizeAdmin(options) {
1018
+ const packageAddress = options.package ?? "@deepbook/core";
1019
+ const argumentsTypes = [
1020
+ null,
1021
+ "u64",
1022
+ "u64",
1023
+ null,
1024
+ "0x2::clock::Clock"
1025
+ ];
1026
+ const parameterNames = [
1027
+ "self",
1028
+ "newLotSize",
1029
+ "newMinSize",
1030
+ "Cap"
1031
+ ];
1032
+ return (tx) => tx.moveCall({
1033
+ package: packageAddress,
1034
+ module: "pool",
1035
+ function: "adjust_min_lot_size_admin",
1036
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1037
+ typeArguments: options.typeArguments
1038
+ });
1039
+ }
1040
+ /**
1041
+ * Enable the EWMA state for the pool. This allows the pool to use the EWMA state
1042
+ * for volatility calculations and additional taker fees.
1043
+ */
1044
+ function enableEwmaState(options) {
1045
+ const packageAddress = options.package ?? "@deepbook/core";
1046
+ const argumentsTypes = [
1047
+ null,
1048
+ null,
1049
+ "bool",
1050
+ "0x2::clock::Clock"
1051
+ ];
1052
+ const parameterNames = [
1053
+ "self",
1054
+ "Cap",
1055
+ "enable"
1056
+ ];
1057
+ return (tx) => tx.moveCall({
1058
+ package: packageAddress,
1059
+ module: "pool",
1060
+ function: "enable_ewma_state",
1061
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1062
+ typeArguments: options.typeArguments
1063
+ });
1064
+ }
1065
+ /** Set the EWMA parameters for the pool. Only admin can set the parameters. */
1066
+ function setEwmaParams(options) {
1067
+ const packageAddress = options.package ?? "@deepbook/core";
1068
+ const argumentsTypes = [
1069
+ null,
1070
+ null,
1071
+ "u64",
1072
+ "u64",
1073
+ "u64",
1074
+ "0x2::clock::Clock"
1075
+ ];
1076
+ const parameterNames = [
1077
+ "self",
1078
+ "Cap",
1079
+ "alpha",
1080
+ "zScoreThreshold",
1081
+ "additionalTakerFee"
1082
+ ];
1083
+ return (tx) => tx.moveCall({
1084
+ package: packageAddress,
1085
+ module: "pool",
1086
+ function: "set_ewma_params",
1087
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1088
+ typeArguments: options.typeArguments
1089
+ });
1090
+ }
1091
+ /** Accessor to check if the pool is whitelisted. */
1092
+ function whitelisted(options) {
1093
+ const packageAddress = options.package ?? "@deepbook/core";
1094
+ const argumentsTypes = [null];
1095
+ const parameterNames = ["self"];
1096
+ return (tx) => tx.moveCall({
1097
+ package: packageAddress,
1098
+ module: "pool",
1099
+ function: "whitelisted",
1100
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1101
+ typeArguments: options.typeArguments
1102
+ });
1103
+ }
1104
+ /** Accessor to check if the pool is a stablecoin pool. */
1105
+ function stablePool(options) {
1106
+ const packageAddress = options.package ?? "@deepbook/core";
1107
+ const argumentsTypes = [null];
1108
+ const parameterNames = ["self"];
1109
+ return (tx) => tx.moveCall({
1110
+ package: packageAddress,
1111
+ module: "pool",
1112
+ function: "stable_pool",
1113
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1114
+ typeArguments: options.typeArguments
1115
+ });
1116
+ }
1117
+ function registeredPool(options) {
1118
+ const packageAddress = options.package ?? "@deepbook/core";
1119
+ const argumentsTypes = [null];
1120
+ const parameterNames = ["self"];
1121
+ return (tx) => tx.moveCall({
1122
+ package: packageAddress,
1123
+ module: "pool",
1124
+ function: "registered_pool",
1125
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1126
+ typeArguments: options.typeArguments
1127
+ });
1128
+ }
1129
+ /**
1130
+ * Dry run to determine the quote quantity out for a given base quantity. Uses DEEP
1131
+ * token as fee.
1132
+ */
1133
+ function getQuoteQuantityOut(options) {
1134
+ const packageAddress = options.package ?? "@deepbook/core";
1135
+ const argumentsTypes = [
1136
+ null,
1137
+ "u64",
1138
+ "0x2::clock::Clock"
1139
+ ];
1140
+ const parameterNames = ["self", "baseQuantity"];
1141
+ return (tx) => tx.moveCall({
1142
+ package: packageAddress,
1143
+ module: "pool",
1144
+ function: "get_quote_quantity_out",
1145
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1146
+ typeArguments: options.typeArguments
1147
+ });
1148
+ }
1149
+ /**
1150
+ * Dry run to determine the base quantity out for a given quote quantity. Uses DEEP
1151
+ * token as fee.
1152
+ */
1153
+ function getBaseQuantityOut(options) {
1154
+ const packageAddress = options.package ?? "@deepbook/core";
1155
+ const argumentsTypes = [
1156
+ null,
1157
+ "u64",
1158
+ "0x2::clock::Clock"
1159
+ ];
1160
+ const parameterNames = ["self", "quoteQuantity"];
1161
+ return (tx) => tx.moveCall({
1162
+ package: packageAddress,
1163
+ module: "pool",
1164
+ function: "get_base_quantity_out",
1165
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1166
+ typeArguments: options.typeArguments
1167
+ });
1168
+ }
1169
+ /**
1170
+ * Dry run to determine the quote quantity out for a given base quantity. Uses
1171
+ * input token as fee.
1172
+ */
1173
+ function getQuoteQuantityOutInputFee(options) {
1174
+ const packageAddress = options.package ?? "@deepbook/core";
1175
+ const argumentsTypes = [
1176
+ null,
1177
+ "u64",
1178
+ "0x2::clock::Clock"
1179
+ ];
1180
+ const parameterNames = ["self", "baseQuantity"];
1181
+ return (tx) => tx.moveCall({
1182
+ package: packageAddress,
1183
+ module: "pool",
1184
+ function: "get_quote_quantity_out_input_fee",
1185
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1186
+ typeArguments: options.typeArguments
1187
+ });
1188
+ }
1189
+ /**
1190
+ * Dry run to determine the base quantity out for a given quote quantity. Uses
1191
+ * input token as fee.
1192
+ */
1193
+ function getBaseQuantityOutInputFee(options) {
1194
+ const packageAddress = options.package ?? "@deepbook/core";
1195
+ const argumentsTypes = [
1196
+ null,
1197
+ "u64",
1198
+ "0x2::clock::Clock"
1199
+ ];
1200
+ const parameterNames = ["self", "quoteQuantity"];
1201
+ return (tx) => tx.moveCall({
1202
+ package: packageAddress,
1203
+ module: "pool",
1204
+ function: "get_base_quantity_out_input_fee",
1205
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1206
+ typeArguments: options.typeArguments
1207
+ });
1208
+ }
1209
+ /**
1210
+ * Dry run to determine the quantity out for a given base or quote quantity. Only
1211
+ * one out of base or quote quantity should be non-zero. Returns the
1212
+ * (base_quantity_out, quote_quantity_out, deep_quantity_required) Uses DEEP token
1213
+ * as fee.
1214
+ */
1215
+ function getQuantityOut(options) {
1216
+ const packageAddress = options.package ?? "@deepbook/core";
1217
+ const argumentsTypes = [
1218
+ null,
1219
+ "u64",
1220
+ "u64",
1221
+ "0x2::clock::Clock"
1222
+ ];
1223
+ const parameterNames = [
1224
+ "self",
1225
+ "baseQuantity",
1226
+ "quoteQuantity"
1227
+ ];
1228
+ return (tx) => tx.moveCall({
1229
+ package: packageAddress,
1230
+ module: "pool",
1231
+ function: "get_quantity_out",
1232
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1233
+ typeArguments: options.typeArguments
1234
+ });
1235
+ }
1236
+ /**
1237
+ * Dry run to determine the quantity out for a given base or quote quantity. Only
1238
+ * one out of base or quote quantity should be non-zero. Returns the
1239
+ * (base_quantity_out, quote_quantity_out, deep_quantity_required) Uses input token
1240
+ * as fee.
1241
+ */
1242
+ function getQuantityOutInputFee(options) {
1243
+ const packageAddress = options.package ?? "@deepbook/core";
1244
+ const argumentsTypes = [
1245
+ null,
1246
+ "u64",
1247
+ "u64",
1248
+ "0x2::clock::Clock"
1249
+ ];
1250
+ const parameterNames = [
1251
+ "self",
1252
+ "baseQuantity",
1253
+ "quoteQuantity"
1254
+ ];
1255
+ return (tx) => tx.moveCall({
1256
+ package: packageAddress,
1257
+ module: "pool",
1258
+ function: "get_quantity_out_input_fee",
1259
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1260
+ typeArguments: options.typeArguments
1261
+ });
1262
+ }
1263
+ /**
1264
+ * Dry run to determine the base quantity needed to sell to receive a target quote
1265
+ * quantity. Returns (base_quantity_in, actual_quote_quantity_out,
1266
+ * deep_quantity_required) Returns (0, 0, 0) if insufficient liquidity or if result
1267
+ * would be below min_size.
1268
+ */
1269
+ function getBaseQuantityIn(options) {
1270
+ const packageAddress = options.package ?? "@deepbook/core";
1271
+ const argumentsTypes = [
1272
+ null,
1273
+ "u64",
1274
+ "bool",
1275
+ "0x2::clock::Clock"
1276
+ ];
1277
+ const parameterNames = [
1278
+ "self",
1279
+ "targetQuoteQuantity",
1280
+ "payWithDeep"
1281
+ ];
1282
+ return (tx) => tx.moveCall({
1283
+ package: packageAddress,
1284
+ module: "pool",
1285
+ function: "get_base_quantity_in",
1286
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1287
+ typeArguments: options.typeArguments
1288
+ });
1289
+ }
1290
+ /**
1291
+ * Dry run to determine the quote quantity needed to buy a target base quantity.
1292
+ * Returns (actual_base_quantity_out, quote_quantity_in, deep_quantity_required)
1293
+ * Returns (0, 0, 0) if insufficient liquidity or if result would be below
1294
+ * min_size.
1295
+ */
1296
+ function getQuoteQuantityIn(options) {
1297
+ const packageAddress = options.package ?? "@deepbook/core";
1298
+ const argumentsTypes = [
1299
+ null,
1300
+ "u64",
1301
+ "bool",
1302
+ "0x2::clock::Clock"
1303
+ ];
1304
+ const parameterNames = [
1305
+ "self",
1306
+ "targetBaseQuantity",
1307
+ "payWithDeep"
1308
+ ];
1309
+ return (tx) => tx.moveCall({
1310
+ package: packageAddress,
1311
+ module: "pool",
1312
+ function: "get_quote_quantity_in",
1313
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1314
+ typeArguments: options.typeArguments
1315
+ });
1316
+ }
1317
+ /** Returns the mid price of the pool. */
1318
+ function midPrice(options) {
1319
+ const packageAddress = options.package ?? "@deepbook/core";
1320
+ const argumentsTypes = [null, "0x2::clock::Clock"];
1321
+ const parameterNames = ["self"];
1322
+ return (tx) => tx.moveCall({
1323
+ package: packageAddress,
1324
+ module: "pool",
1325
+ function: "mid_price",
1326
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1327
+ typeArguments: options.typeArguments
1328
+ });
1329
+ }
1330
+ /** Returns the order_id for all open order for the balance_manager in the pool. */
1331
+ function accountOpenOrders(options) {
1332
+ const packageAddress = options.package ?? "@deepbook/core";
1333
+ const argumentsTypes = [null, null];
1334
+ const parameterNames = ["self", "balanceManager"];
1335
+ return (tx) => tx.moveCall({
1336
+ package: packageAddress,
1337
+ module: "pool",
1338
+ function: "account_open_orders",
1339
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1340
+ typeArguments: options.typeArguments
1341
+ });
1342
+ }
1343
+ /**
1344
+ * Returns the (price_vec, quantity_vec) for the level2 order book. The price_low
1345
+ * and price_high are inclusive, all orders within the range are returned. is_bid
1346
+ * is true for bids and false for asks.
1347
+ */
1348
+ function getLevel2Range(options) {
1349
+ const packageAddress = options.package ?? "@deepbook/core";
1350
+ const argumentsTypes = [
1351
+ null,
1352
+ "u64",
1353
+ "u64",
1354
+ "bool",
1355
+ "0x2::clock::Clock"
1356
+ ];
1357
+ const parameterNames = [
1358
+ "self",
1359
+ "priceLow",
1360
+ "priceHigh",
1361
+ "isBid"
1362
+ ];
1363
+ return (tx) => tx.moveCall({
1364
+ package: packageAddress,
1365
+ module: "pool",
1366
+ function: "get_level2_range",
1367
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1368
+ typeArguments: options.typeArguments
1369
+ });
1370
+ }
1371
+ /**
1372
+ * Returns the (price_vec, quantity_vec) for the level2 order book. Ticks are the
1373
+ * maximum number of ticks to return starting from best bid and best ask.
1374
+ * (bid_price, bid_quantity, ask_price, ask_quantity) are returned as 4 vectors.
1375
+ * The price vectors are sorted in descending order for bids and ascending order
1376
+ * for asks.
1377
+ */
1378
+ function getLevel2TicksFromMid(options) {
1379
+ const packageAddress = options.package ?? "@deepbook/core";
1380
+ const argumentsTypes = [
1381
+ null,
1382
+ "u64",
1383
+ "0x2::clock::Clock"
1384
+ ];
1385
+ const parameterNames = ["self", "ticks"];
1386
+ return (tx) => tx.moveCall({
1387
+ package: packageAddress,
1388
+ module: "pool",
1389
+ function: "get_level2_ticks_from_mid",
1390
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1391
+ typeArguments: options.typeArguments
1392
+ });
1393
+ }
1394
+ /** Get all balances held in this pool. */
1395
+ function vaultBalances(options) {
1396
+ const packageAddress = options.package ?? "@deepbook/core";
1397
+ const argumentsTypes = [null];
1398
+ const parameterNames = ["self"];
1399
+ return (tx) => tx.moveCall({
1400
+ package: packageAddress,
1401
+ module: "pool",
1402
+ function: "vault_balances",
1403
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1404
+ typeArguments: options.typeArguments
1405
+ });
1406
+ }
1407
+ /** Get the ID of the pool given the asset types. */
1408
+ function getPoolIdByAsset(options) {
1409
+ const packageAddress = options.package ?? "@deepbook/core";
1410
+ const argumentsTypes = [null];
1411
+ const parameterNames = ["registry"];
1412
+ return (tx) => tx.moveCall({
1413
+ package: packageAddress,
1414
+ module: "pool",
1415
+ function: "get_pool_id_by_asset",
1416
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1417
+ typeArguments: options.typeArguments
1418
+ });
1419
+ }
1420
+ /** Get the Order struct */
1421
+ function getOrder(options) {
1422
+ const packageAddress = options.package ?? "@deepbook/core";
1423
+ const argumentsTypes = [null, "u128"];
1424
+ const parameterNames = ["self", "orderId"];
1425
+ return (tx) => tx.moveCall({
1426
+ package: packageAddress,
1427
+ module: "pool",
1428
+ function: "get_order",
1429
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1430
+ typeArguments: options.typeArguments
1431
+ });
1432
+ }
1433
+ /** Get multiple orders given a vector of order_ids. */
1434
+ function getOrders(options) {
1435
+ const packageAddress = options.package ?? "@deepbook/core";
1436
+ const argumentsTypes = [null, "vector<u128>"];
1437
+ const parameterNames = ["self", "orderIds"];
1438
+ return (tx) => tx.moveCall({
1439
+ package: packageAddress,
1440
+ module: "pool",
1441
+ function: "get_orders",
1442
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1443
+ typeArguments: options.typeArguments
1444
+ });
1445
+ }
1446
+ /** Return a copy of all orders that are in the book for this account. */
1447
+ function getAccountOrderDetails(options) {
1448
+ const packageAddress = options.package ?? "@deepbook/core";
1449
+ const argumentsTypes = [null, null];
1450
+ const parameterNames = ["self", "balanceManager"];
1451
+ return (tx) => tx.moveCall({
1452
+ package: packageAddress,
1453
+ module: "pool",
1454
+ function: "get_account_order_details",
1455
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1456
+ typeArguments: options.typeArguments
1457
+ });
1458
+ }
1459
+ /** Return the DEEP price for the pool. */
1460
+ function getOrderDeepPrice(options) {
1461
+ const packageAddress = options.package ?? "@deepbook/core";
1462
+ const argumentsTypes = [null];
1463
+ const parameterNames = ["self"];
1464
+ return (tx) => tx.moveCall({
1465
+ package: packageAddress,
1466
+ module: "pool",
1467
+ function: "get_order_deep_price",
1468
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1469
+ typeArguments: options.typeArguments
1470
+ });
1471
+ }
1472
+ /**
1473
+ * Returns the deep required for an order if it's taker or maker given quantity and
1474
+ * price Does not account for discounted taker fees Returns (deep_required_taker,
1475
+ * deep_required_maker)
1476
+ */
1477
+ function getOrderDeepRequired(options) {
1478
+ const packageAddress = options.package ?? "@deepbook/core";
1479
+ const argumentsTypes = [
1480
+ null,
1481
+ "u64",
1482
+ "u64"
1483
+ ];
1484
+ const parameterNames = [
1485
+ "self",
1486
+ "baseQuantity",
1487
+ "price"
1488
+ ];
1489
+ return (tx) => tx.moveCall({
1490
+ package: packageAddress,
1491
+ module: "pool",
1492
+ function: "get_order_deep_required",
1493
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1494
+ typeArguments: options.typeArguments
1495
+ });
1496
+ }
1497
+ /**
1498
+ * Returns the locked balance for the balance_manager in the pool Returns
1499
+ * (base_quantity, quote_quantity, deep_quantity)
1500
+ */
1501
+ function lockedBalance(options) {
1502
+ const packageAddress = options.package ?? "@deepbook/core";
1503
+ const argumentsTypes = [null, null];
1504
+ const parameterNames = ["self", "balanceManager"];
1505
+ return (tx) => tx.moveCall({
1506
+ package: packageAddress,
1507
+ module: "pool",
1508
+ function: "locked_balance",
1509
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1510
+ typeArguments: options.typeArguments
1511
+ });
1512
+ }
1513
+ /**
1514
+ * Check if a limit order can be placed based on balance manager balances. Returns
1515
+ * true if the balance manager has sufficient balance (accounting for fees) to
1516
+ * place the order, false otherwise. Assumes the limit order is a taker order as a
1517
+ * worst case scenario.
1518
+ */
1519
+ function canPlaceLimitOrder(options) {
1520
+ const packageAddress = options.package ?? "@deepbook/core";
1521
+ const argumentsTypes = [
1522
+ null,
1523
+ null,
1524
+ "u64",
1525
+ "u64",
1526
+ "bool",
1527
+ "bool",
1528
+ "u64",
1529
+ "0x2::clock::Clock"
1530
+ ];
1531
+ const parameterNames = [
1532
+ "self",
1533
+ "balanceManager",
1534
+ "price",
1535
+ "quantity",
1536
+ "isBid",
1537
+ "payWithDeep",
1538
+ "expireTimestamp"
1539
+ ];
1540
+ return (tx) => tx.moveCall({
1541
+ package: packageAddress,
1542
+ module: "pool",
1543
+ function: "can_place_limit_order",
1544
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1545
+ typeArguments: options.typeArguments
1546
+ });
1547
+ }
1548
+ /**
1549
+ * Check if a market order can be placed based on balance manager balances. Returns
1550
+ * true if the balance manager has sufficient balance (accounting for fees) to
1551
+ * place the order, false otherwise. Does not account for discounted taker fees
1552
+ */
1553
+ function canPlaceMarketOrder(options) {
1554
+ const packageAddress = options.package ?? "@deepbook/core";
1555
+ const argumentsTypes = [
1556
+ null,
1557
+ null,
1558
+ "u64",
1559
+ "bool",
1560
+ "bool",
1561
+ "0x2::clock::Clock"
1562
+ ];
1563
+ const parameterNames = [
1564
+ "self",
1565
+ "balanceManager",
1566
+ "quantity",
1567
+ "isBid",
1568
+ "payWithDeep"
1569
+ ];
1570
+ return (tx) => tx.moveCall({
1571
+ package: packageAddress,
1572
+ module: "pool",
1573
+ function: "can_place_market_order",
1574
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1575
+ typeArguments: options.typeArguments
1576
+ });
1577
+ }
1578
+ /**
1579
+ * Check if a market order can be placed based on pool book params. Returns true if
1580
+ * the order parameters are valid, false otherwise.
1581
+ */
1582
+ function checkMarketOrderParams(options) {
1583
+ const packageAddress = options.package ?? "@deepbook/core";
1584
+ const argumentsTypes = [null, "u64"];
1585
+ const parameterNames = ["self", "quantity"];
1586
+ return (tx) => tx.moveCall({
1587
+ package: packageAddress,
1588
+ module: "pool",
1589
+ function: "check_market_order_params",
1590
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1591
+ typeArguments: options.typeArguments
1592
+ });
1593
+ }
1594
+ /**
1595
+ * Check if a limit order can be placed based on pool book params. Returns true if
1596
+ * the order parameters are valid, false otherwise.
1597
+ */
1598
+ function checkLimitOrderParams(options) {
1599
+ const packageAddress = options.package ?? "@deepbook/core";
1600
+ const argumentsTypes = [
1601
+ null,
1602
+ "u64",
1603
+ "u64",
1604
+ "u64",
1605
+ "0x2::clock::Clock"
1606
+ ];
1607
+ const parameterNames = [
1608
+ "self",
1609
+ "price",
1610
+ "quantity",
1611
+ "expireTimestamp"
1612
+ ];
1613
+ return (tx) => tx.moveCall({
1614
+ package: packageAddress,
1615
+ module: "pool",
1616
+ function: "check_limit_order_params",
1617
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1618
+ typeArguments: options.typeArguments
1619
+ });
1620
+ }
1621
+ /**
1622
+ * Returns the trade params for the pool. Returns (taker_fee, maker_fee,
1623
+ * stake_required)
1624
+ */
1625
+ function poolTradeParams(options) {
1626
+ const packageAddress = options.package ?? "@deepbook/core";
1627
+ const argumentsTypes = [null];
1628
+ const parameterNames = ["self"];
1629
+ return (tx) => tx.moveCall({
1630
+ package: packageAddress,
1631
+ module: "pool",
1632
+ function: "pool_trade_params",
1633
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1634
+ typeArguments: options.typeArguments
1635
+ });
1636
+ }
1637
+ /** Returns the currently leading trade params for the next epoch for the pool */
1638
+ function poolTradeParamsNext(options) {
1639
+ const packageAddress = options.package ?? "@deepbook/core";
1640
+ const argumentsTypes = [null];
1641
+ const parameterNames = ["self"];
1642
+ return (tx) => tx.moveCall({
1643
+ package: packageAddress,
1644
+ module: "pool",
1645
+ function: "pool_trade_params_next",
1646
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1647
+ typeArguments: options.typeArguments
1648
+ });
1649
+ }
1650
+ /** Returns the tick size, lot size, and min size for the pool. */
1651
+ function poolBookParams(options) {
1652
+ const packageAddress = options.package ?? "@deepbook/core";
1653
+ const argumentsTypes = [null];
1654
+ const parameterNames = ["self"];
1655
+ return (tx) => tx.moveCall({
1656
+ package: packageAddress,
1657
+ module: "pool",
1658
+ function: "pool_book_params",
1659
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1660
+ typeArguments: options.typeArguments
1661
+ });
1662
+ }
1663
+ function accountExists(options) {
1664
+ const packageAddress = options.package ?? "@deepbook/core";
1665
+ const argumentsTypes = [null, null];
1666
+ const parameterNames = ["self", "balanceManager"];
1667
+ return (tx) => tx.moveCall({
1668
+ package: packageAddress,
1669
+ module: "pool",
1670
+ function: "account_exists",
1671
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1672
+ typeArguments: options.typeArguments
1673
+ });
1674
+ }
1675
+ function account(options) {
1676
+ const packageAddress = options.package ?? "@deepbook/core";
1677
+ const argumentsTypes = [null, null];
1678
+ const parameterNames = ["self", "balanceManager"];
1679
+ return (tx) => tx.moveCall({
1680
+ package: packageAddress,
1681
+ module: "pool",
1682
+ function: "account",
1683
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1684
+ typeArguments: options.typeArguments
1685
+ });
1686
+ }
1687
+ /** Returns the quorum needed to pass proposal in the current epoch */
1688
+ function quorum(options) {
1689
+ const packageAddress = options.package ?? "@deepbook/core";
1690
+ const argumentsTypes = [null];
1691
+ const parameterNames = ["self"];
1692
+ return (tx) => tx.moveCall({
1693
+ package: packageAddress,
1694
+ module: "pool",
1695
+ function: "quorum",
1696
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1697
+ typeArguments: options.typeArguments
1698
+ });
1699
+ }
1700
+ function id(options) {
1701
+ const packageAddress = options.package ?? "@deepbook/core";
1702
+ const argumentsTypes = [null];
1703
+ const parameterNames = ["self"];
1704
+ return (tx) => tx.moveCall({
1705
+ package: packageAddress,
1706
+ module: "pool",
1707
+ function: "id",
1708
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1709
+ typeArguments: options.typeArguments
1710
+ });
1711
+ }
1712
+ function getPoolReferralBalances(options) {
1713
+ const packageAddress = options.package ?? "@deepbook/core";
1714
+ const argumentsTypes = [null, null];
1715
+ const parameterNames = ["self", "referral"];
1716
+ return (tx) => tx.moveCall({
1717
+ package: packageAddress,
1718
+ module: "pool",
1719
+ function: "get_pool_referral_balances",
1720
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1721
+ typeArguments: options.typeArguments
1722
+ });
1723
+ }
1724
+ function poolReferralMultiplier(options) {
1725
+ const packageAddress = options.package ?? "@deepbook/core";
1726
+ const argumentsTypes = [null, null];
1727
+ const parameterNames = ["self", "referral"];
1728
+ return (tx) => tx.moveCall({
1729
+ package: packageAddress,
1730
+ module: "pool",
1731
+ function: "pool_referral_multiplier",
1732
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
1733
+ typeArguments: options.typeArguments
1734
+ });
1735
+ }
1736
+
1737
+ //#endregion
1738
+ export { account, accountExists, accountOpenOrders, addDeepPricePoint, adjustMinLotSizeAdmin, adjustTickSizeAdmin, borrowFlashloanBase, borrowFlashloanQuote, burnDeep, canPlaceLimitOrder, canPlaceMarketOrder, cancelAllOrders, cancelLiveOrder, cancelLiveOrders, cancelOrder, cancelOrders, checkLimitOrderParams, checkMarketOrderParams, claimPoolReferralRewards, claimRebates, createPermissionlessPool, createPoolAdmin, enableEwmaState, getAccountOrderDetails, getBaseQuantityIn, getBaseQuantityOut, getBaseQuantityOutInputFee, getLevel2Range, getLevel2TicksFromMid, getOrder, getOrderDeepPrice, getOrderDeepRequired, getOrders, getPoolIdByAsset, getPoolReferralBalances, getQuantityOut, getQuantityOutInputFee, getQuoteQuantityIn, getQuoteQuantityOut, getQuoteQuantityOutInputFee, id, lockedBalance, midPrice, mintReferral, modifyOrder, placeLimitOrder, placeMarketOrder, poolBookParams, poolReferralMultiplier, poolTradeParams, poolTradeParamsNext, quorum, registeredPool, returnFlashloanBase, returnFlashloanQuote, setEwmaParams, stablePool, stake, submitProposal, swapExactBaseForQuote, swapExactBaseForQuoteWithManager, swapExactQuantity, swapExactQuantityWithManager, swapExactQuoteForBase, swapExactQuoteForBaseWithManager, unregisterPoolAdmin, unstake, updateAllowedVersions, updatePoolAllowedVersions, updatePoolReferralMultiplier, vaultBalances, vote, whitelisted, withdrawSettledAmounts, withdrawSettledAmountsPermissionless };
1739
+ //# sourceMappingURL=pool.mjs.map