@waterx/sdk 4.1.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/dist/cjs/src/account/config.d.ts +3 -2
- package/dist/cjs/src/generated/waterx_rule/waterx_rule.d.ts +7 -134
- package/dist/cjs/src/generated/waterx_rule/waterx_rule.js +8 -154
- package/dist/cjs/src/oracle/aggregate.d.ts +21 -21
- package/dist/cjs/src/oracle/aggregate.js +118 -69
- package/dist/cjs/src/oracle/config.d.ts +38 -72
- package/dist/cjs/src/oracle/config.js +0 -56
- package/dist/cjs/src/oracle/host.d.ts +24 -20
- package/dist/cjs/src/oracle/index.d.ts +5 -3
- package/dist/cjs/src/oracle/index.js +31 -8
- package/dist/cjs/src/oracle/price-update-rule.d.ts +13 -6
- package/dist/cjs/src/oracle/price-update-rule.js +3 -3
- package/dist/cjs/src/oracle/pyth.d.ts +44 -0
- package/dist/cjs/src/oracle/pyth.js +48 -6
- package/dist/cjs/src/oracle/read-plane.d.ts +70 -0
- package/dist/cjs/src/oracle/read-plane.js +78 -0
- package/dist/cjs/src/oracle/rule-registry.d.ts +6 -4
- package/dist/cjs/src/oracle/rule-registry.js +6 -4
- package/dist/cjs/src/oracle/rules/pyth-core-rule.js +4 -4
- package/dist/cjs/src/oracle/rules/pyth-lazer-rule.d.ts +21 -0
- package/dist/cjs/src/oracle/rules/pyth-lazer-rule.js +29 -4
- package/dist/cjs/src/oracle/rules/pyth-rule.js +5 -4
- package/dist/cjs/src/oracle/rules/waterx-rule.d.ts +42 -5
- package/dist/cjs/src/oracle/rules/waterx-rule.js +57 -17
- package/dist/cjs/src/perp/client.d.ts +40 -27
- package/dist/cjs/src/perp/client.js +28 -20
- package/dist/cjs/src/perp/config.d.ts +6 -6
- package/dist/cjs/src/perp/config.js +12 -12
- package/dist/cjs/src/perp/index.d.ts +3 -3
- package/dist/cjs/src/perp/index.js +7 -4
- package/dist/cjs/src/unified-client.d.ts +14 -9
- package/dist/cjs/src/unified-client.js +2 -2
- package/dist/src/account/config.d.ts +3 -2
- package/dist/src/generated/waterx_rule/waterx_rule.d.ts +7 -134
- package/dist/src/generated/waterx_rule/waterx_rule.js +7 -143
- package/dist/src/oracle/aggregate.d.ts +21 -21
- package/dist/src/oracle/aggregate.js +118 -69
- package/dist/src/oracle/config.d.ts +38 -72
- package/dist/src/oracle/config.js +1 -55
- package/dist/src/oracle/host.d.ts +24 -20
- package/dist/src/oracle/index.d.ts +5 -3
- package/dist/src/oracle/index.js +25 -10
- package/dist/src/oracle/price-update-rule.d.ts +13 -6
- package/dist/src/oracle/price-update-rule.js +3 -3
- package/dist/src/oracle/pyth.d.ts +44 -0
- package/dist/src/oracle/pyth.js +45 -5
- package/dist/src/oracle/read-plane.d.ts +70 -0
- package/dist/src/oracle/read-plane.js +74 -0
- package/dist/src/oracle/rule-registry.d.ts +6 -4
- package/dist/src/oracle/rule-registry.js +6 -4
- package/dist/src/oracle/rules/pyth-core-rule.js +5 -5
- package/dist/src/oracle/rules/pyth-lazer-rule.d.ts +21 -0
- package/dist/src/oracle/rules/pyth-lazer-rule.js +28 -3
- package/dist/src/oracle/rules/pyth-rule.js +5 -4
- package/dist/src/oracle/rules/waterx-rule.d.ts +42 -5
- package/dist/src/oracle/rules/waterx-rule.js +53 -14
- package/dist/src/perp/client.d.ts +40 -27
- package/dist/src/perp/client.js +29 -21
- package/dist/src/perp/config.d.ts +6 -6
- package/dist/src/perp/config.js +11 -9
- package/dist/src/perp/index.d.ts +3 -3
- package/dist/src/perp/index.js +2 -2
- package/dist/src/unified-client.d.ts +14 -9
- package/dist/src/unified-client.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Exposes three namespaces over the two product-line sub-clients:
|
|
6
6
|
*
|
|
7
|
-
* const client = await WaterXClient.create({ network: "TESTNET" });
|
|
7
|
+
* const client = await WaterXClient.create({ network: "TESTNET", oracleSource: "pyth_rule" });
|
|
8
8
|
* client.account.createAccount(tx, { alias }); // -> shared waterx_account + funding
|
|
9
9
|
* client.perp.placeOrderRequest(tx, params); // -> perp builder
|
|
10
10
|
* client.predict.placeOrder(tx, params); // -> prediction builder
|
|
@@ -186,7 +186,7 @@ class WaterXClient {
|
|
|
186
186
|
* `waterx-config` JSON) and returns a ready client. Each line can target a
|
|
187
187
|
* different network via `opts.perp.network` / `opts.predict.network`.
|
|
188
188
|
*/
|
|
189
|
-
static async create(opts
|
|
189
|
+
static async create(opts) {
|
|
190
190
|
const baseNetwork = opts.network ?? "TESTNET";
|
|
191
191
|
const { network: perpNetwork, ...perpRest } = opts.perp ?? {};
|
|
192
192
|
const { network: predictNetwork, ...predictRest } = opts.predict ?? {};
|
|
@@ -73,8 +73,9 @@ export interface WithdrawalQueuePackage {
|
|
|
73
73
|
/**
|
|
74
74
|
* Wormhole infra for the cross-chain credit bridge. `state_id` is the same
|
|
75
75
|
* shared Sui Wormhole `State` object Pyth uses (kept in sync with
|
|
76
|
-
* `
|
|
77
|
-
* `WaterXConfig.wormhole` if a deployment ever points
|
|
76
|
+
* `PYTH_CORE_INFRA[*].wormhole_state_id` in `oracle/pyth.ts`). Override
|
|
77
|
+
* per-deployment via `WaterXConfig.wormhole` if a deployment ever points
|
|
78
|
+
* elsewhere.
|
|
78
79
|
*/
|
|
79
80
|
export interface WormholeInfraConfig {
|
|
80
81
|
/** Shared Sui Wormhole `State` object. */
|
|
@@ -70,11 +70,6 @@ export declare const BatchPricePayload: MoveStruct<{
|
|
|
70
70
|
length: number;
|
|
71
71
|
}, string>;
|
|
72
72
|
}, "@waterx/rule::waterx_rule::BatchPricePayload">;
|
|
73
|
-
export declare const MerkleRoot: MoveStruct<{
|
|
74
|
-
root: import("@mysten/sui/bcs").BcsType<number[], Iterable<number> & {
|
|
75
|
-
length: number;
|
|
76
|
-
}, string>;
|
|
77
|
-
}, "@waterx/rule::waterx_rule::MerkleRoot">;
|
|
78
73
|
export declare const FeedConfig: MoveStruct<{
|
|
79
74
|
ticker: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
80
75
|
sources: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
@@ -219,82 +214,17 @@ export interface CollectBatchLatestOptions {
|
|
|
219
214
|
* and so aborts on any stale item, this path runs alongside Pyth/Supra. To let
|
|
220
215
|
* those cover a lagging TEE — the blast-radius bound in the GCP ADR — a
|
|
221
216
|
* _freshness_ miss ABSTAINS (records `none`, which `aggregator::remove_outliers`
|
|
222
|
-
* drops before the `weight_threshold` fail-closed check)
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
* not
|
|
226
|
-
*
|
|
227
|
-
* with the on-chain feed config is a red flag, not a liveness blip. Bad signature,
|
|
228
|
-
* malformed batch, and a future timestamp always abort.
|
|
217
|
+
* drops before the `weight_threshold` fail-closed check). A _config/integrity_
|
|
218
|
+
* mismatch (source / ticker / method / confidence / deviation) still ABORTS: an
|
|
219
|
+
* enclave whose signed payload disagrees with the on-chain feed config is a red
|
|
220
|
+
* flag, not a liveness blip. Bad signature, malformed batch, a future timestamp,
|
|
221
|
+
* and replay always abort.
|
|
229
222
|
*
|
|
230
223
|
* Every gate is identical to `feed_batch_item_latest`; only the abort-vs-abstain
|
|
231
|
-
* disposition of the freshness
|
|
232
|
-
*
|
|
224
|
+
* disposition of the two freshness gates differs, and the sink is the caller's
|
|
225
|
+
* collector rather than a fresh single-rule one.
|
|
233
226
|
*/
|
|
234
227
|
export declare function collectBatchLatest(options: CollectBatchLatestOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
235
|
-
export interface FeedSingleWithProofArguments {
|
|
236
|
-
oracleObj: RawTransactionArgument<string>;
|
|
237
|
-
config: RawTransactionArgument<string>;
|
|
238
|
-
enclaveConfig: RawTransactionArgument<string>;
|
|
239
|
-
enclave: RawTransactionArgument<string>;
|
|
240
|
-
timestampMs: RawTransactionArgument<number | bigint>;
|
|
241
|
-
item: TransactionArgument;
|
|
242
|
-
proof: RawTransactionArgument<Array<Array<number>>>;
|
|
243
|
-
sig: RawTransactionArgument<Array<number>>;
|
|
244
|
-
}
|
|
245
|
-
export interface FeedSingleWithProofOptions {
|
|
246
|
-
package?: string;
|
|
247
|
-
arguments: FeedSingleWithProofArguments | [
|
|
248
|
-
oracleObj: RawTransactionArgument<string>,
|
|
249
|
-
config: RawTransactionArgument<string>,
|
|
250
|
-
enclaveConfig: RawTransactionArgument<string>,
|
|
251
|
-
enclave: RawTransactionArgument<string>,
|
|
252
|
-
timestampMs: RawTransactionArgument<number | bigint>,
|
|
253
|
-
item: TransactionArgument,
|
|
254
|
-
proof: RawTransactionArgument<Array<Array<number>>>,
|
|
255
|
-
sig: RawTransactionArgument<Array<number>>
|
|
256
|
-
];
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Streaming per-symbol sibling of `feed_batch_latest`. Verifies ONE enclave
|
|
260
|
-
* signature over a Merkle `root`, checks `item` is a leaf of that root via
|
|
261
|
-
* `proof`, then runs the identical per-item gates + `oracle::aggregate`. Use for a
|
|
262
|
-
* WaterxRule-only aggregator; for a Pyth-coexisting aggregator use
|
|
263
|
-
* `collect_single_with_proof`.
|
|
264
|
-
*/
|
|
265
|
-
export declare function feedSingleWithProof(options: FeedSingleWithProofOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
266
|
-
export interface CollectSingleWithProofArguments {
|
|
267
|
-
collector: TransactionArgument;
|
|
268
|
-
config: RawTransactionArgument<string>;
|
|
269
|
-
enclaveConfig: RawTransactionArgument<string>;
|
|
270
|
-
enclave: RawTransactionArgument<string>;
|
|
271
|
-
timestampMs: RawTransactionArgument<number | bigint>;
|
|
272
|
-
item: TransactionArgument;
|
|
273
|
-
proof: RawTransactionArgument<Array<Array<number>>>;
|
|
274
|
-
sig: RawTransactionArgument<Array<number>>;
|
|
275
|
-
}
|
|
276
|
-
export interface CollectSingleWithProofOptions {
|
|
277
|
-
package?: string;
|
|
278
|
-
arguments: CollectSingleWithProofArguments | [
|
|
279
|
-
collector: TransactionArgument,
|
|
280
|
-
config: RawTransactionArgument<string>,
|
|
281
|
-
enclaveConfig: RawTransactionArgument<string>,
|
|
282
|
-
enclave: RawTransactionArgument<string>,
|
|
283
|
-
timestampMs: RawTransactionArgument<number | bigint>,
|
|
284
|
-
item: TransactionArgument,
|
|
285
|
-
proof: RawTransactionArgument<Array<Array<number>>>,
|
|
286
|
-
sig: RawTransactionArgument<Array<number>>
|
|
287
|
-
];
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Collect-only sibling of `feed_single_with_proof` for the dual-rule latest path
|
|
291
|
-
* (WaterX alongside Pyth on one aggregator), mirroring `collect_batch_latest`:
|
|
292
|
-
* verifies root + proof, feeds the leaf into the caller's `PriceCollector` WITHOUT
|
|
293
|
-
* calling `oracle::aggregate`. Abort vs abstain matches `collect_batch_latest`
|
|
294
|
-
* exactly — a config/integrity mismatch aborts, a freshness miss abstains so Pyth
|
|
295
|
-
* can cover a lagging TEE.
|
|
296
|
-
*/
|
|
297
|
-
export declare function collectSingleWithProof(options: CollectSingleWithProofOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
298
228
|
export interface QuoteForTimestampArguments {
|
|
299
229
|
config: RawTransactionArgument<string>;
|
|
300
230
|
enclaveConfig: RawTransactionArgument<string>;
|
|
@@ -491,27 +421,6 @@ export interface BatchPriceIntentOptions {
|
|
|
491
421
|
];
|
|
492
422
|
}
|
|
493
423
|
export declare function batchPriceIntent(options?: BatchPriceIntentOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
494
|
-
export interface MerkleRootIntentOptions {
|
|
495
|
-
package?: string;
|
|
496
|
-
arguments?: [
|
|
497
|
-
];
|
|
498
|
-
}
|
|
499
|
-
export declare function merkleRootIntent(options?: MerkleRootIntentOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
500
|
-
export interface LeafHashOfArguments {
|
|
501
|
-
item: TransactionArgument;
|
|
502
|
-
}
|
|
503
|
-
export interface LeafHashOfOptions {
|
|
504
|
-
package?: string;
|
|
505
|
-
arguments: LeafHashOfArguments | [
|
|
506
|
-
item: TransactionArgument
|
|
507
|
-
];
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* The keccak256 leaf hash for `item` — `keccak256(0x00 || BCS(item))`. Exposed so
|
|
511
|
-
* the off-chain builder / SDK can be pinned against the on-chain encoding in a
|
|
512
|
-
* cross-implementation golden test.
|
|
513
|
-
*/
|
|
514
|
-
export declare function leafHashOf(options: LeafHashOfOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
515
424
|
export interface MaxBatchSizeOptions {
|
|
516
425
|
package?: string;
|
|
517
426
|
arguments?: [
|
|
@@ -808,42 +717,6 @@ export interface SourceGataUsdtPerpWsOptions {
|
|
|
808
717
|
];
|
|
809
718
|
}
|
|
810
719
|
export declare function sourceGataUsdtPerpWs(options?: SourceGataUsdtPerpWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
811
|
-
export interface SourceBybitSpotWsOptions {
|
|
812
|
-
package?: string;
|
|
813
|
-
arguments?: [
|
|
814
|
-
];
|
|
815
|
-
}
|
|
816
|
-
export declare function sourceBybitSpotWs(options?: SourceBybitSpotWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
817
|
-
export interface SourceXstockEquityRestOptions {
|
|
818
|
-
package?: string;
|
|
819
|
-
arguments?: [
|
|
820
|
-
];
|
|
821
|
-
}
|
|
822
|
-
export declare function sourceXstockEquityRest(options?: SourceXstockEquityRestOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
823
|
-
export interface SourceOkxSpotWsOptions {
|
|
824
|
-
package?: string;
|
|
825
|
-
arguments?: [
|
|
826
|
-
];
|
|
827
|
-
}
|
|
828
|
-
export declare function sourceOkxSpotWs(options?: SourceOkxSpotWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
829
|
-
export interface SourceHyperliquidPerpWsOptions {
|
|
830
|
-
package?: string;
|
|
831
|
-
arguments?: [
|
|
832
|
-
];
|
|
833
|
-
}
|
|
834
|
-
export declare function sourceHyperliquidPerpWs(options?: SourceHyperliquidPerpWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
835
|
-
export interface SourceGateioSpotWsOptions {
|
|
836
|
-
package?: string;
|
|
837
|
-
arguments?: [
|
|
838
|
-
];
|
|
839
|
-
}
|
|
840
|
-
export declare function sourceGateioSpotWs(options?: SourceGateioSpotWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
841
|
-
export interface SourceKrakenSpotWsOptions {
|
|
842
|
-
package?: string;
|
|
843
|
-
arguments?: [
|
|
844
|
-
];
|
|
845
|
-
}
|
|
846
|
-
export declare function sourceKrakenSpotWs(options?: SourceKrakenSpotWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
847
720
|
export interface MethodDirectOptions {
|
|
848
721
|
package?: string;
|
|
849
722
|
arguments?: [
|
|
@@ -41,9 +41,6 @@ export const BatchPriceItem = new MoveStruct({ name: `${$moduleName}::BatchPrice
|
|
|
41
41
|
export const BatchPricePayload = new MoveStruct({ name: `${$moduleName}::BatchPricePayload`, fields: {
|
|
42
42
|
items: bcs.vector(BatchPriceItem)
|
|
43
43
|
} });
|
|
44
|
-
export const MerkleRoot = new MoveStruct({ name: `${$moduleName}::MerkleRoot`, fields: {
|
|
45
|
-
root: bcs.vector(bcs.u8())
|
|
46
|
-
} });
|
|
47
44
|
export const FeedConfig = new MoveStruct({ name: `${$moduleName}::FeedConfig`, fields: {
|
|
48
45
|
ticker: bcs.string(),
|
|
49
46
|
sources: bcs.vector(bcs.u64()),
|
|
@@ -129,17 +126,15 @@ export function feedBatchLatest(options) {
|
|
|
129
126
|
* and so aborts on any stale item, this path runs alongside Pyth/Supra. To let
|
|
130
127
|
* those cover a lagging TEE — the blast-radius bound in the GCP ADR — a
|
|
131
128
|
* _freshness_ miss ABSTAINS (records `none`, which `aggregator::remove_outliers`
|
|
132
|
-
* drops before the `weight_threshold` fail-closed check)
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
* not
|
|
136
|
-
*
|
|
137
|
-
* with the on-chain feed config is a red flag, not a liveness blip. Bad signature,
|
|
138
|
-
* malformed batch, and a future timestamp always abort.
|
|
129
|
+
* drops before the `weight_threshold` fail-closed check). A _config/integrity_
|
|
130
|
+
* mismatch (source / ticker / method / confidence / deviation) still ABORTS: an
|
|
131
|
+
* enclave whose signed payload disagrees with the on-chain feed config is a red
|
|
132
|
+
* flag, not a liveness blip. Bad signature, malformed batch, a future timestamp,
|
|
133
|
+
* and replay always abort.
|
|
139
134
|
*
|
|
140
135
|
* Every gate is identical to `feed_batch_item_latest`; only the abort-vs-abstain
|
|
141
|
-
* disposition of the freshness
|
|
142
|
-
*
|
|
136
|
+
* disposition of the two freshness gates differs, and the sink is the caller's
|
|
137
|
+
* collector rather than a fresh single-rule one.
|
|
143
138
|
*/
|
|
144
139
|
export function collectBatchLatest(options) {
|
|
145
140
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
@@ -161,63 +156,6 @@ export function collectBatchLatest(options) {
|
|
|
161
156
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
162
157
|
});
|
|
163
158
|
}
|
|
164
|
-
/**
|
|
165
|
-
* Streaming per-symbol sibling of `feed_batch_latest`. Verifies ONE enclave
|
|
166
|
-
* signature over a Merkle `root`, checks `item` is a leaf of that root via
|
|
167
|
-
* `proof`, then runs the identical per-item gates + `oracle::aggregate`. Use for a
|
|
168
|
-
* WaterxRule-only aggregator; for a Pyth-coexisting aggregator use
|
|
169
|
-
* `collect_single_with_proof`.
|
|
170
|
-
*/
|
|
171
|
-
export function feedSingleWithProof(options) {
|
|
172
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
173
|
-
const argumentsTypes = [
|
|
174
|
-
null,
|
|
175
|
-
null,
|
|
176
|
-
'0x2::clock::Clock',
|
|
177
|
-
null,
|
|
178
|
-
null,
|
|
179
|
-
'u64',
|
|
180
|
-
null,
|
|
181
|
-
'vector<vector<u8>>',
|
|
182
|
-
'vector<u8>'
|
|
183
|
-
];
|
|
184
|
-
const parameterNames = ["oracleObj", "config", "enclaveConfig", "enclave", "timestampMs", "item", "proof", "sig"];
|
|
185
|
-
return (tx) => tx.moveCall({
|
|
186
|
-
package: packageAddress,
|
|
187
|
-
module: 'waterx_rule',
|
|
188
|
-
function: 'feed_single_with_proof',
|
|
189
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Collect-only sibling of `feed_single_with_proof` for the dual-rule latest path
|
|
194
|
-
* (WaterX alongside Pyth on one aggregator), mirroring `collect_batch_latest`:
|
|
195
|
-
* verifies root + proof, feeds the leaf into the caller's `PriceCollector` WITHOUT
|
|
196
|
-
* calling `oracle::aggregate`. Abort vs abstain matches `collect_batch_latest`
|
|
197
|
-
* exactly — a config/integrity mismatch aborts, a freshness miss abstains so Pyth
|
|
198
|
-
* can cover a lagging TEE.
|
|
199
|
-
*/
|
|
200
|
-
export function collectSingleWithProof(options) {
|
|
201
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
202
|
-
const argumentsTypes = [
|
|
203
|
-
null,
|
|
204
|
-
null,
|
|
205
|
-
'0x2::clock::Clock',
|
|
206
|
-
null,
|
|
207
|
-
null,
|
|
208
|
-
'u64',
|
|
209
|
-
null,
|
|
210
|
-
'vector<vector<u8>>',
|
|
211
|
-
'vector<u8>'
|
|
212
|
-
];
|
|
213
|
-
const parameterNames = ["collector", "config", "enclaveConfig", "enclave", "timestampMs", "item", "proof", "sig"];
|
|
214
|
-
return (tx) => tx.moveCall({
|
|
215
|
-
package: packageAddress,
|
|
216
|
-
module: 'waterx_rule',
|
|
217
|
-
function: 'collect_single_with_proof',
|
|
218
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
159
|
/**
|
|
222
160
|
* Verifies a historical quote without touching `waterx_oracle`.
|
|
223
161
|
*
|
|
@@ -409,32 +347,6 @@ export function batchPriceIntent(options = {}) {
|
|
|
409
347
|
function: 'batch_price_intent',
|
|
410
348
|
});
|
|
411
349
|
}
|
|
412
|
-
export function merkleRootIntent(options = {}) {
|
|
413
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
414
|
-
return (tx) => tx.moveCall({
|
|
415
|
-
package: packageAddress,
|
|
416
|
-
module: 'waterx_rule',
|
|
417
|
-
function: 'merkle_root_intent',
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* The keccak256 leaf hash for `item` — `keccak256(0x00 || BCS(item))`. Exposed so
|
|
422
|
-
* the off-chain builder / SDK can be pinned against the on-chain encoding in a
|
|
423
|
-
* cross-implementation golden test.
|
|
424
|
-
*/
|
|
425
|
-
export function leafHashOf(options) {
|
|
426
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
427
|
-
const argumentsTypes = [
|
|
428
|
-
null
|
|
429
|
-
];
|
|
430
|
-
const parameterNames = ["item"];
|
|
431
|
-
return (tx) => tx.moveCall({
|
|
432
|
-
package: packageAddress,
|
|
433
|
-
module: 'waterx_rule',
|
|
434
|
-
function: 'leaf_hash_of',
|
|
435
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
350
|
export function maxBatchSize(options = {}) {
|
|
439
351
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
440
352
|
return (tx) => tx.moveCall({
|
|
@@ -821,54 +733,6 @@ export function sourceGataUsdtPerpWs(options = {}) {
|
|
|
821
733
|
function: 'source_gata_usdt_perp_ws',
|
|
822
734
|
});
|
|
823
735
|
}
|
|
824
|
-
export function sourceBybitSpotWs(options = {}) {
|
|
825
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
826
|
-
return (tx) => tx.moveCall({
|
|
827
|
-
package: packageAddress,
|
|
828
|
-
module: 'waterx_rule',
|
|
829
|
-
function: 'source_bybit_spot_ws',
|
|
830
|
-
});
|
|
831
|
-
}
|
|
832
|
-
export function sourceXstockEquityRest(options = {}) {
|
|
833
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
834
|
-
return (tx) => tx.moveCall({
|
|
835
|
-
package: packageAddress,
|
|
836
|
-
module: 'waterx_rule',
|
|
837
|
-
function: 'source_xstock_equity_rest',
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
export function sourceOkxSpotWs(options = {}) {
|
|
841
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
842
|
-
return (tx) => tx.moveCall({
|
|
843
|
-
package: packageAddress,
|
|
844
|
-
module: 'waterx_rule',
|
|
845
|
-
function: 'source_okx_spot_ws',
|
|
846
|
-
});
|
|
847
|
-
}
|
|
848
|
-
export function sourceHyperliquidPerpWs(options = {}) {
|
|
849
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
850
|
-
return (tx) => tx.moveCall({
|
|
851
|
-
package: packageAddress,
|
|
852
|
-
module: 'waterx_rule',
|
|
853
|
-
function: 'source_hyperliquid_perp_ws',
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
export function sourceGateioSpotWs(options = {}) {
|
|
857
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
858
|
-
return (tx) => tx.moveCall({
|
|
859
|
-
package: packageAddress,
|
|
860
|
-
module: 'waterx_rule',
|
|
861
|
-
function: 'source_gateio_spot_ws',
|
|
862
|
-
});
|
|
863
|
-
}
|
|
864
|
-
export function sourceKrakenSpotWs(options = {}) {
|
|
865
|
-
const packageAddress = options.package ?? '@waterx/rule';
|
|
866
|
-
return (tx) => tx.moveCall({
|
|
867
|
-
package: packageAddress,
|
|
868
|
-
module: 'waterx_rule',
|
|
869
|
-
function: 'source_kraken_spot_ws',
|
|
870
|
-
});
|
|
871
|
-
}
|
|
872
736
|
export function methodDirect(options = {}) {
|
|
873
737
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
874
738
|
return (tx) => tx.moveCall({
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
*
|
|
20
20
|
* `refreshOraclePrices` additionally routes the on-chain price *update* leg
|
|
21
21
|
* (the fetch + verify/push step, before any of the above feeding) through the
|
|
22
|
-
* `PriceUpdateRule`
|
|
22
|
+
* `PriceUpdateRule` of EVERY source in the `host.oracleSources` fed set — see
|
|
23
|
+
* `rule-registry.ts`.
|
|
23
24
|
*/
|
|
24
25
|
import type { Transaction, TransactionArgument } from "@mysten/sui/transactions";
|
|
25
26
|
import type { OracleHost } from "./host.ts";
|
|
@@ -84,27 +85,26 @@ export declare function aggregateTickerWithConstant(tx: Transaction, host: Oracl
|
|
|
84
85
|
* entry, Lazer if the lazer update leg served it — see below — Supra when
|
|
85
86
|
* enabled, Constant when it's a constant ticker).
|
|
86
87
|
*
|
|
87
|
-
* Before that, the on-chain price *update* leg is routed by
|
|
88
|
-
* (see `rule-registry.ts`):
|
|
89
|
-
* `supportedTickers(host)
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* dry-run, which is correct.
|
|
88
|
+
* Before that, the on-chain price *update* leg is routed by the
|
|
89
|
+
* `host.oracleSources` fed set (see `rule-registry.ts`): EVERY listed source
|
|
90
|
+
* updates the tickers its own `supportedTickers(host)` serves, all in this one
|
|
91
|
+
* PTB. There is **no cross-source fallback** — a requested ticker NO listed
|
|
92
|
+
* source serves, and that is not a constant-only ticker (which needs no
|
|
93
|
+
* price-update leg), fails the build immediately with a clear error naming
|
|
94
|
+
* the ticker and the list. That is the deliberate "fail the tx-build, don't
|
|
95
|
+
* silently reroute" contract: a wrong-but-present feed id is NOT validated
|
|
96
|
+
* here (it surfaces on-chain at dry-run); a ticker MISSING from every listed
|
|
97
|
+
* source's feeds is caught here.
|
|
98
98
|
*
|
|
99
|
-
*
|
|
100
|
-
* per-rule PTB atomicity. A fee-source pre-check runs first (
|
|
101
|
-
* `requiresFeeSource`) BEFORE any off-chain fetch or PTB mutation —
|
|
102
|
-
* fee-charging source with no `opts.feeSource` throws
|
|
99
|
+
* Each source's fetch + build runs against its own infra, guaranteeing
|
|
100
|
+
* per-rule PTB atomicity. A fee-source pre-check runs first (any listed
|
|
101
|
+
* source's `requiresFeeSource`) BEFORE any off-chain fetch or PTB mutation —
|
|
102
|
+
* so a fee-charging source with no `opts.feeSource` throws
|
|
103
103
|
* `OracleFeeSourceUnavailable` with zero wasted network calls and zero stray
|
|
104
|
-
* moveCalls. Only once that check passes
|
|
105
|
-
*
|
|
106
|
-
* can still fail mid-append for
|
|
107
|
-
* throw.
|
|
104
|
+
* moveCalls. Only once that check passes do the off-chain fetches run — in
|
|
105
|
+
* parallel across sources — and ALL settle before the first PTB mutation;
|
|
106
|
+
* on-chain reads inside `buildUpdateCalls` can still fail mid-append for
|
|
107
|
+
* other reasons — callers discard the tx on any throw.
|
|
108
108
|
*
|
|
109
109
|
* **Collector-feed leg is rule-aware:** a lazer-served group's
|
|
110
110
|
* `buildUpdateCalls` returns the verified `Update` PTB value
|
|
@@ -139,7 +139,7 @@ export declare function refreshOraclePrices(tx: Transaction, host: OracleHost, t
|
|
|
139
139
|
/**
|
|
140
140
|
* @internal Test-only: layer fake `PriceUpdateRule`s on top of the
|
|
141
141
|
* production registry (see `rule-registry.ts`'s `resolveOracleRule`).
|
|
142
|
-
* Production callers never set this — routing is by `host.
|
|
142
|
+
* Production callers never set this — routing is by `host.oracleSources`
|
|
143
143
|
* alone.
|
|
144
144
|
*/
|
|
145
145
|
ruleOverrides?: Partial<Record<OracleSource, PriceUpdateRule>>;
|