@mysten/deepbook-v3 2.0.0 → 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 +100 -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/balance_manager.mjs.map +1 -1
- package/dist/contracts/deepbook/balances.d.mts +4 -4
- package/dist/contracts/deepbook/balances.d.mts.map +1 -1
- 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/pool.mjs.map +1 -1
- package/dist/contracts/deepbook/registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_manager_upgraded.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_pool.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/margin_registry.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/pool_proxy.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/protocol_config.mjs.map +1 -1
- package/dist/contracts/deepbook_margin/tpsl.mjs.map +1 -1
- 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/margin_liquidation/liquidation_vault.mjs.map +1 -1
- 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/deepbook.d.mts +20 -20
- package/dist/transactions/deepbookAdmin.d.mts +4 -4
- package/dist/transactions/deepbookAdmin.d.mts.map +1 -1
- package/dist/transactions/marginAdmin.d.mts +7 -7
- package/dist/transactions/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/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/constants.d.mts.map +1 -1
- package/dist/utils/constants.mjs +1 -1
- package/dist/utils/constants.mjs.map +1 -1
- package/package.json +33 -12
- 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/balance_manager.ts +1 -2
- package/src/contracts/deepbook/pool.ts +12 -24
- package/src/contracts/deepbook/registry.ts +1 -2
- package/src/contracts/deepbook_margin/margin_manager.ts +9 -18
- package/src/contracts/deepbook_margin/margin_manager_upgraded.ts +5 -10
- package/src/contracts/deepbook_margin/margin_pool.ts +2 -4
- package/src/contracts/deepbook_margin/margin_registry.ts +3 -6
- package/src/contracts/deepbook_margin/pool_proxy.ts +3 -6
- package/src/contracts/deepbook_margin/protocol_config.ts +1 -2
- package/src/contracts/deepbook_margin/tpsl.ts +1 -2
- 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/margin_liquidation/liquidation_vault.ts +2 -4
- 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/contracts/pyth/pyth.ts +2 -4
- 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/src/types/index.ts +1 -2
- package/src/utils/constants.ts +1 -7
- package/dist/types/bcs.mjs +0 -7
|
@@ -0,0 +1,694 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Registry and creation entrypoints for the Predict protocol.
|
|
7
|
+
*
|
|
8
|
+
* This module creates shared setup objects, owns registry-level capabilities, and
|
|
9
|
+
* exposes registry-owned governance/creation entrypoints. Market identity, cadence
|
|
10
|
+
* policy, underlying watermarks, and market uniqueness live in the embedded
|
|
11
|
+
* `market_manager`. Runtime pool accounting, expiry risk, oracle feeds, and user
|
|
12
|
+
* positions stay in their owning modules.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
MoveStruct,
|
|
17
|
+
normalizeMoveArguments,
|
|
18
|
+
type RawTransactionArgument,
|
|
19
|
+
type ConfigValue,
|
|
20
|
+
} from '../utils/index.js';
|
|
21
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
22
|
+
import { type Transaction } from '@mysten/sui/transactions';
|
|
23
|
+
import * as market_manager from './market_manager.js';
|
|
24
|
+
import * as vec_set from './deps/sui/vec_set.js';
|
|
25
|
+
const $moduleName = '@local-pkg/deepbook_predict::registry';
|
|
26
|
+
export const Registry = new MoveStruct({
|
|
27
|
+
name: `${$moduleName}::Registry`,
|
|
28
|
+
fields: {
|
|
29
|
+
id: bcs.Address,
|
|
30
|
+
/**
|
|
31
|
+
* Market identity, cadence deployment terms, underlying watermarks, and
|
|
32
|
+
* uniqueness.
|
|
33
|
+
*/
|
|
34
|
+
market_manager: market_manager.MarketManager,
|
|
35
|
+
/**
|
|
36
|
+
* IDs of `PauseCap` objects currently authorized to use pause-only entries. Admin
|
|
37
|
+
* mints into this set and revokes from it.
|
|
38
|
+
*/
|
|
39
|
+
allowed_pause_caps: vec_set.VecSet(bcs.Address),
|
|
40
|
+
/**
|
|
41
|
+
* IDs of `MarketLifecycleCap` objects currently authorized for privileged
|
|
42
|
+
* lifecycle entries such as market creation and full-pool valuation. Admin mints
|
|
43
|
+
* into this set and revokes from it.
|
|
44
|
+
*/
|
|
45
|
+
allowed_lifecycle_caps: vec_set.VecSet(bcs.Address),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
export interface IdArguments {
|
|
49
|
+
registry?: RawTransactionArgument<string>;
|
|
50
|
+
}
|
|
51
|
+
export interface IdOptions {
|
|
52
|
+
package?: string;
|
|
53
|
+
arguments?: IdArguments;
|
|
54
|
+
config?: {
|
|
55
|
+
registry: ConfigValue;
|
|
56
|
+
predictPackageId?: string;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/** Return the registry object ID for external discovery and PTB construction. */
|
|
60
|
+
export function id(options: IdOptions) {
|
|
61
|
+
const packageAddress =
|
|
62
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
63
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
64
|
+
const parameterNames = ['registry'];
|
|
65
|
+
return (tx: Transaction) =>
|
|
66
|
+
tx.moveCall({
|
|
67
|
+
package: packageAddress,
|
|
68
|
+
module: 'registry',
|
|
69
|
+
function: 'id',
|
|
70
|
+
arguments: normalizeMoveArguments(
|
|
71
|
+
{
|
|
72
|
+
...options.arguments,
|
|
73
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
74
|
+
},
|
|
75
|
+
argumentsTypes,
|
|
76
|
+
parameterNames,
|
|
77
|
+
),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
export interface ExpiryMarketIdArguments {
|
|
81
|
+
registry?: RawTransactionArgument<string>;
|
|
82
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
83
|
+
expiry: RawTransactionArgument<number | bigint>;
|
|
84
|
+
}
|
|
85
|
+
export interface ExpiryMarketIdOptions {
|
|
86
|
+
package?: string;
|
|
87
|
+
arguments: ExpiryMarketIdArguments;
|
|
88
|
+
config?: {
|
|
89
|
+
registry: ConfigValue;
|
|
90
|
+
predictPackageId?: string;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Resolve an expiry market ID for external discovery and PTB construction. */
|
|
94
|
+
export function expiryMarketId(options: ExpiryMarketIdOptions) {
|
|
95
|
+
const packageAddress =
|
|
96
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
97
|
+
const argumentsTypes = [null, 'u32', 'u64'] satisfies (string | null)[];
|
|
98
|
+
const parameterNames = ['registry', 'propbookUnderlyingId', 'expiry'];
|
|
99
|
+
return (tx: Transaction) =>
|
|
100
|
+
tx.moveCall({
|
|
101
|
+
package: packageAddress,
|
|
102
|
+
module: 'registry',
|
|
103
|
+
function: 'expiry_market_id',
|
|
104
|
+
arguments: normalizeMoveArguments(
|
|
105
|
+
{
|
|
106
|
+
...options.arguments,
|
|
107
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
108
|
+
},
|
|
109
|
+
argumentsTypes,
|
|
110
|
+
parameterNames,
|
|
111
|
+
),
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export interface CadenceConfigArguments {
|
|
115
|
+
registry?: RawTransactionArgument<string>;
|
|
116
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
117
|
+
cadenceId: RawTransactionArgument<number>;
|
|
118
|
+
}
|
|
119
|
+
export interface CadenceConfigOptions {
|
|
120
|
+
package?: string;
|
|
121
|
+
arguments: CadenceConfigArguments;
|
|
122
|
+
config?: {
|
|
123
|
+
registry: ConfigValue;
|
|
124
|
+
predictPackageId?: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/** Return deployment policy for SDK and devInspect market discovery. */
|
|
128
|
+
export function cadenceConfig(options: CadenceConfigOptions) {
|
|
129
|
+
const packageAddress =
|
|
130
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
131
|
+
const argumentsTypes = [null, 'u32', 'u8'] satisfies (string | null)[];
|
|
132
|
+
const parameterNames = ['registry', 'propbookUnderlyingId', 'cadenceId'];
|
|
133
|
+
return (tx: Transaction) =>
|
|
134
|
+
tx.moveCall({
|
|
135
|
+
package: packageAddress,
|
|
136
|
+
module: 'registry',
|
|
137
|
+
function: 'cadence_config',
|
|
138
|
+
arguments: normalizeMoveArguments(
|
|
139
|
+
{
|
|
140
|
+
...options.arguments,
|
|
141
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
142
|
+
},
|
|
143
|
+
argumentsTypes,
|
|
144
|
+
parameterNames,
|
|
145
|
+
),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
export interface CadenceConfigsArguments {
|
|
149
|
+
registry?: RawTransactionArgument<string>;
|
|
150
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
151
|
+
}
|
|
152
|
+
export interface CadenceConfigsOptions {
|
|
153
|
+
package?: string;
|
|
154
|
+
arguments: CadenceConfigsArguments;
|
|
155
|
+
config?: {
|
|
156
|
+
registry: ConfigValue;
|
|
157
|
+
predictPackageId?: string;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Return one underlying's complete deployment policy as a single coherent
|
|
162
|
+
* snapshot, for off-chain consumers (SDK and devInspect cadence discovery by the
|
|
163
|
+
* keeper, price updater, and dashboard) that would otherwise need one read per
|
|
164
|
+
* cadence. The vector holds one entry per supported cadence, indexed by cadence
|
|
165
|
+
* ID; disabled cadences are present as their all-zero configuration. Aborts if the
|
|
166
|
+
* underlying is not registered.
|
|
167
|
+
*/
|
|
168
|
+
export function cadenceConfigs(options: CadenceConfigsOptions) {
|
|
169
|
+
const packageAddress =
|
|
170
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
171
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
172
|
+
const parameterNames = ['registry', 'propbookUnderlyingId'];
|
|
173
|
+
return (tx: Transaction) =>
|
|
174
|
+
tx.moveCall({
|
|
175
|
+
package: packageAddress,
|
|
176
|
+
module: 'registry',
|
|
177
|
+
function: 'cadence_configs',
|
|
178
|
+
arguments: normalizeMoveArguments(
|
|
179
|
+
{
|
|
180
|
+
...options.arguments,
|
|
181
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
182
|
+
},
|
|
183
|
+
argumentsTypes,
|
|
184
|
+
parameterNames,
|
|
185
|
+
),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
export interface MintPauseCapArguments {
|
|
189
|
+
registry?: RawTransactionArgument<string>;
|
|
190
|
+
AdminCap: RawTransactionArgument<string>;
|
|
191
|
+
}
|
|
192
|
+
export interface MintPauseCapOptions {
|
|
193
|
+
package?: string;
|
|
194
|
+
arguments: MintPauseCapArguments;
|
|
195
|
+
config?: {
|
|
196
|
+
registry: ConfigValue;
|
|
197
|
+
predictPackageId?: string;
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Mint a new `PauseCap`. This bypasses the version gate so emergency pause
|
|
202
|
+
* authority remains available from a package version below the runtime floor.
|
|
203
|
+
*/
|
|
204
|
+
export function mintPauseCap(options: MintPauseCapOptions) {
|
|
205
|
+
const packageAddress =
|
|
206
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
207
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
208
|
+
const parameterNames = ['registry', 'AdminCap'];
|
|
209
|
+
return (tx: Transaction) =>
|
|
210
|
+
tx.moveCall({
|
|
211
|
+
package: packageAddress,
|
|
212
|
+
module: 'registry',
|
|
213
|
+
function: 'mint_pause_cap',
|
|
214
|
+
arguments: normalizeMoveArguments(
|
|
215
|
+
{
|
|
216
|
+
...options.arguments,
|
|
217
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
218
|
+
},
|
|
219
|
+
argumentsTypes,
|
|
220
|
+
parameterNames,
|
|
221
|
+
),
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export interface RevokePauseCapArguments {
|
|
225
|
+
registry?: RawTransactionArgument<string>;
|
|
226
|
+
AdminCap: RawTransactionArgument<string>;
|
|
227
|
+
pauseCapId: RawTransactionArgument<string>;
|
|
228
|
+
}
|
|
229
|
+
export interface RevokePauseCapOptions {
|
|
230
|
+
package?: string;
|
|
231
|
+
arguments: RevokePauseCapArguments;
|
|
232
|
+
config?: {
|
|
233
|
+
registry: ConfigValue;
|
|
234
|
+
predictPackageId?: string;
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
/** Revoke a previously minted `PauseCap` by ID. Admin-only. */
|
|
238
|
+
export function revokePauseCap(options: RevokePauseCapOptions) {
|
|
239
|
+
const packageAddress =
|
|
240
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
241
|
+
const argumentsTypes = [null, null, '0x2::object::ID'] satisfies (string | null)[];
|
|
242
|
+
const parameterNames = ['registry', 'AdminCap', 'pauseCapId'];
|
|
243
|
+
return (tx: Transaction) =>
|
|
244
|
+
tx.moveCall({
|
|
245
|
+
package: packageAddress,
|
|
246
|
+
module: 'registry',
|
|
247
|
+
function: 'revoke_pause_cap',
|
|
248
|
+
arguments: normalizeMoveArguments(
|
|
249
|
+
{
|
|
250
|
+
...options.arguments,
|
|
251
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
252
|
+
},
|
|
253
|
+
argumentsTypes,
|
|
254
|
+
parameterNames,
|
|
255
|
+
),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export interface MintLifecycleCapArguments {
|
|
259
|
+
registry?: RawTransactionArgument<string>;
|
|
260
|
+
config?: RawTransactionArgument<string>;
|
|
261
|
+
AdminCap: RawTransactionArgument<string>;
|
|
262
|
+
}
|
|
263
|
+
export interface MintLifecycleCapOptions {
|
|
264
|
+
package?: string;
|
|
265
|
+
arguments: MintLifecycleCapArguments;
|
|
266
|
+
config?: {
|
|
267
|
+
registry: ConfigValue;
|
|
268
|
+
protocolConfig: ConfigValue;
|
|
269
|
+
predictPackageId?: string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Mint a version-gated `MarketLifecycleCap` with market-creation and valuation
|
|
274
|
+
* authority.
|
|
275
|
+
*/
|
|
276
|
+
export function mintLifecycleCap(options: MintLifecycleCapOptions) {
|
|
277
|
+
const packageAddress =
|
|
278
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
279
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
280
|
+
const parameterNames = ['registry', 'config', 'AdminCap'];
|
|
281
|
+
return (tx: Transaction) =>
|
|
282
|
+
tx.moveCall({
|
|
283
|
+
package: packageAddress,
|
|
284
|
+
module: 'registry',
|
|
285
|
+
function: 'mint_lifecycle_cap',
|
|
286
|
+
arguments: normalizeMoveArguments(
|
|
287
|
+
{
|
|
288
|
+
...options.arguments,
|
|
289
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
290
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
291
|
+
},
|
|
292
|
+
argumentsTypes,
|
|
293
|
+
parameterNames,
|
|
294
|
+
),
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
export interface RevokeLifecycleCapArguments {
|
|
298
|
+
registry?: RawTransactionArgument<string>;
|
|
299
|
+
AdminCap: RawTransactionArgument<string>;
|
|
300
|
+
lifecycleCapId: RawTransactionArgument<string>;
|
|
301
|
+
}
|
|
302
|
+
export interface RevokeLifecycleCapOptions {
|
|
303
|
+
package?: string;
|
|
304
|
+
arguments: RevokeLifecycleCapArguments;
|
|
305
|
+
config?: {
|
|
306
|
+
registry: ConfigValue;
|
|
307
|
+
predictPackageId?: string;
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
/** Revoke a `MarketLifecycleCap` by ID without applying the version gate. */
|
|
311
|
+
export function revokeLifecycleCap(options: RevokeLifecycleCapOptions) {
|
|
312
|
+
const packageAddress =
|
|
313
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
314
|
+
const argumentsTypes = [null, null, '0x2::object::ID'] satisfies (string | null)[];
|
|
315
|
+
const parameterNames = ['registry', 'AdminCap', 'lifecycleCapId'];
|
|
316
|
+
return (tx: Transaction) =>
|
|
317
|
+
tx.moveCall({
|
|
318
|
+
package: packageAddress,
|
|
319
|
+
module: 'registry',
|
|
320
|
+
function: 'revoke_lifecycle_cap',
|
|
321
|
+
arguments: normalizeMoveArguments(
|
|
322
|
+
{
|
|
323
|
+
...options.arguments,
|
|
324
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
325
|
+
},
|
|
326
|
+
argumentsTypes,
|
|
327
|
+
parameterNames,
|
|
328
|
+
),
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
export interface GenerateLifecycleProofArguments {
|
|
332
|
+
registry?: RawTransactionArgument<string>;
|
|
333
|
+
lifecycleCap: RawTransactionArgument<string>;
|
|
334
|
+
}
|
|
335
|
+
export interface GenerateLifecycleProofOptions {
|
|
336
|
+
package?: string;
|
|
337
|
+
arguments: GenerateLifecycleProofArguments;
|
|
338
|
+
config?: {
|
|
339
|
+
registry: ConfigValue;
|
|
340
|
+
predictPackageId?: string;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Generate a transaction-local proof that `lifecycle_cap` is currently
|
|
345
|
+
* allowlisted. Consumers take the proof by value so a revoked lifecycle cap cannot
|
|
346
|
+
* authorize cross-module lifecycle actions.
|
|
347
|
+
*/
|
|
348
|
+
export function generateLifecycleProof(options: GenerateLifecycleProofOptions) {
|
|
349
|
+
const packageAddress =
|
|
350
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
351
|
+
const argumentsTypes = [null, null] satisfies (string | null)[];
|
|
352
|
+
const parameterNames = ['registry', 'lifecycleCap'];
|
|
353
|
+
return (tx: Transaction) =>
|
|
354
|
+
tx.moveCall({
|
|
355
|
+
package: packageAddress,
|
|
356
|
+
module: 'registry',
|
|
357
|
+
function: 'generate_lifecycle_proof',
|
|
358
|
+
arguments: normalizeMoveArguments(
|
|
359
|
+
{
|
|
360
|
+
...options.arguments,
|
|
361
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
362
|
+
},
|
|
363
|
+
argumentsTypes,
|
|
364
|
+
parameterNames,
|
|
365
|
+
),
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
export interface PauseTradingPauseCapArguments {
|
|
369
|
+
config?: RawTransactionArgument<string>;
|
|
370
|
+
registry?: RawTransactionArgument<string>;
|
|
371
|
+
pauseCap: RawTransactionArgument<string>;
|
|
372
|
+
}
|
|
373
|
+
export interface PauseTradingPauseCapOptions {
|
|
374
|
+
package?: string;
|
|
375
|
+
arguments: PauseTradingPauseCapArguments;
|
|
376
|
+
config?: {
|
|
377
|
+
protocolConfig: ConfigValue;
|
|
378
|
+
registry: ConfigValue;
|
|
379
|
+
predictPackageId?: string;
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
/** Force `trading_paused = true` via a valid `PauseCap`. One-way. */
|
|
383
|
+
export function pauseTradingPauseCap(options: PauseTradingPauseCapOptions) {
|
|
384
|
+
const packageAddress =
|
|
385
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
386
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
387
|
+
const parameterNames = ['config', 'registry', 'pauseCap'];
|
|
388
|
+
return (tx: Transaction) =>
|
|
389
|
+
tx.moveCall({
|
|
390
|
+
package: packageAddress,
|
|
391
|
+
module: 'registry',
|
|
392
|
+
function: 'pause_trading_pause_cap',
|
|
393
|
+
arguments: normalizeMoveArguments(
|
|
394
|
+
{
|
|
395
|
+
...options.arguments,
|
|
396
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
397
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
398
|
+
},
|
|
399
|
+
argumentsTypes,
|
|
400
|
+
parameterNames,
|
|
401
|
+
),
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
export interface FreezeProtocolPauseCapArguments {
|
|
405
|
+
config?: RawTransactionArgument<string>;
|
|
406
|
+
registry?: RawTransactionArgument<string>;
|
|
407
|
+
pauseCap: RawTransactionArgument<string>;
|
|
408
|
+
}
|
|
409
|
+
export interface FreezeProtocolPauseCapOptions {
|
|
410
|
+
package?: string;
|
|
411
|
+
arguments: FreezeProtocolPauseCapArguments;
|
|
412
|
+
config?: {
|
|
413
|
+
protocolConfig: ConfigValue;
|
|
414
|
+
registry: ConfigValue;
|
|
415
|
+
predictPackageId?: string;
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Force the protocol-wide emergency freeze via a valid `PauseCap`. One-way;
|
|
420
|
+
* admin's `protocol_config::set_frozen` is needed to lift the freeze.
|
|
421
|
+
*/
|
|
422
|
+
export function freezeProtocolPauseCap(options: FreezeProtocolPauseCapOptions) {
|
|
423
|
+
const packageAddress =
|
|
424
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
425
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
426
|
+
const parameterNames = ['config', 'registry', 'pauseCap'];
|
|
427
|
+
return (tx: Transaction) =>
|
|
428
|
+
tx.moveCall({
|
|
429
|
+
package: packageAddress,
|
|
430
|
+
module: 'registry',
|
|
431
|
+
function: 'freeze_protocol_pause_cap',
|
|
432
|
+
arguments: normalizeMoveArguments(
|
|
433
|
+
{
|
|
434
|
+
...options.arguments,
|
|
435
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
436
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
437
|
+
},
|
|
438
|
+
argumentsTypes,
|
|
439
|
+
parameterNames,
|
|
440
|
+
),
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
export interface PauseExpiryMarketMintPauseCapArguments {
|
|
444
|
+
market: RawTransactionArgument<string>;
|
|
445
|
+
registry?: RawTransactionArgument<string>;
|
|
446
|
+
pauseCap: RawTransactionArgument<string>;
|
|
447
|
+
}
|
|
448
|
+
export interface PauseExpiryMarketMintPauseCapOptions {
|
|
449
|
+
package?: string;
|
|
450
|
+
arguments: PauseExpiryMarketMintPauseCapArguments;
|
|
451
|
+
config?: {
|
|
452
|
+
registry: ConfigValue;
|
|
453
|
+
predictPackageId?: string;
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Force `mint_paused = true` on a single expiry market via a valid `PauseCap`.
|
|
458
|
+
* One-way; admin's `expiry_market::set_mint_paused` is needed to unpause.
|
|
459
|
+
*/
|
|
460
|
+
export function pauseExpiryMarketMintPauseCap(options: PauseExpiryMarketMintPauseCapOptions) {
|
|
461
|
+
const packageAddress =
|
|
462
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
463
|
+
const argumentsTypes = [null, null, null] satisfies (string | null)[];
|
|
464
|
+
const parameterNames = ['market', 'registry', 'pauseCap'];
|
|
465
|
+
return (tx: Transaction) =>
|
|
466
|
+
tx.moveCall({
|
|
467
|
+
package: packageAddress,
|
|
468
|
+
module: 'registry',
|
|
469
|
+
function: 'pause_expiry_market_mint_pause_cap',
|
|
470
|
+
arguments: normalizeMoveArguments(
|
|
471
|
+
{
|
|
472
|
+
...options.arguments,
|
|
473
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
474
|
+
},
|
|
475
|
+
argumentsTypes,
|
|
476
|
+
parameterNames,
|
|
477
|
+
),
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
export interface RegisterUnderlyingArguments {
|
|
481
|
+
registry?: RawTransactionArgument<string>;
|
|
482
|
+
config?: RawTransactionArgument<string>;
|
|
483
|
+
AdminCap: RawTransactionArgument<string>;
|
|
484
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
485
|
+
}
|
|
486
|
+
export interface RegisterUnderlyingOptions {
|
|
487
|
+
package?: string;
|
|
488
|
+
arguments: RegisterUnderlyingArguments;
|
|
489
|
+
config?: {
|
|
490
|
+
registry: ConfigValue;
|
|
491
|
+
protocolConfig: ConfigValue;
|
|
492
|
+
predictPackageId?: string;
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Record admin approval of one Propbook underlying. Source IDs and canonical
|
|
497
|
+
* oracle object IDs remain owned by Propbook; this row only gates which
|
|
498
|
+
* underlyings Predict will build markets on and stores deployment watermarks.
|
|
499
|
+
*/
|
|
500
|
+
export function registerUnderlying(options: RegisterUnderlyingOptions) {
|
|
501
|
+
const packageAddress =
|
|
502
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
503
|
+
const argumentsTypes = [null, null, null, 'u32'] satisfies (string | null)[];
|
|
504
|
+
const parameterNames = ['registry', 'config', 'AdminCap', 'propbookUnderlyingId'];
|
|
505
|
+
return (tx: Transaction) =>
|
|
506
|
+
tx.moveCall({
|
|
507
|
+
package: packageAddress,
|
|
508
|
+
module: 'registry',
|
|
509
|
+
function: 'register_underlying',
|
|
510
|
+
arguments: normalizeMoveArguments(
|
|
511
|
+
{
|
|
512
|
+
...options.arguments,
|
|
513
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
514
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
515
|
+
},
|
|
516
|
+
argumentsTypes,
|
|
517
|
+
parameterNames,
|
|
518
|
+
),
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
export interface SetTemplateCadenceConfigArguments {
|
|
522
|
+
registry?: RawTransactionArgument<string>;
|
|
523
|
+
config?: RawTransactionArgument<string>;
|
|
524
|
+
AdminCap: RawTransactionArgument<string>;
|
|
525
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
526
|
+
cadenceId: RawTransactionArgument<number>;
|
|
527
|
+
tickSize: RawTransactionArgument<number | bigint>;
|
|
528
|
+
admissionTickSize: RawTransactionArgument<number | bigint>;
|
|
529
|
+
maxExpiryAllocation: RawTransactionArgument<number | bigint>;
|
|
530
|
+
initialExpiryCash: RawTransactionArgument<number | bigint>;
|
|
531
|
+
windowSize: RawTransactionArgument<number | bigint>;
|
|
532
|
+
}
|
|
533
|
+
export interface SetTemplateCadenceConfigOptions {
|
|
534
|
+
package?: string;
|
|
535
|
+
arguments: SetTemplateCadenceConfigArguments;
|
|
536
|
+
config?: {
|
|
537
|
+
registry: ConfigValue;
|
|
538
|
+
protocolConfig: ConfigValue;
|
|
539
|
+
predictPackageId?: string;
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* Set all deployment terms for one underlying's cadence. Passing zero for all five
|
|
544
|
+
* values disables the cadence; otherwise all values must be nonzero and valid.
|
|
545
|
+
*/
|
|
546
|
+
export function setTemplateCadenceConfig(options: SetTemplateCadenceConfigOptions) {
|
|
547
|
+
const packageAddress =
|
|
548
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
549
|
+
const argumentsTypes = [
|
|
550
|
+
null,
|
|
551
|
+
null,
|
|
552
|
+
null,
|
|
553
|
+
'u32',
|
|
554
|
+
'u8',
|
|
555
|
+
'u64',
|
|
556
|
+
'u64',
|
|
557
|
+
'u64',
|
|
558
|
+
'u64',
|
|
559
|
+
'u64',
|
|
560
|
+
] satisfies (string | null)[];
|
|
561
|
+
const parameterNames = [
|
|
562
|
+
'registry',
|
|
563
|
+
'config',
|
|
564
|
+
'AdminCap',
|
|
565
|
+
'propbookUnderlyingId',
|
|
566
|
+
'cadenceId',
|
|
567
|
+
'tickSize',
|
|
568
|
+
'admissionTickSize',
|
|
569
|
+
'maxExpiryAllocation',
|
|
570
|
+
'initialExpiryCash',
|
|
571
|
+
'windowSize',
|
|
572
|
+
];
|
|
573
|
+
return (tx: Transaction) =>
|
|
574
|
+
tx.moveCall({
|
|
575
|
+
package: packageAddress,
|
|
576
|
+
module: 'registry',
|
|
577
|
+
function: 'set_template_cadence_config',
|
|
578
|
+
arguments: normalizeMoveArguments(
|
|
579
|
+
{
|
|
580
|
+
...options.arguments,
|
|
581
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
582
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
583
|
+
},
|
|
584
|
+
argumentsTypes,
|
|
585
|
+
parameterNames,
|
|
586
|
+
),
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
export interface CreateAndShareExpiryMarketArguments {
|
|
590
|
+
registry?: RawTransactionArgument<string>;
|
|
591
|
+
poolVault?: RawTransactionArgument<string>;
|
|
592
|
+
config?: RawTransactionArgument<string>;
|
|
593
|
+
propbookRegistry?: RawTransactionArgument<string>;
|
|
594
|
+
lifecycleCap: RawTransactionArgument<string>;
|
|
595
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
596
|
+
cadenceId: RawTransactionArgument<number>;
|
|
597
|
+
}
|
|
598
|
+
export interface CreateAndShareExpiryMarketOptions {
|
|
599
|
+
package?: string;
|
|
600
|
+
arguments: CreateAndShareExpiryMarketArguments;
|
|
601
|
+
config?: {
|
|
602
|
+
registry: ConfigValue;
|
|
603
|
+
poolVault: ConfigValue;
|
|
604
|
+
protocolConfig: ConfigValue;
|
|
605
|
+
oracleRegistry: ConfigValue;
|
|
606
|
+
predictPackageId?: string;
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* Create the next deployable `ExpiryMarket` for one cadence on a Propbook
|
|
611
|
+
* underlying.
|
|
612
|
+
*
|
|
613
|
+
* Requires an allowlisted lifecycle capability, a registered underlying with all
|
|
614
|
+
* canonical feed objects bound, and an enabled cadence with a deployable slot.
|
|
615
|
+
* Higher-rank cadence overlaps and existing markets are skipped. The market
|
|
616
|
+
* snapshots cadence and expiry policy, starts with zero cash, and cannot mint
|
|
617
|
+
* until pool rebalancing funds it. Live pricing reads current Propbook bindings.
|
|
618
|
+
*/
|
|
619
|
+
export function createAndShareExpiryMarket(options: CreateAndShareExpiryMarketOptions) {
|
|
620
|
+
const packageAddress =
|
|
621
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
622
|
+
const argumentsTypes = [
|
|
623
|
+
null,
|
|
624
|
+
null,
|
|
625
|
+
null,
|
|
626
|
+
null,
|
|
627
|
+
null,
|
|
628
|
+
'u32',
|
|
629
|
+
'u8',
|
|
630
|
+
'0x2::clock::Clock',
|
|
631
|
+
] satisfies (string | null)[];
|
|
632
|
+
const parameterNames = [
|
|
633
|
+
'registry',
|
|
634
|
+
'poolVault',
|
|
635
|
+
'config',
|
|
636
|
+
'propbookRegistry',
|
|
637
|
+
'lifecycleCap',
|
|
638
|
+
'propbookUnderlyingId',
|
|
639
|
+
'cadenceId',
|
|
640
|
+
];
|
|
641
|
+
return (tx: Transaction) =>
|
|
642
|
+
tx.moveCall({
|
|
643
|
+
package: packageAddress,
|
|
644
|
+
module: 'registry',
|
|
645
|
+
function: 'create_and_share_expiry_market',
|
|
646
|
+
arguments: normalizeMoveArguments(
|
|
647
|
+
{
|
|
648
|
+
...options.arguments,
|
|
649
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
650
|
+
poolVault: options.arguments?.poolVault ?? options.config?.poolVault,
|
|
651
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
652
|
+
propbookRegistry: options.arguments?.propbookRegistry ?? options.config?.oracleRegistry,
|
|
653
|
+
},
|
|
654
|
+
argumentsTypes,
|
|
655
|
+
parameterNames,
|
|
656
|
+
),
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
export interface CreateAndShareBuilderCodeArguments {
|
|
660
|
+
registry?: RawTransactionArgument<string>;
|
|
661
|
+
config?: RawTransactionArgument<string>;
|
|
662
|
+
index: RawTransactionArgument<number | bigint>;
|
|
663
|
+
}
|
|
664
|
+
export interface CreateAndShareBuilderCodeOptions {
|
|
665
|
+
package?: string;
|
|
666
|
+
arguments: CreateAndShareBuilderCodeArguments;
|
|
667
|
+
config?: {
|
|
668
|
+
registry: ConfigValue;
|
|
669
|
+
protocolConfig: ConfigValue;
|
|
670
|
+
predictPackageId?: string;
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
/** Create a derived shared BuilderCode for the caller and index. */
|
|
674
|
+
export function createAndShareBuilderCode(options: CreateAndShareBuilderCodeOptions) {
|
|
675
|
+
const packageAddress =
|
|
676
|
+
options.package ?? options.config?.predictPackageId ?? '@local-pkg/deepbook_predict';
|
|
677
|
+
const argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];
|
|
678
|
+
const parameterNames = ['registry', 'config', 'index'];
|
|
679
|
+
return (tx: Transaction) =>
|
|
680
|
+
tx.moveCall({
|
|
681
|
+
package: packageAddress,
|
|
682
|
+
module: 'registry',
|
|
683
|
+
function: 'create_and_share_builder_code',
|
|
684
|
+
arguments: normalizeMoveArguments(
|
|
685
|
+
{
|
|
686
|
+
...options.arguments,
|
|
687
|
+
registry: options.arguments?.registry ?? options.config?.registry,
|
|
688
|
+
config: options.arguments?.config ?? options.config?.protocolConfig,
|
|
689
|
+
},
|
|
690
|
+
argumentsTypes,
|
|
691
|
+
parameterNames,
|
|
692
|
+
),
|
|
693
|
+
});
|
|
694
|
+
}
|