@mysten/deepbook-v3 2.4.1 → 2.5.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 +23 -0
- package/dist/contracts/account/account.d.mts +23 -23
- package/dist/contracts/account/account.d.mts.map +1 -1
- package/dist/contracts/account/account_events.d.mts +20 -20
- package/dist/contracts/account/account_events.d.mts.map +1 -1
- package/dist/contracts/account/account_registry.d.mts +19 -19
- package/dist/contracts/account/account_registry.d.mts.map +1 -1
- 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 +67 -67
- package/dist/contracts/deepbook_predict/expiry_market.d.mts +95 -95
- 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/market_manager.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/order_events.d.mts +50 -50
- package/dist/contracts/deepbook_predict/pause_cap.d.mts +5 -5
- package/dist/contracts/deepbook_predict/plp.d.mts +72 -72
- package/dist/contracts/deepbook_predict/plp.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 +92 -51
- package/dist/contracts/deepbook_predict/pricing.d.mts.map +1 -1
- package/dist/contracts/deepbook_predict/pricing.mjs +57 -7
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/protocol_config.d.mts +64 -64
- 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 +3 -2
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -1
- package/dist/contracts/deepbook_predict/vault_events.d.mts +105 -105
- package/dist/contracts/deepbook_sessions/session_config.d.mts +8 -8
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -1
- package/dist/contracts/deepbook_sessions/sessions.d.mts +22 -22
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -1
- package/dist/deployments/mainnet.mjs +21 -21
- package/dist/deployments/mainnet.mjs.map +1 -1
- package/dist/deployments/testnet.mjs +21 -21
- package/dist/deployments/testnet.mjs.map +1 -1
- package/dist/predict/index.mjs +1 -1
- package/dist/predict/reads/markets.mjs +11 -3
- package/dist/predict/reads/markets.mjs.map +1 -1
- package/dist/predict/reads/pricing.mjs +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/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/marginLiquidations.d.mts +3 -3
- package/dist/transactions/marginMaintainer.d.mts +5 -5
- package/dist/transactions/marginManager.d.mts +32 -32
- package/dist/transactions/marginPool.d.mts +18 -18
- package/dist/transactions/marginPool.d.mts.map +1 -1
- 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 +2 -2
- package/src/contracts/deepbook_predict/pricing.ts +88 -6
- package/src/contracts/deepbook_predict/strike_exposure.ts +3 -2
- package/src/contracts/propbook/block_scholes_store.ts +34 -0
- package/src/contracts/propbook/pyth_feed.ts +3 -1
- package/src/deployments/mainnet.ts +22 -22
- package/src/deployments/testnet.ts +22 -22
- package/src/predict/reads/markets.ts +16 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigValue, MoveStruct, RawTransactionArgument } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs466 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions286 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/contracts/deepbook_sessions/session_config.d.ts
|
|
@@ -8,11 +8,11 @@ declare namespace session_config_d_exports {
|
|
|
8
8
|
export { BumpVersionWatermarkArguments, BumpVersionWatermarkOptions, IdArguments, IdOptions, SessionsAdminCap, SessionsConfig, VersionWatermarkArguments, VersionWatermarkOptions, bumpVersionWatermark, id, versionWatermark };
|
|
9
9
|
}
|
|
10
10
|
declare const SessionsConfig: MoveStruct<{
|
|
11
|
-
id:
|
|
12
|
-
version_watermark:
|
|
11
|
+
id: _mysten_sui_bcs466.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
12
|
+
version_watermark: _mysten_sui_bcs466.BcsType<bigint, string | number | bigint, "u64">;
|
|
13
13
|
}, "@local-pkg/deepbook_sessions::session_config::SessionsConfig">;
|
|
14
14
|
declare const SessionsAdminCap: MoveStruct<{
|
|
15
|
-
id:
|
|
15
|
+
id: _mysten_sui_bcs466.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
16
16
|
}, "@local-pkg/deepbook_sessions::session_config::SessionsAdminCap">;
|
|
17
17
|
interface IdArguments {
|
|
18
18
|
config?: RawTransactionArgument<string>;
|
|
@@ -26,7 +26,7 @@ interface IdOptions {
|
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
/** Return the config object ID for external PTB construction. */
|
|
29
|
-
declare function id(options: IdOptions): (tx: Transaction) =>
|
|
29
|
+
declare function id(options: IdOptions): (tx: Transaction) => _mysten_sui_transactions286.TransactionResult;
|
|
30
30
|
interface VersionWatermarkArguments {
|
|
31
31
|
config?: RawTransactionArgument<string>;
|
|
32
32
|
}
|
|
@@ -39,7 +39,7 @@ interface VersionWatermarkOptions {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/** Return the minimum Sessions package version accepted by gated entrypoints. */
|
|
42
|
-
declare function versionWatermark(options: VersionWatermarkOptions): (tx: Transaction) =>
|
|
42
|
+
declare function versionWatermark(options: VersionWatermarkOptions): (tx: Transaction) => _mysten_sui_transactions286.TransactionResult;
|
|
43
43
|
interface BumpVersionWatermarkArguments {
|
|
44
44
|
config?: RawTransactionArgument<string>;
|
|
45
45
|
AdminCap: RawTransactionArgument<string>;
|
|
@@ -57,7 +57,7 @@ interface BumpVersionWatermarkOptions {
|
|
|
57
57
|
* so an upgraded package can retire older versions, and it cannot accept a
|
|
58
58
|
* caller-selected target.
|
|
59
59
|
*/
|
|
60
|
-
declare function bumpVersionWatermark(options: BumpVersionWatermarkOptions): (tx: Transaction) =>
|
|
60
|
+
declare function bumpVersionWatermark(options: BumpVersionWatermarkOptions): (tx: Transaction) => _mysten_sui_transactions286.TransactionResult;
|
|
61
61
|
//#endregion
|
|
62
62
|
export { session_config_d_exports };
|
|
63
63
|
//# sourceMappingURL=session_config.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session_config.d.mts","names":[],"sources":["../../../src/contracts/deepbook_sessions/session_config.ts"],"mappings":";;;;;;;;;cAgBa,cAAA,EAAc,UAAA;;;;cAOd,gBAAA,EAAgB,UAAA;;;UAMZ,WAAA;EAChB,MAAA,GAAS,sBAAA;AAAA;AAAA,UAEO,SAAA;EAChB,OAAA;EACA,SAAA,GAAY,WAAA;EACZ,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;iBAIc,EAAA,CAAG,OAAA,EAAS,SAAA,IAKnB,EAAA,EAAI,WAAA,KAAW,
|
|
1
|
+
{"version":3,"file":"session_config.d.mts","names":[],"sources":["../../../src/contracts/deepbook_sessions/session_config.ts"],"mappings":";;;;;;;;;cAgBa,cAAA,EAAc,UAAA;;;;cAOd,gBAAA,EAAgB,UAAA;;;UAMZ,WAAA;EAChB,MAAA,GAAS,sBAAA;AAAA;AAAA,UAEO,SAAA;EAChB,OAAA;EACA,SAAA,GAAY,WAAA;EACZ,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;iBAIc,EAAA,CAAG,OAAA,EAAS,SAAA,IAKnB,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAeP,yBAAA;EAChB,MAAA,GAAS,sBAAA;AAAA;AAAA,UAEO,uBAAA;EAChB,OAAA;EACA,SAAA,GAAY,yBAAA;EACZ,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;iBAIc,gBAAA,CAAiB,OAAA,EAAS,uBAAA,IAKjC,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAeP,6BAAA;EAChB,MAAA,GAAS,sBAAA;EACT,QAAA,EAAU,sBAAA;AAAA;AAAA,UAEM,2BAAA;EAChB,OAAA;EACA,SAAA,EAAW,6BAAA;EACX,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;;;;AAzEF;iBAiFgB,oBAAA,CAAqB,OAAA,EAAS,2BAAA,IAKrC,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigValue, MoveStruct, RawTransactionArgument } from "../utils/index.mjs";
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as _mysten_sui_bcs469 from "@mysten/sui/bcs";
|
|
3
|
+
import * as _mysten_sui_transactions289 from "@mysten/sui/transactions";
|
|
4
4
|
import { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/contracts/deepbook_sessions/sessions.d.ts
|
|
@@ -8,11 +8,11 @@ declare namespace sessions_d_exports {
|
|
|
8
8
|
export { AuthorizeSessionArguments, AuthorizeSessionOptions, CancelLiveOrderArguments, CancelLiveOrderOptions, CancelLiveOrdersArguments, CancelLiveOrdersOptions, MintExactAmountArguments, MintExactAmountOptions, MintExactQuantityArguments, MintExactQuantityOptions, PlaceLimitOrderArguments, PlaceLimitOrderOptions, PlaceMarketOrderArguments, PlaceMarketOrderOptions, RedeemLiveArguments, RedeemLiveOptions, RedeemSettledArguments, RedeemSettledOptions, RevokeSessionArguments, RevokeSessionOptions, SessionAuthorized, SessionExpirationMsArguments, SessionExpirationMsOptions, SessionRevoked, SessionsApp, SessionsData, WithdrawSettledAmountsArguments, WithdrawSettledAmountsOptions, authorizeSession, cancelLiveOrder, cancelLiveOrders, mintExactAmount, mintExactQuantity, placeLimitOrder, placeMarketOrder, redeemLive, redeemSettled, revokeSession, sessionExpirationMs, withdrawSettledAmounts };
|
|
9
9
|
}
|
|
10
10
|
declare const SessionsApp: MoveStruct<{
|
|
11
|
-
dummy_field:
|
|
11
|
+
dummy_field: _mysten_sui_bcs469.BcsType<boolean, boolean, "bool">;
|
|
12
12
|
}, "@local-pkg/deepbook_sessions::sessions::SessionsApp">;
|
|
13
13
|
declare const SessionsData: MoveStruct<{
|
|
14
14
|
sessions: MoveStruct<{
|
|
15
|
-
contents:
|
|
15
|
+
contents: _mysten_sui_bcs469.BcsType<{
|
|
16
16
|
key: string;
|
|
17
17
|
value: bigint;
|
|
18
18
|
}[], Iterable<{
|
|
@@ -24,14 +24,14 @@ declare const SessionsData: MoveStruct<{
|
|
|
24
24
|
}, "0x2::vec_map::VecMap<bytes[32], u64>">;
|
|
25
25
|
}, "@local-pkg/deepbook_sessions::sessions::SessionsData">;
|
|
26
26
|
declare const SessionAuthorized: MoveStruct<{
|
|
27
|
-
account_id:
|
|
28
|
-
session:
|
|
29
|
-
expires_at_ms:
|
|
27
|
+
account_id: _mysten_sui_bcs469.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
28
|
+
session: _mysten_sui_bcs469.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
29
|
+
expires_at_ms: _mysten_sui_bcs469.BcsType<bigint, string | number | bigint, "u64">;
|
|
30
30
|
}, "@local-pkg/deepbook_sessions::sessions::SessionAuthorized">;
|
|
31
31
|
declare const SessionRevoked: MoveStruct<{
|
|
32
|
-
account_id:
|
|
33
|
-
session:
|
|
34
|
-
expires_at_ms:
|
|
32
|
+
account_id: _mysten_sui_bcs469.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
33
|
+
session: _mysten_sui_bcs469.BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
|
|
34
|
+
expires_at_ms: _mysten_sui_bcs469.BcsType<bigint, string | number | bigint, "u64">;
|
|
35
35
|
}, "@local-pkg/deepbook_sessions::sessions::SessionRevoked">;
|
|
36
36
|
interface SessionExpirationMsArguments {
|
|
37
37
|
wrapper: RawTransactionArgument<string>;
|
|
@@ -45,7 +45,7 @@ interface SessionExpirationMsOptions {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
/** Return a known session's expiration timestamp for SDK and devInspect reads. */
|
|
48
|
-
declare function sessionExpirationMs(options: SessionExpirationMsOptions): (tx: Transaction) =>
|
|
48
|
+
declare function sessionExpirationMs(options: SessionExpirationMsOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
49
49
|
interface AuthorizeSessionArguments {
|
|
50
50
|
wrapper: RawTransactionArgument<string>;
|
|
51
51
|
sessionsConfig?: RawTransactionArgument<string>;
|
|
@@ -64,7 +64,7 @@ interface AuthorizeSessionOptions {
|
|
|
64
64
|
* Authorize `session` from execution time for at most 30 days. Accounts may store
|
|
65
65
|
* at most 20 addresses; reauthorization replaces in place.
|
|
66
66
|
*/
|
|
67
|
-
declare function authorizeSession(options: AuthorizeSessionOptions): (tx: Transaction) =>
|
|
67
|
+
declare function authorizeSession(options: AuthorizeSessionOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
68
68
|
interface RevokeSessionArguments {
|
|
69
69
|
wrapper: RawTransactionArgument<string>;
|
|
70
70
|
session: RawTransactionArgument<string>;
|
|
@@ -80,7 +80,7 @@ interface RevokeSessionOptions {
|
|
|
80
80
|
* Revoke `session` if it is present. Only the Account owner may call this
|
|
81
81
|
* function.
|
|
82
82
|
*/
|
|
83
|
-
declare function revokeSession(options: RevokeSessionOptions): (tx: Transaction) =>
|
|
83
|
+
declare function revokeSession(options: RevokeSessionOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
84
84
|
interface PlaceLimitOrderArguments {
|
|
85
85
|
pool: RawTransactionArgument<string>;
|
|
86
86
|
deepbookRegistry: RawTransactionArgument<string>;
|
|
@@ -106,7 +106,7 @@ interface PlaceLimitOrderOptions {
|
|
|
106
106
|
typeArguments: [string, string];
|
|
107
107
|
}
|
|
108
108
|
/** Place a DeepBook spot limit order for an Account with an active session. */
|
|
109
|
-
declare function placeLimitOrder(options: PlaceLimitOrderOptions): (tx: Transaction) =>
|
|
109
|
+
declare function placeLimitOrder(options: PlaceLimitOrderOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
110
110
|
interface PlaceMarketOrderArguments {
|
|
111
111
|
pool: RawTransactionArgument<string>;
|
|
112
112
|
deepbookRegistry: RawTransactionArgument<string>;
|
|
@@ -130,7 +130,7 @@ interface PlaceMarketOrderOptions {
|
|
|
130
130
|
typeArguments: [string, string];
|
|
131
131
|
}
|
|
132
132
|
/** Place a DeepBook spot market order for an Account with an active session. */
|
|
133
|
-
declare function placeMarketOrder(options: PlaceMarketOrderOptions): (tx: Transaction) =>
|
|
133
|
+
declare function placeMarketOrder(options: PlaceMarketOrderOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
134
134
|
interface CancelLiveOrderArguments {
|
|
135
135
|
pool: RawTransactionArgument<string>;
|
|
136
136
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -148,7 +148,7 @@ interface CancelLiveOrderOptions {
|
|
|
148
148
|
typeArguments: [string, string];
|
|
149
149
|
}
|
|
150
150
|
/** Cancel a DeepBook spot order for an Account with an active session. */
|
|
151
|
-
declare function cancelLiveOrder(options: CancelLiveOrderOptions): (tx: Transaction) =>
|
|
151
|
+
declare function cancelLiveOrder(options: CancelLiveOrderOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
152
152
|
interface CancelLiveOrdersArguments {
|
|
153
153
|
pool: RawTransactionArgument<string>;
|
|
154
154
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -166,7 +166,7 @@ interface CancelLiveOrdersOptions {
|
|
|
166
166
|
typeArguments: [string, string];
|
|
167
167
|
}
|
|
168
168
|
/** Cancel multiple DeepBook spot orders for an Account with an active session. */
|
|
169
|
-
declare function cancelLiveOrders(options: CancelLiveOrdersOptions): (tx: Transaction) =>
|
|
169
|
+
declare function cancelLiveOrders(options: CancelLiveOrdersOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
170
170
|
interface WithdrawSettledAmountsArguments {
|
|
171
171
|
pool: RawTransactionArgument<string>;
|
|
172
172
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -183,7 +183,7 @@ interface WithdrawSettledAmountsOptions {
|
|
|
183
183
|
typeArguments: [string, string];
|
|
184
184
|
}
|
|
185
185
|
/** Sweep settled DeepBook spot proceeds into an Account with an active session. */
|
|
186
|
-
declare function withdrawSettledAmounts(options: WithdrawSettledAmountsOptions): (tx: Transaction) =>
|
|
186
|
+
declare function withdrawSettledAmounts(options: WithdrawSettledAmountsOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
187
187
|
interface MintExactQuantityArguments {
|
|
188
188
|
market: RawTransactionArgument<string>;
|
|
189
189
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -206,7 +206,7 @@ interface MintExactQuantityOptions {
|
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
208
|
/** Mint an exact Predict position quantity for an Account with an active session. */
|
|
209
|
-
declare function mintExactQuantity(options: MintExactQuantityOptions): (tx: Transaction) =>
|
|
209
|
+
declare function mintExactQuantity(options: MintExactQuantityOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
210
210
|
interface MintExactAmountArguments {
|
|
211
211
|
market: RawTransactionArgument<string>;
|
|
212
212
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -229,7 +229,7 @@ interface MintExactAmountOptions {
|
|
|
229
229
|
};
|
|
230
230
|
}
|
|
231
231
|
/** Mint a budget-sized Predict position for an Account with an active session. */
|
|
232
|
-
declare function mintExactAmount(options: MintExactAmountOptions): (tx: Transaction) =>
|
|
232
|
+
declare function mintExactAmount(options: MintExactAmountOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
233
233
|
interface RedeemLiveArguments {
|
|
234
234
|
market: RawTransactionArgument<string>;
|
|
235
235
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -251,7 +251,7 @@ interface RedeemLiveOptions {
|
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
/** Redeem a live Predict order for an Account with an active session. */
|
|
254
|
-
declare function redeemLive(options: RedeemLiveOptions): (tx: Transaction) =>
|
|
254
|
+
declare function redeemLive(options: RedeemLiveOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
255
255
|
interface RedeemSettledArguments {
|
|
256
256
|
market: RawTransactionArgument<string>;
|
|
257
257
|
accountRegistry: RawTransactionArgument<string>;
|
|
@@ -269,7 +269,7 @@ interface RedeemSettledOptions {
|
|
|
269
269
|
};
|
|
270
270
|
}
|
|
271
271
|
/** Redeem a settled Predict order for an Account with an active session. */
|
|
272
|
-
declare function redeemSettled(options: RedeemSettledOptions): (tx: Transaction) =>
|
|
272
|
+
declare function redeemSettled(options: RedeemSettledOptions): (tx: Transaction) => _mysten_sui_transactions289.TransactionResult;
|
|
273
273
|
//#endregion
|
|
274
274
|
export { SessionAuthorized, SessionRevoked, SessionsApp, SessionsData, sessions_d_exports };
|
|
275
275
|
//# sourceMappingURL=sessions.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.mts","names":[],"sources":["../../../src/contracts/deepbook_sessions/sessions.ts"],"mappings":";;;;;;;;;cAqBa,WAAA,EAAW,UAAA;eAKtB,
|
|
1
|
+
{"version":3,"file":"sessions.d.mts","names":[],"sources":["../../../src/contracts/deepbook_sessions/sessions.ts"],"mappings":";;;;;;;;;cAqBa,WAAA,EAAW,UAAA;eAKtB,kBAAA,CAAA,OAAA;AAAA;AAAA,cACW,YAAA,EAAY,UAAA;;;;;;;;;;;;;cAMZ,iBAAA,EAAiB,UAAA;;;;;cAQjB,cAAA,EAAc,UAAA;;;;;UAQV,4BAAA;EAChB,OAAA,EAAS,sBAAA;EACT,OAAA,EAAS,sBAAA;AAAA;AAAA,UAEO,0BAAA;EAChB,OAAA;EACA,SAAA,EACG,4BAAA,IACC,OAAA,EAAS,sBAAA,UAAgC,OAAA,EAAS,sBAAA;EACtD,MAAA;IACC,iBAAA;EAAA;AAAA;;iBAIc,mBAAA,CAAoB,OAAA,EAAS,0BAAA,IAKpC,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAQP,yBAAA;EAChB,OAAA,EAAS,sBAAA;EACT,cAAA,GAAiB,sBAAA;EACjB,OAAA,EAAS,sBAAA;EACT,UAAA,EAAY,sBAAA;AAAA;AAAA,UAEI,uBAAA;EAChB,OAAA;EACA,SAAA,EAAW,yBAAA;EACX,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;;;;iBAOc,gBAAA,CAAiB,OAAA,EAAS,uBAAA,IAOjC,EAAA,EAAI,WAAA,K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,EAAQ,sBAAA;EACR,MAAA,EAAQ,mBAAA;EACR,OAAA,EAAS,sBAAA;EACT,aAAA,EAAe,sBAAA;EACf,cAAA,EAAgB,sBAAA;EAChB,WAAA,EAAa,sBAAA;AAAA;AAAA,UAEG,iBAAA;EAChB,OAAA;EACA,SAAA,EAAW,mBAAA;EACX,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;;iBAIc,UAAA,CAAW,OAAA,EAAS,iBAAA,IA6B3B,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA;AAAA,UAeP,sBAAA;EAChB,MAAA,EAAQ,sBAAA;EACR,eAAA,EAAiB,sBAAA;EACjB,OAAA,EAAS,sBAAA;EACT,cAAA,GAAiB,sBAAA;EACjB,MAAA,EAAQ,sBAAA;EACR,OAAA,EAAS,sBAAA;AAAA;AAAA,UAEO,oBAAA;EAChB,OAAA;EACA,SAAA,EAAW,sBAAA;EACX,MAAA;IACC,cAAA,EAAgB,WAAA;IAChB,iBAAA;EAAA;AAAA;AA7dF;AAAA,iBAiegB,aAAA,CAAc,OAAA,EAAS,oBAAA,IAqB9B,EAAA,EAAI,WAAA,KAAW,2BAAA,CAAA,iBAAA"}
|
|
@@ -4,12 +4,12 @@ const MAINNET_DEPLOYMENT = Object.freeze({
|
|
|
4
4
|
deployment: "deepbook-predict-mainnet",
|
|
5
5
|
network: "mainnet",
|
|
6
6
|
chainId: "35834a8a",
|
|
7
|
-
sourceCommit: "
|
|
7
|
+
sourceCommit: "7b169bde2c2a25fee3ac9aa4686e346309bfe570"
|
|
8
8
|
});
|
|
9
9
|
/** Ids for the shared `account` primitive — the `/account` subpath's slice. */
|
|
10
10
|
const MAINNET_ACCOUNT = Object.freeze({
|
|
11
|
-
accountPackageId: "
|
|
12
|
-
accountRegistry: "
|
|
11
|
+
accountPackageId: "0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58",
|
|
12
|
+
accountRegistry: "0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc"
|
|
13
13
|
});
|
|
14
14
|
/**
|
|
15
15
|
* Ids for time-limited sessions — the `/sessions` subpath's slice.
|
|
@@ -19,13 +19,13 @@ const MAINNET_ACCOUNT = Object.freeze({
|
|
|
19
19
|
* the package root for one id.
|
|
20
20
|
*/
|
|
21
21
|
const MAINNET_SESSIONS = Object.freeze({
|
|
22
|
-
sessionsPackageId: "
|
|
23
|
-
sessionsConfig: "
|
|
24
|
-
accountPackageId: "
|
|
25
|
-
accountRegistry: "
|
|
22
|
+
sessionsPackageId: "0x9a068beffa019ae756f4a6d2611e9899d3c6dd888812dd9eca87535d2ac55e2a",
|
|
23
|
+
sessionsConfig: "0xb2fba483748aac7508676020d4e691d68239b66f8bf7c5e7634dd1a76a329317",
|
|
24
|
+
accountPackageId: "0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58",
|
|
25
|
+
accountRegistry: "0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc",
|
|
26
26
|
deepbookRegistry: "0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d",
|
|
27
|
-
deepbookCoreAccountPackageId: "
|
|
28
|
-
protocolConfig: "
|
|
27
|
+
deepbookCoreAccountPackageId: "0xd71b5a341dc8dc7e187517849edf61e54670b60fe496e07186c09a65fa7afdb7",
|
|
28
|
+
protocolConfig: "0x5fa6efbe7691809565a660adde23f0c184ca1d19cefafa4e1c88d655fe279580"
|
|
29
29
|
});
|
|
30
30
|
/**
|
|
31
31
|
* Scale constants the deployment owns rather than the SDK. Deployment-wide:
|
|
@@ -42,29 +42,29 @@ const MAINNET_UNITS = Object.freeze({
|
|
|
42
42
|
const MAINNET_PREDICT = Object.freeze({
|
|
43
43
|
network: "mainnet",
|
|
44
44
|
packages: Object.freeze({
|
|
45
|
-
predict: "
|
|
46
|
-
account: "
|
|
47
|
-
propbook: "
|
|
45
|
+
predict: "0x89aea622e7bb3bdd598bde87dde40ee31c9eed4971b9546e23ec83de3c48bbba",
|
|
46
|
+
account: "0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58",
|
|
47
|
+
propbook: "0xa6c8f32015b5b41d34ee09995a2e9d7a21cdecf0e1910a50b264fd252cd33831"
|
|
48
48
|
}),
|
|
49
49
|
objects: Object.freeze({
|
|
50
|
-
registry: "
|
|
51
|
-
protocolConfig: "
|
|
52
|
-
poolVault: "
|
|
53
|
-
oracleRegistry: "
|
|
54
|
-
accountRegistry: "
|
|
50
|
+
registry: "0x94327dbc256a2cfabd164c2bf4b3fe033bfaa4771f7a6f716954e07cb1b4beba",
|
|
51
|
+
protocolConfig: "0x5fa6efbe7691809565a660adde23f0c184ca1d19cefafa4e1c88d655fe279580",
|
|
52
|
+
poolVault: "0x4d227a1baf8cfcaf6e652a9182d0e63f85f9ce82cd542fdf3356bb3581be3b99",
|
|
53
|
+
oracleRegistry: "0x5d62c0d9be43efa769a708ade53fbe5bea98c15c865b64ca7c498c87b045a698",
|
|
54
|
+
accountRegistry: "0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc"
|
|
55
55
|
}),
|
|
56
56
|
quoteCoinType: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC",
|
|
57
57
|
coinTypes: Object.freeze({
|
|
58
|
-
plp: "
|
|
58
|
+
plp: "0x89aea622e7bb3bdd598bde87dde40ee31c9eed4971b9546e23ec83de3c48bbba::plp::PLP",
|
|
59
59
|
deep: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP"
|
|
60
60
|
}),
|
|
61
61
|
units: MAINNET_UNITS,
|
|
62
62
|
underlyings: Object.freeze({ BTC: Object.freeze({
|
|
63
63
|
symbol: "BTC",
|
|
64
64
|
propbookUnderlyingId: 1,
|
|
65
|
-
pythFeed: "
|
|
66
|
-
blockScholesValueStore: "
|
|
67
|
-
blockScholesSviStore: "
|
|
65
|
+
pythFeed: "0x4c5d2b4c8238f04b7687c3a8df915b69c50d5f4d291fc49aea44bdb6b52e1a20",
|
|
66
|
+
blockScholesValueStore: "0xe83f843b15ae63045b2cea445fb8ea7ad85c5fc2a05f66db122a511e1f2c67bc",
|
|
67
|
+
blockScholesSviStore: "0xfdd447be39d847747caf18ecf3355031bb33979c472581f1a5481375d3748bfb"
|
|
68
68
|
}) })
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mainnet.mjs","names":[],"sources":["../../src/deployments/mainnet.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// GENERATED by `pnpm sync-deployment` from the deploy tooling's own manifest\n// (`packages/predict/deployment/deployment.mainnet.json`). Do not hand-edit:\n// the next regeneration overwrites it, and a hand-patched id is exactly the drift this\n// file exists to prevent. To move to a new deployment, check the sibling deepbookv3\n// checkout out to the new anchor and re-run the script.\n//\n// Deployment: deepbook-predict-mainnet\n// sourceCommit:
|
|
1
|
+
{"version":3,"file":"mainnet.mjs","names":[],"sources":["../../src/deployments/mainnet.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// GENERATED by `pnpm sync-deployment` from the deploy tooling's own manifest\n// (`packages/predict/deployment/deployment.mainnet.json`). Do not hand-edit:\n// the next regeneration overwrites it, and a hand-patched id is exactly the drift this\n// file exists to prevent. To move to a new deployment, check the sibling deepbookv3\n// checkout out to the new anchor and re-run the script.\n//\n// Deployment: deepbook-predict-mainnet\n// sourceCommit: 7b169bde2c2a25fee3ac9aa4686e346309bfe570\n//\n// Runtime-dependency-free — every subpath reads a slice of this, so a value import here\n// would pull that module into all of their graphs. The type import below is erased.\n//\n// Frozen: these are shared module singletons, so an accessor handing one to a caller who\n// mutates it would change what every other caller sees.\n\nimport type {\n\tAccountIds,\n\tDeploymentInfo,\n\tDeploymentUnits,\n\tPredictIds,\n\tSessionsIds,\n} from './types.js';\n\n/** Which on-chain deployment the ids below came from. */\nexport const MAINNET_DEPLOYMENT: DeploymentInfo = Object.freeze({\n\tdeployment: 'deepbook-predict-mainnet',\n\tnetwork: 'mainnet',\n\tchainId: '35834a8a',\n\tsourceCommit: '7b169bde2c2a25fee3ac9aa4686e346309bfe570',\n});\n\n/** Ids for the shared `account` primitive — the `/account` subpath's slice. */\nexport const MAINNET_ACCOUNT: AccountIds = Object.freeze({\n\taccountPackageId: '0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58',\n\taccountRegistry: '0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc',\n});\n\n/**\n * Ids for time-limited sessions — the `/sessions` subpath's slice.\n *\n * `deepbookRegistry` is only needed by the DeepBook **spot** session wrappers; the Predict\n * wrappers never take it. It is carried here so a spot caller does not have to reach into\n * the package root for one id.\n */\nexport const MAINNET_SESSIONS: SessionsIds = Object.freeze({\n\tsessionsPackageId: '0x9a068beffa019ae756f4a6d2611e9899d3c6dd888812dd9eca87535d2ac55e2a',\n\tsessionsConfig: '0xb2fba483748aac7508676020d4e691d68239b66f8bf7c5e7634dd1a76a329317',\n\taccountPackageId: '0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58',\n\taccountRegistry: '0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc',\n\tdeepbookRegistry: '0xaf16199a2dff736e9f07a845f23c5da6df6f756eddb631aed9d24a93efc4549d',\n\tdeepbookCoreAccountPackageId:\n\t\t'0xd71b5a341dc8dc7e187517849edf61e54670b60fe496e07186c09a65fa7afdb7',\n\t/** Required by every Predict session wrapper — they all take `config: &ProtocolConfig`. */\n\tprotocolConfig: '0x5fa6efbe7691809565a660adde23f0c184ca1d19cefafa4e1c88d655fe279580',\n});\n\n/**\n * Scale constants the deployment owns rather than the SDK. Deployment-wide:\n * `quoteCoinDecimals` and `fixedPointScale` apply to any subpath formatting a custody\n * balance, not just Predict.\n */\nexport const MAINNET_UNITS: DeploymentUnits = Object.freeze({\n\tpositionLotSize: 10000,\n\tfixedPointScale: 1000000000,\n\tquoteCoinDecimals: 6,\n\tpositionQuantityDecimals: 6,\n});\n\n/** Ids for DeepBook Predict — the `/predict` subpath's slice. */\nexport const MAINNET_PREDICT: PredictIds = Object.freeze({\n\tnetwork: 'mainnet',\n\tpackages: Object.freeze({\n\t\tpredict: '0x89aea622e7bb3bdd598bde87dde40ee31c9eed4971b9546e23ec83de3c48bbba',\n\t\taccount: '0x4e1dd01465713c9d832313fed5f45c222a4d5c62a533d6da96764c8b2a245d58',\n\t\tpropbook: '0xa6c8f32015b5b41d34ee09995a2e9d7a21cdecf0e1910a50b264fd252cd33831',\n\t}),\n\tobjects: Object.freeze({\n\t\tregistry: '0x94327dbc256a2cfabd164c2bf4b3fe033bfaa4771f7a6f716954e07cb1b4beba',\n\t\tprotocolConfig: '0x5fa6efbe7691809565a660adde23f0c184ca1d19cefafa4e1c88d655fe279580',\n\t\tpoolVault: '0x4d227a1baf8cfcaf6e652a9182d0e63f85f9ce82cd542fdf3356bb3581be3b99',\n\t\toracleRegistry: '0x5d62c0d9be43efa769a708ade53fbe5bea98c15c865b64ca7c498c87b045a698',\n\t\taccountRegistry: '0x8c52c6f5b2374e33f4a726d9c32337b1aee3a71410d41c18faa91d938d66e4bc',\n\t}),\n\tquoteCoinType: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',\n\t/**\n\t * `plp` is the LP share coin type. It is NOT derivable from `packages.predict`: a Move\n\t * type tag keeps the ORIGINAL package id across an upgrade, while `packages.predict`\n\t * moves to the latest. They agree only while predict is at v1.\n\t */\n\tcoinTypes: Object.freeze({\n\t\tplp: '0x89aea622e7bb3bdd598bde87dde40ee31c9eed4971b9546e23ec83de3c48bbba::plp::PLP',\n\t\tdeep: '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP',\n\t}),\n\tunits: MAINNET_UNITS,\n\tunderlyings: Object.freeze({\n\t\tBTC: Object.freeze({\n\t\t\tsymbol: 'BTC',\n\t\t\tpropbookUnderlyingId: 1,\n\t\t\tpythFeed: '0x4c5d2b4c8238f04b7687c3a8df915b69c50d5f4d291fc49aea44bdb6b52e1a20',\n\t\t\tblockScholesValueStore: '0xe83f843b15ae63045b2cea445fb8ea7ad85c5fc2a05f66db122a511e1f2c67bc',\n\t\t\tblockScholesSviStore: '0xfdd447be39d847747caf18ecf3355031bb33979c472581f1a5481375d3748bfb',\n\t\t}),\n\t}),\n});\n"],"mappings":";;AA2BA,MAAa,qBAAqC,OAAO,OAAO;CAC/D,YAAY;CACZ,SAAS;CACT,SAAS;CACT,cAAc;CACd,CAAC;;AAGF,MAAa,kBAA8B,OAAO,OAAO;CACxD,kBAAkB;CAClB,iBAAiB;CACjB,CAAC;;;;;;;;AASF,MAAa,mBAAgC,OAAO,OAAO;CAC1D,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,kBAAkB;CAClB,8BACC;CAED,gBAAgB;CAChB,CAAC;;;;;;AAOF,MAAa,gBAAiC,OAAO,OAAO;CAC3D,iBAAiB;CACjB,iBAAiB;CACjB,mBAAmB;CACnB,0BAA0B;CAC1B,CAAC;;AAGF,MAAa,kBAA8B,OAAO,OAAO;CACxD,SAAS;CACT,UAAU,OAAO,OAAO;EACvB,SAAS;EACT,SAAS;EACT,UAAU;EACV,CAAC;CACF,SAAS,OAAO,OAAO;EACtB,UAAU;EACV,gBAAgB;EAChB,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,CAAC;CACF,eAAe;CAMf,WAAW,OAAO,OAAO;EACxB,KAAK;EACL,MAAM;EACN,CAAC;CACF,OAAO;CACP,aAAa,OAAO,OAAO,EAC1B,KAAK,OAAO,OAAO;EAClB,QAAQ;EACR,sBAAsB;EACtB,UAAU;EACV,wBAAwB;EACxB,sBAAsB;EACtB,CAAC,EACF,CAAC;CACF,CAAC"}
|
|
@@ -4,12 +4,12 @@ const TESTNET_DEPLOYMENT = Object.freeze({
|
|
|
4
4
|
deployment: "deepbook-predict-testnet",
|
|
5
5
|
network: "testnet",
|
|
6
6
|
chainId: "4c78adac",
|
|
7
|
-
sourceCommit: "
|
|
7
|
+
sourceCommit: "4d752fb82d909a821c85bcc5d3963725efb546f4"
|
|
8
8
|
});
|
|
9
9
|
/** Ids for the shared `account` primitive — the `/account` subpath's slice. */
|
|
10
10
|
const TESTNET_ACCOUNT = Object.freeze({
|
|
11
|
-
accountPackageId: "
|
|
12
|
-
accountRegistry: "
|
|
11
|
+
accountPackageId: "0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9",
|
|
12
|
+
accountRegistry: "0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c"
|
|
13
13
|
});
|
|
14
14
|
/**
|
|
15
15
|
* Ids for time-limited sessions — the `/sessions` subpath's slice.
|
|
@@ -19,13 +19,13 @@ const TESTNET_ACCOUNT = Object.freeze({
|
|
|
19
19
|
* the package root for one id.
|
|
20
20
|
*/
|
|
21
21
|
const TESTNET_SESSIONS = Object.freeze({
|
|
22
|
-
sessionsPackageId: "
|
|
23
|
-
sessionsConfig: "
|
|
24
|
-
accountPackageId: "
|
|
25
|
-
accountRegistry: "
|
|
22
|
+
sessionsPackageId: "0x1908eee49d7a08d74a537d7f23766b363a145517fe0d3e0d85635d1682831ffd",
|
|
23
|
+
sessionsConfig: "0xc096b97289821b27badfdf758d614bbbfa386f93d3faa409ecc1fcc6075d1186",
|
|
24
|
+
accountPackageId: "0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9",
|
|
25
|
+
accountRegistry: "0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c",
|
|
26
26
|
deepbookRegistry: "0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1",
|
|
27
|
-
deepbookCoreAccountPackageId: "
|
|
28
|
-
protocolConfig: "
|
|
27
|
+
deepbookCoreAccountPackageId: "0x2a3a5f51e1c566e0a77c667596a8212d036b44aeac32790991c9eb97580fabb1",
|
|
28
|
+
protocolConfig: "0x422a45c31128e69d0310ab3bed28bd14f730acf9f5681f70936d20c60d26bfb0"
|
|
29
29
|
});
|
|
30
30
|
/**
|
|
31
31
|
* Scale constants the deployment owns rather than the SDK. Deployment-wide:
|
|
@@ -42,29 +42,29 @@ const TESTNET_UNITS = Object.freeze({
|
|
|
42
42
|
const TESTNET_PREDICT = Object.freeze({
|
|
43
43
|
network: "testnet",
|
|
44
44
|
packages: Object.freeze({
|
|
45
|
-
predict: "
|
|
46
|
-
account: "
|
|
47
|
-
propbook: "
|
|
45
|
+
predict: "0x59d71119e990573a738dd3ff9c4c7d28d6893af69c87c1a7f3a2e90e280ce2f4",
|
|
46
|
+
account: "0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9",
|
|
47
|
+
propbook: "0xa83f9d7651de09672a40cea371c387bf954e0f3092947670d71428d4fbc9edd9"
|
|
48
48
|
}),
|
|
49
49
|
objects: Object.freeze({
|
|
50
|
-
registry: "
|
|
51
|
-
protocolConfig: "
|
|
52
|
-
poolVault: "
|
|
53
|
-
oracleRegistry: "
|
|
54
|
-
accountRegistry: "
|
|
50
|
+
registry: "0x85cfaa857f9dfca75f6ba624eead063c4a1bc9b701201b8f21e1f9c15833ccc4",
|
|
51
|
+
protocolConfig: "0x422a45c31128e69d0310ab3bed28bd14f730acf9f5681f70936d20c60d26bfb0",
|
|
52
|
+
poolVault: "0x6fd178a49848387d60ccfd3e53bf06969929970246a3a7983ae5bb2a5ed52ee3",
|
|
53
|
+
oracleRegistry: "0xf4ad65184b2e4e9d8e50d44b02a76c64e9607f63e3dbc362e110c99e20a17161",
|
|
54
|
+
accountRegistry: "0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c"
|
|
55
55
|
}),
|
|
56
56
|
quoteCoinType: "0xc028557a1ed49e42ed091e115aedefd70a442b184c18fbec5c48d5b6c0b8c184::usdc::USDC",
|
|
57
57
|
coinTypes: Object.freeze({
|
|
58
|
-
plp: "
|
|
58
|
+
plp: "0x59d71119e990573a738dd3ff9c4c7d28d6893af69c87c1a7f3a2e90e280ce2f4::plp::PLP",
|
|
59
59
|
deep: "0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP"
|
|
60
60
|
}),
|
|
61
61
|
units: TESTNET_UNITS,
|
|
62
62
|
underlyings: Object.freeze({ BTC: Object.freeze({
|
|
63
63
|
symbol: "BTC",
|
|
64
64
|
propbookUnderlyingId: 1,
|
|
65
|
-
pythFeed: "
|
|
66
|
-
blockScholesValueStore: "
|
|
67
|
-
blockScholesSviStore: "
|
|
65
|
+
pythFeed: "0x8ef99c3d14e57612d09a67bcc9b5bff568a80992df6beca2bfcd922973192faa",
|
|
66
|
+
blockScholesValueStore: "0x1e5142471311505a7428b072230c9ffe8a747b3b9392720e39246af4aea08216",
|
|
67
|
+
blockScholesSviStore: "0x0f1cbefd1dd2ba08ae700a7067c32e0718edf926fa18cea80bd231c02d509ece"
|
|
68
68
|
}) })
|
|
69
69
|
});
|
|
70
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testnet.mjs","names":[],"sources":["../../src/deployments/testnet.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// GENERATED by `pnpm sync-deployment` from the deploy tooling's own manifest\n// (`packages/predict/deployment/deployment.testnet.json`). Do not hand-edit:\n// the next regeneration overwrites it, and a hand-patched id is exactly the drift this\n// file exists to prevent. To move to a new deployment, check the sibling deepbookv3\n// checkout out to the new anchor and re-run the script.\n//\n// Deployment: deepbook-predict-testnet\n// sourceCommit:
|
|
1
|
+
{"version":3,"file":"testnet.mjs","names":[],"sources":["../../src/deployments/testnet.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n// GENERATED by `pnpm sync-deployment` from the deploy tooling's own manifest\n// (`packages/predict/deployment/deployment.testnet.json`). Do not hand-edit:\n// the next regeneration overwrites it, and a hand-patched id is exactly the drift this\n// file exists to prevent. To move to a new deployment, check the sibling deepbookv3\n// checkout out to the new anchor and re-run the script.\n//\n// Deployment: deepbook-predict-testnet\n// sourceCommit: 4d752fb82d909a821c85bcc5d3963725efb546f4\n//\n// Runtime-dependency-free — every subpath reads a slice of this, so a value import here\n// would pull that module into all of their graphs. The type import below is erased.\n//\n// Frozen: these are shared module singletons, so an accessor handing one to a caller who\n// mutates it would change what every other caller sees.\n\nimport type {\n\tAccountIds,\n\tDeploymentInfo,\n\tDeploymentUnits,\n\tPredictIds,\n\tSessionsIds,\n} from './types.js';\n\n/** Which on-chain deployment the ids below came from. */\nexport const TESTNET_DEPLOYMENT: DeploymentInfo = Object.freeze({\n\tdeployment: 'deepbook-predict-testnet',\n\tnetwork: 'testnet',\n\tchainId: '4c78adac',\n\tsourceCommit: '4d752fb82d909a821c85bcc5d3963725efb546f4',\n});\n\n/** Ids for the shared `account` primitive — the `/account` subpath's slice. */\nexport const TESTNET_ACCOUNT: AccountIds = Object.freeze({\n\taccountPackageId: '0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9',\n\taccountRegistry: '0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c',\n});\n\n/**\n * Ids for time-limited sessions — the `/sessions` subpath's slice.\n *\n * `deepbookRegistry` is only needed by the DeepBook **spot** session wrappers; the Predict\n * wrappers never take it. It is carried here so a spot caller does not have to reach into\n * the package root for one id.\n */\nexport const TESTNET_SESSIONS: SessionsIds = Object.freeze({\n\tsessionsPackageId: '0x1908eee49d7a08d74a537d7f23766b363a145517fe0d3e0d85635d1682831ffd',\n\tsessionsConfig: '0xc096b97289821b27badfdf758d614bbbfa386f93d3faa409ecc1fcc6075d1186',\n\taccountPackageId: '0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9',\n\taccountRegistry: '0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c',\n\tdeepbookRegistry: '0x7c256edbda983a2cd6f946655f4bf3f00a41043993781f8674a7046e8c0e11d1',\n\tdeepbookCoreAccountPackageId:\n\t\t'0x2a3a5f51e1c566e0a77c667596a8212d036b44aeac32790991c9eb97580fabb1',\n\t/** Required by every Predict session wrapper — they all take `config: &ProtocolConfig`. */\n\tprotocolConfig: '0x422a45c31128e69d0310ab3bed28bd14f730acf9f5681f70936d20c60d26bfb0',\n});\n\n/**\n * Scale constants the deployment owns rather than the SDK. Deployment-wide:\n * `quoteCoinDecimals` and `fixedPointScale` apply to any subpath formatting a custody\n * balance, not just Predict.\n */\nexport const TESTNET_UNITS: DeploymentUnits = Object.freeze({\n\tpositionLotSize: 10000,\n\tfixedPointScale: 1000000000,\n\tquoteCoinDecimals: 6,\n\tpositionQuantityDecimals: 6,\n});\n\n/** Ids for DeepBook Predict — the `/predict` subpath's slice. */\nexport const TESTNET_PREDICT: PredictIds = Object.freeze({\n\tnetwork: 'testnet',\n\tpackages: Object.freeze({\n\t\tpredict: '0x59d71119e990573a738dd3ff9c4c7d28d6893af69c87c1a7f3a2e90e280ce2f4',\n\t\taccount: '0x1e57d6554b99e4ca68330322c3e5c409ba1b681642726b603bf1be92c1840ca9',\n\t\tpropbook: '0xa83f9d7651de09672a40cea371c387bf954e0f3092947670d71428d4fbc9edd9',\n\t}),\n\tobjects: Object.freeze({\n\t\tregistry: '0x85cfaa857f9dfca75f6ba624eead063c4a1bc9b701201b8f21e1f9c15833ccc4',\n\t\tprotocolConfig: '0x422a45c31128e69d0310ab3bed28bd14f730acf9f5681f70936d20c60d26bfb0',\n\t\tpoolVault: '0x6fd178a49848387d60ccfd3e53bf06969929970246a3a7983ae5bb2a5ed52ee3',\n\t\toracleRegistry: '0xf4ad65184b2e4e9d8e50d44b02a76c64e9607f63e3dbc362e110c99e20a17161',\n\t\taccountRegistry: '0x511e11f7f5d5c1043d795180657603d59e06e90fbfcafd3f90c67ff0836bbd0c',\n\t}),\n\tquoteCoinType: '0xc028557a1ed49e42ed091e115aedefd70a442b184c18fbec5c48d5b6c0b8c184::usdc::USDC',\n\t/**\n\t * `plp` is the LP share coin type. It is NOT derivable from `packages.predict`: a Move\n\t * type tag keeps the ORIGINAL package id across an upgrade, while `packages.predict`\n\t * moves to the latest. They agree only while predict is at v1.\n\t */\n\tcoinTypes: Object.freeze({\n\t\tplp: '0x59d71119e990573a738dd3ff9c4c7d28d6893af69c87c1a7f3a2e90e280ce2f4::plp::PLP',\n\t\tdeep: '0x36dbef866a1d62bf7328989a10fb2f07d769f4ee587c0de4a0a256e57e0a58a8::deep::DEEP',\n\t}),\n\tunits: TESTNET_UNITS,\n\tunderlyings: Object.freeze({\n\t\tBTC: Object.freeze({\n\t\t\tsymbol: 'BTC',\n\t\t\tpropbookUnderlyingId: 1,\n\t\t\tpythFeed: '0x8ef99c3d14e57612d09a67bcc9b5bff568a80992df6beca2bfcd922973192faa',\n\t\t\tblockScholesValueStore: '0x1e5142471311505a7428b072230c9ffe8a747b3b9392720e39246af4aea08216',\n\t\t\tblockScholesSviStore: '0x0f1cbefd1dd2ba08ae700a7067c32e0718edf926fa18cea80bd231c02d509ece',\n\t\t}),\n\t}),\n});\n"],"mappings":";;AA2BA,MAAa,qBAAqC,OAAO,OAAO;CAC/D,YAAY;CACZ,SAAS;CACT,SAAS;CACT,cAAc;CACd,CAAC;;AAGF,MAAa,kBAA8B,OAAO,OAAO;CACxD,kBAAkB;CAClB,iBAAiB;CACjB,CAAC;;;;;;;;AASF,MAAa,mBAAgC,OAAO,OAAO;CAC1D,mBAAmB;CACnB,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,kBAAkB;CAClB,8BACC;CAED,gBAAgB;CAChB,CAAC;;;;;;AAOF,MAAa,gBAAiC,OAAO,OAAO;CAC3D,iBAAiB;CACjB,iBAAiB;CACjB,mBAAmB;CACnB,0BAA0B;CAC1B,CAAC;;AAGF,MAAa,kBAA8B,OAAO,OAAO;CACxD,SAAS;CACT,UAAU,OAAO,OAAO;EACvB,SAAS;EACT,SAAS;EACT,UAAU;EACV,CAAC;CACF,SAAS,OAAO,OAAO;EACtB,UAAU;EACV,gBAAgB;EAChB,WAAW;EACX,gBAAgB;EAChB,iBAAiB;EACjB,CAAC;CACF,eAAe;CAMf,WAAW,OAAO,OAAO;EACxB,KAAK;EACL,MAAM;EACN,CAAC;CACF,OAAO;CACP,aAAa,OAAO,OAAO,EAC1B,KAAK,OAAO,OAAO;EAClB,QAAQ;EACR,sBAAsB;EACtB,UAAU;EACV,wBAAwB;EACxB,sBAAsB;EACtB,CAAC,EACF,CAAC;CACF,CAAC"}
|
package/dist/predict/index.mjs
CHANGED
|
@@ -13,9 +13,9 @@ import { U64_MAX, priceToRaw, probabilityToRaw, rawToPrice, rawToProbability, ra
|
|
|
13
13
|
import { deriveAccountWrapperId, generateAuth } from "./tx/common.mjs";
|
|
14
14
|
import { predict_account_exports } from "../contracts/deepbook_predict/predict_account.mjs";
|
|
15
15
|
import { POS_INF_TICK, binaryRangeTicks } from "./ticks.mjs";
|
|
16
|
+
import { pricing_exports as pricing_exports$1 } from "../contracts/deepbook_predict/pricing.mjs";
|
|
16
17
|
import { expiry_market_exports } from "../contracts/deepbook_predict/expiry_market.mjs";
|
|
17
18
|
import { loadLivePricer } from "./tx/trade.mjs";
|
|
18
|
-
import { pricing_exports as pricing_exports$1 } from "../contracts/deepbook_predict/pricing.mjs";
|
|
19
19
|
import { plp_exports } from "../contracts/deepbook_predict/plp.mjs";
|
|
20
20
|
import { range_codec_exports } from "../contracts/deepbook_predict/range_codec.mjs";
|
|
21
21
|
import { market_manager_exports } from "../contracts/deepbook_predict/market_manager.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { inspectReturns } from "./inspect.mjs";
|
|
2
2
|
import { parseOptionalId, parseOptionalU64, parseU64LE, parseVectorOfIds } from "./parse.mjs";
|
|
3
3
|
import { POS_INF_TICK } from "../ticks.mjs";
|
|
4
|
+
import { probability, rangePrice } from "../../contracts/deepbook_predict/pricing.mjs";
|
|
4
5
|
import { admissionTickSize, currentNav as currentNav$1, expiry, mintPaused, referenceTick as referenceTick$1, tickSize } from "../../contracts/deepbook_predict/expiry_market.mjs";
|
|
5
6
|
import { loadLivePricer } from "../tx/trade.mjs";
|
|
6
|
-
import { rangePrice } from "../../contracts/deepbook_predict/pricing.mjs";
|
|
7
7
|
import { activeExpiryMarkets } from "../../contracts/deepbook_predict/plp.mjs";
|
|
8
8
|
import { strikeFromTick } from "../../contracts/deepbook_predict/range_codec.mjs";
|
|
9
9
|
import { expiryMarketId as expiryMarketId$1 } from "../../contracts/deepbook_predict/registry.mjs";
|
|
@@ -75,7 +75,7 @@ async function rangePrices(client, config, marketId, feeds, strikeRaw, tickSizeR
|
|
|
75
75
|
const strike = mkStrike(strikeTick);
|
|
76
76
|
const posInf = mkStrike(POS_INF_TICK);
|
|
77
77
|
const negInf = mkStrike(0n);
|
|
78
|
-
tx.add(rangePrice({
|
|
78
|
+
const up = tx.add(rangePrice({
|
|
79
79
|
config,
|
|
80
80
|
arguments: {
|
|
81
81
|
pricer,
|
|
@@ -83,7 +83,7 @@ async function rangePrices(client, config, marketId, feeds, strikeRaw, tickSizeR
|
|
|
83
83
|
higher: posInf
|
|
84
84
|
}
|
|
85
85
|
}));
|
|
86
|
-
tx.add(rangePrice({
|
|
86
|
+
const down = tx.add(rangePrice({
|
|
87
87
|
config,
|
|
88
88
|
arguments: {
|
|
89
89
|
pricer,
|
|
@@ -91,6 +91,14 @@ async function rangePrices(client, config, marketId, feeds, strikeRaw, tickSizeR
|
|
|
91
91
|
higher: strike
|
|
92
92
|
}
|
|
93
93
|
}));
|
|
94
|
+
tx.add(probability({
|
|
95
|
+
config,
|
|
96
|
+
arguments: { price: up }
|
|
97
|
+
}));
|
|
98
|
+
tx.add(probability({
|
|
99
|
+
config,
|
|
100
|
+
arguments: { price: down }
|
|
101
|
+
}));
|
|
94
102
|
const cmds = await inspectReturns(client, tx);
|
|
95
103
|
return {
|
|
96
104
|
upRaw: parseU64LE(cmds[cmds.length - 2][0]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markets.mjs","names":["plp.activeExpiryMarkets","registry.expiryMarketId","expiryMarket.expiry","expiryMarket.tickSize","expiryMarket.admissionTickSize","expiryMarket.mintPaused","expiryMarket.referenceTick","rangeCodec.strikeFromTick","pricing.rangePrice","expiryMarket.currentNav"],"sources":["../../../src/predict/reads/markets.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { Transaction } from '@mysten/sui/transactions';\nimport { type GeneratedConfig } from '../config/generated.js';\nimport { type UnderlyingConfig } from '../config/index.js';\nimport { PredictMoveError } from '../errors.js';\nimport { POS_INF_TICK } from '../ticks.js';\nimport { loadLivePricer, type MarketFeeds } from '../tx/trade.js';\nimport * as expiryMarket from '../../contracts/deepbook_predict/expiry_market.js';\nimport * as plp from '../../contracts/deepbook_predict/plp.js';\nimport * as pricing from '../../contracts/deepbook_predict/pricing.js';\nimport * as rangeCodec from '../../contracts/deepbook_predict/range_codec.js';\nimport * as registry from '../../contracts/deepbook_predict/registry.js';\nimport { inspectReturns, type ReadClient } from './inspect.js';\nimport { parseOptionalId, parseOptionalU64, parseU64LE, parseVectorOfIds } from './parse.js';\n\n// On-chain ids of the pool's active (live, not-yet-settled) expiry markets.\n// `plp::active_expiry_markets(vault)` — see packages/predict/sources/plp/plp.move:179.\nexport async function activeMarketIds(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n): Promise<string[]> {\n\tconst tx = new Transaction();\n\ttx.add(plp.activeExpiryMarkets({ config }));\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseVectorOfIds(cmd0[0]);\n}\n\n// The expiry market id for one underlying at one expiry, or null if none exists.\n// `registry::expiry_market_id(registry, propbook_underlying_id: u32, expiry: u64):\n// Option<ID>` — see packages/predict/sources/registry/registry.move:58.\nexport async function expiryMarketId(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tunderlying: UnderlyingConfig,\n\texpiryMs: bigint,\n): Promise<string | null> {\n\tconst tx = new Transaction();\n\ttx.add(\n\t\tregistry.expiryMarketId({\n\t\t\tconfig,\n\t\t\targuments: { propbookUnderlyingId: underlying.propbookUnderlyingId, expiry: expiryMs },\n\t\t}),\n\t);\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseOptionalId(cmd0[0]);\n}\n\nexport interface MarketState {\n\texpiryMs: bigint;\n\ttickSizeRaw: bigint;\n\t/**\n\t * The COARSER raw-price step new finite mint boundaries must align to\n\t * (`expiry_market::admission_tick_size`). A numeric strike must be a whole\n\t * multiple of this — the fine `tickSizeRaw` grid alone is not sufficient — or\n\t * the chain aborts `EInvalidAdmissionTick`. The market's reference tick is the\n\t * one finite boundary allowed to bypass it.\n\t */\n\tadmissionTickSizeRaw: bigint;\n\tmintPaused: boolean;\n\t/**\n\t * The reference fine-grid tick (Polymarket-style anchor strike: derived\n\t * on-chain from the exact previous-window oracle observation), or null while\n\t * the keeper has not seeded it. Reference PRICE raw = tick * tickSizeRaw.\n\t */\n\treferenceTickRaw: bigint | null;\n}\n\n// The per-market state getters, in fixed order. `expiry_market::{expiry,\n// tick_size, mint_paused, reference_tick}` — see\n// packages/predict/sources/expiry_market.move:{101,177,259,187}. reference_tick\n// returns Option (no abort risk). settlement is read separately via\n// `settlementPrice` (its own non-batched getter below).\nconst STATE_FNS = [\n\texpiryMarket.expiry,\n\texpiryMarket.tickSize,\n\texpiryMarket.admissionTickSize,\n\texpiryMarket.mintPaused,\n\texpiryMarket.referenceTick,\n] as const;\n\nfunction parseStateAt(cmds: Uint8Array[][], base: number): MarketState {\n\treturn {\n\t\texpiryMs: parseU64LE(cmds[base][0]),\n\t\ttickSizeRaw: parseU64LE(cmds[base + 1][0]),\n\t\tadmissionTickSizeRaw: parseU64LE(cmds[base + 2][0]),\n\t\tmintPaused: (cmds[base + 3][0][0] ?? 0) !== 0, // BCS bool: 1 byte\n\t\treferenceTickRaw: parseOptionalU64(cmds[base + 4][0]),\n\t};\n}\n\nexport async function marketState(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<MarketState> {\n\tconst [state] = await marketStates(client, config, [marketId]);\n\treturn state;\n}\n\n// Batched marketState for N markets in ONE PTB (STATE_FNS.length commands per\n// market, same order). Returns states aligned with `marketIds`.\nexport async function marketStates(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketIds: readonly string[],\n): Promise<MarketState[]> {\n\tif (marketIds.length === 0) return [];\n\tconst tx = new Transaction();\n\tfor (const id of marketIds) {\n\t\tfor (const fn of STATE_FNS) {\n\t\t\ttx.add(fn({ config, arguments: { market: id } }));\n\t\t}\n\t}\n\tconst cmds = await inspectReturns(client, tx);\n\treturn marketIds.map((_, i) => parseStateAt(cmds, STATE_FNS.length * i));\n}\n\n// Anonymous both-sides pricing for one strike: the chain's own probability for\n// (strike, +inf] and (-inf, strike]. Deployed `pricing::range_price` takes typed\n// `range_codec::Strike`s (NOT raw u64) — each boundary is built via\n// `range_codec::strike_from_tick(tick, tick_size)`, which maps tick 0 → -inf,\n// POS_INF_TICK → +inf, and any finite tick → tick*tick_size. `range_price` is a\n// public fun on the deployed package. Both sides read the SAME pricer in one PTB, so\n// `down` is the chain's number, not 1 − up.\nexport async function rangePrices(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n\tfeeds: MarketFeeds,\n\tstrikeRaw: bigint,\n\ttickSizeRaw: bigint,\n): Promise<{ upRaw: bigint; downRaw: bigint }> {\n\tconst tx = new Transaction();\n\tconst pricer = tx.add(loadLivePricer(config, { expiryMarketId: marketId, ...feeds }));\n\t// strikeRaw is a whole tick multiple (the caller validates divisibility), so the\n\t// finite boundary is `strike_from_tick(strikeRaw / tickSize, tickSize)`.\n\tconst strikeTick = strikeRaw / tickSizeRaw;\n\tconst mkStrike = (tick: bigint) =>\n\t\ttx.add(rangeCodec.strikeFromTick({ config, arguments: { tick, tickSize: tickSizeRaw } }));\n\tconst strike = mkStrike(strikeTick);\n\tconst posInf = mkStrike(POS_INF_TICK);\n\tconst negInf = mkStrike(0n);\n\t// UP: (strike, +inf], then DOWN: (-inf, strike] — the last two commands.\n\ttx.add(pricing.rangePrice({ config, arguments: { pricer, lower: strike, higher: posInf } }));\n\ttx.add(pricing.rangePrice({ config, arguments: { pricer, lower: negInf, higher: strike } }));\n\tconst cmds = await inspectReturns(client, tx);\n\treturn {\n\t\tupRaw: parseU64LE(cmds[cmds.length - 2][0]),\n\t\tdownRaw: parseU64LE(cmds[cmds.length - 1][0]),\n\t};\n}\n\n// Fresh single read of the reference tick — used by mint-at-reference, which\n// must not trust a cached state (the reference is unset early in a window\n// until the keeper seeds it).\nexport async function referenceTick(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<bigint | null> {\n\tconst tx = new Transaction();\n\ttx.add(expiryMarket.referenceTick({ config, arguments: { market: marketId } }));\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseOptionalU64(cmd0[0]);\n}\n\n// The recorded settlement price, or null while the market is unsettled.\n//\n// On the deployed package `expiry_market::settlement_price` is public and\n// `destroy_some`s the stored Option — callable here only because simulate runs with\n// checksEnabled:false, and it aborts in std::option (EOPTION_NOT_SET) when the\n// market has not settled; we map exactly that abort (and the public\n// EMarketNotSettled variant, should a future package guard it directly) to null.\n// (A non-aborting `try_settlement_price` also exists on-chain if this ever wants to\n// drop the abort-catch.)\nexport async function settlementPrice(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<bigint | null> {\n\tconst tx = new Transaction();\n\ttx.add(expiryMarket.settlementPrice({ config, arguments: { market: marketId } }));\n\ttry {\n\t\tconst [cmd0] = await inspectReturns(client, tx);\n\t\treturn parseU64LE(cmd0[0]);\n\t} catch (e) {\n\t\tif (\n\t\t\te instanceof PredictMoveError &&\n\t\t\t(e.module === 'option' ||\n\t\t\t\t(e.module === 'expiry_market' && e.abortName === 'EMarketNotSettled'))\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tthrow e;\n\t}\n}\n\n// A market's current NAV mark (the per-expiry recoverable value the flush prices\n// against). Loads a fresh live pricer, then reads `current_nav(market, &pricer)` —\n// see packages/predict/sources/expiry_market.move:236. `Pricer` has copy+drop, so\n// the unconsumed borrow is fine in a read-only inspect.\nexport async function currentNav(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n\tunderlying: UnderlyingConfig,\n): Promise<bigint> {\n\tconst tx = new Transaction();\n\tconst pricer = tx.add(\n\t\tloadLivePricer(config, {\n\t\t\texpiryMarketId: marketId,\n\t\t\tpythFeed: underlying.pythFeed,\n\t\t\tblockScholesValueStore: underlying.blockScholesValueStore,\n\t\t\tblockScholesSviStore: underlying.blockScholesSviStore,\n\t\t}),\n\t);\n\ttx.add(expiryMarket.currentNav({ config, arguments: { market: marketId, pricer } }));\n\tconst cmds = await inspectReturns(client, tx);\n\t// current_nav is the last command; load_live_pricer precedes it.\n\treturn parseU64LE(cmds[cmds.length - 1][0]);\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,gBACrB,QACA,QACoB;CACpB,MAAM,KAAK,IAAI,aAAa;AAC5B,IAAG,IAAIA,oBAAwB,EAAE,QAAQ,CAAC,CAAC;CAC3C,MAAM,CAAC,QAAQ,MAAM,eAAe,QAAQ,GAAG;AAC/C,QAAO,iBAAiB,KAAK,GAAG;;AAMjC,eAAsB,eACrB,QACA,QACA,YACA,UACyB;CACzB,MAAM,KAAK,IAAI,a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expiry","expiryMarket.tickSize","expiryMarket.admissionTickSize","expiryMarket.mintPaused","expiryMarket.referenceTick","rangeCodec.strikeFromTick","pricing.rangePrice","pricing.probability","expiryMarket.currentNav"],"sources":["../../../src/predict/reads/markets.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\nimport { Transaction } from '@mysten/sui/transactions';\nimport { type GeneratedConfig } from '../config/generated.js';\nimport { type UnderlyingConfig } from '../config/index.js';\nimport { PredictMoveError } from '../errors.js';\nimport { POS_INF_TICK } from '../ticks.js';\nimport { loadLivePricer, type MarketFeeds } from '../tx/trade.js';\nimport * as expiryMarket from '../../contracts/deepbook_predict/expiry_market.js';\nimport * as plp from '../../contracts/deepbook_predict/plp.js';\nimport * as pricing from '../../contracts/deepbook_predict/pricing.js';\nimport * as rangeCodec from '../../contracts/deepbook_predict/range_codec.js';\nimport * as registry from '../../contracts/deepbook_predict/registry.js';\nimport { inspectReturns, type ReadClient } from './inspect.js';\nimport { parseOptionalId, parseOptionalU64, parseU64LE, parseVectorOfIds } from './parse.js';\n\n// On-chain ids of the pool's active (live, not-yet-settled) expiry markets.\n// `plp::active_expiry_markets(vault)` — see packages/predict/sources/plp/plp.move:179.\nexport async function activeMarketIds(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n): Promise<string[]> {\n\tconst tx = new Transaction();\n\ttx.add(plp.activeExpiryMarkets({ config }));\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseVectorOfIds(cmd0[0]);\n}\n\n// The expiry market id for one underlying at one expiry, or null if none exists.\n// `registry::expiry_market_id(registry, propbook_underlying_id: u32, expiry: u64):\n// Option<ID>` — see packages/predict/sources/registry/registry.move:58.\nexport async function expiryMarketId(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tunderlying: UnderlyingConfig,\n\texpiryMs: bigint,\n): Promise<string | null> {\n\tconst tx = new Transaction();\n\ttx.add(\n\t\tregistry.expiryMarketId({\n\t\t\tconfig,\n\t\t\targuments: { propbookUnderlyingId: underlying.propbookUnderlyingId, expiry: expiryMs },\n\t\t}),\n\t);\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseOptionalId(cmd0[0]);\n}\n\nexport interface MarketState {\n\texpiryMs: bigint;\n\ttickSizeRaw: bigint;\n\t/**\n\t * The COARSER raw-price step new finite mint boundaries must align to\n\t * (`expiry_market::admission_tick_size`). A numeric strike must be a whole\n\t * multiple of this — the fine `tickSizeRaw` grid alone is not sufficient — or\n\t * the chain aborts `EInvalidAdmissionTick`. The market's reference tick is the\n\t * one finite boundary allowed to bypass it.\n\t */\n\tadmissionTickSizeRaw: bigint;\n\tmintPaused: boolean;\n\t/**\n\t * The reference fine-grid tick (Polymarket-style anchor strike: derived\n\t * on-chain from the exact previous-window oracle observation), or null while\n\t * the keeper has not seeded it. Reference PRICE raw = tick * tickSizeRaw.\n\t */\n\treferenceTickRaw: bigint | null;\n}\n\n// The per-market state getters, in fixed order. `expiry_market::{expiry,\n// tick_size, mint_paused, reference_tick}` — see\n// packages/predict/sources/expiry_market.move:{101,177,259,187}. reference_tick\n// returns Option (no abort risk). settlement is read separately via\n// `settlementPrice` (its own non-batched getter below).\nconst STATE_FNS = [\n\texpiryMarket.expiry,\n\texpiryMarket.tickSize,\n\texpiryMarket.admissionTickSize,\n\texpiryMarket.mintPaused,\n\texpiryMarket.referenceTick,\n] as const;\n\nfunction parseStateAt(cmds: Uint8Array[][], base: number): MarketState {\n\treturn {\n\t\texpiryMs: parseU64LE(cmds[base][0]),\n\t\ttickSizeRaw: parseU64LE(cmds[base + 1][0]),\n\t\tadmissionTickSizeRaw: parseU64LE(cmds[base + 2][0]),\n\t\tmintPaused: (cmds[base + 3][0][0] ?? 0) !== 0, // BCS bool: 1 byte\n\t\treferenceTickRaw: parseOptionalU64(cmds[base + 4][0]),\n\t};\n}\n\nexport async function marketState(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<MarketState> {\n\tconst [state] = await marketStates(client, config, [marketId]);\n\treturn state;\n}\n\n// Batched marketState for N markets in ONE PTB (STATE_FNS.length commands per\n// market, same order). Returns states aligned with `marketIds`.\nexport async function marketStates(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketIds: readonly string[],\n): Promise<MarketState[]> {\n\tif (marketIds.length === 0) return [];\n\tconst tx = new Transaction();\n\tfor (const id of marketIds) {\n\t\tfor (const fn of STATE_FNS) {\n\t\t\ttx.add(fn({ config, arguments: { market: id } }));\n\t\t}\n\t}\n\tconst cmds = await inspectReturns(client, tx);\n\treturn marketIds.map((_, i) => parseStateAt(cmds, STATE_FNS.length * i));\n}\n\n// Anonymous both-sides pricing for one strike: the chain's own probability for\n// (strike, +inf] and (-inf, strike]. Deployed `pricing::range_price` takes typed\n// `range_codec::Strike`s (NOT raw u64) — each boundary is built via\n// `range_codec::strike_from_tick(tick, tick_size)`, which maps tick 0 → -inf,\n// POS_INF_TICK → +inf, and any finite tick → tick*tick_size. `range_price` is a\n// public fun on the deployed package. Both sides read the SAME pricer in one PTB, so\n// `down` is the chain's number, not 1 − up.\n//\n// `range_price` now returns a `RangePrice` carrying both boundary probabilities so the\n// fee can charge each leg separately; `probability()` is the combined range number this\n// function has always returned (`lower_up.saturating_sub(higher_up)`, unchanged). The\n// extra call per side is what keeps the u64 parse below reading a u64 rather than the\n// struct's BCS.\nexport async function rangePrices(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n\tfeeds: MarketFeeds,\n\tstrikeRaw: bigint,\n\ttickSizeRaw: bigint,\n): Promise<{ upRaw: bigint; downRaw: bigint }> {\n\tconst tx = new Transaction();\n\tconst pricer = tx.add(loadLivePricer(config, { expiryMarketId: marketId, ...feeds }));\n\t// strikeRaw is a whole tick multiple (the caller validates divisibility), so the\n\t// finite boundary is `strike_from_tick(strikeRaw / tickSize, tickSize)`.\n\tconst strikeTick = strikeRaw / tickSizeRaw;\n\tconst mkStrike = (tick: bigint) =>\n\t\ttx.add(rangeCodec.strikeFromTick({ config, arguments: { tick, tickSize: tickSizeRaw } }));\n\tconst strike = mkStrike(strikeTick);\n\tconst posInf = mkStrike(POS_INF_TICK);\n\tconst negInf = mkStrike(0n);\n\t// UP: (strike, +inf], then DOWN: (-inf, strike]. The two `probability` reductions are\n\t// the last two commands, which is what the tail-relative parse below indexes.\n\tconst up = tx.add(\n\t\tpricing.rangePrice({ config, arguments: { pricer, lower: strike, higher: posInf } }),\n\t);\n\tconst down = tx.add(\n\t\tpricing.rangePrice({ config, arguments: { pricer, lower: negInf, higher: strike } }),\n\t);\n\ttx.add(pricing.probability({ config, arguments: { price: up } }));\n\ttx.add(pricing.probability({ config, arguments: { price: down } }));\n\tconst cmds = await inspectReturns(client, tx);\n\treturn {\n\t\tupRaw: parseU64LE(cmds[cmds.length - 2][0]),\n\t\tdownRaw: parseU64LE(cmds[cmds.length - 1][0]),\n\t};\n}\n\n// Fresh single read of the reference tick — used by mint-at-reference, which\n// must not trust a cached state (the reference is unset early in a window\n// until the keeper seeds it).\nexport async function referenceTick(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<bigint | null> {\n\tconst tx = new Transaction();\n\ttx.add(expiryMarket.referenceTick({ config, arguments: { market: marketId } }));\n\tconst [cmd0] = await inspectReturns(client, tx);\n\treturn parseOptionalU64(cmd0[0]);\n}\n\n// The recorded settlement price, or null while the market is unsettled.\n//\n// On the deployed package `expiry_market::settlement_price` is public and\n// `destroy_some`s the stored Option — callable here only because simulate runs with\n// checksEnabled:false, and it aborts in std::option (EOPTION_NOT_SET) when the\n// market has not settled; we map exactly that abort (and the public\n// EMarketNotSettled variant, should a future package guard it directly) to null.\n// (A non-aborting `try_settlement_price` also exists on-chain if this ever wants to\n// drop the abort-catch.)\nexport async function settlementPrice(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n): Promise<bigint | null> {\n\tconst tx = new Transaction();\n\ttx.add(expiryMarket.settlementPrice({ config, arguments: { market: marketId } }));\n\ttry {\n\t\tconst [cmd0] = await inspectReturns(client, tx);\n\t\treturn parseU64LE(cmd0[0]);\n\t} catch (e) {\n\t\tif (\n\t\t\te instanceof PredictMoveError &&\n\t\t\t(e.module === 'option' ||\n\t\t\t\t(e.module === 'expiry_market' && e.abortName === 'EMarketNotSettled'))\n\t\t) {\n\t\t\treturn null;\n\t\t}\n\t\tthrow e;\n\t}\n}\n\n// A market's current NAV mark (the per-expiry recoverable value the flush prices\n// against). Loads a fresh live pricer, then reads `current_nav(market, &pricer)` —\n// see packages/predict/sources/expiry_market.move:236. `Pricer` has copy+drop, so\n// the unconsumed borrow is fine in a read-only inspect.\nexport async function currentNav(\n\tclient: ReadClient,\n\tconfig: GeneratedConfig,\n\tmarketId: string,\n\tunderlying: UnderlyingConfig,\n): Promise<bigint> {\n\tconst tx = new Transaction();\n\tconst pricer = tx.add(\n\t\tloadLivePricer(config, {\n\t\t\texpiryMarketId: marketId,\n\t\t\tpythFeed: underlying.pythFeed,\n\t\t\tblockScholesValueStore: underlying.blockScholesValueStore,\n\t\t\tblockScholesSviStore: underlying.blockScholesSviStore,\n\t\t}),\n\t);\n\ttx.add(expiryMarket.currentNav({ config, arguments: { market: marketId, pricer } }));\n\tconst cmds = await inspectReturns(client, tx);\n\t// current_nav is the last command; load_live_pricer precedes it.\n\treturn parseU64LE(cmds[cmds.length - 1][0]);\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,eAAsB,gBACrB,QACA,QACoB;CACpB,MAAM,KAAK,IAAI,aAAa;AAC5B,IAAG,IAAIA,oBAAwB,EAAE,QAAQ,CAAC,CAAC;CAC3C,MAAM,CAAC,QAAQ,MAAM,eAAe,QAAQ,GAAG;AAC/C,QAAO,iBAAiB,KAAK,GAAG;;AAMjC,eAAsB,eACrB,QACA,QACA,YACA,UACyB;CACzB,MAAM,KAAK,IAAI,aAAa;AAC5B,IAAG,IACFC,iBAAwB;EACvB;EACA,WAAW;GAAE,s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E7C,QAAO,WAAW,KAAK,KAAK,SAAS,GAAG,GAAG"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inspectReturns } from "./inspect.mjs";
|
|
2
|
-
import { loadLivePricer } from "../tx/trade.mjs";
|
|
3
2
|
import { Pricer } from "../../contracts/deepbook_predict/pricing.mjs";
|
|
3
|
+
import { loadLivePricer } from "../tx/trade.mjs";
|
|
4
4
|
import { Transaction } from "@mysten/sui/transactions";
|
|
5
5
|
|
|
6
6
|
//#region src/predict/reads/pricing.ts
|