@mysten/deepbook-v3 2.9.2 → 2.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +21 -0
  3. package/dist/account-bindings/account-registry.d.mts +109 -0
  4. package/dist/account-bindings/account-registry.d.mts.map +1 -0
  5. package/dist/account-bindings/account-registry.mjs +56 -0
  6. package/dist/account-bindings/account-registry.mjs.map +1 -0
  7. package/dist/account-bindings/account.d.mts +176 -0
  8. package/dist/account-bindings/account.d.mts.map +1 -0
  9. package/dist/account-bindings/account.mjs +94 -0
  10. package/dist/account-bindings/account.mjs.map +1 -0
  11. package/dist/account-bindings/latest.d.mts +12 -0
  12. package/dist/account-bindings/latest.d.mts.map +1 -0
  13. package/dist/account-bindings/latest.mjs +19 -0
  14. package/dist/account-bindings/latest.mjs.map +1 -0
  15. package/dist/account.d.mts +46 -3
  16. package/dist/account.d.mts.map +1 -1
  17. package/dist/account.mjs +51 -2
  18. package/dist/account.mjs.map +1 -1
  19. package/dist/contracts/account/account.d.mts +25 -97
  20. package/dist/contracts/account/account.d.mts.map +1 -1
  21. package/dist/contracts/account/account.mjs +43 -35
  22. package/dist/contracts/account/account.mjs.map +1 -1
  23. package/dist/contracts/account/account_events.d.mts +20 -20
  24. package/dist/contracts/account/account_registry.d.mts +7 -54
  25. package/dist/contracts/account/account_registry.d.mts.map +1 -1
  26. package/dist/contracts/account/account_registry.mjs +2 -22
  27. package/dist/contracts/account/account_registry.mjs.map +1 -1
  28. package/dist/contracts/deepbook/account.d.mts +18 -18
  29. package/dist/contracts/deepbook/balances.d.mts +4 -4
  30. package/dist/contracts/deepbook/deep_price.d.mts +3 -3
  31. package/dist/contracts/deepbook/order.d.mts +12 -12
  32. package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
  33. package/dist/contracts/deepbook_predict/admin.d.mts.map +1 -1
  34. package/dist/contracts/deepbook_predict/builder_code.d.mts +60 -13
  35. package/dist/contracts/deepbook_predict/builder_code.d.mts.map +1 -1
  36. package/dist/contracts/deepbook_predict/builder_code.mjs +55 -1
  37. package/dist/contracts/deepbook_predict/builder_code.mjs.map +1 -1
  38. package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
  39. package/dist/contracts/deepbook_predict/config_events.d.mts +88 -84
  40. package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
  41. package/dist/contracts/deepbook_predict/config_events.mjs +8 -0
  42. package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
  43. package/dist/contracts/deepbook_predict/expiry_market.d.mts +262 -101
  44. package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
  45. package/dist/contracts/deepbook_predict/expiry_market.mjs +320 -41
  46. package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
  47. package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
  48. package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts.map +1 -1
  49. package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
  50. package/dist/contracts/deepbook_predict/market_manager.d.mts.map +1 -1
  51. package/dist/contracts/deepbook_predict/order_events.d.mts +56 -54
  52. package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
  53. package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
  54. package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
  55. package/dist/contracts/deepbook_predict/pause_cap.d.mts.map +1 -1
  56. package/dist/contracts/deepbook_predict/plp.d.mts +74 -74
  57. package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
  58. package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
  59. package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts.map +1 -1
  60. package/dist/contracts/deepbook_predict/predict_account.d.mts +22 -17
  61. package/dist/contracts/deepbook_predict/predict_account.d.mts.map +1 -1
  62. package/dist/contracts/deepbook_predict/predict_account.mjs +12 -6
  63. package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -1
  64. package/dist/contracts/deepbook_predict/pricing.d.mts +67 -67
  65. package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
  66. package/dist/contracts/deepbook_predict/protocol_config.d.mts +127 -83
  67. package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
  68. package/dist/contracts/deepbook_predict/protocol_config.mjs +59 -1
  69. package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
  70. package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
  71. package/dist/contracts/deepbook_predict/range_codec.d.mts.map +1 -1
  72. package/dist/contracts/deepbook_predict/registry.d.mts +32 -32
  73. package/dist/contracts/deepbook_predict/registry.d.mts.map +1 -1
  74. package/dist/contracts/deepbook_predict/vault_events.d.mts +131 -131
  75. package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +13 -13
  76. package/dist/contracts/deepbook_predict_math/math.d.mts +14 -14
  77. package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +30 -30
  78. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +6 -0
  79. package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -1
  80. package/dist/contracts/deepbook_predict_orders/desk.d.mts +28 -28
  81. package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -1
  82. package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +187 -187
  83. package/dist/contracts/deepbook_predict_orders/queue.d.mts +240 -62
  84. package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -1
  85. package/dist/contracts/deepbook_predict_orders/queue.mjs +306 -41
  86. package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -1
  87. package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +140 -140
  88. package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
  89. package/dist/contracts/deepbook_sessions/sessions.d.mts +271 -31
  90. package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
  91. package/dist/contracts/deepbook_sessions/sessions.mjs +363 -3
  92. package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
  93. package/dist/deployments/mainnet.mjs.map +1 -1
  94. package/dist/deployments/testnet.d.mts.map +1 -1
  95. package/dist/deployments/testnet.mjs +7 -4
  96. package/dist/deployments/testnet.mjs.map +1 -1
  97. package/dist/predict/bindings/expiry-market.d.mts +57 -7
  98. package/dist/predict/bindings/expiry-market.d.mts.map +1 -1
  99. package/dist/predict/bindings/expiry-market.mjs +48 -2
  100. package/dist/predict/bindings/expiry-market.mjs.map +1 -1
  101. package/dist/predict/bindings/protocol-config.d.mts +5 -5
  102. package/dist/predict/bindings/protocol-config.d.mts.map +1 -1
  103. package/dist/predict/bindings/protocol-config.mjs +4 -1
  104. package/dist/predict/bindings/protocol-config.mjs.map +1 -1
  105. package/dist/predict/bindings/queue.d.mts +30 -0
  106. package/dist/predict/bindings/queue.d.mts.map +1 -0
  107. package/dist/predict/bindings/queue.mjs +59 -0
  108. package/dist/predict/bindings/queue.mjs.map +1 -0
  109. package/dist/predict/bindings/rename.mjs +5 -1
  110. package/dist/predict/bindings/rename.mjs.map +1 -1
  111. package/dist/predict/client.d.mts.map +1 -1
  112. package/dist/predict/client.mjs +11 -5
  113. package/dist/predict/client.mjs.map +1 -1
  114. package/dist/predict/config/generated.d.mts +1 -1
  115. package/dist/predict/config/generated.d.mts.map +1 -1
  116. package/dist/predict/config/generated.mjs +1 -0
  117. package/dist/predict/config/generated.mjs.map +1 -1
  118. package/dist/predict/config/mainnet.mjs +3 -1
  119. package/dist/predict/config/mainnet.mjs.map +1 -1
  120. package/dist/predict/config/testnet.mjs +3 -1
  121. package/dist/predict/config/testnet.mjs.map +1 -1
  122. package/dist/predict/config/types.d.mts +23 -0
  123. package/dist/predict/config/types.d.mts.map +1 -1
  124. package/dist/predict/cost.d.mts +9 -1
  125. package/dist/predict/cost.d.mts.map +1 -1
  126. package/dist/predict/cost.mjs.map +1 -1
  127. package/dist/predict/errors.d.mts.map +1 -1
  128. package/dist/predict/errors.mjs +6 -2
  129. package/dist/predict/errors.mjs.map +1 -1
  130. package/dist/predict/index.d.mts +1 -1
  131. package/dist/predict/index.mjs +2 -2
  132. package/dist/predict/queue.d.mts +8 -4
  133. package/dist/predict/queue.d.mts.map +1 -1
  134. package/dist/predict/queue.mjs +8 -4
  135. package/dist/predict/queue.mjs.map +1 -1
  136. package/dist/predict/reads/balances.mjs +1 -1
  137. package/dist/predict/reads/queue.d.mts +3 -2
  138. package/dist/predict/reads/queue.d.mts.map +1 -1
  139. package/dist/predict/reads/queue.mjs +5 -4
  140. package/dist/predict/reads/queue.mjs.map +1 -1
  141. package/dist/predict/tx/authed.mjs +1 -1
  142. package/dist/predict/tx/common.d.mts.map +1 -1
  143. package/dist/predict/tx/common.mjs +3 -2
  144. package/dist/predict/tx/common.mjs.map +1 -1
  145. package/dist/predict/tx/trade.d.mts.map +1 -1
  146. package/dist/predict/tx/trade.mjs +3 -2
  147. package/dist/predict/tx/trade.mjs.map +1 -1
  148. package/dist/sessions.d.mts +10 -1
  149. package/dist/sessions.d.mts.map +1 -1
  150. package/dist/sessions.mjs.map +1 -1
  151. package/dist/transactions/balanceManager.d.mts +12 -12
  152. package/dist/transactions/balanceManager.d.mts.map +1 -1
  153. package/dist/transactions/deepbook.d.mts +20 -20
  154. package/dist/transactions/deepbook.d.mts.map +1 -1
  155. package/dist/transactions/deepbookAdmin.d.mts +4 -4
  156. package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
  157. package/dist/transactions/marginAdmin.d.mts +7 -7
  158. package/dist/transactions/marginAdmin.d.mts.map +1 -1
  159. package/dist/transactions/marginLiquidations.d.mts +3 -3
  160. package/dist/transactions/marginMaintainer.d.mts +5 -5
  161. package/dist/transactions/marginMaintainer.d.mts.map +1 -1
  162. package/dist/transactions/marginManager.d.mts +32 -32
  163. package/dist/transactions/marginManager.d.mts.map +1 -1
  164. package/dist/transactions/marginPool.d.mts +18 -18
  165. package/dist/transactions/marginPool.d.mts.map +1 -1
  166. package/dist/transactions/marginRegistry.d.mts +16 -16
  167. package/dist/transactions/marginTPSL.d.mts +10 -10
  168. package/dist/transactions/marginTPSL.d.mts.map +1 -1
  169. package/dist/transactions/poolProxy.d.mts +8 -8
  170. package/dist/transactions/poolProxy.d.mts.map +1 -1
  171. package/dist/utils/constants.d.mts.map +1 -1
  172. package/dist/utils/constants.mjs +1 -1
  173. package/dist/utils/constants.mjs.map +1 -1
  174. package/package.json +1 -1
  175. package/src/account-bindings/account-registry.ts +39 -0
  176. package/src/account-bindings/account.ts +73 -0
  177. package/src/account-bindings/latest.ts +41 -0
  178. package/src/account.ts +89 -5
  179. package/src/contracts/account/account.ts +73 -4
  180. package/src/contracts/account/account_registry.ts +1 -1
  181. package/src/contracts/deepbook_predict/builder_code.ts +94 -2
  182. package/src/contracts/deepbook_predict/config_events.ts +7 -0
  183. package/src/contracts/deepbook_predict/expiry_market.ts +490 -44
  184. package/src/contracts/deepbook_predict/order_events.ts +6 -4
  185. package/src/contracts/deepbook_predict/predict_account.ts +12 -6
  186. package/src/contracts/deepbook_predict/protocol_config.ts +85 -0
  187. package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +14 -0
  188. package/src/contracts/deepbook_predict_orders/order_flow.ts +4 -0
  189. package/src/contracts/deepbook_predict_orders/queue.ts +495 -9
  190. package/src/contracts/deepbook_sessions/sessions.ts +538 -3
  191. package/src/deployments/mainnet.ts +4 -4
  192. package/src/deployments/testnet.ts +18 -7
  193. package/src/deployments/types.ts +14 -0
  194. package/src/predict/bindings/expiry-market.ts +87 -0
  195. package/src/predict/bindings/queue.ts +42 -0
  196. package/src/predict/bindings/rename.ts +5 -1
  197. package/src/predict/client.ts +25 -3
  198. package/src/predict/config/generated.ts +3 -0
  199. package/src/predict/config/mainnet.ts +4 -0
  200. package/src/predict/config/testnet.ts +4 -0
  201. package/src/predict/config/types.ts +23 -0
  202. package/src/predict/cost.ts +9 -1
  203. package/src/predict/errors.ts +11 -1
  204. package/src/predict/index.ts +1 -1
  205. package/src/predict/queue.ts +8 -4
  206. package/src/predict/reads/queue.ts +7 -4
  207. package/src/predict/tx/common.ts +2 -0
  208. package/src/predict/tx/trade.ts +3 -1
  209. package/src/sessions.ts +10 -1
  210. package/src/utils/constants.ts +5 -1
