@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,37 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A table is a map-like collection. But unlike a traditional collection, it's keys
|
|
7
|
+
* and values are not stored within the `Table` value, but instead are stored using
|
|
8
|
+
* Sui's object system. The `Table` struct acts only as a handle into the object
|
|
9
|
+
* system to retrieve those keys and values. Note that this means that `Table`
|
|
10
|
+
* values with exactly the same key-value mapping will not be equal, with `==`, at
|
|
11
|
+
* runtime. For example
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* let table1 = table::new<u64, bool>();
|
|
15
|
+
* let table2 = table::new<u64, bool>();
|
|
16
|
+
* table::add(&mut table1, 0, false);
|
|
17
|
+
* table::add(&mut table1, 1, true);
|
|
18
|
+
* table::add(&mut table2, 0, false);
|
|
19
|
+
* table::add(&mut table2, 1, true);
|
|
20
|
+
* // table1 does not equal table2, despite having the same entries
|
|
21
|
+
* assert!(&table1 != &table2);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { MoveStruct } from '../../../utils/index.js';
|
|
26
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
27
|
+
import { U64 } from '../../../../bcs/integers.js';
|
|
28
|
+
const $moduleName = '0x2::table';
|
|
29
|
+
export const Table = new MoveStruct({
|
|
30
|
+
name: `${$moduleName}::Table<phantom K, phantom V>`,
|
|
31
|
+
fields: {
|
|
32
|
+
/** the ID of this table */
|
|
33
|
+
id: bcs.Address,
|
|
34
|
+
/** the number of key-value pairs in the table */
|
|
35
|
+
size: U64,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Stores one advancing latest observation and an independent insert-only
|
|
7
|
+
* exact-timestamp history for a Propbook feed. `source_timestamp_ms` is the
|
|
8
|
+
* canonical ordering, freshness, and exact-history key; source adapters may retain
|
|
9
|
+
* richer native timestamps inside the payload. Latest updates ignore invalid or
|
|
10
|
+
* non-advancing timestamps, while exact inserts ignore invalid or previously
|
|
11
|
+
* occupied keys without changing the latest value.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { type BcsType, bcs } from '@mysten/sui/bcs';
|
|
15
|
+
import { MoveStruct, normalizeMoveArguments } from '../utils/index.js';
|
|
16
|
+
import { U64 } from '../../bcs/integers.js';
|
|
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::oracle_lane';
|
|
20
|
+
/**
|
|
21
|
+
* A source value paired with its source publication time and on-chain recording
|
|
22
|
+
* time. Raw and normalized projections preserve this envelope so consumers can
|
|
23
|
+
* apply one freshness policy. `writer_digest` is the digest of the transaction
|
|
24
|
+
* that accepted the observation; consumers use it to refuse pricing against an
|
|
25
|
+
* observation written in the same PTB.
|
|
26
|
+
*/
|
|
27
|
+
export function OracleRead<Value extends BcsType<any>>(...typeParameters: [Value]) {
|
|
28
|
+
return new MoveStruct({
|
|
29
|
+
name: `${$moduleName}::OracleRead<${typeParameters[0].name as Value['name']}>`,
|
|
30
|
+
fields: {
|
|
31
|
+
/** Source publication time in Unix milliseconds and the key used for exact reads. */
|
|
32
|
+
source_timestamp_ms: U64,
|
|
33
|
+
/** Sui clock time in Unix milliseconds when the update transaction executed. */
|
|
34
|
+
onchain_timestamp_ms: U64,
|
|
35
|
+
/** Digest of the transaction that wrote this observation. */
|
|
36
|
+
writer_digest: bcs.vector(bcs.u8()),
|
|
37
|
+
value: typeParameters[0],
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/** Latest and exact-timestamp storage for one feed stream. */
|
|
42
|
+
export function OracleLane<Payload extends BcsType<any>>(...typeParameters: [Payload]) {
|
|
43
|
+
return new MoveStruct({
|
|
44
|
+
name: `${$moduleName}::OracleLane<${typeParameters[0].name as Payload['name']}>`,
|
|
45
|
+
fields: {
|
|
46
|
+
/** Most recent valid source observation submitted through `update`. */
|
|
47
|
+
latest: bcs.option(OracleRead(typeParameters[0])),
|
|
48
|
+
/**
|
|
49
|
+
* First accepted observation at each exact source timestamp; entries are never
|
|
50
|
+
* overwritten.
|
|
51
|
+
*/
|
|
52
|
+
exact_reads: table.Table,
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Emitted when a feed accepts a source-native observation into its live oracle
|
|
58
|
+
* state.
|
|
59
|
+
*/
|
|
60
|
+
export function ObservationRecorded<Observation extends BcsType<any>>(
|
|
61
|
+
...typeParameters: [Observation]
|
|
62
|
+
) {
|
|
63
|
+
return new MoveStruct({
|
|
64
|
+
name: `${$moduleName}::ObservationRecorded<${typeParameters[0].name as Observation['name']}>`,
|
|
65
|
+
fields: {
|
|
66
|
+
/** Canonical Propbook underlying when this source wrapper has been bound. */
|
|
67
|
+
propbook_underlying_id: bcs.option(bcs.u32()),
|
|
68
|
+
propbook_oracle_id: bcs.Address,
|
|
69
|
+
observation: typeParameters[0],
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** Emitted when a feed inserts source-native data keyed by exact source timestamp. */
|
|
74
|
+
export function ObservationInserted<Observation extends BcsType<any>>(
|
|
75
|
+
...typeParameters: [Observation]
|
|
76
|
+
) {
|
|
77
|
+
return new MoveStruct({
|
|
78
|
+
name: `${$moduleName}::ObservationInserted<${typeParameters[0].name as Observation['name']}>`,
|
|
79
|
+
fields: {
|
|
80
|
+
/** Canonical Propbook underlying when this source wrapper has been bound. */
|
|
81
|
+
propbook_underlying_id: bcs.option(bcs.u32()),
|
|
82
|
+
propbook_oracle_id: bcs.Address,
|
|
83
|
+
observation: typeParameters[0],
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export interface ReadSourceTimestampMsArguments {
|
|
88
|
+
read: TransactionArgument;
|
|
89
|
+
}
|
|
90
|
+
export interface ReadSourceTimestampMsOptions {
|
|
91
|
+
package?: string;
|
|
92
|
+
arguments: ReadSourceTimestampMsArguments | [read: TransactionArgument];
|
|
93
|
+
typeArguments: [string];
|
|
94
|
+
}
|
|
95
|
+
export function readSourceTimestampMs(options: ReadSourceTimestampMsOptions) {
|
|
96
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
97
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
98
|
+
const parameterNames = ['read'];
|
|
99
|
+
return (tx: Transaction) =>
|
|
100
|
+
tx.moveCall({
|
|
101
|
+
package: packageAddress,
|
|
102
|
+
module: 'oracle_lane',
|
|
103
|
+
function: 'read_source_timestamp_ms',
|
|
104
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
105
|
+
typeArguments: options.typeArguments,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
export interface ReadOnchainTimestampMsArguments {
|
|
109
|
+
read: TransactionArgument;
|
|
110
|
+
}
|
|
111
|
+
export interface ReadOnchainTimestampMsOptions {
|
|
112
|
+
package?: string;
|
|
113
|
+
arguments: ReadOnchainTimestampMsArguments | [read: TransactionArgument];
|
|
114
|
+
typeArguments: [string];
|
|
115
|
+
}
|
|
116
|
+
export function readOnchainTimestampMs(options: ReadOnchainTimestampMsOptions) {
|
|
117
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
118
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
119
|
+
const parameterNames = ['read'];
|
|
120
|
+
return (tx: Transaction) =>
|
|
121
|
+
tx.moveCall({
|
|
122
|
+
package: packageAddress,
|
|
123
|
+
module: 'oracle_lane',
|
|
124
|
+
function: 'read_onchain_timestamp_ms',
|
|
125
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
126
|
+
typeArguments: options.typeArguments,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export interface ReadWriterDigestArguments {
|
|
130
|
+
read: TransactionArgument;
|
|
131
|
+
}
|
|
132
|
+
export interface ReadWriterDigestOptions {
|
|
133
|
+
package?: string;
|
|
134
|
+
arguments: ReadWriterDigestArguments | [read: TransactionArgument];
|
|
135
|
+
typeArguments: [string];
|
|
136
|
+
}
|
|
137
|
+
export function readWriterDigest(options: ReadWriterDigestOptions) {
|
|
138
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
139
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
140
|
+
const parameterNames = ['read'];
|
|
141
|
+
return (tx: Transaction) =>
|
|
142
|
+
tx.moveCall({
|
|
143
|
+
package: packageAddress,
|
|
144
|
+
module: 'oracle_lane',
|
|
145
|
+
function: 'read_writer_digest',
|
|
146
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
147
|
+
typeArguments: options.typeArguments,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export interface ReadValueArguments {
|
|
151
|
+
read: TransactionArgument;
|
|
152
|
+
}
|
|
153
|
+
export interface ReadValueOptions {
|
|
154
|
+
package?: string;
|
|
155
|
+
arguments: ReadValueArguments | [read: TransactionArgument];
|
|
156
|
+
typeArguments: [string];
|
|
157
|
+
}
|
|
158
|
+
export function readValue(options: ReadValueOptions) {
|
|
159
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
160
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
161
|
+
const parameterNames = ['read'];
|
|
162
|
+
return (tx: Transaction) =>
|
|
163
|
+
tx.moveCall({
|
|
164
|
+
package: packageAddress,
|
|
165
|
+
module: 'oracle_lane',
|
|
166
|
+
function: 'read_value',
|
|
167
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
168
|
+
typeArguments: options.typeArguments,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
/**************************************************************
|
|
2
|
+
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
+
**************************************************************/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Decodes verifier-produced Pyth Lazer spot updates and stores their source-native
|
|
7
|
+
* fields in a shared Propbook oracle lane. Writes are permissionless because
|
|
8
|
+
* possession of `LazerUpdate` carries the upstream verification result; the
|
|
9
|
+
* registry separately owns source uniqueness and canonical binding. A Lazer update
|
|
10
|
+
* carries two distinct clocks: the envelope `timestamp()` is when the signed
|
|
11
|
+
* update was published, and the per-feed `feed_update_timestamp()` is when the
|
|
12
|
+
* price it carries was generated. They are equal only when the update carries a
|
|
13
|
+
* freshly generated aggregate; when Pyth has no new aggregate it carries the
|
|
14
|
+
* previous price forward under a newer envelope. `latest` keys on the generation
|
|
15
|
+
* time so a carried price ages by its true age, while the exact-history key stays
|
|
16
|
+
* on the envelope so a settlement tick resolves to the canonical price as of that
|
|
17
|
+
* tick. This module normalizes positive prices to 1e9 scale but leaves freshness
|
|
18
|
+
* and market-use policy to consumers.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
|
|
22
|
+
import { bcs } from '@mysten/sui/bcs';
|
|
23
|
+
import { U64 } from '../../bcs/integers.js';
|
|
24
|
+
import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
|
|
25
|
+
import * as oracle_lane from './oracle_lane.js';
|
|
26
|
+
const $moduleName = '@local-pkg/propbook::pyth_feed';
|
|
27
|
+
export const RawSpot = new MoveStruct({
|
|
28
|
+
name: `${$moduleName}::RawSpot`,
|
|
29
|
+
fields: {
|
|
30
|
+
pyth_source_id: bcs.u32(),
|
|
31
|
+
price_magnitude: U64,
|
|
32
|
+
price_is_negative: bcs.bool(),
|
|
33
|
+
exponent_magnitude: bcs.u16(),
|
|
34
|
+
exponent_is_negative: bcs.bool(),
|
|
35
|
+
feed_update_timestamp_us: U64,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
export const PythFeed = new MoveStruct({
|
|
39
|
+
name: `${$moduleName}::PythFeed`,
|
|
40
|
+
fields: {
|
|
41
|
+
id: bcs.Address,
|
|
42
|
+
pyth_source_id: bcs.u32(),
|
|
43
|
+
/**
|
|
44
|
+
* Assigned by the registry's canonical binding flow; absent before the feed is
|
|
45
|
+
* first bound.
|
|
46
|
+
*/
|
|
47
|
+
propbook_underlying_id: bcs.option(bcs.u32()),
|
|
48
|
+
/**
|
|
49
|
+
* Package version this feed runs at; updates require an exact match and `migrate`
|
|
50
|
+
* advances it forward-only after a package upgrade.
|
|
51
|
+
*/
|
|
52
|
+
version: U64,
|
|
53
|
+
lane: oracle_lane.OracleLane(RawSpot),
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
export interface IdArguments {
|
|
57
|
+
feed: RawTransactionArgument<string>;
|
|
58
|
+
}
|
|
59
|
+
export interface IdOptions {
|
|
60
|
+
package?: string;
|
|
61
|
+
arguments: IdArguments | [feed: RawTransactionArgument<string>];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the feed identity for external composition and canonical-binding
|
|
65
|
+
* discovery.
|
|
66
|
+
*/
|
|
67
|
+
export function id(options: IdOptions) {
|
|
68
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
69
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
70
|
+
const parameterNames = ['feed'];
|
|
71
|
+
return (tx: Transaction) =>
|
|
72
|
+
tx.moveCall({
|
|
73
|
+
package: packageAddress,
|
|
74
|
+
module: 'pyth_feed',
|
|
75
|
+
function: 'id',
|
|
76
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
export interface PythSourceIdArguments {
|
|
80
|
+
feed: RawTransactionArgument<string>;
|
|
81
|
+
}
|
|
82
|
+
export interface PythSourceIdOptions {
|
|
83
|
+
package?: string;
|
|
84
|
+
arguments: PythSourceIdArguments | [feed: RawTransactionArgument<string>];
|
|
85
|
+
}
|
|
86
|
+
/** Returns the immutable Pyth source ID for external feed inspection. */
|
|
87
|
+
export function pythSourceId(options: PythSourceIdOptions) {
|
|
88
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
89
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
90
|
+
const parameterNames = ['feed'];
|
|
91
|
+
return (tx: Transaction) =>
|
|
92
|
+
tx.moveCall({
|
|
93
|
+
package: packageAddress,
|
|
94
|
+
module: 'pyth_feed',
|
|
95
|
+
function: 'pyth_source_id',
|
|
96
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
export interface VersionArguments {
|
|
100
|
+
feed: RawTransactionArgument<string>;
|
|
101
|
+
}
|
|
102
|
+
export interface VersionOptions {
|
|
103
|
+
package?: string;
|
|
104
|
+
arguments: VersionArguments | [feed: RawTransactionArgument<string>];
|
|
105
|
+
}
|
|
106
|
+
/** Returns the write-gating storage version for external feed inspection. */
|
|
107
|
+
export function version(options: VersionOptions) {
|
|
108
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
109
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
110
|
+
const parameterNames = ['feed'];
|
|
111
|
+
return (tx: Transaction) =>
|
|
112
|
+
tx.moveCall({
|
|
113
|
+
package: packageAddress,
|
|
114
|
+
module: 'pyth_feed',
|
|
115
|
+
function: 'version',
|
|
116
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
export interface RawSpotArguments {
|
|
120
|
+
feed: RawTransactionArgument<string>;
|
|
121
|
+
}
|
|
122
|
+
export interface RawSpotOptions {
|
|
123
|
+
package?: string;
|
|
124
|
+
arguments: RawSpotArguments | [feed: RawTransactionArgument<string>];
|
|
125
|
+
}
|
|
126
|
+
/** Latest raw Pyth spot for external inspection; aborts if none has landed. */
|
|
127
|
+
export function rawSpot(options: RawSpotOptions) {
|
|
128
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
129
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
130
|
+
const parameterNames = ['feed'];
|
|
131
|
+
return (tx: Transaction) =>
|
|
132
|
+
tx.moveCall({
|
|
133
|
+
package: packageAddress,
|
|
134
|
+
module: 'pyth_feed',
|
|
135
|
+
function: 'raw_spot',
|
|
136
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
export interface NormalizedSpotArguments {
|
|
140
|
+
feed: RawTransactionArgument<string>;
|
|
141
|
+
}
|
|
142
|
+
export interface NormalizedSpotOptions {
|
|
143
|
+
package?: string;
|
|
144
|
+
arguments: NormalizedSpotArguments | [feed: RawTransactionArgument<string>];
|
|
145
|
+
}
|
|
146
|
+
/** Latest Propbook-normalized spot in 1e9 price scaling. */
|
|
147
|
+
export function normalizedSpot(options: NormalizedSpotOptions) {
|
|
148
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
149
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
150
|
+
const parameterNames = ['feed'];
|
|
151
|
+
return (tx: Transaction) =>
|
|
152
|
+
tx.moveCall({
|
|
153
|
+
package: packageAddress,
|
|
154
|
+
module: 'pyth_feed',
|
|
155
|
+
function: 'normalized_spot',
|
|
156
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export interface RawSpotAtArguments {
|
|
160
|
+
feed: RawTransactionArgument<string>;
|
|
161
|
+
sourceTimestampMs: RawTransactionArgument<number | bigint>;
|
|
162
|
+
}
|
|
163
|
+
export interface RawSpotAtOptions {
|
|
164
|
+
package?: string;
|
|
165
|
+
arguments:
|
|
166
|
+
| RawSpotAtArguments
|
|
167
|
+
| [
|
|
168
|
+
feed: RawTransactionArgument<string>,
|
|
169
|
+
sourceTimestampMs: RawTransactionArgument<number | bigint>,
|
|
170
|
+
];
|
|
171
|
+
}
|
|
172
|
+
/** Exact raw Pyth spot for external timestamp inspection. */
|
|
173
|
+
export function rawSpotAt(options: RawSpotAtOptions) {
|
|
174
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
175
|
+
const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
|
|
176
|
+
const parameterNames = ['feed', 'sourceTimestampMs'];
|
|
177
|
+
return (tx: Transaction) =>
|
|
178
|
+
tx.moveCall({
|
|
179
|
+
package: packageAddress,
|
|
180
|
+
module: 'pyth_feed',
|
|
181
|
+
function: 'raw_spot_at',
|
|
182
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export interface NormalizedSpotAtArguments {
|
|
186
|
+
feed: RawTransactionArgument<string>;
|
|
187
|
+
sourceTimestampMs: RawTransactionArgument<number | bigint>;
|
|
188
|
+
}
|
|
189
|
+
export interface NormalizedSpotAtOptions {
|
|
190
|
+
package?: string;
|
|
191
|
+
arguments:
|
|
192
|
+
| NormalizedSpotAtArguments
|
|
193
|
+
| [
|
|
194
|
+
feed: RawTransactionArgument<string>,
|
|
195
|
+
sourceTimestampMs: RawTransactionArgument<number | bigint>,
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
/** Exact Propbook-normalized spot in 1e9 price scaling for `source_timestamp_ms`. */
|
|
199
|
+
export function normalizedSpotAt(options: NormalizedSpotAtOptions) {
|
|
200
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
201
|
+
const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
|
|
202
|
+
const parameterNames = ['feed', 'sourceTimestampMs'];
|
|
203
|
+
return (tx: Transaction) =>
|
|
204
|
+
tx.moveCall({
|
|
205
|
+
package: packageAddress,
|
|
206
|
+
module: 'pyth_feed',
|
|
207
|
+
function: 'normalized_spot_at',
|
|
208
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
export interface RawPythSourceIdArguments {
|
|
212
|
+
raw: TransactionArgument;
|
|
213
|
+
}
|
|
214
|
+
export interface RawPythSourceIdOptions {
|
|
215
|
+
package?: string;
|
|
216
|
+
arguments: RawPythSourceIdArguments | [raw: TransactionArgument];
|
|
217
|
+
}
|
|
218
|
+
/** Return the Pyth source ID for external raw-feed inspection. */
|
|
219
|
+
export function rawPythSourceId(options: RawPythSourceIdOptions) {
|
|
220
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
221
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
222
|
+
const parameterNames = ['raw'];
|
|
223
|
+
return (tx: Transaction) =>
|
|
224
|
+
tx.moveCall({
|
|
225
|
+
package: packageAddress,
|
|
226
|
+
module: 'pyth_feed',
|
|
227
|
+
function: 'raw_pyth_source_id',
|
|
228
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
export interface RawPriceMagnitudeArguments {
|
|
232
|
+
raw: TransactionArgument;
|
|
233
|
+
}
|
|
234
|
+
export interface RawPriceMagnitudeOptions {
|
|
235
|
+
package?: string;
|
|
236
|
+
arguments: RawPriceMagnitudeArguments | [raw: TransactionArgument];
|
|
237
|
+
}
|
|
238
|
+
/** Return the unsigned price magnitude for external raw-feed inspection. */
|
|
239
|
+
export function rawPriceMagnitude(options: RawPriceMagnitudeOptions) {
|
|
240
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
241
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
242
|
+
const parameterNames = ['raw'];
|
|
243
|
+
return (tx: Transaction) =>
|
|
244
|
+
tx.moveCall({
|
|
245
|
+
package: packageAddress,
|
|
246
|
+
module: 'pyth_feed',
|
|
247
|
+
function: 'raw_price_magnitude',
|
|
248
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
export interface RawPriceIsNegativeArguments {
|
|
252
|
+
raw: TransactionArgument;
|
|
253
|
+
}
|
|
254
|
+
export interface RawPriceIsNegativeOptions {
|
|
255
|
+
package?: string;
|
|
256
|
+
arguments: RawPriceIsNegativeArguments | [raw: TransactionArgument];
|
|
257
|
+
}
|
|
258
|
+
/** Return the price sign for external raw-feed inspection. */
|
|
259
|
+
export function rawPriceIsNegative(options: RawPriceIsNegativeOptions) {
|
|
260
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
261
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
262
|
+
const parameterNames = ['raw'];
|
|
263
|
+
return (tx: Transaction) =>
|
|
264
|
+
tx.moveCall({
|
|
265
|
+
package: packageAddress,
|
|
266
|
+
module: 'pyth_feed',
|
|
267
|
+
function: 'raw_price_is_negative',
|
|
268
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
export interface RawExponentMagnitudeArguments {
|
|
272
|
+
raw: TransactionArgument;
|
|
273
|
+
}
|
|
274
|
+
export interface RawExponentMagnitudeOptions {
|
|
275
|
+
package?: string;
|
|
276
|
+
arguments: RawExponentMagnitudeArguments | [raw: TransactionArgument];
|
|
277
|
+
}
|
|
278
|
+
/** Return the unsigned exponent magnitude for external raw-feed inspection. */
|
|
279
|
+
export function rawExponentMagnitude(options: RawExponentMagnitudeOptions) {
|
|
280
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
281
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
282
|
+
const parameterNames = ['raw'];
|
|
283
|
+
return (tx: Transaction) =>
|
|
284
|
+
tx.moveCall({
|
|
285
|
+
package: packageAddress,
|
|
286
|
+
module: 'pyth_feed',
|
|
287
|
+
function: 'raw_exponent_magnitude',
|
|
288
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
export interface RawExponentIsNegativeArguments {
|
|
292
|
+
raw: TransactionArgument;
|
|
293
|
+
}
|
|
294
|
+
export interface RawExponentIsNegativeOptions {
|
|
295
|
+
package?: string;
|
|
296
|
+
arguments: RawExponentIsNegativeArguments | [raw: TransactionArgument];
|
|
297
|
+
}
|
|
298
|
+
/** Return the exponent sign for external raw-feed inspection. */
|
|
299
|
+
export function rawExponentIsNegative(options: RawExponentIsNegativeOptions) {
|
|
300
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
301
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
302
|
+
const parameterNames = ['raw'];
|
|
303
|
+
return (tx: Transaction) =>
|
|
304
|
+
tx.moveCall({
|
|
305
|
+
package: packageAddress,
|
|
306
|
+
module: 'pyth_feed',
|
|
307
|
+
function: 'raw_exponent_is_negative',
|
|
308
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
export interface RawFeedUpdateTimestampUsArguments {
|
|
312
|
+
raw: TransactionArgument;
|
|
313
|
+
}
|
|
314
|
+
export interface RawFeedUpdateTimestampUsOptions {
|
|
315
|
+
package?: string;
|
|
316
|
+
arguments: RawFeedUpdateTimestampUsArguments | [raw: TransactionArgument];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Return the microsecond time at which Pyth generated this price, for external
|
|
320
|
+
* raw-feed inspection. This is the price's true age; it can be older than the
|
|
321
|
+
* envelope that delivered it.
|
|
322
|
+
*/
|
|
323
|
+
export function rawFeedUpdateTimestampUs(options: RawFeedUpdateTimestampUsOptions) {
|
|
324
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
325
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
326
|
+
const parameterNames = ['raw'];
|
|
327
|
+
return (tx: Transaction) =>
|
|
328
|
+
tx.moveCall({
|
|
329
|
+
package: packageAddress,
|
|
330
|
+
module: 'pyth_feed',
|
|
331
|
+
function: 'raw_feed_update_timestamp_us',
|
|
332
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
export interface UpdateArguments {
|
|
336
|
+
feed: RawTransactionArgument<string>;
|
|
337
|
+
update: TransactionArgument;
|
|
338
|
+
}
|
|
339
|
+
export interface UpdateOptions {
|
|
340
|
+
package?: string;
|
|
341
|
+
arguments: UpdateArguments | [feed: RawTransactionArgument<string>, update: TransactionArgument];
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Decode and record a verifier-produced Pyth Lazer update when its generation
|
|
345
|
+
* timestamp advances. A zero, future, duplicate, or stale generation timestamp is
|
|
346
|
+
* ignored without changing `latest` or emitting an event; a price Pyth carried
|
|
347
|
+
* forward therefore leaves `latest` untouched, so redelivery cannot renew a
|
|
348
|
+
* consumer's freshness window. The raw observation may be stored even when its
|
|
349
|
+
* positive normalized projection is unavailable.
|
|
350
|
+
*/
|
|
351
|
+
export function update(options: UpdateOptions) {
|
|
352
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
353
|
+
const argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
354
|
+
const parameterNames = ['feed', 'update'];
|
|
355
|
+
return (tx: Transaction) =>
|
|
356
|
+
tx.moveCall({
|
|
357
|
+
package: packageAddress,
|
|
358
|
+
module: 'pyth_feed',
|
|
359
|
+
function: 'update',
|
|
360
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
export interface InsertAtArguments {
|
|
364
|
+
feed: RawTransactionArgument<string>;
|
|
365
|
+
update: TransactionArgument;
|
|
366
|
+
}
|
|
367
|
+
export interface InsertAtOptions {
|
|
368
|
+
package?: string;
|
|
369
|
+
arguments:
|
|
370
|
+
InsertAtArguments | [feed: RawTransactionArgument<string>, update: TransactionArgument];
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Insert an exact Pyth Lazer spot observation keyed by its exact millisecond
|
|
374
|
+
* envelope timestamp. Aborts `EInsertTimestampNotExactMillisecond` if the envelope
|
|
375
|
+
* timestamp is not a whole millisecond, so the exact-history key is an unambiguous
|
|
376
|
+
* millisecond a consumer can look up by equality. Aborts
|
|
377
|
+
* `ESettlementCarryExceedsWindow` if Pyth generated the price more than
|
|
378
|
+
* `constants::max_settlement_carry_ms` before that envelope, so a long-carried
|
|
379
|
+
* price cannot claim a settlement key. This does not mutate `latest`. The first
|
|
380
|
+
* lane-valid raw observation owns the key and cannot be replaced, even if its
|
|
381
|
+
* normalized projection is unavailable.
|
|
382
|
+
*/
|
|
383
|
+
export function insertAt(options: InsertAtOptions) {
|
|
384
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
385
|
+
const argumentsTypes = [null, null, '0x2::clock::Clock'] satisfies (string | null)[];
|
|
386
|
+
const parameterNames = ['feed', 'update'];
|
|
387
|
+
return (tx: Transaction) =>
|
|
388
|
+
tx.moveCall({
|
|
389
|
+
package: packageAddress,
|
|
390
|
+
module: 'pyth_feed',
|
|
391
|
+
function: 'insert_at',
|
|
392
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
export interface MigrateArguments {
|
|
396
|
+
feed: RawTransactionArgument<string>;
|
|
397
|
+
}
|
|
398
|
+
export interface MigrateOptions {
|
|
399
|
+
package?: string;
|
|
400
|
+
arguments: MigrateArguments | [feed: RawTransactionArgument<string>];
|
|
401
|
+
}
|
|
402
|
+
/** Migrate this feed to the running package version (forward-only). */
|
|
403
|
+
export function migrate(options: MigrateOptions) {
|
|
404
|
+
const packageAddress = options.package ?? '@local-pkg/propbook';
|
|
405
|
+
const argumentsTypes = [null] satisfies (string | null)[];
|
|
406
|
+
const parameterNames = ['feed'];
|
|
407
|
+
return (tx: Transaction) =>
|
|
408
|
+
tx.moveCall({
|
|
409
|
+
package: packageAddress,
|
|
410
|
+
module: 'pyth_feed',
|
|
411
|
+
function: 'migrate',
|
|
412
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
413
|
+
});
|
|
414
|
+
}
|