@mysten/deepbook-v3 2.0.1 → 2.1.4
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 +85 -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/client.d.mts +2 -2
- 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/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/marginTPSL.d.mts.map +1 -1
- package/dist/transactions/poolProxy.d.mts +8 -8
- package/dist/transactions/poolProxy.d.mts.map +1 -1
- package/package.json +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,596 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Owns Propbook's permissionless source catalog and admin-selected canonical
|
|
7
|
+
* oracle bindings. Registering a source creates its wrapper but does not make it
|
|
8
|
+
* canonical; a binding is the trust claim that the source represents a particular
|
|
9
|
+
* Propbook underlying and value kind. A source key can serve only one underlying
|
|
10
|
+
* for its lifetime, even after its active binding is replaced. Registry operations
|
|
11
|
+
* are not version-gated because each feed owns its write version and migration
|
|
12
|
+
* path.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
16
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
17
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
18
|
+
import * as table from './deps/sui/table.js';
|
|
19
|
+
const $moduleName = '@local-pkg/propbook::registry';
|
|
20
|
+
export const RegistryAdminCap = new MoveStruct({
|
|
21
|
+
name: `${$moduleName}::RegistryAdminCap`,
|
|
22
|
+
fields: {
|
|
23
|
+
id: bcs.Address,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
export const OracleRegistry = new MoveStruct({
|
|
27
|
+
name: `${$moduleName}::OracleRegistry`,
|
|
28
|
+
fields: {
|
|
29
|
+
id: bcs.Address,
|
|
30
|
+
/** Provider/source pair to the shared feed object created for that source. */
|
|
31
|
+
sources: table.Table,
|
|
32
|
+
/** Underlying/provider/value tuple to its active canonical feed metadata. */
|
|
33
|
+
bindings: table.Table,
|
|
34
|
+
/** Provider/source pair to the sole underlying it may serve. */
|
|
35
|
+
source_bindings: table.Table,
|
|
36
|
+
/**
|
|
37
|
+
* Underlying to its canonical Block Scholes store pair. Each store owns the
|
|
38
|
+
* immutable Block Scholes base asset that gates its reads and writes. The pair is
|
|
39
|
+
* permanent storage: newer signed observations and in-place version migrations
|
|
40
|
+
* recover it without an admin source switch.
|
|
41
|
+
*/
|
|
42
|
+
block_scholes_stores: table.Table,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
export const BlockScholesStorePair = new MoveStruct({
|
|
46
|
+
name: `${$moduleName}::BlockScholesStorePair`,
|
|
47
|
+
fields: {
|
|
48
|
+
value_store_id: bcs.Address,
|
|
49
|
+
svi_store_id: bcs.Address,
|
|
50
|
+
block_scholes_base_asset: bcs.string(),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const OracleSourceKey = new MoveStruct({
|
|
54
|
+
name: `${$moduleName}::OracleSourceKey`,
|
|
55
|
+
fields: {
|
|
56
|
+
oracle_kind: bcs.u8(),
|
|
57
|
+
source_id: bcs.u32(),
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
export const OracleBindingKey = new MoveStruct({
|
|
61
|
+
name: `${$moduleName}::OracleBindingKey`,
|
|
62
|
+
fields: {
|
|
63
|
+
propbook_underlying_id: bcs.u32(),
|
|
64
|
+
oracle_kind: bcs.u8(),
|
|
65
|
+
value_kind: bcs.u8(),
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
export const OracleMetadata = new MoveStruct({
|
|
69
|
+
name: `${$moduleName}::OracleMetadata`,
|
|
70
|
+
fields: {
|
|
71
|
+
propbook_underlying_id: bcs.u32(),
|
|
72
|
+
oracle_kind: bcs.u8(),
|
|
73
|
+
source_id: bcs.u32(),
|
|
74
|
+
propbook_oracle_id: bcs.Address,
|
|
75
|
+
value_kind: bcs.u8(),
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
export const OracleSourceRegistered = new MoveStruct({
|
|
79
|
+
name: `${$moduleName}::OracleSourceRegistered`,
|
|
80
|
+
fields: {
|
|
81
|
+
oracle_kind: bcs.u8(),
|
|
82
|
+
source_id: bcs.u32(),
|
|
83
|
+
propbook_oracle_id: bcs.Address,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
export const OracleBound = new MoveStruct({
|
|
87
|
+
name: `${$moduleName}::OracleBound`,
|
|
88
|
+
fields: {
|
|
89
|
+
propbook_underlying_id: bcs.u32(),
|
|
90
|
+
oracle_kind: bcs.u8(),
|
|
91
|
+
source_id: bcs.u32(),
|
|
92
|
+
propbook_oracle_id: bcs.Address,
|
|
93
|
+
value_kind: bcs.u8(),
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
export const BlockScholesStoresRegistered = new MoveStruct({
|
|
97
|
+
name: `${$moduleName}::BlockScholesStoresRegistered`,
|
|
98
|
+
fields: {
|
|
99
|
+
propbook_underlying_id: bcs.u32(),
|
|
100
|
+
value_store_id: bcs.Address,
|
|
101
|
+
svi_store_id: bcs.Address,
|
|
102
|
+
block_scholes_base_asset: bcs.string(),
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
export const OracleRebound = new MoveStruct({
|
|
106
|
+
name: `${$moduleName}::OracleRebound`,
|
|
107
|
+
fields: {
|
|
108
|
+
propbook_underlying_id: bcs.u32(),
|
|
109
|
+
oracle_kind: bcs.u8(),
|
|
110
|
+
value_kind: bcs.u8(),
|
|
111
|
+
old_source_id: bcs.u32(),
|
|
112
|
+
old_propbook_oracle_id: bcs.Address,
|
|
113
|
+
new_source_id: bcs.u32(),
|
|
114
|
+
new_propbook_oracle_id: bcs.Address,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
export interface IdArguments {
|
|
118
|
+
registry: RawTransactionArgument<string>;
|
|
119
|
+
}
|
|
120
|
+
export interface IdOptions {
|
|
121
|
+
package?: string;
|
|
122
|
+
arguments: IdArguments | [registry: RawTransactionArgument<string>];
|
|
123
|
+
}
|
|
124
|
+
/** Returns the registry identity for external composition and PTB construction. */
|
|
125
|
+
export function id(options: IdOptions) {
|
|
126
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
127
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
128
|
+
const parameterNames = ['registry'];
|
|
129
|
+
return (tx: Transaction) =>
|
|
130
|
+
tx.moveCall({
|
|
131
|
+
package: packageAddress,
|
|
132
|
+
module: 'registry',
|
|
133
|
+
function: 'id',
|
|
134
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
export interface RegistryAdminCapIdArguments {
|
|
138
|
+
cap: RawTransactionArgument<string>;
|
|
139
|
+
}
|
|
140
|
+
export interface RegistryAdminCapIdOptions {
|
|
141
|
+
package?: string;
|
|
142
|
+
arguments: RegistryAdminCapIdArguments | [cap: RawTransactionArgument<string>];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the admin capability identity for administration tooling and object
|
|
146
|
+
* discovery.
|
|
147
|
+
*/
|
|
148
|
+
export function registryAdminCapId(options: RegistryAdminCapIdOptions) {
|
|
149
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
150
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
151
|
+
const parameterNames = ['cap'];
|
|
152
|
+
return (tx: Transaction) =>
|
|
153
|
+
tx.moveCall({
|
|
154
|
+
package: packageAddress,
|
|
155
|
+
module: 'registry',
|
|
156
|
+
function: 'registry_admin_cap_id',
|
|
157
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
export interface ContainsPythSourceArguments {
|
|
161
|
+
registry: RawTransactionArgument<string>;
|
|
162
|
+
pythSourceId: RawTransactionArgument<number>;
|
|
163
|
+
}
|
|
164
|
+
export interface ContainsPythSourceOptions {
|
|
165
|
+
package?: string;
|
|
166
|
+
arguments:
|
|
167
|
+
| ContainsPythSourceArguments
|
|
168
|
+
| [registry: RawTransactionArgument<string>, pythSourceId: RawTransactionArgument<number>];
|
|
169
|
+
}
|
|
170
|
+
/** Returns whether the Pyth source wrapper exists in the external source catalog. */
|
|
171
|
+
export function containsPythSource(options: ContainsPythSourceOptions) {
|
|
172
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
173
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
174
|
+
const parameterNames = ['registry', 'pythSourceId'];
|
|
175
|
+
return (tx: Transaction) =>
|
|
176
|
+
tx.moveCall({
|
|
177
|
+
package: packageAddress,
|
|
178
|
+
module: 'registry',
|
|
179
|
+
function: 'contains_pyth_source',
|
|
180
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
export interface PropbookPythIdForSourceArguments {
|
|
184
|
+
registry: RawTransactionArgument<string>;
|
|
185
|
+
pythSourceId: RawTransactionArgument<number>;
|
|
186
|
+
}
|
|
187
|
+
export interface PropbookPythIdForSourceOptions {
|
|
188
|
+
package?: string;
|
|
189
|
+
arguments:
|
|
190
|
+
| PropbookPythIdForSourceArguments
|
|
191
|
+
| [registry: RawTransactionArgument<string>, pythSourceId: RawTransactionArgument<number>];
|
|
192
|
+
}
|
|
193
|
+
/** Resolves a registered Pyth source wrapper for external composition or discovery. */
|
|
194
|
+
export function propbookPythIdForSource(options: PropbookPythIdForSourceOptions) {
|
|
195
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
196
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
197
|
+
const parameterNames = ['registry', 'pythSourceId'];
|
|
198
|
+
return (tx: Transaction) =>
|
|
199
|
+
tx.moveCall({
|
|
200
|
+
package: packageAddress,
|
|
201
|
+
module: 'registry',
|
|
202
|
+
function: 'propbook_pyth_id_for_source',
|
|
203
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export interface PropbookPythIdForUnderlyingArguments {
|
|
207
|
+
registry: RawTransactionArgument<string>;
|
|
208
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
209
|
+
}
|
|
210
|
+
export interface PropbookPythIdForUnderlyingOptions {
|
|
211
|
+
package?: string;
|
|
212
|
+
arguments:
|
|
213
|
+
| PropbookPythIdForUnderlyingArguments
|
|
214
|
+
| [
|
|
215
|
+
registry: RawTransactionArgument<string>,
|
|
216
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
/** Resolves the canonical Pyth feed for external composition or discovery. */
|
|
220
|
+
export function propbookPythIdForUnderlying(options: PropbookPythIdForUnderlyingOptions) {
|
|
221
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
222
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
223
|
+
const parameterNames = ['registry', 'propbookUnderlyingId'];
|
|
224
|
+
return (tx: Transaction) =>
|
|
225
|
+
tx.moveCall({
|
|
226
|
+
package: packageAddress,
|
|
227
|
+
module: 'registry',
|
|
228
|
+
function: 'propbook_pyth_id_for_underlying',
|
|
229
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
export interface PropbookBlockScholesStorePairForUnderlyingArguments {
|
|
233
|
+
registry: RawTransactionArgument<string>;
|
|
234
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
235
|
+
}
|
|
236
|
+
export interface PropbookBlockScholesStorePairForUnderlyingOptions {
|
|
237
|
+
package?: string;
|
|
238
|
+
arguments:
|
|
239
|
+
| PropbookBlockScholesStorePairForUnderlyingArguments
|
|
240
|
+
| [
|
|
241
|
+
registry: RawTransactionArgument<string>,
|
|
242
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
243
|
+
];
|
|
244
|
+
}
|
|
245
|
+
/** Resolves the complete immutable Block Scholes binding for an underlying. */
|
|
246
|
+
export function propbookBlockScholesStorePairForUnderlying(
|
|
247
|
+
options: PropbookBlockScholesStorePairForUnderlyingOptions,
|
|
248
|
+
) {
|
|
249
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
250
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
251
|
+
const parameterNames = ['registry', 'propbookUnderlyingId'];
|
|
252
|
+
return (tx: Transaction) =>
|
|
253
|
+
tx.moveCall({
|
|
254
|
+
package: packageAddress,
|
|
255
|
+
module: 'registry',
|
|
256
|
+
function: 'propbook_block_scholes_store_pair_for_underlying',
|
|
257
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
export interface BlockScholesValueStoreIdArguments {
|
|
261
|
+
pair: TransactionArgument;
|
|
262
|
+
}
|
|
263
|
+
export interface BlockScholesValueStoreIdOptions {
|
|
264
|
+
package?: string;
|
|
265
|
+
arguments: BlockScholesValueStoreIdArguments | [pair: TransactionArgument];
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Returns the canonical value-store identity for external composition or
|
|
269
|
+
* discovery.
|
|
270
|
+
*/
|
|
271
|
+
export function blockScholesValueStoreId(options: BlockScholesValueStoreIdOptions) {
|
|
272
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
273
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
274
|
+
const parameterNames = ['pair'];
|
|
275
|
+
return (tx: Transaction) =>
|
|
276
|
+
tx.moveCall({
|
|
277
|
+
package: packageAddress,
|
|
278
|
+
module: 'registry',
|
|
279
|
+
function: 'block_scholes_value_store_id',
|
|
280
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
export interface BlockScholesBaseAssetArguments {
|
|
284
|
+
pair: TransactionArgument;
|
|
285
|
+
}
|
|
286
|
+
export interface BlockScholesBaseAssetOptions {
|
|
287
|
+
package?: string;
|
|
288
|
+
arguments: BlockScholesBaseAssetArguments | [pair: TransactionArgument];
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Returns the bound provider base asset for external composition, discovery, or
|
|
292
|
+
* devInspect confirmation that the binding names the asset the subscription
|
|
293
|
+
* resolves to.
|
|
294
|
+
*/
|
|
295
|
+
export function blockScholesBaseAsset(options: BlockScholesBaseAssetOptions) {
|
|
296
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
297
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
298
|
+
const parameterNames = ['pair'];
|
|
299
|
+
return (tx: Transaction) =>
|
|
300
|
+
tx.moveCall({
|
|
301
|
+
package: packageAddress,
|
|
302
|
+
module: 'registry',
|
|
303
|
+
function: 'block_scholes_base_asset',
|
|
304
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
export interface BlockScholesSviStoreIdArguments {
|
|
308
|
+
pair: TransactionArgument;
|
|
309
|
+
}
|
|
310
|
+
export interface BlockScholesSviStoreIdOptions {
|
|
311
|
+
package?: string;
|
|
312
|
+
arguments: BlockScholesSviStoreIdArguments | [pair: TransactionArgument];
|
|
313
|
+
}
|
|
314
|
+
/** Returns the canonical SVI-store identity for external composition or discovery. */
|
|
315
|
+
export function blockScholesSviStoreId(options: BlockScholesSviStoreIdOptions) {
|
|
316
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
317
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
318
|
+
const parameterNames = ['pair'];
|
|
319
|
+
return (tx: Transaction) =>
|
|
320
|
+
tx.moveCall({
|
|
321
|
+
package: packageAddress,
|
|
322
|
+
module: 'registry',
|
|
323
|
+
function: 'block_scholes_svi_store_id',
|
|
324
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
export interface PythMetadataForUnderlyingArguments {
|
|
328
|
+
registry: RawTransactionArgument<string>;
|
|
329
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
330
|
+
}
|
|
331
|
+
export interface PythMetadataForUnderlyingOptions {
|
|
332
|
+
package?: string;
|
|
333
|
+
arguments:
|
|
334
|
+
| PythMetadataForUnderlyingArguments
|
|
335
|
+
| [
|
|
336
|
+
registry: RawTransactionArgument<string>,
|
|
337
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
338
|
+
];
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Returns the canonical Pyth binding metadata for external composition or
|
|
342
|
+
* inspection.
|
|
343
|
+
*/
|
|
344
|
+
export function pythMetadataForUnderlying(options: PythMetadataForUnderlyingOptions) {
|
|
345
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
346
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
347
|
+
const parameterNames = ['registry', 'propbookUnderlyingId'];
|
|
348
|
+
return (tx: Transaction) =>
|
|
349
|
+
tx.moveCall({
|
|
350
|
+
package: packageAddress,
|
|
351
|
+
module: 'registry',
|
|
352
|
+
function: 'pyth_metadata_for_underlying',
|
|
353
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
export interface PropbookUnderlyingIdArguments {
|
|
357
|
+
metadata: TransactionArgument;
|
|
358
|
+
}
|
|
359
|
+
export interface PropbookUnderlyingIdOptions {
|
|
360
|
+
package?: string;
|
|
361
|
+
arguments: PropbookUnderlyingIdArguments | [metadata: TransactionArgument];
|
|
362
|
+
}
|
|
363
|
+
/** Return the bound underlying ID for external registry discovery. */
|
|
364
|
+
export function propbookUnderlyingId(options: PropbookUnderlyingIdOptions) {
|
|
365
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
366
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
367
|
+
const parameterNames = ['metadata'];
|
|
368
|
+
return (tx: Transaction) =>
|
|
369
|
+
tx.moveCall({
|
|
370
|
+
package: packageAddress,
|
|
371
|
+
module: 'registry',
|
|
372
|
+
function: 'propbook_underlying_id',
|
|
373
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
export interface OracleKindArguments {
|
|
377
|
+
metadata: TransactionArgument;
|
|
378
|
+
}
|
|
379
|
+
export interface OracleKindOptions {
|
|
380
|
+
package?: string;
|
|
381
|
+
arguments: OracleKindArguments | [metadata: TransactionArgument];
|
|
382
|
+
}
|
|
383
|
+
/** Return the oracle-kind discriminator for external registry discovery. */
|
|
384
|
+
export function oracleKind(options: OracleKindOptions) {
|
|
385
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
386
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
387
|
+
const parameterNames = ['metadata'];
|
|
388
|
+
return (tx: Transaction) =>
|
|
389
|
+
tx.moveCall({
|
|
390
|
+
package: packageAddress,
|
|
391
|
+
module: 'registry',
|
|
392
|
+
function: 'oracle_kind',
|
|
393
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
export interface SourceIdArguments {
|
|
397
|
+
metadata: TransactionArgument;
|
|
398
|
+
}
|
|
399
|
+
export interface SourceIdOptions {
|
|
400
|
+
package?: string;
|
|
401
|
+
arguments: SourceIdArguments | [metadata: TransactionArgument];
|
|
402
|
+
}
|
|
403
|
+
/** Return the provider source ID for external registry discovery. */
|
|
404
|
+
export function sourceId(options: SourceIdOptions) {
|
|
405
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
406
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
407
|
+
const parameterNames = ['metadata'];
|
|
408
|
+
return (tx: Transaction) =>
|
|
409
|
+
tx.moveCall({
|
|
410
|
+
package: packageAddress,
|
|
411
|
+
module: 'registry',
|
|
412
|
+
function: 'source_id',
|
|
413
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
export interface PropbookOracleIdArguments {
|
|
417
|
+
metadata: TransactionArgument;
|
|
418
|
+
}
|
|
419
|
+
export interface PropbookOracleIdOptions {
|
|
420
|
+
package?: string;
|
|
421
|
+
arguments: PropbookOracleIdArguments | [metadata: TransactionArgument];
|
|
422
|
+
}
|
|
423
|
+
/** Return the canonical feed object ID for external PTB construction. */
|
|
424
|
+
export function propbookOracleId(options: PropbookOracleIdOptions) {
|
|
425
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
426
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
427
|
+
const parameterNames = ['metadata'];
|
|
428
|
+
return (tx: Transaction) =>
|
|
429
|
+
tx.moveCall({
|
|
430
|
+
package: packageAddress,
|
|
431
|
+
module: 'registry',
|
|
432
|
+
function: 'propbook_oracle_id',
|
|
433
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
export interface ValueKindArguments {
|
|
437
|
+
metadata: TransactionArgument;
|
|
438
|
+
}
|
|
439
|
+
export interface ValueKindOptions {
|
|
440
|
+
package?: string;
|
|
441
|
+
arguments: ValueKindArguments | [metadata: TransactionArgument];
|
|
442
|
+
}
|
|
443
|
+
/** Return the value-kind discriminator for external registry discovery. */
|
|
444
|
+
export function valueKind(options: ValueKindOptions) {
|
|
445
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
446
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
447
|
+
const parameterNames = ['metadata'];
|
|
448
|
+
return (tx: Transaction) =>
|
|
449
|
+
tx.moveCall({
|
|
450
|
+
package: packageAddress,
|
|
451
|
+
module: 'registry',
|
|
452
|
+
function: 'value_kind',
|
|
453
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
export interface CreateAndSharePythFeedArguments {
|
|
457
|
+
registry: RawTransactionArgument<string>;
|
|
458
|
+
pythSourceId: RawTransactionArgument<number>;
|
|
459
|
+
}
|
|
460
|
+
export interface CreateAndSharePythFeedOptions {
|
|
461
|
+
package?: string;
|
|
462
|
+
arguments:
|
|
463
|
+
| CreateAndSharePythFeedArguments
|
|
464
|
+
| [registry: RawTransactionArgument<string>, pythSourceId: RawTransactionArgument<number>];
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Create and share the Propbook Pyth wrapper for `pyth_source_id`, then record it
|
|
468
|
+
* in the source catalog. Permissionless: a duplicate source aborts before object
|
|
469
|
+
* creation, and a junk source id creates an inert feed whose storage the caller
|
|
470
|
+
* pays for.
|
|
471
|
+
*/
|
|
472
|
+
export function createAndSharePythFeed(options: CreateAndSharePythFeedOptions) {
|
|
473
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
474
|
+
const argumentsTypes = [null, 'u32'] satisfies (string | null)[];
|
|
475
|
+
const parameterNames = ['registry', 'pythSourceId'];
|
|
476
|
+
return (tx: Transaction) =>
|
|
477
|
+
tx.moveCall({
|
|
478
|
+
package: packageAddress,
|
|
479
|
+
module: 'registry',
|
|
480
|
+
function: 'create_and_share_pyth_feed',
|
|
481
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
export interface CreateAndShareBlockScholesStoresArguments {
|
|
485
|
+
registry: RawTransactionArgument<string>;
|
|
486
|
+
AdminCap: RawTransactionArgument<string>;
|
|
487
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
488
|
+
blockScholesBaseAsset: RawTransactionArgument<string>;
|
|
489
|
+
}
|
|
490
|
+
export interface CreateAndShareBlockScholesStoresOptions {
|
|
491
|
+
package?: string;
|
|
492
|
+
arguments:
|
|
493
|
+
| CreateAndShareBlockScholesStoresArguments
|
|
494
|
+
| [
|
|
495
|
+
registry: RawTransactionArgument<string>,
|
|
496
|
+
AdminCap: RawTransactionArgument<string>,
|
|
497
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
498
|
+
blockScholesBaseAsset: RawTransactionArgument<string>,
|
|
499
|
+
];
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Create and share this underlying's Block Scholes store partition and bind its
|
|
503
|
+
* source identity. Admin-gated and once per underlying so consumers have one
|
|
504
|
+
* immutable descriptor and store pair.
|
|
505
|
+
*
|
|
506
|
+
* `block_scholes_base_asset` is carried into every derived series id exactly as
|
|
507
|
+
* spelled, and no on-chain fact can say whether it is the asset this underlying is
|
|
508
|
+
* meant to track: a spelling the provider does not serve makes the underlying
|
|
509
|
+
* permanently unfeedable, and a spelling naming a _different_ real asset prices
|
|
510
|
+
* this underlying off that asset with every check passing. Confirm it against the
|
|
511
|
+
* provider's acknowledged subscription before this call — the emitted
|
|
512
|
+
* `BlockScholesStoresRegistered` and `block_scholes_base_asset` reader exist so
|
|
513
|
+
* that confirmation can be made against the chain rather than against the intent.
|
|
514
|
+
* Bad observations are corrected by newer signed rows, and version changes migrate
|
|
515
|
+
* in place. A structural replacement — including recovery from a wrong permanent
|
|
516
|
+
* base-asset binding — belongs in the package upgrade that defines its migration
|
|
517
|
+
* rather than in a generic pre-deployed rebind.
|
|
518
|
+
*/
|
|
519
|
+
export function createAndShareBlockScholesStores(options: CreateAndShareBlockScholesStoresOptions) {
|
|
520
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
521
|
+
const argumentsTypes = [null, null, 'u32', '0x1::string::String'] satisfies (string | null)[];
|
|
522
|
+
const parameterNames = ['registry', 'AdminCap', 'propbookUnderlyingId', 'blockScholesBaseAsset'];
|
|
523
|
+
return (tx: Transaction) =>
|
|
524
|
+
tx.moveCall({
|
|
525
|
+
package: packageAddress,
|
|
526
|
+
module: 'registry',
|
|
527
|
+
function: 'create_and_share_block_scholes_stores',
|
|
528
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
export interface BindPythToUnderlyingArguments {
|
|
532
|
+
registry: RawTransactionArgument<string>;
|
|
533
|
+
adminCap: RawTransactionArgument<string>;
|
|
534
|
+
feed: RawTransactionArgument<string>;
|
|
535
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
536
|
+
}
|
|
537
|
+
export interface BindPythToUnderlyingOptions {
|
|
538
|
+
package?: string;
|
|
539
|
+
arguments:
|
|
540
|
+
| BindPythToUnderlyingArguments
|
|
541
|
+
| [
|
|
542
|
+
registry: RawTransactionArgument<string>,
|
|
543
|
+
adminCap: RawTransactionArgument<string>,
|
|
544
|
+
feed: RawTransactionArgument<string>,
|
|
545
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
546
|
+
];
|
|
547
|
+
}
|
|
548
|
+
/** Admin-bind this Pyth source feed to a canonical Propbook underlying. */
|
|
549
|
+
export function bindPythToUnderlying(options: BindPythToUnderlyingOptions) {
|
|
550
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
551
|
+
const argumentsTypes = [null, null, null, 'u32'] satisfies (string | null)[];
|
|
552
|
+
const parameterNames = ['registry', 'adminCap', 'feed', 'propbookUnderlyingId'];
|
|
553
|
+
return (tx: Transaction) =>
|
|
554
|
+
tx.moveCall({
|
|
555
|
+
package: packageAddress,
|
|
556
|
+
module: 'registry',
|
|
557
|
+
function: 'bind_pyth_to_underlying',
|
|
558
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
export interface ReplacePythBindingForUnderlyingArguments {
|
|
562
|
+
registry: RawTransactionArgument<string>;
|
|
563
|
+
adminCap: RawTransactionArgument<string>;
|
|
564
|
+
feed: RawTransactionArgument<string>;
|
|
565
|
+
propbookUnderlyingId: RawTransactionArgument<number>;
|
|
566
|
+
}
|
|
567
|
+
export interface ReplacePythBindingForUnderlyingOptions {
|
|
568
|
+
package?: string;
|
|
569
|
+
arguments:
|
|
570
|
+
| ReplacePythBindingForUnderlyingArguments
|
|
571
|
+
| [
|
|
572
|
+
registry: RawTransactionArgument<string>,
|
|
573
|
+
adminCap: RawTransactionArgument<string>,
|
|
574
|
+
feed: RawTransactionArgument<string>,
|
|
575
|
+
propbookUnderlyingId: RawTransactionArgument<number>,
|
|
576
|
+
];
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Admin-replace the canonical Pyth source feed for a Propbook underlying.
|
|
580
|
+
*
|
|
581
|
+
* The replacement feed must already be registered in the source catalog. A source
|
|
582
|
+
* key already assigned to another underlying remains ineligible forever;
|
|
583
|
+
* replacement does not create an unbound intermediate state.
|
|
584
|
+
*/
|
|
585
|
+
export function replacePythBindingForUnderlying(options: ReplacePythBindingForUnderlyingOptions) {
|
|
586
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
587
|
+
const argumentsTypes = [null, null, null, 'u32'] satisfies (string | null)[];
|
|
588
|
+
const parameterNames = ['registry', 'adminCap', 'feed', 'propbookUnderlyingId'];
|
|
589
|
+
return (tx: Transaction) =>
|
|
590
|
+
tx.moveCall({
|
|
591
|
+
package: packageAddress,
|
|
592
|
+
module: 'registry',
|
|
593
|
+
function: 'replace_pyth_binding_for_underlying',
|
|
594
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
595
|
+
});
|
|
596
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Mysten Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Canonical per-network deployment ids.
|
|
6
|
+
*
|
|
7
|
+
* Every subpath reads its slice of this one record rather than carrying its own copy, so a
|
|
8
|
+
* redeploy is a single regeneration (`pnpm sync-deployment`) and the subpaths cannot end up
|
|
9
|
+
* addressing different deployments. The records themselves are generated from the deploy
|
|
10
|
+
* tooling's manifest — see `scripts/sync-deployment.ts`.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { SuiClientTypes } from '@mysten/sui/client';
|
|
14
|
+
|
|
15
|
+
import {
|
|
16
|
+
TESTNET_ACCOUNT,
|
|
17
|
+
TESTNET_DEPLOYMENT,
|
|
18
|
+
TESTNET_PREDICT,
|
|
19
|
+
TESTNET_SESSIONS,
|
|
20
|
+
TESTNET_UNITS,
|
|
21
|
+
} from './testnet.js';
|
|
22
|
+
import type { DeploymentInfo, DeploymentUnits } from './types.js';
|
|
23
|
+
|
|
24
|
+
export type {
|
|
25
|
+
AccountIds,
|
|
26
|
+
DeploymentInfo,
|
|
27
|
+
DeploymentUnits,
|
|
28
|
+
PredictIds,
|
|
29
|
+
SessionsIds,
|
|
30
|
+
} from './types.js';
|
|
31
|
+
|
|
32
|
+
export { TESTNET_ACCOUNT, TESTNET_DEPLOYMENT, TESTNET_PREDICT, TESTNET_SESSIONS, TESTNET_UNITS };
|
|
33
|
+
|
|
34
|
+
/** Networks this package carries ids for. Predict and sessions are testnet-only so far. */
|
|
35
|
+
export type DeployedNetwork = 'testnet';
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Accepts the same wide network type the Sui client exposes, so `getUnits(client.network)`
|
|
39
|
+
* composes. Narrowing to `DeployedNetwork` would reject that, and listing
|
|
40
|
+
* `'testnet' | 'mainnet'` would be worse still: it admits exactly one value that always
|
|
41
|
+
* throws while rejecting `'devnet'` at compile time.
|
|
42
|
+
*/
|
|
43
|
+
export type NetworkArg = SuiClientTypes.Network;
|
|
44
|
+
|
|
45
|
+
function unrecorded(network: string, override: string): Error {
|
|
46
|
+
return new Error(
|
|
47
|
+
`@mysten/deepbook-v3: no deployment recorded for network '${network}'. ` +
|
|
48
|
+
'Predict, sessions and the account primitive are testnet-only today. ' +
|
|
49
|
+
`For your own deployment, ${override}`,
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @description Which deployment the ids on `network` came from — its name and the
|
|
55
|
+
* deepbookv3 commit they were generated at. Useful when a bug report needs to say which
|
|
56
|
+
* on-chain deployment an SDK build was pinned to.
|
|
57
|
+
* @throws if the network has no deployment recorded, rather than returning placeholder ids.
|
|
58
|
+
*/
|
|
59
|
+
export function getDeployment(network: NetworkArg): DeploymentInfo {
|
|
60
|
+
if (network === 'testnet') return TESTNET_DEPLOYMENT;
|
|
61
|
+
throw unrecorded(network, 'read the deployment name and commit from your own deploy manifest.');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @description Scale constants for `network` — lot size, fixed-point scale, and coin
|
|
66
|
+
* decimals. Deployment-wide, so any subpath formatting a custody balance can read them
|
|
67
|
+
* rather than hardcoding 6.
|
|
68
|
+
* @throws if the network has no recorded deployment.
|
|
69
|
+
*/
|
|
70
|
+
export function getUnits(network: NetworkArg): DeploymentUnits {
|
|
71
|
+
if (network === 'testnet') return TESTNET_UNITS;
|
|
72
|
+
throw unrecorded(network, 'read these scale constants from your own deploy manifest.');
|
|
73
|
+
}
|