@@ -1,4 +1,3 @@
1
- import { __exportAll } from "../../_virtual/rolldown_runtime.mjs";
2
1
  import { MoveStruct, normalizeMoveArguments } from "../utils/index.mjs";
3
2
  import { OrderBook } from "./order_queue.mjs";
4
3
  import { bcs } from "@mysten/sui/bcs";
@@ -39,38 +38,6 @@ import { bcs } from "@mysten/sui/bcs";
39
38
  * globally paused every address counts as denied: fills refuse, refunds park, and
40
39
  * payouts skip until the pause lifts.
41
40
  */
42
- var queue_exports = /* @__PURE__ */ __exportAll({
43
- MarketQueue: () => MarketQueue,
44
- adminRefund: () => adminRefund,
45
- claimParked: () => claimParked,
46
- cleanup: () => cleanup,
47
- commit: () => commit,
48
- createAndShare: () => createAndShare,
49
- deskId: () => deskId,
50
- enqueueExactAmount: () => enqueueExactAmount,
51
- enqueueExactCost: () => enqueueExactCost,
52
- enqueueExactQuantity: () => enqueueExactQuantity,
53
- enqueueRedeemOpen: () => enqueueRedeemOpen,
54
- expiryMarketId: () => expiryMarketId,
55
- id: () => id,
56
- oldestUnfinishedTauMs: () => oldestUnfinishedTauMs,
57
- order: () => order,
58
- payOpen: () => payOpen,
59
- payoutProgress: () => payoutProgress,
60
- pendingCounts: () => pendingCounts,
61
- phaseDone: () => phaseDone,
62
- phaseDrain: () => phaseDrain,
63
- phasePay: () => phasePay,
64
- queueHeads: () => queueHeads,
65
- queueId: () => queueId,
66
- queueStuck: () => queueStuck,
67
- quoteRedeemOpen: () => quoteRedeemOpen,
68
- refund: () => refund,
69
- resolve: () => resolve,
70
- settleStep: () => settleStep,
71
- waitingCohorts: () => waitingCohorts,
72
- waitingOrders: () => waitingOrders
73
- });
74
41
  const $moduleName = "@local-pkg/deepbook_predict_orders::queue";
