@mysten/deepbook-v3 2.6.4 → 2.8.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.
- package/CHANGELOG.md +153 -0
- package/PREDICT.md +389 -61
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_registry.d.mts +13 -13
- package/dist/contracts/deepbook/account.d.mts +18 -18
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/deep_price.d.mts +3 -3
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/admin.d.mts +4 -4
- package/dist/contracts/deepbook_predict/builder_code.d.mts +11 -11
- package/dist/contracts/deepbook_predict/builder_code_events.d.mts +10 -10
- package/dist/contracts/deepbook_predict/config_events.d.mts +93 -68
- package/dist/contracts/deepbook_predict/config_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/config_events.mjs +45 -1
- package/dist/contracts/deepbook_predict/config_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/deps/std/type_name.mjs +17 -0
- package/dist/contracts/deepbook_predict/deps/std/type_name.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +652 -235
- package/dist/contracts/deepbook_predict/expiry_market.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/expiry_market.mjs +652 -186
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/lp_book.mjs +1 -1
- package/dist/contracts/deepbook_predict/market_lifecycle_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/market_manager.d.mts +27 -27
- package/dist/contracts/deepbook_predict/order_events.d.mts +50 -50
- package/dist/contracts/deepbook_predict/order_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.mjs +3 -1
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/plp.d.mts +184 -82
- package/dist/contracts/deepbook_predict/plp.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/plp.mjs +126 -7
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +1 -1
- package/dist/contracts/deepbook_predict/pool_valuation_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/predict_account.d.mts +14 -14
- package/dist/contracts/deepbook_predict/pricing.d.mts +91 -58
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +30 -3
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/pricing_config.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +400 -92
- package/dist/contracts/deepbook_predict/protocol_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.mjs +451 -61
- package/dist/contracts/deepbook_predict/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/range_codec.d.mts +2 -2
- package/dist/contracts/deepbook_predict/registry.d.mts +28 -28
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +1 -1
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +17 -12
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +154 -106
- package/dist/contracts/deepbook_predict/vault_events.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs +57 -1
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -1
- package/dist/contracts/deepbook_predict_math/config-arguments.d.mts +10 -0
- package/dist/contracts/deepbook_predict_math/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.d.mts +106 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.mjs +125 -0
- package/dist/contracts/deepbook_predict_math/lazer_price.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_math/math.d.mts +284 -0
- package/dist/contracts/deepbook_predict_math/math.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_math/math.mjs +364 -0
- package/dist/contracts/deepbook_predict_math/math.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts +13 -0
- package/dist/contracts/deepbook_predict_orders/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts +215 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs +215 -0
- package/dist/contracts/deepbook_predict_orders/delayed_execution_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs +87 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs +52 -0
- package/dist/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs +25 -0
- package/dist/contracts/deepbook_predict_orders/deps/fixed_math/i64.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs +21 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs +39 -0
- package/dist/contracts/deepbook_predict_orders/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/desk.d.mts +187 -0
- package/dist/contracts/deepbook_predict_orders/desk.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/desk.mjs +261 -0
- package/dist/contracts/deepbook_predict_orders/desk.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.d.mts +1042 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.mjs +849 -0
- package/dist/contracts/deepbook_predict_orders/order_queue.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue.d.mts +683 -0
- package/dist/contracts/deepbook_predict_orders/queue.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue.mjs +912 -0
- package/dist/contracts/deepbook_predict_orders/queue.mjs.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.d.mts +195 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.mjs +187 -0
- package/dist/contracts/deepbook_predict_orders/queue_events.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/sessions.d.mts +163 -28
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.mjs +234 -5
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -1
- package/dist/deployments/mainnet.mjs +7 -4
- package/dist/deployments/mainnet.mjs.map +1 -1
- package/dist/deployments/testnet.mjs +7 -4
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/predict/bindings/expiry-market.d.mts +77 -0
- package/dist/predict/bindings/expiry-market.d.mts.map +1 -0
- package/dist/predict/bindings/expiry-market.mjs +139 -0
- package/dist/predict/bindings/expiry-market.mjs.map +1 -0
- package/dist/predict/bindings/protocol-config.d.mts +39 -0
- package/dist/predict/bindings/protocol-config.d.mts.map +1 -0
- package/dist/predict/bindings/protocol-config.mjs +90 -0
- package/dist/predict/bindings/protocol-config.mjs.map +1 -0
- package/dist/predict/bindings/rename.mjs +9 -0
- package/dist/predict/bindings/rename.mjs.map +1 -0
- package/dist/predict/client.d.mts +595 -16
- package/dist/predict/client.d.mts.map +1 -1
- package/dist/predict/client.mjs +986 -10
- package/dist/predict/client.mjs.map +1 -1
- package/dist/predict/config/generated.d.mts +22 -1
- package/dist/predict/config/generated.d.mts.map +1 -1
- package/dist/predict/config/generated.mjs +30 -1
- package/dist/predict/config/generated.mjs.map +1 -1
- package/dist/predict/config/mainnet.mjs +11 -3
- package/dist/predict/config/mainnet.mjs.map +1 -1
- package/dist/predict/config/testnet.mjs +11 -3
- package/dist/predict/config/testnet.mjs.map +1 -1
- package/dist/predict/config/types.d.mts +50 -1
- package/dist/predict/config/types.d.mts.map +1 -1
- package/dist/predict/cost.d.mts +38 -11
- package/dist/predict/cost.d.mts.map +1 -1
- package/dist/predict/cost.mjs +37 -11
- package/dist/predict/cost.mjs.map +1 -1
- package/dist/predict/decode.d.mts +251 -1
- package/dist/predict/decode.d.mts.map +1 -1
- package/dist/predict/decode.mjs +342 -4
- package/dist/predict/decode.mjs.map +1 -1
- package/dist/predict/errors.d.mts +69 -6
- package/dist/predict/errors.d.mts.map +1 -1
- package/dist/predict/errors.mjs +277 -4
- package/dist/predict/errors.mjs.map +1 -1
- package/dist/predict/index.d.mts +21 -10
- package/dist/predict/index.mjs +24 -12
- package/dist/predict/queue-id.d.mts +13 -0
- package/dist/predict/queue-id.d.mts.map +1 -0
- package/dist/predict/queue-id.mjs +19 -0
- package/dist/predict/queue-id.mjs.map +1 -0
- package/dist/predict/queue.d.mts +505 -0
- package/dist/predict/queue.d.mts.map +1 -0
- package/dist/predict/queue.mjs +774 -0
- package/dist/predict/queue.mjs.map +1 -0
- package/dist/predict/reads/balances.mjs +1 -1
- package/dist/predict/reads/markets.mjs +46 -5
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pool.mjs +1 -1
- package/dist/predict/reads/pricing.d.mts +1 -1
- package/dist/predict/reads/queue.d.mts +105 -0
- package/dist/predict/reads/queue.d.mts.map +1 -0
- package/dist/predict/reads/queue.mjs +445 -0
- package/dist/predict/reads/queue.mjs.map +1 -0
- package/dist/predict/ticks.d.mts +9 -1
- package/dist/predict/ticks.d.mts.map +1 -1
- package/dist/predict/ticks.mjs +18 -1
- package/dist/predict/ticks.mjs.map +1 -1
- package/dist/predict/tx/authed.mjs +1 -1
- package/dist/predict/tx/common.d.mts.map +1 -1
- package/dist/predict/tx/common.mjs +12 -1
- package/dist/predict/tx/common.mjs.map +1 -1
- package/dist/predict/tx/queue.d.mts +220 -0
- package/dist/predict/tx/queue.d.mts.map +1 -0
- package/dist/predict/tx/queue.mjs +399 -0
- package/dist/predict/tx/queue.mjs.map +1 -0
- package/dist/predict/tx/trade.d.mts.map +1 -1
- package/dist/predict/tx/trade.mjs +61 -43
- package/dist/predict/tx/trade.mjs.map +1 -1
- package/dist/sessions.d.mts +90 -2
- package/dist/sessions.d.mts.map +1 -1
- package/dist/sessions.mjs +107 -2
- package/dist/sessions.mjs.map +1 -1
- package/dist/transactions/balanceManager.d.mts +12 -12
- package/dist/transactions/balanceManager.d.mts.map +1 -1
- package/dist/transactions/deepbook.d.mts +20 -20
- package/dist/transactions/deepbook.d.mts.map +1 -1
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginAdmin.d.mts.map +1 -1
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginMaintainer.d.mts.map +1 -1
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginManager.d.mts.map +1 -1
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/package.json +4 -4
- package/src/contracts/deepbook_predict/config_events.ts +39 -0
- package/src/contracts/deepbook_predict/deps/std/type_name.ts +24 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +960 -169
- package/src/contracts/deepbook_predict/order_events.ts +3 -1
- package/src/contracts/deepbook_predict/plp.ts +150 -9
- package/src/contracts/deepbook_predict/pricing.ts +46 -7
- package/src/contracts/deepbook_predict/pricing_config.ts +3 -1
- package/src/contracts/deepbook_predict/protocol_config.ts +648 -33
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +25 -21
- package/src/contracts/deepbook_predict/vault_events.ts +65 -0
- package/src/contracts/deepbook_predict_math/config-arguments.ts +6 -0
- package/src/contracts/deepbook_predict_math/lazer_price.ts +196 -0
- package/src/contracts/deepbook_predict_math/math.ts +553 -0
- package/src/contracts/deepbook_predict_orders/config-arguments.ts +11 -0
- package/src/contracts/deepbook_predict_orders/delayed_execution_config.ts +430 -0
- package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/expiry_market.ts +108 -0
- package/src/contracts/deepbook_predict_orders/deps/deepbook_predict/pricing.ts +58 -0
- package/src/contracts/deepbook_predict_orders/deps/fixed_math/i64.ts +21 -0
- package/src/contracts/deepbook_predict_orders/deps/sui/balance.ts +19 -0
- package/src/contracts/deepbook_predict_orders/deps/sui/table.ts +37 -0
- package/src/contracts/deepbook_predict_orders/desk.ts +419 -0
- package/src/contracts/deepbook_predict_orders/order_flow.ts +19 -0
- package/src/contracts/deepbook_predict_orders/order_queue.ts +1670 -0
- package/src/contracts/deepbook_predict_orders/queue.ts +1394 -0
- package/src/contracts/deepbook_predict_orders/queue_events.ts +189 -0
- package/src/contracts/deepbook_sessions/sessions.ts +355 -4
- package/src/deployments/mainnet.ts +7 -2
- package/src/deployments/testnet.ts +7 -2
- package/src/deployments/types.ts +14 -1
- package/src/predict/bindings/expiry-market.ts +127 -0
- package/src/predict/bindings/protocol-config.ts +59 -0
- package/src/predict/bindings/rename.ts +14 -0
- package/src/predict/client.ts +2076 -13
- package/src/predict/config/generated.ts +50 -0
- package/src/predict/config/mainnet.ts +16 -2
- package/src/predict/config/testnet.ts +16 -2
- package/src/predict/config/types.ts +51 -1
- package/src/predict/cost.ts +62 -14
- package/src/predict/decode.ts +691 -2
- package/src/predict/errors.ts +391 -14
- package/src/predict/index.ts +87 -6
- package/src/predict/queue-id.ts +22 -0
- package/src/predict/queue.ts +1231 -0
- package/src/predict/reads/markets.ts +30 -0
- package/src/predict/reads/queue.ts +606 -0
- package/src/predict/ticks.ts +35 -0
- package/src/predict/tx/common.ts +25 -1
- package/src/predict/tx/queue.ts +525 -0
- package/src/predict/tx/trade.ts +80 -49
- package/src/sessions.ts +206 -1
package/dist/predict/errors.mjs
CHANGED
|
@@ -17,21 +17,294 @@ var PredictMoveError = class extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
+
* The error constants of the Predict modules the SDK's flows abort in, by module, as an array
|
|
21
|
+
* indexed by the plain `u64` abort code (each module numbers its constants from 0 with no gaps).
|
|
22
|
+
* Generated from the Move sources at deepbookv3 29117434. A published code never changes meaning:
|
|
23
|
+
* new codes only append, so an older package version's codes are a prefix of its module's list.
|
|
24
|
+
* Keyed by module name only, as the abort location reports it, so a same-named module in an
|
|
25
|
+
* unrelated package would be named from this table too.
|
|
26
|
+
*/
|
|
27
|
+
const ABORT_NAMES = Object.freeze({
|
|
28
|
+
expiry_market: [
|
|
29
|
+
"EMintPaused",
|
|
30
|
+
"EMarketNotSettled",
|
|
31
|
+
"EMintCostAboveMax",
|
|
32
|
+
"EMintProbabilityAboveMax",
|
|
33
|
+
"EWrongPricer",
|
|
34
|
+
"EReferenceTickObservationMissing",
|
|
35
|
+
"EMintRedeemSameTimestamp",
|
|
36
|
+
"ERedeemProbabilityBelowMin",
|
|
37
|
+
"ERedeemProceedsBelowMin",
|
|
38
|
+
"EMintCostCapRequired",
|
|
39
|
+
"EMarketNotPendingValuation",
|
|
40
|
+
"EMintCostAboveMaxPayout",
|
|
41
|
+
"ENotSettledRedeemKeeper",
|
|
42
|
+
"EDelayedExecutionRequired",
|
|
43
|
+
"EOrderFailsLimits",
|
|
44
|
+
"EInsufficientMarketCash",
|
|
45
|
+
"EInvalidOrderTiming",
|
|
46
|
+
"EInvalidOrderTerms",
|
|
47
|
+
"EWrongMarket",
|
|
48
|
+
"EWrongStage",
|
|
49
|
+
"ENotRecordOwner",
|
|
50
|
+
"EEscrowMismatch",
|
|
51
|
+
"EWrongPrice"
|
|
52
|
+
],
|
|
53
|
+
protocol_config: [
|
|
54
|
+
"ETradingPaused",
|
|
55
|
+
"EValuationInProgress",
|
|
56
|
+
"EValuationNotInProgress",
|
|
57
|
+
"EPackageVersionDisabled",
|
|
58
|
+
"EVersionWatermarkNotAdvanced",
|
|
59
|
+
"EProtocolFrozen",
|
|
60
|
+
"ESnapshotInProgress",
|
|
61
|
+
"ETradeWindowClosed",
|
|
62
|
+
"ESettledRedeemKeeperAlreadyAdded",
|
|
63
|
+
"ESettledRedeemKeeperNotFound",
|
|
64
|
+
"EFlushOperatorAlreadyAdded",
|
|
65
|
+
"EFlushOperatorNotFound",
|
|
66
|
+
"ENotFlushOperator",
|
|
67
|
+
"ECutoverNotReached",
|
|
68
|
+
"EEwmaRetired",
|
|
69
|
+
"EOrderFlowNotAllowed"
|
|
70
|
+
],
|
|
71
|
+
pricing: [
|
|
72
|
+
"EZeroForward",
|
|
73
|
+
"ECannotBeNegative",
|
|
74
|
+
"ENonPositiveVariance",
|
|
75
|
+
"EInvalidRange",
|
|
76
|
+
"EBlockScholesPriceStale",
|
|
77
|
+
"EBlockScholesInputsInvalid",
|
|
78
|
+
"EPythSpotInvalid",
|
|
79
|
+
"EWrongPythFeed",
|
|
80
|
+
"EWrongBlockScholesValueStore",
|
|
81
|
+
"ELivePricingExpired",
|
|
82
|
+
"EBlockScholesSVIStale",
|
|
83
|
+
"EWrongBlockScholesSVIStore",
|
|
84
|
+
"EBlockScholesPriceUnavailable",
|
|
85
|
+
"EBlockScholesSVIUnavailable",
|
|
86
|
+
"EBlockScholesMinVarianceInvalid",
|
|
87
|
+
"EOracleWrittenInThisTransaction",
|
|
88
|
+
"EBlockScholesInputTooWide",
|
|
89
|
+
"EPythSpotUnavailable",
|
|
90
|
+
"EPythSpotStale",
|
|
91
|
+
"EPythForwardRequired"
|
|
92
|
+
],
|
|
93
|
+
strike_exposure: [
|
|
94
|
+
"EInvalidCloseQuantity",
|
|
95
|
+
"EInvalidAdmissionTick",
|
|
96
|
+
"EInvalidReferenceTick",
|
|
97
|
+
"EReferenceTickAlreadySet",
|
|
98
|
+
"ETermsExposureMismatch",
|
|
99
|
+
"EMintQuantityBelowMin",
|
|
100
|
+
"EInvalidInventoryImpactScale"
|
|
101
|
+
],
|
|
102
|
+
strike_exposure_config: [
|
|
103
|
+
"EEntryProbabilityOutOfBounds",
|
|
104
|
+
"EInvalidEntryProbabilityBound",
|
|
105
|
+
"EInvalidFeeProbability",
|
|
106
|
+
"EPremiumBelowMinimum"
|
|
107
|
+
],
|
|
108
|
+
strike_payout_tree: [
|
|
109
|
+
"EInsufficientPayoutQuantity",
|
|
110
|
+
"EMaxPayoutTreeNodes",
|
|
111
|
+
"ENonMonotonePrice",
|
|
112
|
+
"EStaleValuationSnapshot",
|
|
113
|
+
"ESnapshotSeqNotIncreasing",
|
|
114
|
+
"ENodeMissing"
|
|
115
|
+
],
|
|
116
|
+
expiry_cash: ["EInsufficientCash", "EInventoryImpactRebateExceedsReserve"],
|
|
117
|
+
predict_account: ["EPositionAlreadyExists", "EPositionNotFound"],
|
|
118
|
+
builder_code: ["ENotOwner"],
|
|
119
|
+
plp: [
|
|
120
|
+
"EMissingExpiryValuation",
|
|
121
|
+
"ENotBootstrapped",
|
|
122
|
+
"EAlreadyBootstrapped",
|
|
123
|
+
"EBelowMinBootstrapLiquidity",
|
|
124
|
+
"EBelowMinFeeIncentiveSponsorship",
|
|
125
|
+
"EMaxLiveExpiryMarketsExceeded",
|
|
126
|
+
"EValuationSnapshotNotSealed",
|
|
127
|
+
"EExpiryPricerAlreadySnapshotted",
|
|
128
|
+
"EIncompleteValuationSnapshot",
|
|
129
|
+
"EExpiredMarketNotSettled",
|
|
130
|
+
"EValuationWindowExpired",
|
|
131
|
+
"ESnapshotStageOpen",
|
|
132
|
+
"EBelowMinUsdcContribution",
|
|
133
|
+
"EContributionExceedsPriceCeiling",
|
|
134
|
+
"EInsufficientFeeIncentiveReserve"
|
|
135
|
+
],
|
|
136
|
+
lp_book: [
|
|
137
|
+
"ERequestNotFound",
|
|
138
|
+
"EBelowMinSupplyRequest",
|
|
139
|
+
"EBelowMinWithdrawRequest",
|
|
140
|
+
"ENotRequestOwner"
|
|
141
|
+
],
|
|
142
|
+
pool_accounting: [
|
|
143
|
+
"EUnknownRegisteredExpiry",
|
|
144
|
+
"ERegisteredExpiryAlreadyExists",
|
|
145
|
+
"EMaxExpiryFundingExceeded",
|
|
146
|
+
"ETerminalAccountingStarted"
|
|
147
|
+
],
|
|
148
|
+
queue: [
|
|
149
|
+
"EWrongDesk",
|
|
150
|
+
"EWrongMarket",
|
|
151
|
+
"EQueueStuck",
|
|
152
|
+
"EQueueFull",
|
|
153
|
+
"EAccountOrderCap",
|
|
154
|
+
"EPastCutoff",
|
|
155
|
+
"EMintCostCapRequired",
|
|
156
|
+
"EFeeNotCovered",
|
|
157
|
+
"EBelowMinSell",
|
|
158
|
+
"ERecordNotOpen",
|
|
159
|
+
"ENotRecordOwner",
|
|
160
|
+
"EMarketNotSettled",
|
|
161
|
+
"EMarketNotExpired"
|
|
162
|
+
],
|
|
163
|
+
desk: [
|
|
164
|
+
"EPackageVersionDisabled",
|
|
165
|
+
"EVersionWatermarkNotAdvanced",
|
|
166
|
+
"EProtocolFrozen"
|
|
167
|
+
],
|
|
168
|
+
order_queue: ["ERecordNotOpen"],
|
|
169
|
+
delayed_execution_config: [
|
|
170
|
+
"EInvalidDelayMs",
|
|
171
|
+
"EInvalidStallTimeoutMs",
|
|
172
|
+
"EInvalidStuckThresholdMs",
|
|
173
|
+
"EInvalidGapWaitMs",
|
|
174
|
+
"EInvalidPythPriceBufferMs",
|
|
175
|
+
"EInvalidSviMaxAgeMs",
|
|
176
|
+
"EInvalidMintCapacity",
|
|
177
|
+
"EInvalidSellCapacity",
|
|
178
|
+
"EInvalidPerAccountCap",
|
|
179
|
+
"EInvalidMinSellQuantity",
|
|
180
|
+
"EInvalidOrderFee",
|
|
181
|
+
"EInvalidSettleRefundBatch",
|
|
182
|
+
"EInvalidSettlePayoutBatch",
|
|
183
|
+
"EUnsupportedPythChannel",
|
|
184
|
+
"EInvalidTiming",
|
|
185
|
+
"EInvalidLimits"
|
|
186
|
+
],
|
|
187
|
+
lazer_price: [
|
|
188
|
+
"EPropertyNotRequested",
|
|
189
|
+
"EGenerationAfterEnvelope",
|
|
190
|
+
"EFeedMissing"
|
|
191
|
+
],
|
|
192
|
+
sessions: [
|
|
193
|
+
"EInvalidSessionDuration",
|
|
194
|
+
"ESessionNotAuthorized",
|
|
195
|
+
"ESessionLimitExceeded"
|
|
196
|
+
],
|
|
197
|
+
session_config: ["EPackageVersionDisabled", "EVersionWatermarkNotAdvanced"],
|
|
198
|
+
account_registry: [
|
|
199
|
+
"EAppAlreadyAuthorized",
|
|
200
|
+
"EAppNotAuthorized",
|
|
201
|
+
"EAccountAlreadyExists"
|
|
202
|
+
]
|
|
203
|
+
});
|
|
204
|
+
/** `std::option::EOPTION_NOT_SET`. */
|
|
205
|
+
const OPTION_NOT_SET = 262145n;
|
|
206
|
+
/**
|
|
207
|
+
* The constant name of a plain `u64` abort `code` in `module`, from {@link ABORT_NAMES}, or null
|
|
208
|
+
* when the module or the code is unknown.
|
|
209
|
+
*/
|
|
210
|
+
function abortNameFor(module, code) {
|
|
211
|
+
if (module === "option" && code === OPTION_NOT_SET) return "EOPTION_NOT_SET";
|
|
212
|
+
if (!Object.hasOwn(ABORT_NAMES, module)) return null;
|
|
213
|
+
const names = ABORT_NAMES[module];
|
|
214
|
+
if (code < 0n || code >= BigInt(names.length)) return null;
|
|
215
|
+
return names[Number(code)];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
20
218
|
* Decode a `@mysten/sui` MoveAbort execution error into a {@link PredictMoveError}.
|
|
21
219
|
* Returns null when `error` carries no MoveAbort (InsufficientGas, a size error, any
|
|
22
220
|
* non-abort failure), so callers can fall back to a plain Error.
|
|
23
221
|
*
|
|
24
|
-
* `abortName` is
|
|
25
|
-
*
|
|
222
|
+
* `abortName` is the chain-decoded clever-error constant when the fullnode surfaces one, and
|
|
223
|
+
* otherwise the name {@link ABORT_NAMES} gives the module's plain code (Predict's constants are
|
|
224
|
+
* plain codes, so this is the usual path). It is null when neither knows the abort.
|
|
26
225
|
* `code` stays a bigint — a clever-error abort code packs the module, line, and
|
|
27
226
|
* constant index into the high bits of the u64 and would lose precision as a Number.
|
|
28
227
|
*/
|
|
29
228
|
function decodeMoveAbort(error) {
|
|
30
229
|
const abort = error?.MoveAbort;
|
|
31
230
|
if (!abort) return null;
|
|
32
|
-
|
|
231
|
+
const module = abort.location?.module ?? "";
|
|
232
|
+
const code = abort.abortCode != null ? BigInt(abort.abortCode) : 0n;
|
|
233
|
+
return new PredictMoveError(module, code, abort.cleverError?.constantName ?? abortNameFor(module, code));
|
|
234
|
+
}
|
|
235
|
+
/** A queued-order builder's refusal, raised before any transaction is built. */
|
|
236
|
+
var PredictPreflightError = class extends Error {
|
|
237
|
+
constructor(code, message) {
|
|
238
|
+
super(message);
|
|
239
|
+
this.name = "PredictPreflightError";
|
|
240
|
+
this.code = code;
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const PREDICT_ERROR_TEXT = Object.freeze({
|
|
244
|
+
"queue::EQueueStuck": "Pricing is delayed for this market. Try again shortly.",
|
|
245
|
+
"queue::EQueueFull": "This market's order queue is full. Try again shortly.",
|
|
246
|
+
"queue::EAccountOrderCap": "You already have the most waiting orders this market allows.",
|
|
247
|
+
"queue::EPastCutoff": "This market no longer takes orders before its expiry.",
|
|
248
|
+
"queue::EFeeNotCovered": "Your balance doesn't cover the order fee. Top up and retry.",
|
|
249
|
+
"queue::EBelowMinSell": "The sell is below the minimum size, or leaves a remainder below it.",
|
|
250
|
+
"queue::ERecordNotOpen": "That position isn't open in this market anymore.",
|
|
251
|
+
"queue::ENotRecordOwner": "That position belongs to another account.",
|
|
252
|
+
"queue::EMintCostCapRequired": "Set a maximum cost for the order.",
|
|
253
|
+
"queue::EWrongDesk": "That order queue belongs to another order desk.",
|
|
254
|
+
"queue::EWrongMarket": "That order queue doesn't belong to this market.",
|
|
255
|
+
"queue::EMarketNotSettled": "The market hasn't settled yet.",
|
|
256
|
+
"queue::EMarketNotExpired": "The market hasn't expired yet.",
|
|
257
|
+
"desk::EPackageVersionDisabled": "This order-flow package version is retired. Update to an SDK that calls the current package.",
|
|
258
|
+
"desk::EProtocolFrozen": "The protocol is frozen.",
|
|
259
|
+
"option::EOPTION_NOT_SET": "This order wasn't placed: most likely the order fee rose after it was built. Build it again.",
|
|
260
|
+
"expiry_market::EDelayedExecutionRequired": "Immediate trades are retired on this market. Place a queued order instead.",
|
|
261
|
+
"expiry_market::EOrderFailsLimits": "The market can't take this order at the current price: it misses its price limits, its price is outside the market's entry range, or its premium is below the minimum.",
|
|
262
|
+
"expiry_market::EInsufficientMarketCash": "This market can't take an order this size right now.",
|
|
263
|
+
"expiry_market::EMintCostCapRequired": "Set a maximum cost for the order.",
|
|
264
|
+
"expiry_market::EMintPaused": "Minting is paused on this market.",
|
|
265
|
+
"expiry_market::EInvalidOrderTiming": "This market no longer takes orders before its expiry.",
|
|
266
|
+
"expiry_market::EMarketNotSettled": "The market hasn't settled yet.",
|
|
267
|
+
"strike_exposure_config::EEntryProbabilityOutOfBounds": "This strike's price is outside the market's entry range. Pick a strike nearer the money.",
|
|
268
|
+
"strike_exposure_config::EPremiumBelowMinimum": "The order's premium is below the 1 USDC minimum.",
|
|
269
|
+
"strike_exposure::EMintQuantityBelowMin": "The price moved, so the budget buys fewer contracts than the order asks for.",
|
|
270
|
+
"strike_payout_tree::EMaxPayoutTreeNodes": "This market has no room for a new strike right now. Pick a strike that already has positions.",
|
|
271
|
+
"expiry_cash::EInsufficientCash": "This market can't take an order this size right now.",
|
|
272
|
+
"lp_book::EBelowMinSupplyRequest": "The deposit is below the minimum supply request.",
|
|
273
|
+
"lp_book::EBelowMinWithdrawRequest": "The withdrawal is below the minimum withdraw request.",
|
|
274
|
+
"pricing::EBlockScholesPriceUnavailable": "Pricing is briefly unavailable for this market. Try again in a moment.",
|
|
275
|
+
"pricing::EBlockScholesSVIUnavailable": "Pricing is briefly unavailable for this market. Try again in a moment.",
|
|
276
|
+
"pricing::EBlockScholesPriceStale": "This market's price feed is behind. Try again shortly.",
|
|
277
|
+
"pricing::EBlockScholesSVIStale": "This market's price feed is behind. Try again shortly.",
|
|
278
|
+
"pricing::EPythSpotUnavailable": "This market's live price is unavailable. Try again shortly.",
|
|
279
|
+
"pricing::EPythSpotStale": "This market's live price is behind. Try again shortly.",
|
|
280
|
+
"pricing::ELivePricingExpired": "This market has reached its expiry.",
|
|
281
|
+
"lazer_price::EGenerationAfterEnvelope": "The Pyth update was generated after its own timestamp envelope.",
|
|
282
|
+
"lazer_price::EFeedMissing": "The Pyth update doesn't carry this market's feed.",
|
|
283
|
+
"lazer_price::EPropertyNotRequested": "The Pyth update doesn't carry the price property commit needs.",
|
|
284
|
+
"sessions::ESessionNotAuthorized": "This session key isn't authorized for the account, or its grant has expired.",
|
|
285
|
+
"sessions::ESessionLimitExceeded": "The account holds the most session keys it can. Revoke expired ones, then grant again.",
|
|
286
|
+
"sessions::EInvalidSessionDuration": "A session must last more than 0 ms and at most 30 days.",
|
|
287
|
+
"session_config::EPackageVersionDisabled": "This sessions package version is retired. Update to an SDK that calls the current package.",
|
|
288
|
+
"account_registry::EAppNotAuthorized": "Trading through this app (such as Sessions) isn't enabled for accounts yet.",
|
|
289
|
+
"account_registry::EAccountAlreadyExists": "This address already has an account.",
|
|
290
|
+
"protocol_config::ECutoverNotReached": "Queued orders aren't live yet: the protocol's version watermark hasn't been raised.",
|
|
291
|
+
"protocol_config::EOrderFlowNotAllowed": "Queued orders aren't live yet: the protocol hasn't enabled the order-flow package.",
|
|
292
|
+
"protocol_config::EPackageVersionDisabled": "This package version is retired. Update to an SDK that calls the current package.",
|
|
293
|
+
"protocol_config::EProtocolFrozen": "The protocol is frozen.",
|
|
294
|
+
"protocol_config::ETradingPaused": "Trading is paused.",
|
|
295
|
+
"protocol_config::ESnapshotInProgress": "A pool valuation is running. Try again in a moment."
|
|
296
|
+
});
|
|
297
|
+
/**
|
|
298
|
+
* Readable text for a decoded Move abort on the Predict paths, or `null` when the abort isn't
|
|
299
|
+
* one this SDK describes (an unknown name, or an abort `decodeMoveAbort` couldn't name). Callers
|
|
300
|
+
* fall back to `e.message` on `null`, so new contract errors degrade to the raw abort rather
|
|
301
|
+
* than to a wrong message.
|
|
302
|
+
*/
|
|
303
|
+
function describePredictError(e) {
|
|
304
|
+
if (!e.abortName) return null;
|
|
305
|
+
return PREDICT_ERROR_TEXT[`${e.module}::${e.abortName}`] ?? null;
|
|
33
306
|
}
|
|
34
307
|
|
|
35
308
|
//#endregion
|
|
36
|
-
export { PredictInputError, PredictMoveError, decodeMoveAbort };
|
|
309
|
+
export { PredictInputError, PredictMoveError, PredictPreflightError, decodeMoveAbort, describePredictError };
|
|
37
310
|
//# sourceMappingURL=errors.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/predict/errors.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n// Typed errors for the Predict SDK.\n//\n// Two failure kinds cross the SDK boundary:\n// - PredictInputError — a caller gave us something we rejected before touching\n// the chain (unknown underlying, malformed argument, …).\n// - PredictMoveError — a Move `abort` surfaced by a read/simulate. The deployed\n// Predict packages are compiled with CLEVER ERRORS, so the fullnode decodes the\n// `E…` error-constant name out of the abort code's high bits and returns it on\n// the structured execution error. We read that name straight from chain instead\n// of maintaining a module→code→name table that goes stale on every redeploy.\n\n/** A caller-supplied argument the SDK rejected before building/sending a tx. */\nexport class PredictInputError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'PredictInputError';\n\t}\n}\n\n/** A Move `abort` decoded from a simulate/read failure. */\nexport class PredictMoveError extends Error {\n\treadonly module: string;\n\t/** Exact u64 abort code — bigint because clever-error encodings pack data\n\t * into the high bits, which Number would silently truncate. */\n\treadonly code: bigint;\n\t/** The `E…` constant name, decoded from the clever-error abort code by the\n\t * fullnode, or null when the transport surfaced no name (a non-clever abort,\n\t * or a JSON-RPC failure that carries only a line number). */\n\treadonly abortName: string | null;\n\n\tconstructor(module: string, code: bigint, abortName: string | null) {\n\t\tsuper(\n\t\t\tabortName\n\t\t\t\t? `Move abort in ${module}: ${abortName} (code ${code})`\n\t\t\t\t: `Move abort in ${module}: code ${code}`,\n\t\t);\n\t\tthis.name = 'PredictMoveError';\n\t\tthis.module = module;\n\t\tthis.code = code;\n\t\tthis.abortName = abortName;\n\t}\n}\n\n// The structured MoveAbort execution error surfaced by `@mysten/sui` on a failed\n// simulate/execute. Read structurally rather than via the client's exported\n// `SuiClientTypes.ExecutionError` (`@mysten/sui/client`) so mocked simulate results\n// and future API-shape drift still satisfy it — the same convention reads/inspect.ts\n// uses for its simulate seam. Field provenance:\n// - `MoveAbort.abortCode` → u64 abort code as a decimal string.\n// - `MoveAbort.location.module` → the aborting module's short name.\n// - `MoveAbort.cleverError.constantName` → the `E…` error constant, decoded by the\n// fullnode from the clever-error bits of the abort code and surfaced by the gRPC\n// (`grpc/core.ts` parseMoveAbort) and GraphQL transports. This is the on-chain\n// name that replaces the old hand-maintained ABORT_TABLES. JSON-RPC surfaces only\n// a line number, so `constantName` (and thus `abortName`) is absent there.\nexport interface MoveAbortError {\n\tMoveAbort?: {\n\t\tabortCode?: string | number | bigint;\n\t\tlocation?: { module?: string };\n\t\tcleverError?: { constantName?: string };\n\t};\n}\n\n/**\n * Decode a `@mysten/sui` MoveAbort execution error into a {@link PredictMoveError}.\n * Returns null when `error` carries no MoveAbort (InsufficientGas, a size error, any\n * non-abort failure), so callers can fall back to a plain Error.\n *\n * `abortName` is taken straight from the chain-decoded clever-error constant; it is\n * null when the abort predates clever errors or the transport didn't surface a name.\n * `code` stays a bigint — a clever-error abort code packs the module, line, and\n * constant index into the high bits of the u64 and would lose precision as a Number.\n */\nexport function decodeMoveAbort(error: MoveAbortError | null | undefined): PredictMoveError | null {\n\tconst abort = error?.MoveAbort;\n\tif (!abort) return null;\n\tconst module = abort.location?.module ?? '';\n\tconst code = abort.abortCode != null ? BigInt(abort.abortCode) : 0n;\n\tconst abortName = abort.cleverError?.constantName ?? null;\n\treturn new PredictMoveError(module, code, abortName);\n}\n"],"mappings":";;AAcA,IAAa,oBAAb,cAAuC,MAAM;CAC5C,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;AAKd,IAAa,mBAAb,cAAsC,MAAM;CAU3C,YAAY,QAAgB,MAAc,WAA0B;AACnE,QACC,YACG,iBAAiB,OAAO,IAAI,UAAU,SAAS,KAAK,KACpD,iBAAiB,OAAO,SAAS,OACpC;AACD,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,OAAO;AACZ,OAAK,YAAY;;;;;;;;;;;;;AAkCnB,SAAgB,gBAAgB,OAAmE;CAClG,MAAM,QAAQ,OAAO;AACrB,KAAI,CAAC,MAAO,QAAO;AAInB,QAAO,IAAI,iBAHI,MAAM,UAAU,UAAU,IAC5B,MAAM,aAAa,OAAO,OAAO,MAAM,UAAU,GAAG,IAC/C,MAAM,aAAa,gBAAgB,KACD"}
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/predict/errors.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n// Typed errors for the Predict SDK.\n//\n// Two failure kinds cross the SDK boundary:\n// - PredictInputError — a caller gave us something we rejected before touching\n// the chain (unknown underlying, malformed argument, …).\n// - PredictMoveError — a Move `abort` surfaced by a read/simulate. Predict's error\n// constants are plain `u64` codes, not clever errors, so the fullnode can't name\n// them: `decodeMoveAbort` maps `(module, code)` to the constant name with\n// ABORT_NAMES below. A clever-error name the fullnode does decode takes precedence.\n\n/** A caller-supplied argument the SDK rejected before building/sending a tx. */\nexport class PredictInputError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'PredictInputError';\n\t}\n}\n\n/** A Move `abort` decoded from a simulate/read failure. */\nexport class PredictMoveError extends Error {\n\treadonly module: string;\n\t/** Exact u64 abort code — bigint because clever-error encodings pack data\n\t * into the high bits, which Number would silently truncate. */\n\treadonly code: bigint;\n\t/** The `E…` constant name: the fullnode's clever-error name when it decodes\n\t * one, else the name {@link ABORT_NAMES} gives the module's plain code, or null\n\t * when neither knows the abort. */\n\treadonly abortName: string | null;\n\n\tconstructor(module: string, code: bigint, abortName: string | null) {\n\t\tsuper(\n\t\t\tabortName\n\t\t\t\t? `Move abort in ${module}: ${abortName} (code ${code})`\n\t\t\t\t: `Move abort in ${module}: code ${code}`,\n\t\t);\n\t\tthis.name = 'PredictMoveError';\n\t\tthis.module = module;\n\t\tthis.code = code;\n\t\tthis.abortName = abortName;\n\t}\n}\n\n// The structured MoveAbort execution error surfaced by `@mysten/sui` on a failed\n// simulate/execute. Read structurally rather than via the client's exported\n// `SuiClientTypes.ExecutionError` (`@mysten/sui/client`) so mocked simulate results\n// and future API-shape drift still satisfy it — the same convention reads/inspect.ts\n// uses for its simulate seam. Field provenance:\n// - `MoveAbort.abortCode` → u64 abort code as a decimal string.\n// - `MoveAbort.location.module` → the aborting module's short name.\n// - `MoveAbort.cleverError.constantName` → the `E…` error constant, decoded by the\n// fullnode from the clever-error bits of the abort code and surfaced by the gRPC\n// (`grpc/core.ts` parseMoveAbort) and GraphQL transports. Only a clever-error abort\n// carries one, and Predict's plain `u64` constants never do, so ABORT_NAMES names\n// those. JSON-RPC surfaces no `constantName` at all.\nexport interface MoveAbortError {\n\tMoveAbort?: {\n\t\tabortCode?: string | number | bigint;\n\t\tlocation?: { module?: string };\n\t\tcleverError?: { constantName?: string };\n\t};\n}\n\n/**\n * The error constants of the Predict modules the SDK's flows abort in, by module, as an array\n * indexed by the plain `u64` abort code (each module numbers its constants from 0 with no gaps).\n * Generated from the Move sources at deepbookv3 29117434. A published code never changes meaning:\n * new codes only append, so an older package version's codes are a prefix of its module's list.\n * Keyed by module name only, as the abort location reports it, so a same-named module in an\n * unrelated package would be named from this table too.\n */\nexport const ABORT_NAMES: Readonly<Record<string, readonly string[]>> = Object.freeze({\n\t// Predict (`deepbook_predict`). Append-only since v1, so older package versions use a prefix.\n\texpiry_market: [\n\t\t'EMintPaused',\n\t\t'EMarketNotSettled',\n\t\t'EMintCostAboveMax',\n\t\t'EMintProbabilityAboveMax',\n\t\t'EWrongPricer',\n\t\t'EReferenceTickObservationMissing',\n\t\t'EMintRedeemSameTimestamp',\n\t\t'ERedeemProbabilityBelowMin',\n\t\t'ERedeemProceedsBelowMin',\n\t\t'EMintCostCapRequired',\n\t\t'EMarketNotPendingValuation',\n\t\t'EMintCostAboveMaxPayout',\n\t\t'ENotSettledRedeemKeeper',\n\t\t'EDelayedExecutionRequired',\n\t\t'EOrderFailsLimits',\n\t\t'EInsufficientMarketCash',\n\t\t'EInvalidOrderTiming',\n\t\t'EInvalidOrderTerms',\n\t\t'EWrongMarket',\n\t\t'EWrongStage',\n\t\t'ENotRecordOwner',\n\t\t'EEscrowMismatch',\n\t\t'EWrongPrice',\n\t],\n\tprotocol_config: [\n\t\t'ETradingPaused',\n\t\t'EValuationInProgress',\n\t\t'EValuationNotInProgress',\n\t\t'EPackageVersionDisabled',\n\t\t'EVersionWatermarkNotAdvanced',\n\t\t'EProtocolFrozen',\n\t\t'ESnapshotInProgress',\n\t\t'ETradeWindowClosed',\n\t\t'ESettledRedeemKeeperAlreadyAdded',\n\t\t'ESettledRedeemKeeperNotFound',\n\t\t'EFlushOperatorAlreadyAdded',\n\t\t'EFlushOperatorNotFound',\n\t\t'ENotFlushOperator',\n\t\t'ECutoverNotReached',\n\t\t'EEwmaRetired',\n\t\t'EOrderFlowNotAllowed',\n\t],\n\t// Predict's live pricer, which every quote, plan and enqueue loads.\n\tpricing: [\n\t\t'EZeroForward',\n\t\t'ECannotBeNegative',\n\t\t'ENonPositiveVariance',\n\t\t'EInvalidRange',\n\t\t'EBlockScholesPriceStale',\n\t\t'EBlockScholesInputsInvalid',\n\t\t'EPythSpotInvalid',\n\t\t'EWrongPythFeed',\n\t\t'EWrongBlockScholesValueStore',\n\t\t'ELivePricingExpired',\n\t\t'EBlockScholesSVIStale',\n\t\t'EWrongBlockScholesSVIStore',\n\t\t'EBlockScholesPriceUnavailable',\n\t\t'EBlockScholesSVIUnavailable',\n\t\t'EBlockScholesMinVarianceInvalid',\n\t\t'EOracleWrittenInThisTransaction',\n\t\t'EBlockScholesInputTooWide',\n\t\t'EPythSpotUnavailable',\n\t\t'EPythSpotStale',\n\t\t'EPythForwardRequired',\n\t],\n\t// Admission, positions and the LP pool. `order` and `registry` are left out: DeepBook's core\n\t// package has modules of the same names, which this table would misname.\n\tstrike_exposure: [\n\t\t'EInvalidCloseQuantity',\n\t\t'EInvalidAdmissionTick',\n\t\t'EInvalidReferenceTick',\n\t\t'EReferenceTickAlreadySet',\n\t\t'ETermsExposureMismatch',\n\t\t'EMintQuantityBelowMin',\n\t\t'EInvalidInventoryImpactScale',\n\t],\n\tstrike_exposure_config: [\n\t\t'EEntryProbabilityOutOfBounds',\n\t\t'EInvalidEntryProbabilityBound',\n\t\t'EInvalidFeeProbability',\n\t\t'EPremiumBelowMinimum',\n\t],\n\tstrike_payout_tree: [\n\t\t'EInsufficientPayoutQuantity',\n\t\t'EMaxPayoutTreeNodes',\n\t\t'ENonMonotonePrice',\n\t\t'EStaleValuationSnapshot',\n\t\t'ESnapshotSeqNotIncreasing',\n\t\t'ENodeMissing',\n\t],\n\texpiry_cash: ['EInsufficientCash', 'EInventoryImpactRebateExceedsReserve'],\n\tpredict_account: ['EPositionAlreadyExists', 'EPositionNotFound'],\n\tbuilder_code: ['ENotOwner'],\n\tplp: [\n\t\t'EMissingExpiryValuation',\n\t\t'ENotBootstrapped',\n\t\t'EAlreadyBootstrapped',\n\t\t'EBelowMinBootstrapLiquidity',\n\t\t'EBelowMinFeeIncentiveSponsorship',\n\t\t'EMaxLiveExpiryMarketsExceeded',\n\t\t'EValuationSnapshotNotSealed',\n\t\t'EExpiryPricerAlreadySnapshotted',\n\t\t'EIncompleteValuationSnapshot',\n\t\t'EExpiredMarketNotSettled',\n\t\t'EValuationWindowExpired',\n\t\t'ESnapshotStageOpen',\n\t\t'EBelowMinUsdcContribution',\n\t\t'EContributionExceedsPriceCeiling',\n\t\t'EInsufficientFeeIncentiveReserve',\n\t],\n\tlp_book: [\n\t\t'ERequestNotFound',\n\t\t'EBelowMinSupplyRequest',\n\t\t'EBelowMinWithdrawRequest',\n\t\t'ENotRequestOwner',\n\t],\n\tpool_accounting: [\n\t\t'EUnknownRegisteredExpiry',\n\t\t'ERegisteredExpiryAlreadyExists',\n\t\t'EMaxExpiryFundingExceeded',\n\t\t'ETerminalAccountingStarted',\n\t],\n\t// The order-flow package (`deepbook_predict_orders`).\n\tqueue: [\n\t\t'EWrongDesk',\n\t\t'EWrongMarket',\n\t\t'EQueueStuck',\n\t\t'EQueueFull',\n\t\t'EAccountOrderCap',\n\t\t'EPastCutoff',\n\t\t'EMintCostCapRequired',\n\t\t'EFeeNotCovered',\n\t\t'EBelowMinSell',\n\t\t'ERecordNotOpen',\n\t\t'ENotRecordOwner',\n\t\t'EMarketNotSettled',\n\t\t'EMarketNotExpired',\n\t],\n\tdesk: ['EPackageVersionDisabled', 'EVersionWatermarkNotAdvanced', 'EProtocolFrozen'],\n\torder_queue: ['ERecordNotOpen'],\n\tdelayed_execution_config: [\n\t\t'EInvalidDelayMs',\n\t\t'EInvalidStallTimeoutMs',\n\t\t'EInvalidStuckThresholdMs',\n\t\t'EInvalidGapWaitMs',\n\t\t'EInvalidPythPriceBufferMs',\n\t\t'EInvalidSviMaxAgeMs',\n\t\t'EInvalidMintCapacity',\n\t\t'EInvalidSellCapacity',\n\t\t'EInvalidPerAccountCap',\n\t\t'EInvalidMinSellQuantity',\n\t\t'EInvalidOrderFee',\n\t\t'EInvalidSettleRefundBatch',\n\t\t'EInvalidSettlePayoutBatch',\n\t\t'EUnsupportedPythChannel',\n\t\t'EInvalidTiming',\n\t\t'EInvalidLimits',\n\t],\n\t// The math library (`deepbook_predict_math`).\n\tlazer_price: ['EPropertyNotRequested', 'EGenerationAfterEnvelope', 'EFeedMissing'],\n\t// Sessions (`deepbook_sessions`), which the `/sessions` Predict wrappers abort in.\n\tsessions: ['EInvalidSessionDuration', 'ESessionNotAuthorized', 'ESessionLimitExceeded'],\n\tsession_config: ['EPackageVersionDisabled', 'EVersionWatermarkNotAdvanced'],\n\t// The shared account (`deepbook_account`).\n\taccount_registry: ['EAppAlreadyAuthorized', 'EAppNotAuthorized', 'EAccountAlreadyExists'],\n});\n\n/** `std::option::EOPTION_NOT_SET`. */\nconst OPTION_NOT_SET = 0x40001n;\n\n/**\n * The constant name of a plain `u64` abort `code` in `module`, from {@link ABORT_NAMES}, or null\n * when the module or the code is unknown.\n */\nexport function abortNameFor(module: string, code: bigint): string | null {\n\t// The order-fee guard (`queueTx.assertOrderFeeAtMost`) aborts in the standard library's\n\t// `option`, whose constant isn't an index.\n\tif (module === 'option' && code === OPTION_NOT_SET) return 'EOPTION_NOT_SET';\n\t// Own keys only: a module named like an `Object.prototype` member is simply unknown.\n\tif (!Object.hasOwn(ABORT_NAMES, module)) return null;\n\tconst names = ABORT_NAMES[module];\n\tif (code < 0n || code >= BigInt(names.length)) return null;\n\treturn names[Number(code)];\n}\n\n/**\n * Decode a `@mysten/sui` MoveAbort execution error into a {@link PredictMoveError}.\n * Returns null when `error` carries no MoveAbort (InsufficientGas, a size error, any\n * non-abort failure), so callers can fall back to a plain Error.\n *\n * `abortName` is the chain-decoded clever-error constant when the fullnode surfaces one, and\n * otherwise the name {@link ABORT_NAMES} gives the module's plain code (Predict's constants are\n * plain codes, so this is the usual path). It is null when neither knows the abort.\n * `code` stays a bigint — a clever-error abort code packs the module, line, and\n * constant index into the high bits of the u64 and would lose precision as a Number.\n */\nexport function decodeMoveAbort(error: MoveAbortError | null | undefined): PredictMoveError | null {\n\tconst abort = error?.MoveAbort;\n\tif (!abort) return null;\n\tconst module = abort.location?.module ?? '';\n\tconst code = abort.abortCode != null ? BigInt(abort.abortCode) : 0n;\n\tconst abortName = abort.cleverError?.constantName ?? abortNameFor(module, code);\n\treturn new PredictMoveError(module, code, abortName);\n}\n\n// === Delayed execution (DBU-885) ===\n\n/**\n * Why a queued-order builder refused to add an enqueue. The builder reads the market first and\n * throws this instead of building a transaction the queue or protocol gates would abort, so a\n * refused order never fails the rest of a transaction. Each code mirrors one on-chain refusal. The\n * order's own limits at the current price are checked only on chain (`EOrderFailsLimits`).\n */\nexport type PredictPreflightCode =\n\t/**\n\t * Delayed execution isn't live: Predict's version watermark isn't raised\n\t * (`ECutoverNotReached`), or Predict doesn't allowlist the order-flow package yet\n\t * (`EOrderFlowNotAllowed`).\n\t */\n\t| 'not-live'\n\t/** The market has no `MarketQueue` yet: `queue::create_and_share` hasn't run for it. */\n\t| 'no-queue'\n\t/**\n\t * A version floor retired code this SDK calls: Predict's watermark is above the Predict\n\t * version it was built for (`protocol_config::EPackageVersionDisabled`), or the order desk's\n\t * floor is above its order-flow package (`desk::EPackageVersionDisabled`). Update the SDK.\n\t */\n\t| 'retired'\n\t/** Trading is paused, the protocol is frozen, or minting is paused on this market. */\n\t| 'paused'\n\t/** The market's pricing is delayed (`queue_stuck`). Enqueue aborts `EQueueStuck`. */\n\t| 'stuck'\n\t/**\n\t * The order's τ would land at or after the market's order cutoff (`EPastCutoff`). A\n\t * `read.planMint` or `read.planSell` plan on a market past its expiry throws it too, since the\n\t * chain has no live price to quote (`ELivePricingExpired`).\n\t */\n\t| 'past-cutoff'\n\t/** The market has its maximum unfinished mints or sells (`EQueueFull`). */\n\t| 'queue-full'\n\t/** The account has its maximum unfinished orders in this market (`EAccountOrderCap`). */\n\t| 'account-cap'\n\t/**\n\t * The account balance doesn't cover the order fee (`EFeeNotCovered`). A `read.planMint` plan\n\t * also reports it when the balance doesn't cover the plan's `totalDebit`, since its limits assume\n\t * the whole budget, or when the owner has no account yet. Prompt a top-up.\n\t */\n\t| 'fee'\n\t/** A mint's cash need is above the market's spare cash (`EInsufficientMarketCash`). */\n\t| 'market-cash'\n\t/**\n\t * The escrowed budget, or an exact-amount mint's premium cap, can't buy the minimum premium,\n\t * so the order fails its limits. A budget `read.planMint` plan also reports it when what the\n\t * budget buys without the fee subsidy, as admission prices it, has a premium below the minimum,\n\t * and throws it for a budget below the minimum premium or one no fill clears it with.\n\t */\n\t| 'min-premium'\n\t/**\n\t * The strike's entry probability is outside the market's entry band, so the chain refuses to\n\t * quote or admit it (`EOrderFailsLimits`). Pick a strike nearer the money. Only `read.planMint`\n\t * reports it, and the probability can still leave the band between plan and placement.\n\t */\n\t| 'entry-band'\n\t/**\n\t * The order's all-in cost without the fee subsidy is above its payout, so admission refuses it\n\t * at any slippage (`EOrderFailsLimits`), or for a budget, the fill costs about its payout, where\n\t * admission's sizing can't be previewed. Only `read.planMint` reports it, near a certain outcome.\n\t */\n\t| 'cost-above-payout'\n\t/** A sell is below the policy minimum, or leaves a remainder below it (`EBelowMinSell`). */\n\t| 'below-min-sell'\n\t/** The record to sell is missing or not Open (`ERecordNotOpen`). */\n\t| 'record-not-open'\n\t/** The record to sell belongs to another account (`ENotRecordOwner`). */\n\t| 'not-record-owner';\n\n/** A queued-order builder's refusal, raised before any transaction is built. */\nexport class PredictPreflightError extends Error {\n\treadonly code: PredictPreflightCode;\n\n\tconstructor(code: PredictPreflightCode, message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'PredictPreflightError';\n\t\tthis.code = code;\n\t}\n}\n\n// Readable text for the aborts a trader, an app or a filler meets on the delayed-execution\n// paths, keyed by `module::EName` as `decodeMoveAbort` names it. The queue's own\n// checks are in the order-flow companion's `queue` and `desk` modules; Predict's admission, fill\n// and quote checks stay in `expiry_market` and `protocol_config`; the Lazer decode is in the math\n// library's `lazer_price`.\nconst PREDICT_ERROR_TEXT: Readonly<Record<string, string>> = Object.freeze({\n\t// Placement (`queue::enqueue_*`).\n\t'queue::EQueueStuck': 'Pricing is delayed for this market. Try again shortly.',\n\t'queue::EQueueFull': \"This market's order queue is full. Try again shortly.\",\n\t'queue::EAccountOrderCap': 'You already have the most waiting orders this market allows.',\n\t'queue::EPastCutoff': 'This market no longer takes orders before its expiry.',\n\t'queue::EFeeNotCovered': \"Your balance doesn't cover the order fee. Top up and retry.\",\n\t'queue::EBelowMinSell': 'The sell is below the minimum size, or leaves a remainder below it.',\n\t'queue::ERecordNotOpen': \"That position isn't open in this market anymore.\",\n\t'queue::ENotRecordOwner': 'That position belongs to another account.',\n\t'queue::EMintCostCapRequired': 'Set a maximum cost for the order.',\n\t'queue::EWrongDesk': 'That order queue belongs to another order desk.',\n\t'queue::EWrongMarket': \"That order queue doesn't belong to this market.\",\n\t'queue::EMarketNotSettled': \"The market hasn't settled yet.\",\n\t'queue::EMarketNotExpired': \"The market hasn't expired yet.\",\n\t'desk::EPackageVersionDisabled':\n\t\t'This order-flow package version is retired. Update to an SDK that calls the current package.',\n\t'desk::EProtocolFrozen': 'The protocol is frozen.',\n\t// The order-fee guard every SDK enqueue starts with. Predict's own `option` unwraps can abort the\n\t// same way, so the text hedges.\n\t'option::EOPTION_NOT_SET':\n\t\t\"This order wasn't placed: most likely the order fee rose after it was built. Build it again.\",\n\t// Predict's admission and quotes.\n\t'expiry_market::EDelayedExecutionRequired':\n\t\t'Immediate trades are retired on this market. Place a queued order instead.',\n\t'expiry_market::EOrderFailsLimits':\n\t\t\"The market can't take this order at the current price: it misses its price limits, its price is outside the market's entry range, or its premium is below the minimum.\",\n\t'expiry_market::EInsufficientMarketCash': \"This market can't take an order this size right now.\",\n\t'expiry_market::EMintCostCapRequired': 'Set a maximum cost for the order.',\n\t'expiry_market::EMintPaused': 'Minting is paused on this market.',\n\t'expiry_market::EInvalidOrderTiming': 'This market no longer takes orders before its expiry.',\n\t'expiry_market::EMarketNotSettled': \"The market hasn't settled yet.\",\n\t'strike_exposure_config::EEntryProbabilityOutOfBounds':\n\t\t\"This strike's price is outside the market's entry range. Pick a strike nearer the money.\",\n\t'strike_exposure_config::EPremiumBelowMinimum':\n\t\t\"The order's premium is below the 1 USDC minimum.\",\n\t'strike_exposure::EMintQuantityBelowMin':\n\t\t'The price moved, so the budget buys fewer contracts than the order asks for.',\n\t'strike_payout_tree::EMaxPayoutTreeNodes':\n\t\t'This market has no room for a new strike right now. Pick a strike that already has positions.',\n\t'expiry_cash::EInsufficientCash': \"This market can't take an order this size right now.\",\n\t// The LP pool.\n\t'lp_book::EBelowMinSupplyRequest': 'The deposit is below the minimum supply request.',\n\t'lp_book::EBelowMinWithdrawRequest': 'The withdrawal is below the minimum withdraw request.',\n\t// Live pricing. The unavailable and stale aborts clear once the oracles write again.\n\t'pricing::EBlockScholesPriceUnavailable':\n\t\t'Pricing is briefly unavailable for this market. Try again in a moment.',\n\t'pricing::EBlockScholesSVIUnavailable':\n\t\t'Pricing is briefly unavailable for this market. Try again in a moment.',\n\t'pricing::EBlockScholesPriceStale': \"This market's price feed is behind. Try again shortly.\",\n\t'pricing::EBlockScholesSVIStale': \"This market's price feed is behind. Try again shortly.\",\n\t'pricing::EPythSpotUnavailable': \"This market's live price is unavailable. Try again shortly.\",\n\t'pricing::EPythSpotStale': \"This market's live price is behind. Try again shortly.\",\n\t'pricing::ELivePricingExpired': 'This market has reached its expiry.',\n\t// Filler (`queue::commit`, decoding the Lazer update).\n\t'lazer_price::EGenerationAfterEnvelope':\n\t\t'The Pyth update was generated after its own timestamp envelope.',\n\t'lazer_price::EFeedMissing': \"The Pyth update doesn't carry this market's feed.\",\n\t'lazer_price::EPropertyNotRequested':\n\t\t\"The Pyth update doesn't carry the price property commit needs.\",\n\t// Sessions and the shared account.\n\t'sessions::ESessionNotAuthorized':\n\t\t\"This session key isn't authorized for the account, or its grant has expired.\",\n\t'sessions::ESessionLimitExceeded':\n\t\t'The account holds the most session keys it can. Revoke expired ones, then grant again.',\n\t'sessions::EInvalidSessionDuration': 'A session must last more than 0 ms and at most 30 days.',\n\t'session_config::EPackageVersionDisabled':\n\t\t'This sessions package version is retired. Update to an SDK that calls the current package.',\n\t'account_registry::EAppNotAuthorized':\n\t\t\"Trading through this app (such as Sessions) isn't enabled for accounts yet.\",\n\t'account_registry::EAccountAlreadyExists': 'This address already has an account.',\n\t// Protocol gates.\n\t'protocol_config::ECutoverNotReached':\n\t\t\"Queued orders aren't live yet: the protocol's version watermark hasn't been raised.\",\n\t'protocol_config::EOrderFlowNotAllowed':\n\t\t\"Queued orders aren't live yet: the protocol hasn't enabled the order-flow package.\",\n\t'protocol_config::EPackageVersionDisabled':\n\t\t'This package version is retired. Update to an SDK that calls the current package.',\n\t'protocol_config::EProtocolFrozen': 'The protocol is frozen.',\n\t'protocol_config::ETradingPaused': 'Trading is paused.',\n\t'protocol_config::ESnapshotInProgress': 'A pool valuation is running. Try again in a moment.',\n});\n\n/**\n * Readable text for a decoded Move abort on the Predict paths, or `null` when the abort isn't\n * one this SDK describes (an unknown name, or an abort `decodeMoveAbort` couldn't name). Callers\n * fall back to `e.message` on `null`, so new contract errors degrade to the raw abort rather\n * than to a wrong message.\n */\nexport function describePredictError(e: PredictMoveError): string | null {\n\tif (!e.abortName) return null;\n\treturn PREDICT_ERROR_TEXT[`${e.module}::${e.abortName}`] ?? null;\n}\n"],"mappings":";;AAaA,IAAa,oBAAb,cAAuC,MAAM;CAC5C,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;AAKd,IAAa,mBAAb,cAAsC,MAAM;CAU3C,YAAY,QAAgB,MAAc,WAA0B;AACnE,QACC,YACG,iBAAiB,OAAO,IAAI,UAAU,SAAS,KAAK,KACpD,iBAAiB,OAAO,SAAS,OACpC;AACD,OAAK,OAAO;AACZ,OAAK,SAAS;AACd,OAAK,OAAO;AACZ,OAAK,YAAY;;;;;;;;;;;AAgCnB,MAAa,cAA2D,OAAO,OAAO;CAErF,eAAe;EACd;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,iBAAiB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAED,SAAS;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAGD,iBAAiB;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,wBAAwB;EACvB;EACA;EACA;EACA;EACA;CACD,oBAAoB;EACnB;EACA;EACA;EACA;EACA;EACA;EACA;CACD,aAAa,CAAC,qBAAqB,uCAAuC;CAC1E,iBAAiB,CAAC,0BAA0B,oBAAoB;CAChE,cAAc,CAAC,YAAY;CAC3B,KAAK;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,SAAS;EACR;EACA;EACA;EACA;EACA;CACD,iBAAiB;EAChB;EACA;EACA;EACA;EACA;CAED,OAAO;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,MAAM;EAAC;EAA2B;EAAgC;EAAkB;CACpF,aAAa,CAAC,iBAAiB;CAC/B,0BAA0B;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CAED,aAAa;EAAC;EAAyB;EAA4B;EAAe;CAElF,UAAU;EAAC;EAA2B;EAAyB;EAAwB;CACvF,gBAAgB,CAAC,2BAA2B,+BAA+B;CAE3E,kBAAkB;EAAC;EAAyB;EAAqB;EAAwB;CACzF,CAAC;;AAGF,MAAM,iBAAiB;;;;;AAMvB,SAAgB,aAAa,QAAgB,MAA6B;AAGzE,KAAI,WAAW,YAAY,SAAS,eAAgB,QAAO;AAE3D,KAAI,CAAC,OAAO,OAAO,aAAa,OAAO,CAAE,QAAO;CAChD,MAAM,QAAQ,YAAY;AAC1B,KAAI,OAAO,MAAM,QAAQ,OAAO,MAAM,OAAO,CAAE,QAAO;AACtD,QAAO,MAAM,OAAO,KAAK;;;;;;;;;;;;;AAc1B,SAAgB,gBAAgB,OAAmE;CAClG,MAAM,QAAQ,OAAO;AACrB,KAAI,CAAC,MAAO,QAAO;CACnB,MAAM,SAAS,MAAM,UAAU,UAAU;CACzC,MAAM,OAAO,MAAM,aAAa,OAAO,OAAO,MAAM,UAAU,GAAG;AAEjE,QAAO,IAAI,iBAAiB,QAAQ,MADlB,MAAM,aAAa,gBAAgB,aAAa,QAAQ,KAAK,CAC3B;;;AA2ErD,IAAa,wBAAb,cAA2C,MAAM;CAGhD,YAAY,MAA4B,SAAiB;AACxD,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO;;;AASd,MAAM,qBAAuD,OAAO,OAAO;CAE1E,sBAAsB;CACtB,qBAAqB;CACrB,2BAA2B;CAC3B,sBAAsB;CACtB,yBAAyB;CACzB,wBAAwB;CACxB,yBAAyB;CACzB,0BAA0B;CAC1B,+BAA+B;CAC/B,qBAAqB;CACrB,uBAAuB;CACvB,4BAA4B;CAC5B,4BAA4B;CAC5B,iCACC;CACD,yBAAyB;CAGzB,2BACC;CAED,4CACC;CACD,oCACC;CACD,0CAA0C;CAC1C,uCAAuC;CACvC,8BAA8B;CAC9B,sCAAsC;CACtC,oCAAoC;CACpC,wDACC;CACD,gDACC;CACD,0CACC;CACD,2CACC;CACD,kCAAkC;CAElC,mCAAmC;CACnC,qCAAqC;CAErC,0CACC;CACD,wCACC;CACD,oCAAoC;CACpC,kCAAkC;CAClC,iCAAiC;CACjC,2BAA2B;CAC3B,gCAAgC;CAEhC,yCACC;CACD,6BAA6B;CAC7B,sCACC;CAED,mCACC;CACD,mCACC;CACD,qCAAqC;CACrC,2CACC;CACD,uCACC;CACD,2CAA2C;CAE3C,uCACC;CACD,yCACC;CACD,4CACC;CACD,oCAAoC;CACpC,mCAAmC;CACnC,wCAAwC;CACxC,CAAC;;;;;;;AAQF,SAAgB,qBAAqB,GAAoC;AACxE,KAAI,CAAC,EAAE,UAAW,QAAO;AACzB,QAAO,mBAAmB,GAAG,EAAE,OAAO,IAAI,EAAE,gBAAgB"}
|
package/dist/predict/index.d.mts
CHANGED
|
@@ -5,19 +5,27 @@ import { PredictConfig, PredictPackages, UnderlyingConfig } from "./config/types
|
|
|
5
5
|
import { MAINNET_CONFIG } from "./config/mainnet.mjs";
|
|
6
6
|
import { TESTNET_CONFIG } from "./config/testnet.mjs";
|
|
7
7
|
import { getConfig } from "./config/index.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { queue_events_d_exports } from "../contracts/deepbook_predict_orders/queue_events.mjs";
|
|
9
|
+
import { delayed_execution_config_d_exports } from "../contracts/deepbook_predict_orders/delayed_execution_config.mjs";
|
|
10
|
+
import { order_queue_d_exports } from "../contracts/deepbook_predict_orders/order_queue.mjs";
|
|
11
|
+
import { queue_d_exports } from "./queue.mjs";
|
|
12
|
+
import { BalanceChangeReceipt, BuilderCodeReceipt, ClaimReceipt, CohortCommitReceipt, CreateManagerReceipt, DecodableEvent, DecodableTransactionResult, EnqueueReceipt, ExpiryPnlRealizedReceipt, MarketPayoutsCompletedReceipt, MintReceipt, OpenRecordPayoutReceipt, PlpCancelReceipt, PlpRequestReceipt, PolicyUpdateReceipt, QueueCashFigures, QueueEvent, QueueOpsReceipt, QueuedFillReceipt, QueuedRefundReceipt, RecordFundsReceipt, RedeemReceipt, realizedPnlRaw } from "./decode.mjs";
|
|
11
13
|
import { pricing_d_exports } from "./pricing.mjs";
|
|
14
|
+
import { POS_INF_TICK, Side, binaryRangeTicks, snapStrike } from "./ticks.mjs";
|
|
15
|
+
import { cost_d_exports } from "./cost.mjs";
|
|
16
|
+
import { MoveAbortError, PredictInputError, PredictMoveError, PredictPreflightCode, PredictPreflightError, decodeMoveAbort, describePredictError } from "./errors.mjs";
|
|
17
|
+
import { GeneratedConfig, OrdersGeneratedConfig, toGeneratedConfig, toOrdersConfig } from "./config/generated.mjs";
|
|
12
18
|
import { MarketFeeds, loadLivePricer } from "./tx/trade.mjs";
|
|
19
|
+
import { queue_d_exports as queue_d_exports$2 } from "./tx/queue.mjs";
|
|
13
20
|
import { ReadClient } from "./reads/inspect.mjs";
|
|
21
|
+
import { ExecutionMode, MarketQueueState, orderFlowWitnessType } from "./reads/queue.mjs";
|
|
22
|
+
import { OpenPosition } from "./reads/positions.mjs";
|
|
14
23
|
import { PricerSnapshot } from "./reads/pricing.mjs";
|
|
15
|
-
import {
|
|
16
|
-
import { ActiveMarket, CloseOptions, MarketDescriptor, MarketSummary, MintAmountOptions, MintCostOptions, MintOptions, MintQuote, POSITION_LOT_SIZE, PlpSupplyOptions, PlpWithdrawOptions, PoolSummary, PredictClient, PredictCompatibleClient, RedeemQuote, predict } from "./client.mjs";
|
|
24
|
+
import { ActiveMarket, AppliedSlippage, CloseOptions, EnqueueMintAmountOptions, EnqueueMintCostOptions, EnqueueMintOptions, EnqueueSellOptions, MarketCoordinates, MarketDescriptor, MarketQueueView, MarketSettlement, MarketSummary, MintAmountOptions, MintCostOptions, MintOptions, MintPlan, MintQuote, POSITION_LOT_SIZE, PlanMintOptions, PlanSellOptions, PlpSupplyOptions, PlpWithdrawOptions, PoolSummary, PredictClient, PredictCompatibleClient, QueuedOrderOutcome, QueuedOrderPlan, QueuedOrderPreview, QueuedOrderView, RedeemQuote, SellPlan, SellQuote, SlippageOptions, predict } from "./client.mjs";
|
|
17
25
|
import { deriveAccountWrapperId, generateAuth } from "./tx/common.mjs";
|
|
18
26
|
import { admin_d_exports } from "../contracts/deepbook_predict/admin.mjs";
|
|
19
27
|
import { builder_code_d_exports } from "../contracts/deepbook_predict/builder_code.mjs";
|
|
20
|
-
import { expiry_market_d_exports } from "
|
|
28
|
+
import { expiry_market_d_exports } from "./bindings/expiry-market.mjs";
|
|
21
29
|
import { market_lifecycle_cap_d_exports } from "../contracts/deepbook_predict/market_lifecycle_cap.mjs";
|
|
22
30
|
import { market_manager_d_exports } from "../contracts/deepbook_predict/market_manager.mjs";
|
|
23
31
|
import { pause_cap_d_exports } from "../contracts/deepbook_predict/pause_cap.mjs";
|
|
@@ -25,14 +33,17 @@ import { plp_d_exports } from "../contracts/deepbook_predict/plp.mjs";
|
|
|
25
33
|
import { pool_valuation_cap_d_exports } from "../contracts/deepbook_predict/pool_valuation_cap.mjs";
|
|
26
34
|
import { predict_account_d_exports } from "../contracts/deepbook_predict/predict_account.mjs";
|
|
27
35
|
import { pricing_d_exports as pricing_d_exports$1 } from "../contracts/deepbook_predict/pricing.mjs";
|
|
28
|
-
import { protocol_config_d_exports } from "
|
|
36
|
+
import { protocol_config_d_exports } from "./bindings/protocol-config.mjs";
|
|
29
37
|
import { range_codec_d_exports } from "../contracts/deepbook_predict/range_codec.mjs";
|
|
30
38
|
import { registry_d_exports } from "../contracts/deepbook_predict/registry.mjs";
|
|
31
39
|
import { builder_code_events_d_exports } from "../contracts/deepbook_predict/builder_code_events.mjs";
|
|
32
40
|
import { config_events_d_exports } from "../contracts/deepbook_predict/config_events.mjs";
|
|
33
41
|
import { order_events_d_exports } from "../contracts/deepbook_predict/order_events.mjs";
|
|
34
42
|
import { vault_events_d_exports } from "../contracts/deepbook_predict/vault_events.mjs";
|
|
43
|
+
import { queue_d_exports as queue_d_exports$1 } from "../contracts/deepbook_predict_orders/queue.mjs";
|
|
44
|
+
import { desk_d_exports } from "../contracts/deepbook_predict_orders/desk.mjs";
|
|
45
|
+
import { math_d_exports } from "../contracts/deepbook_predict_math/math.mjs";
|
|
46
|
+
import { lazer_price_d_exports } from "../contracts/deepbook_predict_math/lazer_price.mjs";
|
|
35
47
|
import { U64_MAX, priceToRaw, probabilityToRaw, rawToPrice, rawToProbability, rawToUsdc, usdcToRaw } from "./units.mjs";
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
export { type ActiveMarket, type BalanceChangeReceipt, type BuilderCodeReceipt, type ClaimReceipt, type CloseOptions, type CreateManagerReceipt, type DecodableEvent, type DecodableTransactionResult, type GeneratedConfig, MAINNET_CONFIG, MAINNET_DEPLOYMENT, MAINNET_UNITS, type MarketDescriptor, type MarketFeeds, type MarketSummary, type MintAmountOptions, type MintCostOptions, type MintOptions, type MintQuote, type MintReceipt, type MoveAbortError, type OpenPosition, POSITION_LOT_SIZE, POS_INF_TICK, type PlpCancelReceipt, type PlpRequestReceipt, type PlpSupplyOptions, type PlpWithdrawOptions, type PoolSummary, PredictClient, type PredictCompatibleClient, type PredictConfig, PredictInputError, PredictMoveError, type PredictPackages, type PricerSnapshot, type ReadClient, type RedeemQuote, type RedeemReceipt, type Side, TESTNET_CONFIG, TESTNET_DEPLOYMENT, TESTNET_UNITS, U64_MAX, type UnderlyingConfig, admin_d_exports as adminMoveCalls, binaryRangeTicks, builder_code_events_d_exports as builderCodeEvents, builder_code_d_exports as builderCodeMoveCalls, config_events_d_exports as configEvents, cost_d_exports as cost, decodeMoveAbort, deriveAccountWrapperId, expiry_market_d_exports as expiryMarketMoveCalls, generateAuth, getConfig, getDeployment, getUnits, loadLivePricer, market_lifecycle_cap_d_exports as marketLifecycleCapMoveCalls, market_manager_d_exports as marketManagerMoveCalls, order_events_d_exports as orderEvents, pause_cap_d_exports as pauseCapMoveCalls, plp_d_exports as plpMoveCalls, pool_valuation_cap_d_exports as poolValuationCapMoveCalls, predict, predict_account_d_exports as predictAccountMoveCalls, priceToRaw, pricing_d_exports as pricing, pricing_d_exports$1 as pricingMoveCalls, probabilityToRaw, protocol_config_d_exports as protocolConfigMoveCalls, range_codec_d_exports as rangeCodecMoveCalls, rawToPrice, rawToProbability, rawToUsdc, registry_d_exports as registryMoveCalls, toGeneratedConfig, usdcToRaw, vault_events_d_exports as vaultEvents };
|
|
48
|
+
import { deriveQueueId } from "./queue-id.mjs";
|
|
49
|
+
export { type ActiveMarket, type AppliedSlippage, type BalanceChangeReceipt, type BuilderCodeReceipt, type ClaimReceipt, type CloseOptions, type CohortCommitReceipt, type CreateManagerReceipt, type DecodableEvent, type DecodableTransactionResult, type EnqueueMintAmountOptions, type EnqueueMintCostOptions, type EnqueueMintOptions, type EnqueueReceipt, type EnqueueSellOptions, type ExecutionMode, type ExpiryPnlRealizedReceipt, type GeneratedConfig, MAINNET_CONFIG, MAINNET_DEPLOYMENT, MAINNET_UNITS, type MarketCoordinates, type MarketDescriptor, type MarketFeeds, type MarketPayoutsCompletedReceipt, type MarketQueueState, type MarketQueueView, type MarketSettlement, type MarketSummary, type MintAmountOptions, type MintCostOptions, type MintOptions, type MintPlan, type MintQuote, type MintReceipt, type MoveAbortError, type OpenPosition, type OpenRecordPayoutReceipt, type OrdersGeneratedConfig, POSITION_LOT_SIZE, POS_INF_TICK, type PlanMintOptions, type PlanSellOptions, type PlpCancelReceipt, type PlpRequestReceipt, type PlpSupplyOptions, type PlpWithdrawOptions, type PolicyUpdateReceipt, type PoolSummary, PredictClient, type PredictCompatibleClient, type PredictConfig, PredictInputError, PredictMoveError, type PredictPackages, type PredictPreflightCode, PredictPreflightError, type PricerSnapshot, type QueueCashFigures, type QueueEvent, type QueueOpsReceipt, type QueuedFillReceipt, type QueuedOrderOutcome, type QueuedOrderPlan, type QueuedOrderPreview, type QueuedOrderView, type QueuedRefundReceipt, type ReadClient, type RecordFundsReceipt, type RedeemQuote, type RedeemReceipt, type SellPlan, type SellQuote, type Side, type SlippageOptions, TESTNET_CONFIG, TESTNET_DEPLOYMENT, TESTNET_UNITS, U64_MAX, type UnderlyingConfig, admin_d_exports as adminMoveCalls, binaryRangeTicks, builder_code_events_d_exports as builderCodeEvents, builder_code_d_exports as builderCodeMoveCalls, config_events_d_exports as configEvents, cost_d_exports as cost, decodeMoveAbort, delayed_execution_config_d_exports as delayedExecutionConfigMoveCalls, deriveAccountWrapperId, deriveQueueId, describePredictError, desk_d_exports as deskMoveCalls, expiry_market_d_exports as expiryMarketMoveCalls, generateAuth, getConfig, getDeployment, getUnits, lazer_price_d_exports as lazerPriceMoveCalls, loadLivePricer, market_lifecycle_cap_d_exports as marketLifecycleCapMoveCalls, market_manager_d_exports as marketManagerMoveCalls, order_events_d_exports as orderEvents, orderFlowWitnessType, order_queue_d_exports as orderQueueMoveCalls, pause_cap_d_exports as pauseCapMoveCalls, plp_d_exports as plpMoveCalls, pool_valuation_cap_d_exports as poolValuationCapMoveCalls, predict, predict_account_d_exports as predictAccountMoveCalls, math_d_exports as predictMathMoveCalls, priceToRaw, pricing_d_exports as pricing, pricing_d_exports$1 as pricingMoveCalls, probabilityToRaw, protocol_config_d_exports as protocolConfigMoveCalls, queue_d_exports as queue, queue_events_d_exports as queueEvents, queue_d_exports$1 as queueMoveCalls, queue_d_exports$2 as queueTx, range_codec_d_exports as rangeCodecMoveCalls, rawToPrice, rawToProbability, rawToUsdc, realizedPnlRaw, registry_d_exports as registryMoveCalls, snapStrike, toGeneratedConfig, toOrdersConfig, usdcToRaw, vault_events_d_exports as vaultEvents };
|
package/dist/predict/index.mjs
CHANGED
|
@@ -1,34 +1,46 @@
|
|
|
1
1
|
import { MAINNET_DEPLOYMENT, MAINNET_UNITS } from "../deployments/mainnet.mjs";
|
|
2
2
|
import { TESTNET_DEPLOYMENT, TESTNET_UNITS } from "../deployments/testnet.mjs";
|
|
3
3
|
import { getDeployment, getUnits } from "../deployments/index.mjs";
|
|
4
|
+
import { deriveQueueId } from "./queue-id.mjs";
|
|
4
5
|
import { MAINNET_CONFIG } from "./config/mainnet.mjs";
|
|
5
6
|
import { TESTNET_CONFIG } from "./config/testnet.mjs";
|
|
6
7
|
import { getConfig } from "./config/index.mjs";
|
|
7
|
-
import {
|
|
8
|
+
import { PredictInputError, PredictMoveError, PredictPreflightError, decodeMoveAbort, describePredictError } from "./errors.mjs";
|
|
9
|
+
import { toGeneratedConfig, toOrdersConfig } from "./config/generated.mjs";
|
|
10
|
+
import { pricing_exports } from "./pricing.mjs";
|
|
11
|
+
import { POS_INF_TICK, binaryRangeTicks, snapStrike } from "./ticks.mjs";
|
|
12
|
+
import { U64_MAX, priceToRaw, probabilityToRaw, rawToPrice, rawToProbability, rawToUsdc, usdcToRaw } from "./units.mjs";
|
|
13
|
+
import { cost_exports } from "./cost.mjs";
|
|
8
14
|
import { builder_code_events_exports } from "../contracts/deepbook_predict/builder_code_events.mjs";
|
|
15
|
+
import { config_events_exports } from "../contracts/deepbook_predict/config_events.mjs";
|
|
9
16
|
import { order_events_exports } from "../contracts/deepbook_predict/order_events.mjs";
|
|
10
17
|
import { vault_events_exports } from "../contracts/deepbook_predict/vault_events.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
18
|
+
import { order_queue_exports } from "../contracts/deepbook_predict_orders/order_queue.mjs";
|
|
19
|
+
import { delayed_execution_config_exports } from "../contracts/deepbook_predict_orders/delayed_execution_config.mjs";
|
|
20
|
+
import { queue_events_exports } from "../contracts/deepbook_predict_orders/queue_events.mjs";
|
|
21
|
+
import { queue_exports } from "./queue.mjs";
|
|
22
|
+
import { realizedPnlRaw } from "./decode.mjs";
|
|
13
23
|
import { deriveAccountWrapperId, generateAuth } from "./tx/common.mjs";
|
|
14
|
-
import { predict_account_exports } from "../contracts/deepbook_predict/predict_account.mjs";
|
|
15
|
-
import { POS_INF_TICK, binaryRangeTicks } from "./ticks.mjs";
|
|
16
24
|
import { pricing_exports as pricing_exports$1 } from "../contracts/deepbook_predict/pricing.mjs";
|
|
17
|
-
import { expiry_market_exports } from "../contracts/deepbook_predict/expiry_market.mjs";
|
|
18
|
-
import { loadLivePricer } from "./tx/trade.mjs";
|
|
19
25
|
import { plp_exports } from "../contracts/deepbook_predict/plp.mjs";
|
|
26
|
+
import { desk_exports } from "../contracts/deepbook_predict_orders/desk.mjs";
|
|
27
|
+
import { queue_exports as queue_exports$1 } from "../contracts/deepbook_predict_orders/queue.mjs";
|
|
28
|
+
import { queue_exports as queue_exports$2 } from "./tx/queue.mjs";
|
|
29
|
+
import { loadLivePricer } from "./tx/trade.mjs";
|
|
30
|
+
import { orderFlowWitnessType } from "./reads/queue.mjs";
|
|
31
|
+
import { predict_account_exports } from "../contracts/deepbook_predict/predict_account.mjs";
|
|
20
32
|
import { range_codec_exports } from "../contracts/deepbook_predict/range_codec.mjs";
|
|
21
33
|
import { market_manager_exports } from "../contracts/deepbook_predict/market_manager.mjs";
|
|
22
34
|
import { registry_exports } from "../contracts/deepbook_predict/registry.mjs";
|
|
23
|
-
import { pricing_exports } from "./pricing.mjs";
|
|
24
35
|
import { POSITION_LOT_SIZE, PredictClient, predict } from "./client.mjs";
|
|
25
36
|
import { admin_exports } from "../contracts/deepbook_predict/admin.mjs";
|
|
26
37
|
import { builder_code_exports } from "../contracts/deepbook_predict/builder_code.mjs";
|
|
38
|
+
import { expiry_market_exports } from "./bindings/expiry-market.mjs";
|
|
27
39
|
import { market_lifecycle_cap_exports } from "../contracts/deepbook_predict/market_lifecycle_cap.mjs";
|
|
28
40
|
import { pause_cap_exports } from "../contracts/deepbook_predict/pause_cap.mjs";
|
|
29
41
|
import { pool_valuation_cap_exports } from "../contracts/deepbook_predict/pool_valuation_cap.mjs";
|
|
30
|
-
import { protocol_config_exports } from "
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
42
|
+
import { protocol_config_exports } from "./bindings/protocol-config.mjs";
|
|
43
|
+
import { math_exports } from "../contracts/deepbook_predict_math/math.mjs";
|
|
44
|
+
import { lazer_price_exports } from "../contracts/deepbook_predict_math/lazer_price.mjs";
|
|
33
45
|
|
|
34
|
-
export { MAINNET_CONFIG, MAINNET_DEPLOYMENT, MAINNET_UNITS, POSITION_LOT_SIZE, POS_INF_TICK, PredictClient, PredictInputError, PredictMoveError, TESTNET_CONFIG, TESTNET_DEPLOYMENT, TESTNET_UNITS, U64_MAX, admin_exports as adminMoveCalls, binaryRangeTicks, builder_code_events_exports as builderCodeEvents, builder_code_exports as builderCodeMoveCalls, config_events_exports as configEvents, cost_exports as cost, decodeMoveAbort, deriveAccountWrapperId, expiry_market_exports as expiryMarketMoveCalls, generateAuth, getConfig, getDeployment, getUnits, loadLivePricer, market_lifecycle_cap_exports as marketLifecycleCapMoveCalls, market_manager_exports as marketManagerMoveCalls, order_events_exports as orderEvents, pause_cap_exports as pauseCapMoveCalls, plp_exports as plpMoveCalls, pool_valuation_cap_exports as poolValuationCapMoveCalls, predict, predict_account_exports as predictAccountMoveCalls, priceToRaw, pricing_exports as pricing, pricing_exports$1 as pricingMoveCalls, probabilityToRaw, protocol_config_exports as protocolConfigMoveCalls, range_codec_exports as rangeCodecMoveCalls, rawToPrice, rawToProbability, rawToUsdc, registry_exports as registryMoveCalls, toGeneratedConfig, usdcToRaw, vault_events_exports as vaultEvents };
|
|
46
|
+
export { MAINNET_CONFIG, MAINNET_DEPLOYMENT, MAINNET_UNITS, POSITION_LOT_SIZE, POS_INF_TICK, PredictClient, PredictInputError, PredictMoveError, PredictPreflightError, TESTNET_CONFIG, TESTNET_DEPLOYMENT, TESTNET_UNITS, U64_MAX, admin_exports as adminMoveCalls, binaryRangeTicks, builder_code_events_exports as builderCodeEvents, builder_code_exports as builderCodeMoveCalls, config_events_exports as configEvents, cost_exports as cost, decodeMoveAbort, delayed_execution_config_exports as delayedExecutionConfigMoveCalls, deriveAccountWrapperId, deriveQueueId, describePredictError, desk_exports as deskMoveCalls, expiry_market_exports as expiryMarketMoveCalls, generateAuth, getConfig, getDeployment, getUnits, lazer_price_exports as lazerPriceMoveCalls, loadLivePricer, market_lifecycle_cap_exports as marketLifecycleCapMoveCalls, market_manager_exports as marketManagerMoveCalls, order_events_exports as orderEvents, orderFlowWitnessType, order_queue_exports as orderQueueMoveCalls, pause_cap_exports as pauseCapMoveCalls, plp_exports as plpMoveCalls, pool_valuation_cap_exports as poolValuationCapMoveCalls, predict, predict_account_exports as predictAccountMoveCalls, math_exports as predictMathMoveCalls, priceToRaw, pricing_exports as pricing, pricing_exports$1 as pricingMoveCalls, probabilityToRaw, protocol_config_exports as protocolConfigMoveCalls, queue_exports as queue, queue_events_exports as queueEvents, queue_exports$1 as queueMoveCalls, queue_exports$2 as queueTx, range_codec_exports as rangeCodecMoveCalls, rawToPrice, rawToProbability, rawToUsdc, realizedPnlRaw, registry_exports as registryMoveCalls, snapStrike, toGeneratedConfig, toOrdersConfig, usdcToRaw, vault_events_exports as vaultEvents };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/predict/queue-id.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The ID of `expiryMarketId`'s `MarketQueue` under the queue registry `registryId`, whether or not
|
|
4
|
+
* the queue exists yet: Sui's `derived_object::derive_address(registry_id, expiry_market_id)`, as
|
|
5
|
+
* `queue::queue_id` computes it on chain. The parent is the order-flow package's `QueueRegistry`,
|
|
6
|
+
* not its `OrderDesk`. The key is the market's `0x2::object::ID`, whose BCS is the bare 32-byte
|
|
7
|
+
* address. Each market has exactly one queue, created once by the permissionless
|
|
8
|
+
* `queue::create_and_share`.
|
|
9
|
+
*/
|
|
10
|
+
declare function deriveQueueId(registryId: string, expiryMarketId: string): string;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { deriveQueueId };
|
|
13
|
+
//# sourceMappingURL=queue-id.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-id.d.mts","names":[],"sources":["../../src/predict/queue-id.ts"],"mappings":";;AAeA;;;;;;;iBAAgB,aAAA,CAAc,UAAA,UAAoB,cAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { bcs } from "@mysten/sui/bcs";
|
|
2
|
+
import { deriveObjectID } from "@mysten/sui/utils";
|
|
3
|
+
|
|
4
|
+
//#region src/predict/queue-id.ts
|
|
5
|
+
/**
|
|
6
|
+
* The ID of `expiryMarketId`'s `MarketQueue` under the queue registry `registryId`, whether or not
|
|
7
|
+
* the queue exists yet: Sui's `derived_object::derive_address(registry_id, expiry_market_id)`, as
|
|
8
|
+
* `queue::queue_id` computes it on chain. The parent is the order-flow package's `QueueRegistry`,
|
|
9
|
+
* not its `OrderDesk`. The key is the market's `0x2::object::ID`, whose BCS is the bare 32-byte
|
|
10
|
+
* address. Each market has exactly one queue, created once by the permissionless
|
|
11
|
+
* `queue::create_and_share`.
|
|
12
|
+
*/
|
|
13
|
+
function deriveQueueId(registryId, expiryMarketId) {
|
|
14
|
+
return deriveObjectID(registryId, "0x2::object::ID", bcs.Address.serialize(expiryMarketId).toBytes());
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { deriveQueueId };
|
|
19
|
+
//# sourceMappingURL=queue-id.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue-id.mjs","names":[],"sources":["../../src/predict/queue-id.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n// A leaf module with no SDK imports, so `/sessions` can derive queue IDs without pulling the\n// `/predict` module graph in.\nimport { bcs } from '@mysten/sui/bcs';\nimport { deriveObjectID } from '@mysten/sui/utils';\n\n/**\n * The ID of `expiryMarketId`'s `MarketQueue` under the queue registry `registryId`, whether or not\n * the queue exists yet: Sui's `derived_object::derive_address(registry_id, expiry_market_id)`, as\n * `queue::queue_id` computes it on chain. The parent is the order-flow package's `QueueRegistry`,\n * not its `OrderDesk`. The key is the market's `0x2::object::ID`, whose BCS is the bare 32-byte\n * address. Each market has exactly one queue, created once by the permissionless\n * `queue::create_and_share`.\n */\nexport function deriveQueueId(registryId: string, expiryMarketId: string): string {\n\treturn deriveObjectID(\n\t\tregistryId,\n\t\t'0x2::object::ID',\n\t\tbcs.Address.serialize(expiryMarketId).toBytes(),\n\t);\n}\n"],"mappings":";;;;;;;;;;;;AAeA,SAAgB,cAAc,YAAoB,gBAAgC;AACjF,QAAO,eACN,YACA,mBACA,IAAI,QAAQ,UAAU,eAAe,CAAC,SAAS,CAC/C"}
|