@mysten/deepbook-v3 2.0.1 → 2.1.3
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 +83 -0
- package/PREDICT.md +256 -0
- package/README.md +116 -0
- package/dist/account.d.mts +139 -0
- package/dist/account.d.mts.map +1 -0
- package/dist/account.mjs +181 -0
- package/dist/account.mjs.map +1 -0
- package/dist/bcs/integers.mjs +23 -0
- package/dist/bcs/integers.mjs.map +1 -0
- package/dist/contracts/account/account.d.mts +382 -0
- package/dist/contracts/account/account.d.mts.map +1 -0
- package/dist/contracts/account/account.mjs +443 -0
- package/dist/contracts/account/account.mjs.map +1 -0
- package/dist/contracts/account/account_events.d.mts +41 -0
- package/dist/contracts/account/account_events.d.mts.map +1 -0
- package/dist/contracts/account/account_events.mjs +72 -0
- package/dist/contracts/account/account_events.mjs.map +1 -0
- package/dist/contracts/account/account_registry.d.mts +210 -0
- package/dist/contracts/account/account_registry.d.mts.map +1 -0
- package/dist/contracts/account/account_registry.mjs +263 -0
- package/dist/contracts/account/account_registry.mjs.map +1 -0
- package/dist/contracts/account/config-arguments.d.mts +10 -0
- package/dist/contracts/account/config-arguments.d.mts.map +1 -0
- package/dist/contracts/account/deps/sui/bag.mjs +44 -0
- package/dist/contracts/account/deps/sui/bag.mjs.map +1 -0
- 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/deep_price.d.mts.map +1 -1
- package/dist/contracts/deepbook/order.d.mts +12 -12
- package/dist/contracts/deepbook_predict/builder_code_events.mjs +38 -0
- package/dist/contracts/deepbook_predict/builder_code_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts +13 -0
- package/dist/contracts/deepbook_predict/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/fixed_math/i64.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs +25 -0
- package/dist/contracts/deepbook_predict/deps/sui/balance.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs +24 -0
- package/dist/contracts/deepbook_predict/deps/sui/coin.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs +39 -0
- package/dist/contracts/deepbook_predict/deps/sui/table.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs +26 -0
- package/dist/contracts/deepbook_predict/deps/sui/vec_set.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/ewma.mjs +29 -0
- package/dist/contracts/deepbook_predict/ewma.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs +27 -0
- package/dist/contracts/deepbook_predict/expiry_cash.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs +367 -0
- package/dist/contracts/deepbook_predict/expiry_market.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs +92 -0
- package/dist/contracts/deepbook_predict/lp_book.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs +59 -0
- package/dist/contracts/deepbook_predict/market_manager.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order.mjs +26 -0
- package/dist/contracts/deepbook_predict/order.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/order_events.mjs +84 -0
- package/dist/contracts/deepbook_predict/order_events.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/plp.mjs +284 -0
- package/dist/contracts/deepbook_predict/plp.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs +58 -0
- package/dist/contracts/deepbook_predict/pool_accounting.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs +106 -0
- package/dist/contracts/deepbook_predict/predict_account.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/pricing.mjs +80 -0
- package/dist/contracts/deepbook_predict/pricing.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs +41 -0
- package/dist/contracts/deepbook_predict/range_codec.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/registry.mjs +55 -0
- package/dist/contracts/deepbook_predict/registry.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs +65 -0
- package/dist/contracts/deepbook_predict/strike_exposure.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs +33 -0
- package/dist/contracts/deepbook_predict/strike_exposure_config.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs +72 -0
- package/dist/contracts/deepbook_predict/strike_payout_tree.mjs.map +1 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs +184 -0
- package/dist/contracts/deepbook_predict/vault_events.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts +10 -0
- package/dist/contracts/deepbook_sessions/config-arguments.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs +37 -0
- package/dist/contracts/deepbook_sessions/deps/sui/vec_map.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts +63 -0
- package/dist/contracts/deepbook_sessions/session_config.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs +82 -0
- package/dist/contracts/deepbook_sessions/session_config.mjs.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts +275 -0
- package/dist/contracts/deepbook_sessions/sessions.d.mts.map +1 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs +443 -0
- package/dist/contracts/deepbook_sessions/sessions.mjs.map +1 -0
- package/dist/contracts/utils/index.d.mts +18 -1
- package/dist/contracts/utils/index.d.mts.map +1 -1
- package/dist/deployments/index.d.mts +31 -0
- package/dist/deployments/index.d.mts.map +1 -0
- package/dist/deployments/index.mjs +30 -0
- package/dist/deployments/index.mjs.map +1 -0
- package/dist/deployments/testnet.d.mts +14 -0
- package/dist/deployments/testnet.d.mts.map +1 -0
- package/dist/deployments/testnet.mjs +73 -0
- package/dist/deployments/testnet.mjs.map +1 -0
- package/dist/deployments/types.d.mts +36 -0
- package/dist/deployments/types.d.mts.map +1 -0
- package/dist/index.mjs +0 -1
- package/dist/predict/client.d.mts +255 -0
- package/dist/predict/client.d.mts.map +1 -0
- package/dist/predict/client.mjs +436 -0
- package/dist/predict/client.mjs.map +1 -0
- package/dist/predict/config/generated.d.mts +29 -0
- package/dist/predict/config/generated.d.mts.map +1 -0
- package/dist/predict/config/generated.mjs +16 -0
- package/dist/predict/config/generated.mjs.map +1 -0
- package/dist/predict/config/index.d.mts +10 -0
- package/dist/predict/config/index.d.mts.map +1 -0
- package/dist/predict/config/index.mjs +13 -0
- package/dist/predict/config/index.mjs.map +1 -0
- package/dist/predict/config/testnet.d.mts +17 -0
- package/dist/predict/config/testnet.d.mts.map +1 -0
- package/dist/predict/config/testnet.mjs +26 -0
- package/dist/predict/config/testnet.mjs.map +1 -0
- package/dist/predict/config/types.d.mts +55 -0
- package/dist/predict/config/types.d.mts.map +1 -0
- package/dist/predict/decode.d.mts +162 -0
- package/dist/predict/decode.d.mts.map +1 -0
- package/dist/predict/decode.mjs +175 -0
- package/dist/predict/decode.mjs.map +1 -0
- package/dist/predict/errors.d.mts +42 -0
- package/dist/predict/errors.d.mts.map +1 -0
- package/dist/predict/errors.mjs +37 -0
- package/dist/predict/errors.mjs.map +1 -0
- package/dist/predict/index.d.mts +18 -0
- package/dist/predict/index.mjs +14 -0
- package/dist/predict/pricing.d.mts +73 -0
- package/dist/predict/pricing.d.mts.map +1 -0
- package/dist/predict/pricing.mjs +129 -0
- package/dist/predict/pricing.mjs.map +1 -0
- package/dist/predict/reads/balances.mjs +41 -0
- package/dist/predict/reads/balances.mjs.map +1 -0
- package/dist/predict/reads/inspect.d.mts +8 -0
- package/dist/predict/reads/inspect.d.mts.map +1 -0
- package/dist/predict/reads/inspect.mjs +37 -0
- package/dist/predict/reads/inspect.mjs.map +1 -0
- package/dist/predict/reads/markets.mjs +130 -0
- package/dist/predict/reads/markets.mjs.map +1 -0
- package/dist/predict/reads/parse.mjs +20 -0
- package/dist/predict/reads/parse.mjs.map +1 -0
- package/dist/predict/reads/pool.mjs +26 -0
- package/dist/predict/reads/pool.mjs.map +1 -0
- package/dist/predict/reads/positions.d.mts +12 -0
- package/dist/predict/reads/positions.d.mts.map +1 -0
- package/dist/predict/reads/positions.mjs +77 -0
- package/dist/predict/reads/positions.mjs.map +1 -0
- package/dist/predict/reads/pricing.d.mts +20 -0
- package/dist/predict/reads/pricing.d.mts.map +1 -0
- package/dist/predict/reads/pricing.mjs +43 -0
- package/dist/predict/reads/pricing.mjs.map +1 -0
- package/dist/predict/ticks.d.mts +11 -0
- package/dist/predict/ticks.d.mts.map +1 -0
- package/dist/predict/ticks.mjs +21 -0
- package/dist/predict/ticks.mjs.map +1 -0
- package/dist/predict/tx/authed.mjs +18 -0
- package/dist/predict/tx/authed.mjs.map +1 -0
- package/dist/predict/tx/common.d.mts +18 -0
- package/dist/predict/tx/common.d.mts.map +1 -0
- package/dist/predict/tx/common.mjs +52 -0
- package/dist/predict/tx/common.mjs.map +1 -0
- package/dist/predict/tx/trade.d.mts +15 -0
- package/dist/predict/tx/trade.d.mts.map +1 -0
- package/dist/predict/tx/trade.mjs +86 -0
- package/dist/predict/tx/trade.mjs.map +1 -0
- package/dist/predict/units.d.mts +11 -0
- package/dist/predict/units.d.mts.map +1 -0
- package/dist/predict/units.mjs +44 -0
- package/dist/predict/units.mjs.map +1 -0
- package/dist/queries/accountQueries.mjs +0 -1
- package/dist/queries/accountQueries.mjs.map +1 -1
- package/dist/queries/orderQueries.mjs +0 -1
- package/dist/queries/orderQueries.mjs.map +1 -1
- package/dist/queries/registryQueries.mjs +0 -1
- package/dist/queries/registryQueries.mjs.map +1 -1
- package/dist/sessions.d.mts +244 -0
- package/dist/sessions.d.mts.map +1 -0
- package/dist/sessions.mjs +291 -0
- package/dist/sessions.mjs.map +1 -0
- 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/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/marginRegistry.d.mts +16 -16
- package/dist/transactions/marginTPSL.d.mts +10 -10
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/package.json +25 -4
- package/src/account.ts +239 -0
- package/src/bcs/integers.ts +35 -0
- package/src/contracts/account/account.ts +706 -0
- package/src/contracts/account/account_events.ts +64 -0
- package/src/contracts/account/account_registry.ts +468 -0
- package/src/contracts/account/config-arguments.ts +8 -0
- package/src/contracts/account/deps/sui/bag.ts +42 -0
- package/src/contracts/deepbook_predict/admin.ts +44 -0
- package/src/contracts/deepbook_predict/builder_code.ts +155 -0
- package/src/contracts/deepbook_predict/builder_code_events.ts +34 -0
- package/src/contracts/deepbook_predict/config-arguments.ts +11 -0
- package/src/contracts/deepbook_predict/config_events.ts +140 -0
- package/src/contracts/deepbook_predict/deps/fixed_math/i64.ts +21 -0
- package/src/contracts/deepbook_predict/deps/sui/balance.ts +25 -0
- package/src/contracts/deepbook_predict/deps/sui/coin.ts +20 -0
- package/src/contracts/deepbook_predict/deps/sui/table.ts +37 -0
- package/src/contracts/deepbook_predict/deps/sui/vec_set.ts +22 -0
- package/src/contracts/deepbook_predict/ewma.ts +26 -0
- package/src/contracts/deepbook_predict/ewma_config.ts +28 -0
- package/src/contracts/deepbook_predict/expiry_cash.ts +24 -0
- package/src/contracts/deepbook_predict/expiry_market.ts +1549 -0
- package/src/contracts/deepbook_predict/lp_book.ts +105 -0
- package/src/contracts/deepbook_predict/market_lifecycle_cap.ts +75 -0
- package/src/contracts/deepbook_predict/market_manager.ts +218 -0
- package/src/contracts/deepbook_predict/order.ts +24 -0
- package/src/contracts/deepbook_predict/order_events.ts +129 -0
- package/src/contracts/deepbook_predict/pause_cap.ts +68 -0
- package/src/contracts/deepbook_predict/plp.ts +987 -0
- package/src/contracts/deepbook_predict/pool_accounting.ts +79 -0
- package/src/contracts/deepbook_predict/predict_account.ts +180 -0
- package/src/contracts/deepbook_predict/pricing.ts +124 -0
- package/src/contracts/deepbook_predict/pricing_config.ts +41 -0
- package/src/contracts/deepbook_predict/protocol_config.ts +1066 -0
- package/src/contracts/deepbook_predict/range_codec.ts +53 -0
- package/src/contracts/deepbook_predict/registry.ts +694 -0
- package/src/contracts/deepbook_predict/strike_exposure.ts +77 -0
- package/src/contracts/deepbook_predict/strike_exposure_config.ts +46 -0
- package/src/contracts/deepbook_predict/strike_payout_tree.ts +89 -0
- package/src/contracts/deepbook_predict/vault_events.ts +222 -0
- package/src/contracts/deepbook_sessions/config-arguments.ts +8 -0
- package/src/contracts/deepbook_sessions/deps/sui/vec_map.ts +33 -0
- package/src/contracts/deepbook_sessions/session_config.ts +130 -0
- package/src/contracts/deepbook_sessions/sessions.ts +663 -0
- package/src/contracts/propbook/block_scholes_store.ts +842 -0
- package/src/contracts/propbook/deps/sui/table.ts +37 -0
- package/src/contracts/propbook/oracle_lane.ts +170 -0
- package/src/contracts/propbook/pyth_feed.ts +414 -0
- package/src/contracts/propbook/registry.ts +596 -0
- package/src/deployments/index.ts +73 -0
- package/src/deployments/testnet.ts +107 -0
- package/src/deployments/types.ts +81 -0
- package/src/index.ts +5 -0
- package/src/predict/client.ts +941 -0
- package/src/predict/config/generated.ts +39 -0
- package/src/predict/config/index.ts +25 -0
- package/src/predict/config/testnet.ts +27 -0
- package/src/predict/config/types.ts +52 -0
- package/src/predict/decode.ts +476 -0
- package/src/predict/errors.ts +83 -0
- package/src/predict/index.ts +94 -0
- package/src/predict/pricing.ts +199 -0
- package/src/predict/reads/balances.ts +55 -0
- package/src/predict/reads/inspect.ts +78 -0
- package/src/predict/reads/markets.ts +222 -0
- package/src/predict/reads/parse.ts +30 -0
- package/src/predict/reads/pool.ts +37 -0
- package/src/predict/reads/positions.ts +144 -0
- package/src/predict/reads/pricing.ts +79 -0
- package/src/predict/ticks.ts +42 -0
- package/src/predict/tx/authed.ts +20 -0
- package/src/predict/tx/common.ts +92 -0
- package/src/predict/tx/trade.ts +183 -0
- package/src/predict/units.ts +49 -0
- package/src/sessions.ts +471 -0
- package/dist/types/bcs.mjs +0 -7
|
@@ -0,0 +1,1549 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Per-expiry Predict market.
|
|
7
|
+
*
|
|
8
|
+
* An ExpiryMarket is the hot shared object for one expiry. It owns trade
|
|
9
|
+
* execution, strike exposure state, and an embedded expiry-cash custody component,
|
|
10
|
+
* plus local sponsor-funded fee incentives. Live oracle validation is delegated to
|
|
11
|
+
* `pricing::load_live_pricer`; this module owns market flow policy and then passes
|
|
12
|
+
* loaded `Pricer` snapshots into exposure business logic. Pool-wide PLP accounting
|
|
13
|
+
* and profit accounting remain outside this module.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
MoveStruct,
|
|
18
|
+
normalizeMoveArguments,
|
|
19
|
+
type RawTransactionArgument,
|
|
20
|
+
type ConfigValue,
|
|
21
|
+
} from '../utils/index.js';
|
|
22
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
23
|
+
import { U64 } from '../../bcs/integers.js';
|
|
24
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
25
|
+
import * as expiry_cash from './expiry_cash.js';
|
|
26
|
+
import * as balance from './deps/sui/balance.js';
|
|
27
|
+
import * as strike_exposure from './strike_exposure.js';
|
|
28
|
+
import * as ewma from './ewma.js';
|
|
29
|
+
const $moduleName = '@local-pkg/deepbook_predict::expiry_market';
|
|
30
|
+
export const ExpiryMarket = new MoveStruct({
|
|
31
|
+
name: `${$moduleName}::ExpiryMarket`,
|
|
32
|
+
fields: {
|
|
33
|
+
id: bcs.Address,
|
|
34
|
+
/** Propbook underlying this market was created for. */
|
|
35
|
+
propbook_underlying_id: bcs.u32(),
|
|
36
|
+
expiry: U64,
|
|
37
|
+
/** DUSDC custody and payout backing. */
|
|
38
|
+
cash: expiry_cash.ExpiryCash,
|
|
39
|
+
/** Sponsor-funded DUSDC available to subsidize this market's taker fees. */
|
|
40
|
+
fee_incentive_balance: balance.Balance,
|
|
41
|
+
/** Exposure lifecycle state for this expiry's strike ticks. */
|
|
42
|
+
strike_exposure: strike_exposure.StrikeExposure,
|
|
43
|
+
/** Smoothed gas-price stats backing the congestion trade penalty. */
|
|
44
|
+
ewma: ewma.EwmaState,
|
|
45
|
+
/**
|
|
46
|
+
* When true, new mints on this expiry abort. Other flows stay available. Admin
|
|
47
|
+
* sets/unsets it (version-gated); a `PauseCap` holder can force it true one-way
|
|
48
|
+
* through the registry (ungated kill switch).
|
|
49
|
+
*/
|
|
50
|
+
mint_paused: bcs.bool(),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const MintQuote = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::MintQuote`,
|
|
55
|
+
fields: {
|
|
56
|
+
quantity: U64,
|
|
57
|
+
entry_probability: U64,
|
|
58
|
+
premium: U64,
|
|
59
|
+
trading_fee: U64,
|
|
60
|
+
fee_incentive_subsidy: U64,
|
|
61
|
+
builder_fee: U64,
|
|
62
|
+
penalty_fee: U64,
|
|
63
|
+
inventory_impact_charge: U64,
|
|
64
|
+
all_in_cost: U64,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
export interface IdArguments {
|
|
68
|
+
market: RawTransactionArgument<string>;
|
|
69
|
+
}
|
|
70
|
+
export interface IdOptions {
|
|
71
|
+
package?: string;
|
|
72
|
+
arguments: IdArguments | [market: RawTransactionArgument<string>];
|
|
73
|
+
config?: {
|
|
74
|
+
predictPackageId?: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Return the market object ID for external discovery and PTB construction. */
|
|
78
|
+
export function id(options: IdOptions) {
|
|
79
|
+
const packageAddress =
|
|
80
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
81
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
82
|
+
const parameterNames = ['market'];
|
|
83
|
+
return (tx: Transaction) =>
|
|
84
|
+
tx.moveCall({
|
|
85
|
+
package: packageAddress,
|
|
86
|
+
module: 'expiry_market',
|
|
87
|
+
function: 'id',
|
|
88
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
export interface PropbookUnderlyingIdArguments {
|
|
92
|
+
market: RawTransactionArgument<string>;
|
|
93
|
+
}
|
|
94
|
+
export interface PropbookUnderlyingIdOptions {
|
|
95
|
+
package?: string;
|
|
96
|
+
arguments: PropbookUnderlyingIdArguments | [market: RawTransactionArgument<string>];
|
|
97
|
+
config?: {
|
|
98
|
+
predictPackageId?: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
/** Return the Propbook underlying for SDK and devInspect market reads. */
|
|
102
|
+
export function propbookUnderlyingId(options: PropbookUnderlyingIdOptions) {
|
|
103
|
+
const packageAddress =
|
|
104
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
105
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
106
|
+
const parameterNames = ['market'];
|
|
107
|
+
return (tx: Transaction) =>
|
|
108
|
+
tx.moveCall({
|
|
109
|
+
package: packageAddress,
|
|
110
|
+
module: 'expiry_market',
|
|
111
|
+
function: 'propbook_underlying_id',
|
|
112
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export interface ExpiryArguments {
|
|
116
|
+
market: RawTransactionArgument<string>;
|
|
117
|
+
}
|
|
118
|
+
export interface ExpiryOptions {
|
|
119
|
+
package?: string;
|
|
120
|
+
arguments: ExpiryArguments | [market: RawTransactionArgument<string>];
|
|
121
|
+
config?: {
|
|
122
|
+
predictPackageId?: string;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** Return the expiry timestamp for SDK and devInspect market reads. */
|
|
126
|
+
export function expiry(options: ExpiryOptions) {
|
|
127
|
+
const packageAddress =
|
|
128
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
129
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
130
|
+
const parameterNames = ['market'];
|
|
131
|
+
return (tx: Transaction) =>
|
|
132
|
+
tx.moveCall({
|
|
133
|
+
package: packageAddress,
|
|
134
|
+
module: 'expiry_market',
|
|
135
|
+
function: 'expiry',
|
|
136
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export interface SettlementPriceArguments {
|
|
140
|
+
market: RawTransactionArgument<string>;
|
|
141
|
+
}
|
|
142
|
+
export interface SettlementPriceOptions {
|
|
143
|
+
package?: string;
|
|
144
|
+
arguments: SettlementPriceArguments | [market: RawTransactionArgument<string>];
|
|
145
|
+
config?: {
|
|
146
|
+
predictPackageId?: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/** Return the recorded settlement price. Aborts if the market is not settled. */
|
|
150
|
+
export function settlementPrice(options: SettlementPriceOptions) {
|
|
151
|
+
const packageAddress =
|
|
152
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
153
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
154
|
+
const parameterNames = ['market'];
|
|
155
|
+
return (tx: Transaction) =>
|
|
156
|
+
tx.moveCall({
|
|
157
|
+
package: packageAddress,
|
|
158
|
+
module: 'expiry_market',
|
|
159
|
+
function: 'settlement_price',
|
|
160
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
export interface IsSettledArguments {
|
|
164
|
+
market: RawTransactionArgument<string>;
|
|
165
|
+
}
|
|
166
|
+
export interface IsSettledOptions {
|
|
167
|
+
package?: string;
|
|
168
|
+
arguments: IsSettledArguments | [market: RawTransactionArgument<string>];
|
|
169
|
+
config?: {
|
|
170
|
+
predictPackageId?: string;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Return whether terminal settlement has been recorded for this market. Public
|
|
175
|
+
* read for SDK/devInspect settlement-state checks.
|
|
176
|
+
*/
|
|
177
|
+
export function isSettled(options: IsSettledOptions) {
|
|
178
|
+
const packageAddress =
|
|
179
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
180
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
181
|
+
const parameterNames = ['market'];
|
|
182
|
+
return (tx: Transaction) =>
|
|
183
|
+
tx.moveCall({
|
|
184
|
+
package: packageAddress,
|
|
185
|
+
module: 'expiry_market',
|
|
186
|
+
function: 'is_settled',
|
|
187
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
export interface TrySettlementPriceArguments {
|
|
191
|
+
market: RawTransactionArgument<string>;
|
|
192
|
+
}
|
|
193
|
+
export interface TrySettlementPriceOptions {
|
|
194
|
+
package?: string;
|
|
195
|
+
arguments: TrySettlementPriceArguments | [market: RawTransactionArgument<string>];
|
|
196
|
+
config?: {
|
|
197
|
+
predictPackageId?: string;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Return the recorded settlement price, or `none` while the market is live.
|
|
202
|
+
* Non-aborting companion to `settlement_price` for SDK/devInspect reads.
|
|
203
|
+
*/
|
|
204
|
+
export function trySettlementPrice(options: TrySettlementPriceOptions) {
|
|
205
|
+
const packageAddress =
|
|
206
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
207
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
208
|
+
const parameterNames = ['market'];
|
|
209
|
+
return (tx: Transaction) =>
|
|
210
|
+
tx.moveCall({
|
|
211
|
+
package: packageAddress,
|
|
212
|
+
module: 'expiry_market',
|
|
213
|
+
function: 'try_settlement_price',
|
|
214
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
export interface CashBalanceArguments {
|
|
218
|
+
market: RawTransactionArgument<string>;
|
|
219
|
+
}
|
|
220
|
+
export interface CashBalanceOptions {
|
|
221
|
+
package?: string;
|
|
222
|
+
arguments: CashBalanceArguments | [market: RawTransactionArgument<string>];
|
|
223
|
+
config?: {
|
|
224
|
+
predictPackageId?: string;
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/** Return expiry DUSDC custody for SDK and devInspect state reads. */
|
|
228
|
+
export function cashBalance(options: CashBalanceOptions) {
|
|
229
|
+
const packageAddress =
|
|
230
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
231
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
232
|
+
const parameterNames = ['market'];
|
|
233
|
+
return (tx: Transaction) =>
|
|
234
|
+
tx.moveCall({
|
|
235
|
+
package: packageAddress,
|
|
236
|
+
module: 'expiry_market',
|
|
237
|
+
function: 'cash_balance',
|
|
238
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export interface InventoryImpactReserveArguments {
|
|
242
|
+
market: RawTransactionArgument<string>;
|
|
243
|
+
}
|
|
244
|
+
export interface InventoryImpactReserveOptions {
|
|
245
|
+
package?: string;
|
|
246
|
+
arguments: InventoryImpactReserveArguments | [market: RawTransactionArgument<string>];
|
|
247
|
+
config?: {
|
|
248
|
+
predictPackageId?: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/** Return the isolated inventory-impact escrow for SDK and devInspect state reads. */
|
|
252
|
+
export function inventoryImpactReserve(options: InventoryImpactReserveOptions) {
|
|
253
|
+
const packageAddress =
|
|
254
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
255
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
256
|
+
const parameterNames = ['market'];
|
|
257
|
+
return (tx: Transaction) =>
|
|
258
|
+
tx.moveCall({
|
|
259
|
+
package: packageAddress,
|
|
260
|
+
module: 'expiry_market',
|
|
261
|
+
function: 'inventory_impact_reserve',
|
|
262
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
export interface FeeIncentiveBalanceArguments {
|
|
266
|
+
market: RawTransactionArgument<string>;
|
|
267
|
+
}
|
|
268
|
+
export interface FeeIncentiveBalanceOptions {
|
|
269
|
+
package?: string;
|
|
270
|
+
arguments: FeeIncentiveBalanceArguments | [market: RawTransactionArgument<string>];
|
|
271
|
+
config?: {
|
|
272
|
+
predictPackageId?: string;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/** Return local fee incentives for SDK and devInspect state reads. */
|
|
276
|
+
export function feeIncentiveBalance(options: FeeIncentiveBalanceOptions) {
|
|
277
|
+
const packageAddress =
|
|
278
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
279
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
280
|
+
const parameterNames = ['market'];
|
|
281
|
+
return (tx: Transaction) =>
|
|
282
|
+
tx.moveCall({
|
|
283
|
+
package: packageAddress,
|
|
284
|
+
module: 'expiry_market',
|
|
285
|
+
function: 'fee_incentive_balance',
|
|
286
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
export interface BackingBufferLambdaArguments {
|
|
290
|
+
market: RawTransactionArgument<string>;
|
|
291
|
+
}
|
|
292
|
+
export interface BackingBufferLambdaOptions {
|
|
293
|
+
package?: string;
|
|
294
|
+
arguments: BackingBufferLambdaArguments | [market: RawTransactionArgument<string>];
|
|
295
|
+
config?: {
|
|
296
|
+
predictPackageId?: string;
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
/** Return the snapshotted backing-buffer lambda for SDK and devInspect reads. */
|
|
300
|
+
export function backingBufferLambda(options: BackingBufferLambdaOptions) {
|
|
301
|
+
const packageAddress =
|
|
302
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
303
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
304
|
+
const parameterNames = ['market'];
|
|
305
|
+
return (tx: Transaction) =>
|
|
306
|
+
tx.moveCall({
|
|
307
|
+
package: packageAddress,
|
|
308
|
+
module: 'expiry_market',
|
|
309
|
+
function: 'backing_buffer_lambda',
|
|
310
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
export interface ExpiryFeeWindowMsArguments {
|
|
314
|
+
market: RawTransactionArgument<string>;
|
|
315
|
+
}
|
|
316
|
+
export interface ExpiryFeeWindowMsOptions {
|
|
317
|
+
package?: string;
|
|
318
|
+
arguments: ExpiryFeeWindowMsArguments | [market: RawTransactionArgument<string>];
|
|
319
|
+
config?: {
|
|
320
|
+
predictPackageId?: string;
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
/** Return the snapshotted fee-ramp window for SDK and devInspect reads. */
|
|
324
|
+
export function expiryFeeWindowMs(options: ExpiryFeeWindowMsOptions) {
|
|
325
|
+
const packageAddress =
|
|
326
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
327
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
328
|
+
const parameterNames = ['market'];
|
|
329
|
+
return (tx: Transaction) =>
|
|
330
|
+
tx.moveCall({
|
|
331
|
+
package: packageAddress,
|
|
332
|
+
module: 'expiry_market',
|
|
333
|
+
function: 'expiry_fee_window_ms',
|
|
334
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
export interface ExpiryFeeMaxMultiplierArguments {
|
|
338
|
+
market: RawTransactionArgument<string>;
|
|
339
|
+
}
|
|
340
|
+
export interface ExpiryFeeMaxMultiplierOptions {
|
|
341
|
+
package?: string;
|
|
342
|
+
arguments: ExpiryFeeMaxMultiplierArguments | [market: RawTransactionArgument<string>];
|
|
343
|
+
config?: {
|
|
344
|
+
predictPackageId?: string;
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
/** Return the snapshotted fee-ramp multiplier for SDK and devInspect reads. */
|
|
348
|
+
export function expiryFeeMaxMultiplier(options: ExpiryFeeMaxMultiplierOptions) {
|
|
349
|
+
const packageAddress =
|
|
350
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
351
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
352
|
+
const parameterNames = ['market'];
|
|
353
|
+
return (tx: Transaction) =>
|
|
354
|
+
tx.moveCall({
|
|
355
|
+
package: packageAddress,
|
|
356
|
+
module: 'expiry_market',
|
|
357
|
+
function: 'expiry_fee_max_multiplier',
|
|
358
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
export interface InventoryImpactMaxRateArguments {
|
|
362
|
+
market: RawTransactionArgument<string>;
|
|
363
|
+
}
|
|
364
|
+
export interface InventoryImpactMaxRateOptions {
|
|
365
|
+
package?: string;
|
|
366
|
+
arguments: InventoryImpactMaxRateArguments | [market: RawTransactionArgument<string>];
|
|
367
|
+
config?: {
|
|
368
|
+
predictPackageId?: string;
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Return this market's immutable maximum marginal inventory-impact rate for SDK
|
|
373
|
+
* and devInspect state reads.
|
|
374
|
+
*/
|
|
375
|
+
export function inventoryImpactMaxRate(options: InventoryImpactMaxRateOptions) {
|
|
376
|
+
const packageAddress =
|
|
377
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
378
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
379
|
+
const parameterNames = ['market'];
|
|
380
|
+
return (tx: Transaction) =>
|
|
381
|
+
tx.moveCall({
|
|
382
|
+
package: packageAddress,
|
|
383
|
+
module: 'expiry_market',
|
|
384
|
+
function: 'inventory_impact_max_rate',
|
|
385
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
export interface InventoryImpactScaleArguments {
|
|
389
|
+
market: RawTransactionArgument<string>;
|
|
390
|
+
}
|
|
391
|
+
export interface InventoryImpactScaleOptions {
|
|
392
|
+
package?: string;
|
|
393
|
+
arguments: InventoryImpactScaleArguments | [market: RawTransactionArgument<string>];
|
|
394
|
+
config?: {
|
|
395
|
+
predictPackageId?: string;
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Return the immutable DUSDC scale of this market's inventory-impact curve for SDK
|
|
400
|
+
* and devInspect state reads.
|
|
401
|
+
*/
|
|
402
|
+
export function inventoryImpactScale(options: InventoryImpactScaleOptions) {
|
|
403
|
+
const packageAddress =
|
|
404
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
405
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
406
|
+
const parameterNames = ['market'];
|
|
407
|
+
return (tx: Transaction) =>
|
|
408
|
+
tx.moveCall({
|
|
409
|
+
package: packageAddress,
|
|
410
|
+
module: 'expiry_market',
|
|
411
|
+
function: 'inventory_impact_scale',
|
|
412
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
export interface TickSizeArguments {
|
|
416
|
+
market: RawTransactionArgument<string>;
|
|
417
|
+
}
|
|
418
|
+
export interface TickSizeOptions {
|
|
419
|
+
package?: string;
|
|
420
|
+
arguments: TickSizeArguments | [market: RawTransactionArgument<string>];
|
|
421
|
+
config?: {
|
|
422
|
+
predictPackageId?: string;
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Return the strike tick size for SDK and devInspect range construction. Raw
|
|
427
|
+
* strikes are `tick * tick_size`.
|
|
428
|
+
*/
|
|
429
|
+
export function tickSize(options: TickSizeOptions) {
|
|
430
|
+
const packageAddress =
|
|
431
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
432
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
433
|
+
const parameterNames = ['market'];
|
|
434
|
+
return (tx: Transaction) =>
|
|
435
|
+
tx.moveCall({
|
|
436
|
+
package: packageAddress,
|
|
437
|
+
module: 'expiry_market',
|
|
438
|
+
function: 'tick_size',
|
|
439
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
export interface AdmissionTickSizeArguments {
|
|
443
|
+
market: RawTransactionArgument<string>;
|
|
444
|
+
}
|
|
445
|
+
export interface AdmissionTickSizeOptions {
|
|
446
|
+
package?: string;
|
|
447
|
+
arguments: AdmissionTickSizeArguments | [market: RawTransactionArgument<string>];
|
|
448
|
+
config?: {
|
|
449
|
+
predictPackageId?: string;
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/** Return the admission-grid step for SDK and devInspect range construction. */
|
|
453
|
+
export function admissionTickSize(options: AdmissionTickSizeOptions) {
|
|
454
|
+
const packageAddress =
|
|
455
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
456
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
457
|
+
const parameterNames = ['market'];
|
|
458
|
+
return (tx: Transaction) =>
|
|
459
|
+
tx.moveCall({
|
|
460
|
+
package: packageAddress,
|
|
461
|
+
module: 'expiry_market',
|
|
462
|
+
function: 'admission_tick_size',
|
|
463
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
464
|
+
});
|
|
465
|
+
}
|
|
466
|
+
export interface ReferenceTickArguments {
|
|
467
|
+
market: RawTransactionArgument<string>;
|
|
468
|
+
}
|
|
469
|
+
export interface ReferenceTickOptions {
|
|
470
|
+
package?: string;
|
|
471
|
+
arguments: ReferenceTickArguments | [market: RawTransactionArgument<string>];
|
|
472
|
+
config?: {
|
|
473
|
+
predictPackageId?: string;
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
/** Return the admitted reference tick for SDK and devInspect range construction. */
|
|
477
|
+
export function referenceTick(options: ReferenceTickOptions) {
|
|
478
|
+
const packageAddress =
|
|
479
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
480
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
481
|
+
const parameterNames = ['market'];
|
|
482
|
+
return (tx: Transaction) =>
|
|
483
|
+
tx.moveCall({
|
|
484
|
+
package: packageAddress,
|
|
485
|
+
module: 'expiry_market',
|
|
486
|
+
function: 'reference_tick',
|
|
487
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
export interface ReferenceTickSourceTimestampMsArguments {
|
|
491
|
+
market: RawTransactionArgument<string>;
|
|
492
|
+
}
|
|
493
|
+
export interface ReferenceTickSourceTimestampMsOptions {
|
|
494
|
+
package?: string;
|
|
495
|
+
arguments: ReferenceTickSourceTimestampMsArguments | [market: RawTransactionArgument<string>];
|
|
496
|
+
config?: {
|
|
497
|
+
predictPackageId?: string;
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
/** Return the reference observation timestamp for SDK and devInspect reads. */
|
|
501
|
+
export function referenceTickSourceTimestampMs(options: ReferenceTickSourceTimestampMsOptions) {
|
|
502
|
+
const packageAddress =
|
|
503
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
504
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
505
|
+
const parameterNames = ['market'];
|
|
506
|
+
return (tx: Transaction) =>
|
|
507
|
+
tx.moveCall({
|
|
508
|
+
package: packageAddress,
|
|
509
|
+
module: 'expiry_market',
|
|
510
|
+
function: 'reference_tick_source_timestamp_ms',
|
|
511
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
export interface PayoutLiabilityArguments {
|
|
515
|
+
market: RawTransactionArgument<string>;
|
|
516
|
+
}
|
|
517
|
+
export interface PayoutLiabilityOptions {
|
|
518
|
+
package?: string;
|
|
519
|
+
arguments: PayoutLiabilityArguments | [market: RawTransactionArgument<string>];
|
|
520
|
+
config?: {
|
|
521
|
+
predictPackageId?: string;
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Return payout reserve or settled liability for external accounting
|
|
526
|
+
* observability.
|
|
527
|
+
*/
|
|
528
|
+
export function payoutLiability(options: PayoutLiabilityOptions) {
|
|
529
|
+
const packageAddress =
|
|
530
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
531
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
532
|
+
const parameterNames = ['market'];
|
|
533
|
+
return (tx: Transaction) =>
|
|
534
|
+
tx.moveCall({
|
|
535
|
+
package: packageAddress,
|
|
536
|
+
module: 'expiry_market',
|
|
537
|
+
function: 'payout_liability',
|
|
538
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
export interface RequiredCashArguments {
|
|
542
|
+
market: RawTransactionArgument<string>;
|
|
543
|
+
}
|
|
544
|
+
export interface RequiredCashOptions {
|
|
545
|
+
package?: string;
|
|
546
|
+
arguments: RequiredCashArguments | [market: RawTransactionArgument<string>];
|
|
547
|
+
config?: {
|
|
548
|
+
predictPackageId?: string;
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
/** Return required expiry cash for external accounting observability. */
|
|
552
|
+
export function requiredCash(options: RequiredCashOptions) {
|
|
553
|
+
const packageAddress =
|
|
554
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
555
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
556
|
+
const parameterNames = ['market'];
|
|
557
|
+
return (tx: Transaction) =>
|
|
558
|
+
tx.moveCall({
|
|
559
|
+
package: packageAddress,
|
|
560
|
+
module: 'expiry_market',
|
|
561
|
+
function: 'required_cash',
|
|
562
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
export interface LoadLivePricerArguments {
|
|
566
|
+
market: RawTransactionArgument<string>;
|
|
567
|
+
config?: RawTransactionArgument<string>;
|
|
568
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
569
|
+
pyth: RawTransactionArgument<string>;
|
|
570
|
+
bsValues: RawTransactionArgument<string>;
|
|
571
|
+
bsSvi: RawTransactionArgument<string>;
|
|
572
|
+
}
|
|
573
|
+
export interface LoadLivePricerOptions {
|
|
574
|
+
package?: string;
|
|
575
|
+
arguments: LoadLivePricerArguments;
|
|
576
|
+
config?: {
|
|
577
|
+
protocolConfig: ConfigValue;
|
|
578
|
+
oracleRegistry: ConfigValue;
|
|
579
|
+
predictPackageId?: string;
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Load a PTB-local live pricing snapshot for this market.
|
|
584
|
+
*
|
|
585
|
+
* The returned `Pricer` is bound to `market.id()` and can be passed into live
|
|
586
|
+
* mint, redeem, and NAV functions in the same transaction.
|
|
587
|
+
*
|
|
588
|
+
* Aborts `pricing::EOracleWrittenInThisTransaction` when any observation that
|
|
589
|
+
* feeds the returned forward or SVI was written in this transaction (RP-24).
|
|
590
|
+
* Independently submitted refresh-then-trade PTBs are unaffected: the guard
|
|
591
|
+
* compares observation `writer_digest` to `tx_context::digest()`, not sender
|
|
592
|
+
* identity, and does not prohibit reads of older observations.
|
|
593
|
+
*/
|
|
594
|
+
export function loadLivePricer(options: LoadLivePricerOptions) {
|
|
595
|
+
const packageAddress =
|
|
596
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
597
|
+
const argumentsTypes = [null, null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
598
|
+
string | null
|
|
599
|
+
)[];
|
|
600
|
+
const parameterNames = ['market', 'config', 'propbookRegistry', 'pyth', 'bsValues', 'bsSvi'];
|
|
601
|
+
return (tx: Transaction) =>
|
|
602
|
+
tx.moveCall({
|
|
603
|
+
package: packageAddress,
|
|
604
|
+
module: 'expiry_market',
|
|
605
|
+
function: 'load_live_pricer',
|
|
606
|
+
arguments: normalizeMoveArguments(
|
|
607
|
+
{
|
|
608
|
+
...options.arguments,
|
|
609
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
610
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
611
|
+
},
|
|
612
|
+
argumentsTypes,
|
|
613
|
+
parameterNames,
|
|
614
|
+
),
|
|
615
|
+
});
|
|
616
|
+
}
|
|
617
|
+
export interface CurrentNavArguments {
|
|
618
|
+
market: RawTransactionArgument<string>;
|
|
619
|
+
pricer: TransactionArgument;
|
|
620
|
+
}
|
|
621
|
+
export interface CurrentNavOptions {
|
|
622
|
+
package?: string;
|
|
623
|
+
arguments:
|
|
624
|
+
CurrentNavArguments | [market: RawTransactionArgument<string>, pricer: TransactionArgument];
|
|
625
|
+
config?: {
|
|
626
|
+
predictPackageId?: string;
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Return live marked NAV as free expiry cash minus the exposure book's marked
|
|
631
|
+
* liability, floored at zero. This read requires a market-bound pre-expiry
|
|
632
|
+
* `Pricer`; an expired but unsettled market cannot be valued through this path.
|
|
633
|
+
* Public for PTB composition and devInspect pool valuation.
|
|
634
|
+
*/
|
|
635
|
+
export function currentNav(options: CurrentNavOptions) {
|
|
636
|
+
const packageAddress =
|
|
637
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
638
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
639
|
+
const parameterNames = ['market', 'pricer'];
|
|
640
|
+
return (tx: Transaction) =>
|
|
641
|
+
tx.moveCall({
|
|
642
|
+
package: packageAddress,
|
|
643
|
+
module: 'expiry_market',
|
|
644
|
+
function: 'current_nav',
|
|
645
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
export interface LiveOrderValueArguments {
|
|
649
|
+
market: RawTransactionArgument<string>;
|
|
650
|
+
pricer: TransactionArgument;
|
|
651
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
652
|
+
}
|
|
653
|
+
export interface LiveOrderValueOptions {
|
|
654
|
+
package?: string;
|
|
655
|
+
arguments:
|
|
656
|
+
| LiveOrderValueArguments
|
|
657
|
+
| [
|
|
658
|
+
market: RawTransactionArgument<string>,
|
|
659
|
+
pricer: TransactionArgument,
|
|
660
|
+
orderId: RawTransactionArgument<number | bigint>,
|
|
661
|
+
];
|
|
662
|
+
config?: {
|
|
663
|
+
predictPackageId?: string;
|
|
664
|
+
};
|
|
665
|
+
}
|
|
666
|
+
/**
|
|
667
|
+
* Return one live order's full-close range value before fees. Requires a
|
|
668
|
+
* market-bound `Pricer` and does not prove account ownership of `order_id`. Public
|
|
669
|
+
* for SDK, PTB, and devInspect position valuation.
|
|
670
|
+
*/
|
|
671
|
+
export function liveOrderValue(options: LiveOrderValueOptions) {
|
|
672
|
+
const packageAddress =
|
|
673
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
674
|
+
const argumentsTypes = [null, null, 'u256'] satisfies (string | null)[];
|
|
675
|
+
const parameterNames = ['market', 'pricer', 'orderId'];
|
|
676
|
+
return (tx: Transaction) =>
|
|
677
|
+
tx.moveCall({
|
|
678
|
+
package: packageAddress,
|
|
679
|
+
module: 'expiry_market',
|
|
680
|
+
function: 'live_order_value',
|
|
681
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
export interface SettledOrderPayoutArguments {
|
|
685
|
+
market: RawTransactionArgument<string>;
|
|
686
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
687
|
+
}
|
|
688
|
+
export interface SettledOrderPayoutOptions {
|
|
689
|
+
package?: string;
|
|
690
|
+
arguments:
|
|
691
|
+
| SettledOrderPayoutArguments
|
|
692
|
+
| [market: RawTransactionArgument<string>, orderId: RawTransactionArgument<number | bigint>];
|
|
693
|
+
config?: {
|
|
694
|
+
predictPackageId?: string;
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Return one settled order's terminal payout. This function does not prove account
|
|
699
|
+
* ownership of `order_id`. Public for SDK, PTB, and devInspect position valuation.
|
|
700
|
+
*/
|
|
701
|
+
export function settledOrderPayout(options: SettledOrderPayoutOptions) {
|
|
702
|
+
const packageAddress =
|
|
703
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
704
|
+
const argumentsTypes = [null, 'u256'] satisfies (string | null)[];
|
|
705
|
+
const parameterNames = ['market', 'orderId'];
|
|
706
|
+
return (tx: Transaction) =>
|
|
707
|
+
tx.moveCall({
|
|
708
|
+
package: packageAddress,
|
|
709
|
+
module: 'expiry_market',
|
|
710
|
+
function: 'settled_order_payout',
|
|
711
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
export interface MintPausedArguments {
|
|
715
|
+
market: RawTransactionArgument<string>;
|
|
716
|
+
}
|
|
717
|
+
export interface MintPausedOptions {
|
|
718
|
+
package?: string;
|
|
719
|
+
arguments: MintPausedArguments | [market: RawTransactionArgument<string>];
|
|
720
|
+
config?: {
|
|
721
|
+
predictPackageId?: string;
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
/** Return the market mint-pause state for SDK and devInspect reads. */
|
|
725
|
+
export function mintPaused(options: MintPausedOptions) {
|
|
726
|
+
const packageAddress =
|
|
727
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
728
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
729
|
+
const parameterNames = ['market'];
|
|
730
|
+
return (tx: Transaction) =>
|
|
731
|
+
tx.moveCall({
|
|
732
|
+
package: packageAddress,
|
|
733
|
+
module: 'expiry_market',
|
|
734
|
+
function: 'mint_paused',
|
|
735
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
export interface QuoteMintArguments {
|
|
739
|
+
market: RawTransactionArgument<string>;
|
|
740
|
+
config?: RawTransactionArgument<string>;
|
|
741
|
+
pricer: TransactionArgument;
|
|
742
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
743
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
744
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
745
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
746
|
+
exactQuantity: RawTransactionArgument<boolean>;
|
|
747
|
+
}
|
|
748
|
+
export interface QuoteMintOptions {
|
|
749
|
+
package?: string;
|
|
750
|
+
arguments: QuoteMintArguments;
|
|
751
|
+
config?: {
|
|
752
|
+
protocolConfig: ConfigValue;
|
|
753
|
+
predictPackageId?: string;
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Quote the all-in cost of a mint request for an anonymous taker (no builder code)
|
|
758
|
+
* without mutating any market state. Exact-quantity mode uses `min_quantity`;
|
|
759
|
+
* budget mode conservatively sizes a lot-rounded fill under `max_premium`. The
|
|
760
|
+
* quote applies live-mint and admission gates but does not preflight account
|
|
761
|
+
* balance, slippage caps, or exposure-index capacity. Its penalty uses the current
|
|
762
|
+
* pre-update EWMA state. Public for SDK and devInspect pre-trade pricing.
|
|
763
|
+
*/
|
|
764
|
+
export function quoteMint(options: QuoteMintOptions) {
|
|
765
|
+
const packageAddress =
|
|
766
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
767
|
+
const argumentsTypes = [
|
|
768
|
+
null,
|
|
769
|
+
null,
|
|
770
|
+
null,
|
|
771
|
+
'u64',
|
|
772
|
+
'u64',
|
|
773
|
+
'u64',
|
|
774
|
+
'u64',
|
|
775
|
+
'bool',
|
|
776
|
+
'0x2::clock::Clock',
|
|
777
|
+
] satisfies (string | null)[];
|
|
778
|
+
const parameterNames = [
|
|
779
|
+
'market',
|
|
780
|
+
'config',
|
|
781
|
+
'pricer',
|
|
782
|
+
'lowerTick',
|
|
783
|
+
'higherTick',
|
|
784
|
+
'maxPremium',
|
|
785
|
+
'minQuantity',
|
|
786
|
+
'exactQuantity',
|
|
787
|
+
];
|
|
788
|
+
return (tx: Transaction) =>
|
|
789
|
+
tx.moveCall({
|
|
790
|
+
package: packageAddress,
|
|
791
|
+
module: 'expiry_market',
|
|
792
|
+
function: 'quote_mint',
|
|
793
|
+
arguments: normalizeMoveArguments(
|
|
794
|
+
{
|
|
795
|
+
...options.arguments,
|
|
796
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
797
|
+
},
|
|
798
|
+
argumentsTypes,
|
|
799
|
+
parameterNames,
|
|
800
|
+
),
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
export interface QuoteMintForAccountArguments {
|
|
804
|
+
market: RawTransactionArgument<string>;
|
|
805
|
+
wrapper: RawTransactionArgument<string>;
|
|
806
|
+
config?: RawTransactionArgument<string>;
|
|
807
|
+
pricer: TransactionArgument;
|
|
808
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
809
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
810
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
811
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
812
|
+
exactQuantity: RawTransactionArgument<boolean>;
|
|
813
|
+
}
|
|
814
|
+
export interface QuoteMintForAccountOptions {
|
|
815
|
+
package?: string;
|
|
816
|
+
arguments: QuoteMintForAccountArguments;
|
|
817
|
+
config?: {
|
|
818
|
+
protocolConfig: ConfigValue;
|
|
819
|
+
predictPackageId?: string;
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Quote the all-in cost of a mint request for one account, reading its builder
|
|
824
|
+
* code. Budget mode caps premium by total account balance, including unsettled
|
|
825
|
+
* accumulator funds. Public for SDK and devInspect pre-trade pricing.
|
|
826
|
+
*/
|
|
827
|
+
export function quoteMintForAccount(options: QuoteMintForAccountOptions) {
|
|
828
|
+
const packageAddress =
|
|
829
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
830
|
+
const argumentsTypes = [
|
|
831
|
+
null,
|
|
832
|
+
null,
|
|
833
|
+
null,
|
|
834
|
+
null,
|
|
835
|
+
'u64',
|
|
836
|
+
'u64',
|
|
837
|
+
'u64',
|
|
838
|
+
'u64',
|
|
839
|
+
'bool',
|
|
840
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
841
|
+
'0x2::clock::Clock',
|
|
842
|
+
] satisfies (string | null)[];
|
|
843
|
+
const parameterNames = [
|
|
844
|
+
'market',
|
|
845
|
+
'wrapper',
|
|
846
|
+
'config',
|
|
847
|
+
'pricer',
|
|
848
|
+
'lowerTick',
|
|
849
|
+
'higherTick',
|
|
850
|
+
'maxPremium',
|
|
851
|
+
'minQuantity',
|
|
852
|
+
'exactQuantity',
|
|
853
|
+
];
|
|
854
|
+
return (tx: Transaction) =>
|
|
855
|
+
tx.moveCall({
|
|
856
|
+
package: packageAddress,
|
|
857
|
+
module: 'expiry_market',
|
|
858
|
+
function: 'quote_mint_for_account',
|
|
859
|
+
arguments: normalizeMoveArguments(
|
|
860
|
+
{
|
|
861
|
+
...options.arguments,
|
|
862
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
863
|
+
},
|
|
864
|
+
argumentsTypes,
|
|
865
|
+
parameterNames,
|
|
866
|
+
),
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
export interface QuantityArguments {
|
|
870
|
+
quote: TransactionArgument;
|
|
871
|
+
}
|
|
872
|
+
export interface QuantityOptions {
|
|
873
|
+
package?: string;
|
|
874
|
+
arguments: QuantityArguments | [quote: TransactionArgument];
|
|
875
|
+
config?: {
|
|
876
|
+
predictPackageId?: string;
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
/** Return the sized quantity for SDK and devInspect quote consumers. */
|
|
880
|
+
export function quantity(options: QuantityOptions) {
|
|
881
|
+
const packageAddress =
|
|
882
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
883
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
884
|
+
const parameterNames = ['quote'];
|
|
885
|
+
return (tx: Transaction) =>
|
|
886
|
+
tx.moveCall({
|
|
887
|
+
package: packageAddress,
|
|
888
|
+
module: 'expiry_market',
|
|
889
|
+
function: 'quantity',
|
|
890
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
891
|
+
});
|
|
892
|
+
}
|
|
893
|
+
export interface EntryProbabilityArguments {
|
|
894
|
+
quote: TransactionArgument;
|
|
895
|
+
}
|
|
896
|
+
export interface EntryProbabilityOptions {
|
|
897
|
+
package?: string;
|
|
898
|
+
arguments: EntryProbabilityArguments | [quote: TransactionArgument];
|
|
899
|
+
config?: {
|
|
900
|
+
predictPackageId?: string;
|
|
901
|
+
};
|
|
902
|
+
}
|
|
903
|
+
/** Return the quoted range probability for SDK and devInspect consumers. */
|
|
904
|
+
export function entryProbability(options: EntryProbabilityOptions) {
|
|
905
|
+
const packageAddress =
|
|
906
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
907
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
908
|
+
const parameterNames = ['quote'];
|
|
909
|
+
return (tx: Transaction) =>
|
|
910
|
+
tx.moveCall({
|
|
911
|
+
package: packageAddress,
|
|
912
|
+
module: 'expiry_market',
|
|
913
|
+
function: 'entry_probability',
|
|
914
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
export interface PremiumArguments {
|
|
918
|
+
quote: TransactionArgument;
|
|
919
|
+
}
|
|
920
|
+
export interface PremiumOptions {
|
|
921
|
+
package?: string;
|
|
922
|
+
arguments: PremiumArguments | [quote: TransactionArgument];
|
|
923
|
+
config?: {
|
|
924
|
+
predictPackageId?: string;
|
|
925
|
+
};
|
|
926
|
+
}
|
|
927
|
+
/** Return the quoted premium for SDK and devInspect consumers. */
|
|
928
|
+
export function premium(options: PremiumOptions) {
|
|
929
|
+
const packageAddress =
|
|
930
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
931
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
932
|
+
const parameterNames = ['quote'];
|
|
933
|
+
return (tx: Transaction) =>
|
|
934
|
+
tx.moveCall({
|
|
935
|
+
package: packageAddress,
|
|
936
|
+
module: 'expiry_market',
|
|
937
|
+
function: 'premium',
|
|
938
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
export interface TradingFeeArguments {
|
|
942
|
+
quote: TransactionArgument;
|
|
943
|
+
}
|
|
944
|
+
export interface TradingFeeOptions {
|
|
945
|
+
package?: string;
|
|
946
|
+
arguments: TradingFeeArguments | [quote: TransactionArgument];
|
|
947
|
+
config?: {
|
|
948
|
+
predictPackageId?: string;
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
/** Return the quoted trading fee before subsidy for SDK and devInspect consumers. */
|
|
952
|
+
export function tradingFee(options: TradingFeeOptions) {
|
|
953
|
+
const packageAddress =
|
|
954
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
955
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
956
|
+
const parameterNames = ['quote'];
|
|
957
|
+
return (tx: Transaction) =>
|
|
958
|
+
tx.moveCall({
|
|
959
|
+
package: packageAddress,
|
|
960
|
+
module: 'expiry_market',
|
|
961
|
+
function: 'trading_fee',
|
|
962
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
export interface FeeIncentiveSubsidyArguments {
|
|
966
|
+
quote: TransactionArgument;
|
|
967
|
+
}
|
|
968
|
+
export interface FeeIncentiveSubsidyOptions {
|
|
969
|
+
package?: string;
|
|
970
|
+
arguments: FeeIncentiveSubsidyArguments | [quote: TransactionArgument];
|
|
971
|
+
config?: {
|
|
972
|
+
predictPackageId?: string;
|
|
973
|
+
};
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Return the sponsor-funded portion of the quoted fee for SDK and devInspect
|
|
977
|
+
* consumers.
|
|
978
|
+
*/
|
|
979
|
+
export function feeIncentiveSubsidy(options: FeeIncentiveSubsidyOptions) {
|
|
980
|
+
const packageAddress =
|
|
981
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
982
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
983
|
+
const parameterNames = ['quote'];
|
|
984
|
+
return (tx: Transaction) =>
|
|
985
|
+
tx.moveCall({
|
|
986
|
+
package: packageAddress,
|
|
987
|
+
module: 'expiry_market',
|
|
988
|
+
function: 'fee_incentive_subsidy',
|
|
989
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
export interface BuilderFeeArguments {
|
|
993
|
+
quote: TransactionArgument;
|
|
994
|
+
}
|
|
995
|
+
export interface BuilderFeeOptions {
|
|
996
|
+
package?: string;
|
|
997
|
+
arguments: BuilderFeeArguments | [quote: TransactionArgument];
|
|
998
|
+
config?: {
|
|
999
|
+
predictPackageId?: string;
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
/** Return the quoted builder fee for SDK and devInspect consumers. */
|
|
1003
|
+
export function builderFee(options: BuilderFeeOptions) {
|
|
1004
|
+
const packageAddress =
|
|
1005
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1006
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1007
|
+
const parameterNames = ['quote'];
|
|
1008
|
+
return (tx: Transaction) =>
|
|
1009
|
+
tx.moveCall({
|
|
1010
|
+
package: packageAddress,
|
|
1011
|
+
module: 'expiry_market',
|
|
1012
|
+
function: 'builder_fee',
|
|
1013
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
export interface PenaltyFeeArguments {
|
|
1017
|
+
quote: TransactionArgument;
|
|
1018
|
+
}
|
|
1019
|
+
export interface PenaltyFeeOptions {
|
|
1020
|
+
package?: string;
|
|
1021
|
+
arguments: PenaltyFeeArguments | [quote: TransactionArgument];
|
|
1022
|
+
config?: {
|
|
1023
|
+
predictPackageId?: string;
|
|
1024
|
+
};
|
|
1025
|
+
}
|
|
1026
|
+
/** Return the quoted EWMA congestion surcharge for SDK and devInspect consumers. */
|
|
1027
|
+
export function penaltyFee(options: PenaltyFeeOptions) {
|
|
1028
|
+
const packageAddress =
|
|
1029
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1030
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1031
|
+
const parameterNames = ['quote'];
|
|
1032
|
+
return (tx: Transaction) =>
|
|
1033
|
+
tx.moveCall({
|
|
1034
|
+
package: packageAddress,
|
|
1035
|
+
module: 'expiry_market',
|
|
1036
|
+
function: 'penalty_fee',
|
|
1037
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
export interface InventoryImpactChargeArguments {
|
|
1041
|
+
quote: TransactionArgument;
|
|
1042
|
+
}
|
|
1043
|
+
export interface InventoryImpactChargeOptions {
|
|
1044
|
+
package?: string;
|
|
1045
|
+
arguments: InventoryImpactChargeArguments | [quote: TransactionArgument];
|
|
1046
|
+
config?: {
|
|
1047
|
+
predictPackageId?: string;
|
|
1048
|
+
};
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Return the separate inventory-impact charge for SDK and devInspect quote
|
|
1052
|
+
* consumers.
|
|
1053
|
+
*/
|
|
1054
|
+
export function inventoryImpactCharge(options: InventoryImpactChargeOptions) {
|
|
1055
|
+
const packageAddress =
|
|
1056
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1057
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1058
|
+
const parameterNames = ['quote'];
|
|
1059
|
+
return (tx: Transaction) =>
|
|
1060
|
+
tx.moveCall({
|
|
1061
|
+
package: packageAddress,
|
|
1062
|
+
module: 'expiry_market',
|
|
1063
|
+
function: 'inventory_impact_charge',
|
|
1064
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
export interface AllInCostArguments {
|
|
1068
|
+
quote: TransactionArgument;
|
|
1069
|
+
}
|
|
1070
|
+
export interface AllInCostOptions {
|
|
1071
|
+
package?: string;
|
|
1072
|
+
arguments: AllInCostArguments | [quote: TransactionArgument];
|
|
1073
|
+
config?: {
|
|
1074
|
+
predictPackageId?: string;
|
|
1075
|
+
};
|
|
1076
|
+
}
|
|
1077
|
+
/** Return the total quoted account withdrawal for SDK and devInspect consumers. */
|
|
1078
|
+
export function allInCost(options: AllInCostOptions) {
|
|
1079
|
+
const packageAddress =
|
|
1080
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1081
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
1082
|
+
const parameterNames = ['quote'];
|
|
1083
|
+
return (tx: Transaction) =>
|
|
1084
|
+
tx.moveCall({
|
|
1085
|
+
package: packageAddress,
|
|
1086
|
+
module: 'expiry_market',
|
|
1087
|
+
function: 'all_in_cost',
|
|
1088
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
export interface MintExactQuantityArguments {
|
|
1092
|
+
market: RawTransactionArgument<string>;
|
|
1093
|
+
wrapper: RawTransactionArgument<string>;
|
|
1094
|
+
auth: TransactionArgument;
|
|
1095
|
+
config?: RawTransactionArgument<string>;
|
|
1096
|
+
pricer: TransactionArgument;
|
|
1097
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
1098
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
1099
|
+
quantity: RawTransactionArgument<number | bigint>;
|
|
1100
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
1101
|
+
maxProbability: RawTransactionArgument<number | bigint>;
|
|
1102
|
+
}
|
|
1103
|
+
export interface MintExactQuantityOptions {
|
|
1104
|
+
package?: string;
|
|
1105
|
+
arguments: MintExactQuantityArguments;
|
|
1106
|
+
config?: {
|
|
1107
|
+
protocolConfig: ConfigValue;
|
|
1108
|
+
predictPackageId?: string;
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Mint an exact live position quantity against this expiry market.
|
|
1113
|
+
*
|
|
1114
|
+
* Requires the running package version to be at or above the protocol version
|
|
1115
|
+
* watermark, per-market mint pause to be off, trading globally enabled, valid
|
|
1116
|
+
* owner or authorized-app account auth, a market-bound live `Pricer`, and enough
|
|
1117
|
+
* expiry cash to back the post-mint max payout. Mint fees are paid by routing a
|
|
1118
|
+
* withdraw through the loaded account. The position's strike range is the tick
|
|
1119
|
+
* pair `(lower_tick, higher_tick]` (`lower_tick = 0` is `-inf`,
|
|
1120
|
+
* `higher_tick = pos_inf_tick` is `+inf`); the SDK converts raw strikes to ticks.
|
|
1121
|
+
* `max_cost` caps the all-in DUSDC withdrawal, while `max_probability` caps the
|
|
1122
|
+
* quoted per-contract probability before fees. Callers can pass
|
|
1123
|
+
* `std::u64::max_value!()` for either uncapped guard. Returns the minted order ID
|
|
1124
|
+
* for future order-scoped flows.
|
|
1125
|
+
*/
|
|
1126
|
+
export function mintExactQuantity(options: MintExactQuantityOptions) {
|
|
1127
|
+
const packageAddress =
|
|
1128
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1129
|
+
const argumentsTypes = [
|
|
1130
|
+
null,
|
|
1131
|
+
null,
|
|
1132
|
+
null,
|
|
1133
|
+
null,
|
|
1134
|
+
null,
|
|
1135
|
+
'u64',
|
|
1136
|
+
'u64',
|
|
1137
|
+
'u64',
|
|
1138
|
+
'u64',
|
|
1139
|
+
'u64',
|
|
1140
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1141
|
+
'0x2::clock::Clock',
|
|
1142
|
+
] satisfies (string | null)[];
|
|
1143
|
+
const parameterNames = [
|
|
1144
|
+
'market',
|
|
1145
|
+
'wrapper',
|
|
1146
|
+
'auth',
|
|
1147
|
+
'config',
|
|
1148
|
+
'pricer',
|
|
1149
|
+
'lowerTick',
|
|
1150
|
+
'higherTick',
|
|
1151
|
+
'quantity',
|
|
1152
|
+
'maxCost',
|
|
1153
|
+
'maxProbability',
|
|
1154
|
+
];
|
|
1155
|
+
return (tx: Transaction) =>
|
|
1156
|
+
tx.moveCall({
|
|
1157
|
+
package: packageAddress,
|
|
1158
|
+
module: 'expiry_market',
|
|
1159
|
+
function: 'mint_exact_quantity',
|
|
1160
|
+
arguments: normalizeMoveArguments(
|
|
1161
|
+
{
|
|
1162
|
+
...options.arguments,
|
|
1163
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1164
|
+
},
|
|
1165
|
+
argumentsTypes,
|
|
1166
|
+
parameterNames,
|
|
1167
|
+
),
|
|
1168
|
+
});
|
|
1169
|
+
}
|
|
1170
|
+
export interface MintExactAmountArguments {
|
|
1171
|
+
market: RawTransactionArgument<string>;
|
|
1172
|
+
wrapper: RawTransactionArgument<string>;
|
|
1173
|
+
auth: TransactionArgument;
|
|
1174
|
+
config?: RawTransactionArgument<string>;
|
|
1175
|
+
pricer: TransactionArgument;
|
|
1176
|
+
lowerTick: RawTransactionArgument<number | bigint>;
|
|
1177
|
+
higherTick: RawTransactionArgument<number | bigint>;
|
|
1178
|
+
maxPremium: RawTransactionArgument<number | bigint>;
|
|
1179
|
+
minQuantity: RawTransactionArgument<number | bigint>;
|
|
1180
|
+
maxCost: RawTransactionArgument<number | bigint>;
|
|
1181
|
+
}
|
|
1182
|
+
export interface MintExactAmountOptions {
|
|
1183
|
+
package?: string;
|
|
1184
|
+
arguments: MintExactAmountArguments;
|
|
1185
|
+
config?: {
|
|
1186
|
+
protocolConfig: ConfigValue;
|
|
1187
|
+
predictPackageId?: string;
|
|
1188
|
+
};
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Mint a conservatively sized lot-rounded position whose premium does not exceed
|
|
1192
|
+
* `max_premium`. The result may be one lot below the largest fitting quantity and
|
|
1193
|
+
* must meet `min_quantity`.
|
|
1194
|
+
*
|
|
1195
|
+
* Fees, builder fees, and EWMA congestion penalties are charged on top of
|
|
1196
|
+
* `max_premium`, so `max_cost` — not `max_premium` — bounds the all-in DUSDC
|
|
1197
|
+
* withdrawal (`premium + trader-paid fee + builder_fee + EWMA penalty`).
|
|
1198
|
+
* `max_cost` is required: unlike `mint_exact_quantity`'s guards there is no value
|
|
1199
|
+
* that disables it, because the budget shape exists to bound spend. The sizing
|
|
1200
|
+
* budget is first capped to the account's available DUSDC after settlement; fees
|
|
1201
|
+
* still require additional available DUSDC at payment time. Any unspent premium
|
|
1202
|
+
* dust remains in the account because order quantity must be an integer number of
|
|
1203
|
+
* `position_lot_size` lots.
|
|
1204
|
+
*/
|
|
1205
|
+
export function mintExactAmount(options: MintExactAmountOptions) {
|
|
1206
|
+
const packageAddress =
|
|
1207
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1208
|
+
const argumentsTypes = [
|
|
1209
|
+
null,
|
|
1210
|
+
null,
|
|
1211
|
+
null,
|
|
1212
|
+
null,
|
|
1213
|
+
null,
|
|
1214
|
+
'u64',
|
|
1215
|
+
'u64',
|
|
1216
|
+
'u64',
|
|
1217
|
+
'u64',
|
|
1218
|
+
'u64',
|
|
1219
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1220
|
+
'0x2::clock::Clock',
|
|
1221
|
+
] satisfies (string | null)[];
|
|
1222
|
+
const parameterNames = [
|
|
1223
|
+
'market',
|
|
1224
|
+
'wrapper',
|
|
1225
|
+
'auth',
|
|
1226
|
+
'config',
|
|
1227
|
+
'pricer',
|
|
1228
|
+
'lowerTick',
|
|
1229
|
+
'higherTick',
|
|
1230
|
+
'maxPremium',
|
|
1231
|
+
'minQuantity',
|
|
1232
|
+
'maxCost',
|
|
1233
|
+
];
|
|
1234
|
+
return (tx: Transaction) =>
|
|
1235
|
+
tx.moveCall({
|
|
1236
|
+
package: packageAddress,
|
|
1237
|
+
module: 'expiry_market',
|
|
1238
|
+
function: 'mint_exact_amount',
|
|
1239
|
+
arguments: normalizeMoveArguments(
|
|
1240
|
+
{
|
|
1241
|
+
...options.arguments,
|
|
1242
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1243
|
+
},
|
|
1244
|
+
argumentsTypes,
|
|
1245
|
+
parameterNames,
|
|
1246
|
+
),
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
export interface RedeemLiveArguments {
|
|
1250
|
+
market: RawTransactionArgument<string>;
|
|
1251
|
+
wrapper: RawTransactionArgument<string>;
|
|
1252
|
+
auth: TransactionArgument;
|
|
1253
|
+
config?: RawTransactionArgument<string>;
|
|
1254
|
+
pricer: TransactionArgument;
|
|
1255
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
1256
|
+
closeQuantity: RawTransactionArgument<number | bigint>;
|
|
1257
|
+
minProbability: RawTransactionArgument<number | bigint>;
|
|
1258
|
+
minProceeds: RawTransactionArgument<number | bigint>;
|
|
1259
|
+
}
|
|
1260
|
+
export interface RedeemLiveOptions {
|
|
1261
|
+
package?: string;
|
|
1262
|
+
arguments: RedeemLiveArguments;
|
|
1263
|
+
config?: {
|
|
1264
|
+
protocolConfig: ConfigValue;
|
|
1265
|
+
predictPackageId?: string;
|
|
1266
|
+
};
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Redeem a live order you hold account authority over.
|
|
1270
|
+
*
|
|
1271
|
+
* A live order is priced and closed (partial or full). Settled orders must use
|
|
1272
|
+
* `redeem_settled`. Returns a replacement order ID only when a partial close
|
|
1273
|
+
* leaves quantity open.
|
|
1274
|
+
*
|
|
1275
|
+
* Two close-side slippage floors, the mirror of mint's `max_probability` /
|
|
1276
|
+
* `max_cost` pair; pass `0` to disable either. `min_probability` floors the quoted
|
|
1277
|
+
* per-contract range probability (same units as mint's `max_probability`).
|
|
1278
|
+
* `min_proceeds` floors the all-in net DUSDC credited to the account
|
|
1279
|
+
* (`redeem_amount` minus trading fee, builder fee, and EWMA penalty), the mirror
|
|
1280
|
+
* of mint's all-in `max_cost`.
|
|
1281
|
+
*/
|
|
1282
|
+
export function redeemLive(options: RedeemLiveOptions) {
|
|
1283
|
+
const packageAddress =
|
|
1284
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1285
|
+
const argumentsTypes = [
|
|
1286
|
+
null,
|
|
1287
|
+
null,
|
|
1288
|
+
null,
|
|
1289
|
+
null,
|
|
1290
|
+
null,
|
|
1291
|
+
'u256',
|
|
1292
|
+
'u64',
|
|
1293
|
+
'u64',
|
|
1294
|
+
'u64',
|
|
1295
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1296
|
+
'0x2::clock::Clock',
|
|
1297
|
+
] satisfies (string | null)[];
|
|
1298
|
+
const parameterNames = [
|
|
1299
|
+
'market',
|
|
1300
|
+
'wrapper',
|
|
1301
|
+
'auth',
|
|
1302
|
+
'config',
|
|
1303
|
+
'pricer',
|
|
1304
|
+
'orderId',
|
|
1305
|
+
'closeQuantity',
|
|
1306
|
+
'minProbability',
|
|
1307
|
+
'minProceeds',
|
|
1308
|
+
];
|
|
1309
|
+
return (tx: Transaction) =>
|
|
1310
|
+
tx.moveCall({
|
|
1311
|
+
package: packageAddress,
|
|
1312
|
+
module: 'expiry_market',
|
|
1313
|
+
function: 'redeem_live',
|
|
1314
|
+
arguments: normalizeMoveArguments(
|
|
1315
|
+
{
|
|
1316
|
+
...options.arguments,
|
|
1317
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1318
|
+
},
|
|
1319
|
+
argumentsTypes,
|
|
1320
|
+
parameterNames,
|
|
1321
|
+
),
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
export interface RedeemSettledArguments {
|
|
1325
|
+
market: RawTransactionArgument<string>;
|
|
1326
|
+
wrapper: RawTransactionArgument<string>;
|
|
1327
|
+
auth: TransactionArgument;
|
|
1328
|
+
config?: RawTransactionArgument<string>;
|
|
1329
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
1330
|
+
}
|
|
1331
|
+
export interface RedeemSettledOptions {
|
|
1332
|
+
package?: string;
|
|
1333
|
+
arguments: RedeemSettledArguments;
|
|
1334
|
+
config?: {
|
|
1335
|
+
protocolConfig: ConfigValue;
|
|
1336
|
+
predictPackageId?: string;
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Redeem a settled order you hold account authority over.
|
|
1341
|
+
*
|
|
1342
|
+
* The market must be settled already; this flow does not run live pricing.
|
|
1343
|
+
* Explicit owner auth remains available when Predict app automation is
|
|
1344
|
+
* deauthorized; another authorized app may also supply valid account auth.
|
|
1345
|
+
*/
|
|
1346
|
+
export function redeemSettled(options: RedeemSettledOptions) {
|
|
1347
|
+
const packageAddress =
|
|
1348
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1349
|
+
const argumentsTypes = [
|
|
1350
|
+
null,
|
|
1351
|
+
null,
|
|
1352
|
+
null,
|
|
1353
|
+
null,
|
|
1354
|
+
'u256',
|
|
1355
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1356
|
+
'0x2::clock::Clock',
|
|
1357
|
+
] satisfies (string | null)[];
|
|
1358
|
+
const parameterNames = ['market', 'wrapper', 'auth', 'config', 'orderId'];
|
|
1359
|
+
return (tx: Transaction) =>
|
|
1360
|
+
tx.moveCall({
|
|
1361
|
+
package: packageAddress,
|
|
1362
|
+
module: 'expiry_market',
|
|
1363
|
+
function: 'redeem_settled',
|
|
1364
|
+
arguments: normalizeMoveArguments(
|
|
1365
|
+
{
|
|
1366
|
+
...options.arguments,
|
|
1367
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1368
|
+
},
|
|
1369
|
+
argumentsTypes,
|
|
1370
|
+
parameterNames,
|
|
1371
|
+
),
|
|
1372
|
+
});
|
|
1373
|
+
}
|
|
1374
|
+
export interface RedeemSettledPermissionlessArguments {
|
|
1375
|
+
market: RawTransactionArgument<string>;
|
|
1376
|
+
accountRegistry: RawTransactionArgument<string>;
|
|
1377
|
+
wrapper: RawTransactionArgument<string>;
|
|
1378
|
+
config?: RawTransactionArgument<string>;
|
|
1379
|
+
orderId: RawTransactionArgument<number | bigint>;
|
|
1380
|
+
}
|
|
1381
|
+
export interface RedeemSettledPermissionlessOptions {
|
|
1382
|
+
package?: string;
|
|
1383
|
+
arguments: RedeemSettledPermissionlessArguments;
|
|
1384
|
+
config?: {
|
|
1385
|
+
protocolConfig: ConfigValue;
|
|
1386
|
+
predictPackageId?: string;
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
/**
|
|
1390
|
+
* Permissionlessly redeem a settled order without account-owner authority.
|
|
1391
|
+
*
|
|
1392
|
+
* This keeper path uses Predict app-auth from the account registry, so
|
|
1393
|
+
* `deauthorize_app<PredictApp>` disables this automation. Owners can still use
|
|
1394
|
+
* `redeem_settled` with owner auth to redeem their own settled positions.
|
|
1395
|
+
*/
|
|
1396
|
+
export function redeemSettledPermissionless(options: RedeemSettledPermissionlessOptions) {
|
|
1397
|
+
const packageAddress =
|
|
1398
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1399
|
+
const argumentsTypes = [
|
|
1400
|
+
null,
|
|
1401
|
+
null,
|
|
1402
|
+
null,
|
|
1403
|
+
null,
|
|
1404
|
+
'u256',
|
|
1405
|
+
'0x2::accumulator::AccumulatorRoot',
|
|
1406
|
+
'0x2::clock::Clock',
|
|
1407
|
+
] satisfies (string | null)[];
|
|
1408
|
+
const parameterNames = ['market', 'accountRegistry', 'wrapper', 'config', 'orderId'];
|
|
1409
|
+
return (tx: Transaction) =>
|
|
1410
|
+
tx.moveCall({
|
|
1411
|
+
package: packageAddress,
|
|
1412
|
+
module: 'expiry_market',
|
|
1413
|
+
function: 'redeem_settled_permissionless',
|
|
1414
|
+
arguments: normalizeMoveArguments(
|
|
1415
|
+
{
|
|
1416
|
+
...options.arguments,
|
|
1417
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1418
|
+
},
|
|
1419
|
+
argumentsTypes,
|
|
1420
|
+
parameterNames,
|
|
1421
|
+
),
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
export interface SetReferenceTickArguments {
|
|
1425
|
+
market: RawTransactionArgument<string>;
|
|
1426
|
+
config?: RawTransactionArgument<string>;
|
|
1427
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
1428
|
+
pyth: RawTransactionArgument<string>;
|
|
1429
|
+
}
|
|
1430
|
+
export interface SetReferenceTickOptions {
|
|
1431
|
+
package?: string;
|
|
1432
|
+
arguments: SetReferenceTickArguments;
|
|
1433
|
+
config?: {
|
|
1434
|
+
protocolConfig: ConfigValue;
|
|
1435
|
+
oracleRegistry: ConfigValue;
|
|
1436
|
+
predictPackageId?: string;
|
|
1437
|
+
};
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Set this expiry's reference fine-grid tick from the exact previous-window
|
|
1441
|
+
* Propbook Pyth observation. The source observation must be inserted into the feed
|
|
1442
|
+
* at `reference_tick_source_timestamp_ms` before this call, and the normalized
|
|
1443
|
+
* spot is floored to the market's `tick_size`.
|
|
1444
|
+
*/
|
|
1445
|
+
export function setReferenceTick(options: SetReferenceTickOptions) {
|
|
1446
|
+
const packageAddress =
|
|
1447
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1448
|
+
const argumentsTypes = [null, null, null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
1449
|
+
const parameterNames = ['market', 'config', 'propbookRegistry', 'pyth'];
|
|
1450
|
+
return (tx: Transaction) =>
|
|
1451
|
+
tx.moveCall({
|
|
1452
|
+
package: packageAddress,
|
|
1453
|
+
module: 'expiry_market',
|
|
1454
|
+
function: 'set_reference_tick',
|
|
1455
|
+
arguments: normalizeMoveArguments(
|
|
1456
|
+
{
|
|
1457
|
+
...options.arguments,
|
|
1458
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1459
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
1460
|
+
},
|
|
1461
|
+
argumentsTypes,
|
|
1462
|
+
parameterNames,
|
|
1463
|
+
),
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
export interface SetMintPausedArguments {
|
|
1467
|
+
market: RawTransactionArgument<string>;
|
|
1468
|
+
config?: RawTransactionArgument<string>;
|
|
1469
|
+
AdminCap: RawTransactionArgument<string>;
|
|
1470
|
+
paused: RawTransactionArgument<boolean>;
|
|
1471
|
+
}
|
|
1472
|
+
export interface SetMintPausedOptions {
|
|
1473
|
+
package?: string;
|
|
1474
|
+
arguments: SetMintPausedArguments;
|
|
1475
|
+
config?: {
|
|
1476
|
+
protocolConfig: ConfigValue;
|
|
1477
|
+
predictPackageId?: string;
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* Set whether new mints are paused on this expiry market. Admin-only and
|
|
1482
|
+
* version-gated. A `PauseCap` holder can force-engage the pause one-way under a
|
|
1483
|
+
* version freeze via `registry::pause_expiry_market_mint_pause_cap`.
|
|
1484
|
+
*/
|
|
1485
|
+
export function setMintPaused(options: SetMintPausedOptions) {
|
|
1486
|
+
const packageAddress =
|
|
1487
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1488
|
+
const argumentsTypes = [null, null, null, 'bool'] satisfies (string | null)[];
|
|
1489
|
+
const parameterNames = ['market', 'config', 'AdminCap', 'paused'];
|
|
1490
|
+
return (tx: Transaction) =>
|
|
1491
|
+
tx.moveCall({
|
|
1492
|
+
package: packageAddress,
|
|
1493
|
+
module: 'expiry_market',
|
|
1494
|
+
function: 'set_mint_paused',
|
|
1495
|
+
arguments: normalizeMoveArguments(
|
|
1496
|
+
{
|
|
1497
|
+
...options.arguments,
|
|
1498
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1499
|
+
},
|
|
1500
|
+
argumentsTypes,
|
|
1501
|
+
parameterNames,
|
|
1502
|
+
),
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
export interface TrySettleArguments {
|
|
1506
|
+
market: RawTransactionArgument<string>;
|
|
1507
|
+
config?: RawTransactionArgument<string>;
|
|
1508
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
1509
|
+
pyth: RawTransactionArgument<string>;
|
|
1510
|
+
bsValues: RawTransactionArgument<string>;
|
|
1511
|
+
}
|
|
1512
|
+
export interface TrySettleOptions {
|
|
1513
|
+
package?: string;
|
|
1514
|
+
arguments: TrySettleArguments;
|
|
1515
|
+
config?: {
|
|
1516
|
+
protocolConfig: ConfigValue;
|
|
1517
|
+
oracleRegistry: ConfigValue;
|
|
1518
|
+
predictPackageId?: string;
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Settle from Propbook's exact positive Pyth spot at expiry, or from the exact
|
|
1523
|
+
* Block Scholes minute-boundary spot when Pyth remains unavailable after the
|
|
1524
|
+
* compiled grace period. Permissionless and idempotent; missing or unusable
|
|
1525
|
+
* observations leave the market unsettled.
|
|
1526
|
+
*/
|
|
1527
|
+
export function trySettle(options: TrySettleOptions) {
|
|
1528
|
+
const packageAddress =
|
|
1529
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
1530
|
+
const argumentsTypes = [null, null, null, null, null, '0x2::clock::Clock'] satisfies (
|
|
1531
|
+
string | null
|
|
1532
|
+
)[];
|
|
1533
|
+
const parameterNames = ['market', 'config', 'propbookRegistry', 'pyth', 'bsValues'];
|
|
1534
|
+
return (tx: Transaction) =>
|
|
1535
|
+
tx.moveCall({
|
|
1536
|
+
package: packageAddress,
|
|
1537
|
+
module: 'expiry_market',
|
|
1538
|
+
function: 'try_settle',
|
|
1539
|
+
arguments: normalizeMoveArguments(
|
|
1540
|
+
{
|
|
1541
|
+
...options.arguments,
|
|
1542
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
1543
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
1544
|
+
},
|
|
1545
|
+
argumentsTypes,
|
|
1546
|
+
parameterNames,
|
|
1547
|
+
),
|
|
1548
|
+
});
|
|
1549
|
+
}
|