75
42
  const MarketQueue = new MoveStruct({
76
43
  name: `${$moduleName}::MarketQueue`,
@@ -280,13 +247,31 @@ function oldestUnfinishedTauMs(options) {
280
247
  });
281
248
  }
282
249
  /**
250
+ * Return the builder fee per contract `record_id`'s order pays at its fill, in
251
+ * FLOAT_SCALING of the $1 payout: the capped fee its receipt records, or `0` for a
252
+ * missing record, a record holding no receipt or an open one, and an order that
253
+ * names no builder. For SDK and devInspect reads of a waiting order.
254
+ */
255
+ function builderFeePerContract(options) {
256
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
257
+ const argumentsTypes = [null, "u64"];
258
+ const parameterNames = ["queue", "recordId"];
259
+ return (tx) => tx.moveCall({
260
+ package: packageAddress,
261
+ module: "queue",
262
+ function: "builder_fee_per_contract",
263
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames)
264
+ });
265
+ }
266
+ /**
283
267
  * Quote an early sell of `close_quantity` from the Open record `record_id` at a
284
- * live `Pricer`, with the wrapper account's builder code, through Predict's
285
- * `quote_close`: the close a queued sell fills, with the trading fee at the clock
286
- * instead of a committed tick. `proceeds` is before the order fee. Changes
287
- * nothing. Aborts `ERecordNotOpen` for a missing or non-Open record, and otherwise
288
- * as `quote_close` does. Does not check that the account owns the record. For SDK
289
- * and devInspect pricing before `enqueue_redeem_open`.
268
+ * live `Pricer` through Predict's `quote_close`: the close a queued sell fills,
269
+ * with the trading fee at the clock instead of a committed tick. No builder fee,
270
+ * matching `enqueue_redeem_open`; `quote_redeem_open_with_builder_fee` quotes a
271
+ * sell that names a builder. `proceeds` is before the order fee. Changes nothing.
272
+ * Aborts `ERecordNotOpen` for a missing or non-Open record, and otherwise as
273
+ * `quote_close` does. Does not check that the account owns the record. For SDK and
274
+ * devInspect pricing before `enqueue_redeem_open`.
290
275
  */
291
276
  function quoteRedeemOpen(options) {
292
277
  const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
@@ -302,7 +287,7 @@ function quoteRedeemOpen(options) {
302
287
  const parameterNames = [
303
288
  "queue",
304
289
  "market",
305
- "wrapper",
290
+ "Wrapper",
306
291
  "pricer",
307
292
  "recordId",
308
293
  "closeQuantity"
@@ -315,6 +300,45 @@ function quoteRedeemOpen(options) {
315
300
  });
316
301
  }
317
302
  /**
303
+ * `quote_redeem_open` for a sell that names a builder, through Predict's
304
+ * `quote_close_with_builder_fee`: charges `builder_fee_per_contract`, in
305
+ * FLOAT_SCALING of the $1 payout, capped at `protocol_config::builder_fee_cap` and
306
+ * then at the redeem value left after the trading fee, as the fill charges it.
307
+ * Changes nothing and aborts like `quote_redeem_open`. For SDK and devInspect
308
+ * pricing before `enqueue_redeem_open_with_builder`.
309
+ */
310
+ function quoteRedeemOpenWithBuilderFee(options) {
311
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
312
+ const argumentsTypes = [
313
+ null,
314
+ null,
315
+ null,
316
+ null,
317
+ "u64",
318
+ "u64",
319
+ "u64",
320
+ "0x2::clock::Clock"
321
+ ];
322
+ const parameterNames = [
323
+ "queue",
324
+ "market",
325
+ "config",
326
+ "pricer",
327
+ "recordId",
328
+ "closeQuantity",
329
+ "builderFeePerContract"
330
+ ];
331
+ return (tx) => tx.moveCall({
332
+ package: packageAddress,
333
+ module: "queue",
334
+ function: "quote_redeem_open_with_builder_fee",
335
+ arguments: normalizeMoveArguments({
336
+ ...options.arguments,
337
+ config: options.arguments?.config ?? options.config?.protocolConfig
338
+ }, argumentsTypes, parameterNames)
339
+ });
340
+ }
341
+ /**
318
342
  * Create and share `market`'s queue under `desk`. Permissionless; the caller pays
319
343
  * its storage. The queue's ID is derived from the desk's registry and the market,
320
344
  * so a second call for the same market aborts. Writes only the registry, which no
@@ -410,6 +434,69 @@ function enqueueExactQuantity(options) {
410
434
  });
411
435
  }
412
436
  /**
437
+ * `enqueue_exact_quantity` for an order that names a builder: `code` is the
438
+ * builder code the trade pays and `builder_fee_per_contract` its fee per contract,
439
+ * in FLOAT_SCALING of the $1 payout. Predict caps the fee at
440
+ * `protocol_config::builder_fee_cap`, records it in the order's receipt, and
441
+ * prices the order's limits with it, and the fill pays `quantity * fee`, rounded
442
+ * down, to the code. Refuses orders like `enqueue_exact_quantity`. Returns the new
443
+ * record ID.
444
+ */
445
+ function enqueueExactQuantityWithBuilder(options) {
446
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
447
+ const argumentsTypes = [
448
+ null,
449
+ null,
450
+ null,
451
+ null,
452
+ null,
453
+ null,
454
+ null,
455
+ null,
456
+ null,
457
+ null,
458
+ null,
459
+ "u64",
460
+ "u64",
461
+ "u64",
462
+ "u64",
463
+ "u64",
464
+ "u64",
465
+ "0x2::accumulator::AccumulatorRoot",
466
+ "0x2::clock::Clock"
467
+ ];
468
+ const parameterNames = [
469
+ "queue",
470
+ "market",
471
+ "wrapper",
472
+ "auth",
473
+ "desk",
474
+ "config",
475
+ "propbookRegistry",
476
+ "pyth",
477
+ "bsValues",
478
+ "bsSvi",
479
+ "code",
480
+ "builderFeePerContract",
481
+ "lowerTick",
482
+ "higherTick",
483
+ "quantity",
484
+ "maxCost",
485
+ "maxProbability"
486
+ ];
487
+ return (tx) => tx.moveCall({
488
+ package: packageAddress,
489
+ module: "queue",
490
+ function: "enqueue_exact_quantity_with_builder",
491
+ arguments: normalizeMoveArguments({
492
+ ...options.arguments,
493
+ desk: options.arguments?.desk ?? options.config?.orderDesk,
494
+ config: options.arguments?.config ?? options.config?.protocolConfig,
495
+ propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
496
+ }, argumentsTypes, parameterNames)
497
+ });
498
+ }
499
+ /**
413
500
  * Place a queued premium-budget mint: sized at τ under `max_premium`, at least
414
501
  * `min_quantity`, with the all-in withdrawal capped by the mandatory `max_cost`.
415
502
  * Escrows `min(max_cost, available - order_fee)` and the order fee. Refuses orders
@@ -466,6 +553,65 @@ function enqueueExactAmount(options) {
466
553
  });
467
554
  }
468
555
  /**
556
+ * `enqueue_exact_amount` for an order that names a builder, charging the capped
557
+ * `builder_fee_per_contract` to `code` like `enqueue_exact_quantity_with_builder`.
558
+ * The fee is inside the `max_cost` withdrawal cap. Returns the new record ID.
559
+ */
560
+ function enqueueExactAmountWithBuilder(options) {
561
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
562
+ const argumentsTypes = [
563
+ null,
564
+ null,
565
+ null,
566
+ null,
567
+ null,
568
+ null,
569
+ null,
570
+ null,
571
+ null,
572
+ null,
573
+ null,
574
+ "u64",
575
+ "u64",
576
+ "u64",
577
+ "u64",
578
+ "u64",
579
+ "u64",
580
+ "0x2::accumulator::AccumulatorRoot",
581
+ "0x2::clock::Clock"
582
+ ];
583
+ const parameterNames = [
584
+ "queue",
585
+ "market",
586
+ "wrapper",
587
+ "auth",
588
+ "desk",
589
+ "config",
590
+ "propbookRegistry",
591
+ "pyth",
592
+ "bsValues",
593
+ "bsSvi",
594
+ "code",
595
+ "builderFeePerContract",
596
+ "lowerTick",
597
+ "higherTick",
598
+ "maxPremium",
599
+ "minQuantity",
600
+ "maxCost"
601
+ ];
602
+ return (tx) => tx.moveCall({
603
+ package: packageAddress,
604
+ module: "queue",
605
+ function: "enqueue_exact_amount_with_builder",
606
+ arguments: normalizeMoveArguments({
607
+ ...options.arguments,
608
+ desk: options.arguments?.desk ?? options.config?.orderDesk,
609
+ config: options.arguments?.config ?? options.config?.protocolConfig,
610
+ propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
611
+ }, argumentsTypes, parameterNames)
612
+ });
613
+ }
614
+ /**
469
615
  * Place a queued all-in-budget mint: sized at τ so the all-in cost fits
470
616
  * `max_cost`, at least `min_quantity`. Escrows
471
617
  * `min(max_cost, available - order_fee)` and the order fee. `max_cost` is
@@ -521,6 +667,64 @@ function enqueueExactCost(options) {
521
667
  });
522
668
  }
523
669
  /**
670
+ * `enqueue_exact_cost` for an order that names a builder, charging the capped
671
+ * `builder_fee_per_contract` to `code` like `enqueue_exact_quantity_with_builder`.
672
+ * The fill sizes the order so the fee fits inside `max_cost`. Returns the new
673
+ * record ID.
674
+ */
675
+ function enqueueExactCostWithBuilder(options) {
676
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
677
+ const argumentsTypes = [
678
+ null,
679
+ null,
680
+ null,
681
+ null,
682
+ null,
683
+ null,
684
+ null,
685
+ null,
686
+ null,
687
+ null,
688
+ null,
689
+ "u64",
690
+ "u64",
691
+ "u64",
692
+ "u64",
693
+ "u64",
694
+ "0x2::accumulator::AccumulatorRoot",
695
+ "0x2::clock::Clock"
696
+ ];
697
+ const parameterNames = [
698
+ "queue",
699
+ "market",
700
+ "wrapper",
701
+ "auth",
702
+ "desk",
703
+ "config",
704
+ "propbookRegistry",
705
+ "pyth",
706
+ "bsValues",
707
+ "bsSvi",
708
+ "code",
709
+ "builderFeePerContract",
710
+ "lowerTick",
711
+ "higherTick",
712
+ "maxCost",
713
+ "minQuantity"
714
+ ];
715
+ return (tx) => tx.moveCall({
716
+ package: packageAddress,
717
+ module: "queue",
718
+ function: "enqueue_exact_cost_with_builder",
719
+ arguments: normalizeMoveArguments({
720
+ ...options.arguments,
721
+ desk: options.arguments?.desk ?? options.config?.orderDesk,
722
+ config: options.arguments?.config ?? options.config?.protocolConfig,
723
+ propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
724
+ }, argumentsTypes, parameterNames)
725
+ });
726
+ }
727
+ /**
524
728
  * Place a queued early sell of `close_quantity` of an Open record's position.
525
729
  * `record_id` is the record's queue ID, not the position's order ID. The source
526
730
  * record must belong to this account (`ENotRecordOwner`) and be Open
@@ -585,6 +789,67 @@ function enqueueRedeemOpen(options) {
585
789
  });
586
790
  }
587
791
  /**
792
+ * `enqueue_redeem_open` for a sell that names a builder: `code` is the builder
793
+ * code the sell pays and `builder_fee_per_contract` its fee per contract, in
794
+ * FLOAT_SCALING of the $1 payout. Predict caps the fee at
795
+ * `protocol_config::builder_fee_cap`, records it in the order's receipt, and
796
+ * checks `min_proceeds` with it, and the fill pays `close_quantity * fee`, rounded
797
+ * down, to the code, capped at the redeem value left after the trading fee.
798
+ * Refuses sells like `enqueue_redeem_open`. Returns the new record ID.
799
+ */
800
+ function enqueueRedeemOpenWithBuilder(options) {
801
+ const packageAddress = options.package ?? options.config?.predictOrdersPackageId ?? "@local-pkg/deepbook_predict_orders";
802
+ const argumentsTypes = [
803
+ null,
804
+ null,
805
+ null,
806
+ null,
807
+ null,
808
+ null,
809
+ null,
810
+ null,
811
+ null,
812
+ null,
813
+ null,
814
+ "u64",
815
+ "u64",
816
+ "u64",
817
+ "u64",
818
+ "u64",
819
+ "0x2::accumulator::AccumulatorRoot",
820
+ "0x2::clock::Clock"
821
+ ];
822
+ const parameterNames = [
823
+ "queue",
824
+ "market",
825
+ "wrapper",
826
+ "auth",
827
+ "desk",
828
+ "config",
829
+ "propbookRegistry",
830
+ "pyth",
831
+ "bsValues",
832
+ "bsSvi",
833
+ "code",
834
+ "builderFeePerContract",
835
+ "recordId",
836
+ "closeQuantity",
837
+ "minProbability",
838
+ "minProceeds"
839
+ ];
840
+ return (tx) => tx.moveCall({
841
+ package: packageAddress,
842
+ module: "queue",
843
+ function: "enqueue_redeem_open_with_builder",
844
+ arguments: normalizeMoveArguments({
845
+ ...options.arguments,
846
+ desk: options.arguments?.desk ?? options.config?.orderDesk,
847
+ config: options.arguments?.config ?? options.config?.protocolConfig,
848
+ propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry
849
+ }, argumentsTypes, parameterNames)
850
+ });
851
+ }
852
+ /**
588
853
  * Attach verified Pyth Lazer prices to the waiting cohorts whose τ they match.
589
854
  * Permissionless. Each update must come from the Pyth Lazer verifier earlier in
590
855
  * the same PTB; their order in `updates` does not matter. An update that matches
@@ -908,5 +1173,5 @@ function claimParked(options) {
908
1173
  }
909
1174
 
910
1175
  //#endregion
911
- export { adminRefund, claimParked, cleanup, commit, createAndShare, enqueueExactAmount, enqueueExactCost, enqueueExactQuantity, enqueueRedeemOpen, order, payOpen, payoutProgress, pendingCounts, queueHeads, queueStuck, queue_exports, quoteRedeemOpen, refund, resolve, settleStep, waitingCohorts, waitingOrders };
1176
+ export { MarketQueue, adminRefund, builderFeePerContract, claimParked, cleanup, commit, createAndShare, deskId, enqueueExactAmount, enqueueExactAmountWithBuilder, enqueueExactCost, enqueueExactCostWithBuilder, enqueueExactQuantity, enqueueExactQuantityWithBuilder, enqueueRedeemOpen, enqueueRedeemOpenWithBuilder, expiryMarketId, id, oldestUnfinishedTauMs, order, payOpen, payoutProgress, pendingCounts, phaseDone, phaseDrain, phasePay, queueHeads, queueId, queueStuck, quoteRedeemOpen, quoteRedeemOpenWithBuilderFee, refund, resolve, settleStep, waitingCohorts, waitingOrders };
912
1177
  //# sourceMappingURL=queue.mjs.map