@waterx/sdk 4.3.2 → 5.0.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/.claude/skills/waterx-sdk-integration/SKILL.md +225 -0
- package/README.md +216 -45
- package/SKILLS.md +34 -0
- package/dist/cjs/src/account/config.d.ts +3 -5
- package/dist/cjs/src/account/funding/wormhole.d.ts +1 -2
- package/dist/cjs/src/account/funding/wormhole.js +1 -2
- package/dist/cjs/src/generated/waterx_rule/waterx_rule.d.ts +140 -7
- package/dist/cjs/src/generated/waterx_rule/waterx_rule.js +163 -8
- package/dist/cjs/src/oracle/aggregate.d.ts +49 -62
- package/dist/cjs/src/oracle/aggregate.js +208 -164
- package/dist/cjs/src/oracle/config.d.ts +38 -51
- package/dist/cjs/src/oracle/config.js +1 -1
- package/dist/cjs/src/oracle/host.d.ts +14 -19
- package/dist/cjs/src/oracle/host.js +3 -3
- package/dist/cjs/src/oracle/index.d.ts +25 -16
- package/dist/cjs/src/oracle/index.js +87 -69
- package/dist/cjs/src/oracle/price-update-rule.d.ts +104 -66
- package/dist/cjs/src/oracle/price-update-rule.js +24 -16
- package/dist/cjs/src/oracle/pyth-pro-history.d.ts +36 -0
- package/dist/cjs/src/oracle/pyth-pro-history.js +41 -0
- package/dist/cjs/src/oracle/read-plane.d.ts +35 -53
- package/dist/cjs/src/oracle/read-plane.js +26 -48
- package/dist/cjs/src/oracle/read-prices.d.ts +105 -0
- package/dist/cjs/src/oracle/read-prices.js +162 -0
- package/dist/cjs/src/oracle/rule-registry.d.ts +12 -12
- package/dist/cjs/src/oracle/rule-registry.js +12 -14
- package/dist/cjs/src/oracle/rules/pyth-lazer-rule.d.ts +24 -3
- package/dist/cjs/src/oracle/rules/pyth-lazer-rule.js +40 -20
- package/dist/cjs/src/oracle/rules/waterx-rule.d.ts +271 -57
- package/dist/cjs/src/oracle/rules/waterx-rule.js +743 -144
- package/dist/cjs/src/oracle/schedule.d.ts +109 -0
- package/dist/cjs/src/oracle/schedule.js +991 -0
- package/dist/cjs/src/oracle/source-list.d.ts +31 -27
- package/dist/cjs/src/oracle/source-list.js +43 -45
- package/dist/cjs/src/oracle/symbol-catalog.d.ts +54 -0
- package/dist/cjs/src/oracle/symbol-catalog.js +69 -0
- package/dist/cjs/src/oracle/update-fetch.d.ts +11 -15
- package/dist/cjs/src/oracle/update-fetch.js +12 -19
- package/dist/cjs/src/oracle/validate.d.ts +105 -0
- package/dist/cjs/src/oracle/validate.js +185 -0
- package/dist/cjs/src/oracle/weight-coverage.d.ts +79 -0
- package/dist/cjs/src/oracle/weight-coverage.js +173 -0
- package/dist/cjs/src/perp/client.d.ts +40 -55
- package/dist/cjs/src/perp/client.js +44 -17
- package/dist/cjs/src/perp/config-view.d.ts +5 -14
- package/dist/cjs/src/perp/config-view.js +5 -16
- package/dist/cjs/src/perp/config.d.ts +3 -3
- package/dist/cjs/src/perp/config.js +11 -13
- package/dist/cjs/src/perp/index.d.ts +4 -6
- package/dist/cjs/src/perp/index.js +43 -18
- package/dist/cjs/src/perp/tx-builders/common.d.ts +86 -48
- package/dist/cjs/src/perp/tx-builders/common.js +115 -47
- package/dist/cjs/src/perp/tx-builders/wlp.d.ts +3 -14
- package/dist/cjs/src/perp/tx-builders/wlp.js +6 -35
- package/dist/cjs/src/perp/tx-builders.d.ts +6 -5
- package/dist/cjs/src/perp/tx-builders.js +16 -10
- package/dist/cjs/src/unified-client.d.ts +9 -35
- package/dist/cjs/src/unified-client.js +3 -4
- package/dist/cjs/src/utils/config.d.ts +0 -8
- package/dist/cjs/src/utils/config.js +5 -13
- package/dist/src/account/config.d.ts +3 -5
- package/dist/src/account/funding/wormhole.d.ts +1 -2
- package/dist/src/account/funding/wormhole.js +1 -2
- package/dist/src/generated/waterx_rule/waterx_rule.d.ts +140 -7
- package/dist/src/generated/waterx_rule/waterx_rule.js +151 -7
- package/dist/src/oracle/aggregate.d.ts +49 -62
- package/dist/src/oracle/aggregate.js +209 -164
- package/dist/src/oracle/config.d.ts +38 -51
- package/dist/src/oracle/config.js +1 -1
- package/dist/src/oracle/host.d.ts +14 -19
- package/dist/src/oracle/host.js +3 -3
- package/dist/src/oracle/index.d.ts +25 -16
- package/dist/src/oracle/index.js +61 -54
- package/dist/src/oracle/price-update-rule.d.ts +104 -66
- package/dist/src/oracle/price-update-rule.js +23 -16
- package/dist/src/oracle/pyth-pro-history.d.ts +36 -0
- package/dist/src/oracle/pyth-pro-history.js +38 -0
- package/dist/src/oracle/read-plane.d.ts +35 -53
- package/dist/src/oracle/read-plane.js +25 -47
- package/dist/src/oracle/read-prices.d.ts +105 -0
- package/dist/src/oracle/read-prices.js +156 -0
- package/dist/src/oracle/rule-registry.d.ts +12 -12
- package/dist/src/oracle/rule-registry.js +12 -14
- package/dist/src/oracle/rules/pyth-lazer-rule.d.ts +24 -3
- package/dist/src/oracle/rules/pyth-lazer-rule.js +39 -20
- package/dist/src/oracle/rules/waterx-rule.d.ts +271 -57
- package/dist/src/oracle/rules/waterx-rule.js +735 -144
- package/dist/src/oracle/schedule.d.ts +109 -0
- package/dist/src/oracle/schedule.js +985 -0
- package/dist/src/oracle/source-list.d.ts +31 -27
- package/dist/src/oracle/source-list.js +42 -43
- package/dist/src/oracle/symbol-catalog.d.ts +54 -0
- package/dist/src/oracle/symbol-catalog.js +65 -0
- package/dist/src/oracle/update-fetch.d.ts +11 -15
- package/dist/src/oracle/update-fetch.js +12 -18
- package/dist/src/oracle/validate.d.ts +105 -0
- package/dist/src/oracle/validate.js +177 -0
- package/dist/src/oracle/weight-coverage.d.ts +79 -0
- package/dist/src/oracle/weight-coverage.js +166 -0
- package/dist/src/perp/client.d.ts +40 -55
- package/dist/src/perp/client.js +45 -18
- package/dist/src/perp/config-view.d.ts +5 -14
- package/dist/src/perp/config-view.js +5 -16
- package/dist/src/perp/config.d.ts +3 -3
- package/dist/src/perp/config.js +11 -13
- package/dist/src/perp/index.d.ts +4 -6
- package/dist/src/perp/index.js +17 -5
- package/dist/src/perp/tx-builders/common.d.ts +86 -48
- package/dist/src/perp/tx-builders/common.js +114 -48
- package/dist/src/perp/tx-builders/wlp.d.ts +3 -14
- package/dist/src/perp/tx-builders/wlp.js +6 -35
- package/dist/src/perp/tx-builders.d.ts +6 -5
- package/dist/src/perp/tx-builders.js +15 -6
- package/dist/src/unified-client.d.ts +9 -35
- package/dist/src/unified-client.js +3 -4
- package/dist/src/utils/config.d.ts +0 -8
- package/dist/src/utils/config.js +5 -12
- package/package.json +8 -2
- package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +0 -12
- package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.js +0 -17
- package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +0 -68
- package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +0 -113
- package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +0 -36
- package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +0 -31
- package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.d.ts +0 -192
- package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.js +0 -214
- package/dist/cjs/src/oracle/pyth.d.ts +0 -227
- package/dist/cjs/src/oracle/pyth.js +0 -652
- package/dist/cjs/src/oracle/rules/pyth-core-rule.d.ts +0 -15
- package/dist/cjs/src/oracle/rules/pyth-core-rule.js +0 -100
- package/dist/cjs/src/oracle/rules/pyth-rule.d.ts +0 -11
- package/dist/cjs/src/oracle/rules/pyth-rule.js +0 -29
- package/dist/cjs/src/oracle/rules/sponsor.d.ts +0 -32
- package/dist/cjs/src/oracle/rules/sponsor.js +0 -56
- package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +0 -12
- package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.js +0 -14
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +0 -68
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +0 -73
- package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +0 -27
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +0 -192
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +0 -170
- package/dist/src/oracle/pyth.d.ts +0 -227
- package/dist/src/oracle/pyth.js +0 -638
- package/dist/src/oracle/rules/pyth-core-rule.d.ts +0 -15
- package/dist/src/oracle/rules/pyth-core-rule.js +0 -97
- package/dist/src/oracle/rules/pyth-rule.d.ts +0 -11
- package/dist/src/oracle/rules/pyth-rule.js +0 -26
- package/dist/src/oracle/rules/sponsor.d.ts +0 -32
- package/dist/src/oracle/rules/sponsor.js +0 -52
package/SKILLS.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Skills
|
|
2
|
+
|
|
3
|
+
Agent Skills shipped with `@waterx/sdk`. A skill is a written procedure an AI coding agent
|
|
4
|
+
loads on demand — the same flow a developer would follow, in a form an agent can execute
|
|
5
|
+
without being re-taught it each session.
|
|
6
|
+
|
|
7
|
+
[**`waterx-sdk-integration`**](./.claude/skills/waterx-sdk-integration/SKILL.md) is the one
|
|
8
|
+
skill here: it covers integrating the SDK into an app, keeper, or bot. Its frontmatter
|
|
9
|
+
`description` states exactly when it triggers.
|
|
10
|
+
|
|
11
|
+
## Using it in this repo
|
|
12
|
+
|
|
13
|
+
Nothing to do. Claude Code discovers `.claude/skills/` automatically; ask for the skill by
|
|
14
|
+
name, or just describe an integration task and it loads.
|
|
15
|
+
|
|
16
|
+
## Using it in your own repo
|
|
17
|
+
|
|
18
|
+
The skill ships inside the published package, so copy it out of `node_modules`:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
mkdir -p .claude/skills
|
|
22
|
+
cp -r node_modules/@waterx/sdk/.claude/skills/waterx-sdk-integration .claude/skills/
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Agents other than Claude Code can read the file directly — it is plain Markdown with a
|
|
26
|
+
YAML header, and nothing in it is Claude-specific.
|
|
27
|
+
|
|
28
|
+
Re-copy after upgrading the SDK; the skill tracks the API surface and changes with it.
|
|
29
|
+
|
|
30
|
+
## For humans
|
|
31
|
+
|
|
32
|
+
The skill is readable on its own and doubles as an integration checklist. If you are
|
|
33
|
+
reading rather than delegating, [`README.md`](./README.md) covers the same ground with
|
|
34
|
+
more prose — start with [First integration](./README.md#first-integration).
|
|
@@ -71,11 +71,9 @@ export interface WithdrawalQueuePackage {
|
|
|
71
71
|
queue?: string;
|
|
72
72
|
}
|
|
73
73
|
/**
|
|
74
|
-
* Wormhole infra for the cross-chain credit bridge. `state_id` is the
|
|
75
|
-
*
|
|
76
|
-
* `
|
|
77
|
-
* per-deployment via `WaterXConfig.wormhole` if a deployment ever points
|
|
78
|
-
* elsewhere.
|
|
74
|
+
* Wormhole infra for the cross-chain credit bridge. `state_id` is the shared
|
|
75
|
+
* Sui Wormhole `State` object for the network. Override per-deployment via
|
|
76
|
+
* `WaterXConfig.wormhole` if a deployment ever points elsewhere.
|
|
79
77
|
*/
|
|
80
78
|
export interface WormholeInfraConfig {
|
|
81
79
|
/** Shared Sui Wormhole `State` object. */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Wormhole / Wormholescan integration for the cross-chain credit bridge.
|
|
3
3
|
*
|
|
4
|
-
* Single source of truth for VAA discovery + (de)serialization
|
|
5
|
-
* `oracle/pyth.ts`'s role for Pyth's Hermes endpoint. Two directions:
|
|
4
|
+
* Single source of truth for VAA discovery + (de)serialization. Two directions:
|
|
6
5
|
*
|
|
7
6
|
* - Mint (EVM → Sui): fetch the signed VAA for an EVM `Deposit` by
|
|
8
7
|
* (emitter chain, emitter address, sequence); the raw bytes feed
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Wormhole / Wormholescan integration for the cross-chain credit bridge.
|
|
4
4
|
*
|
|
5
|
-
* Single source of truth for VAA discovery + (de)serialization
|
|
6
|
-
* `oracle/pyth.ts`'s role for Pyth's Hermes endpoint. Two directions:
|
|
5
|
+
* Single source of truth for VAA discovery + (de)serialization. Two directions:
|
|
7
6
|
*
|
|
8
7
|
* - Mint (EVM → Sui): fetch the signed VAA for an EVM `Deposit` by
|
|
9
8
|
* (emitter chain, emitter address, sequence); the raw bytes feed
|
|
@@ -70,6 +70,11 @@ 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">;
|
|
73
78
|
export declare const FeedConfig: MoveStruct<{
|
|
74
79
|
ticker: import("@mysten/sui/bcs").BcsType<string, string, "string">;
|
|
75
80
|
sources: import("@mysten/sui/bcs").BcsType<string[], Iterable<string | number | bigint> & {
|
|
@@ -214,17 +219,82 @@ export interface CollectBatchLatestOptions {
|
|
|
214
219
|
* and so aborts on any stale item, this path runs alongside Pyth/Supra. To let
|
|
215
220
|
* those cover a lagging TEE — the blast-radius bound in the GCP ADR — a
|
|
216
221
|
* _freshness_ miss ABSTAINS (records `none`, which `aggregator::remove_outliers`
|
|
217
|
-
* drops before the `weight_threshold` fail-closed check)
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
+
* drops before the `weight_threshold` fail-closed check), and so does a _replayed_
|
|
223
|
+
* signed timestamp (the chain already accepted that snapshot — the on-chain price
|
|
224
|
+
* is at least as fresh, and two concurrent keeper PTBs sharing one envelope must
|
|
225
|
+
* not kill each other). A _config/integrity_ mismatch (source / ticker / method /
|
|
226
|
+
* confidence / deviation) still ABORTS: an enclave whose signed payload disagrees
|
|
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.
|
|
222
229
|
*
|
|
223
230
|
* Every gate is identical to `feed_batch_item_latest`; only the abort-vs-abstain
|
|
224
|
-
* disposition of the
|
|
225
|
-
* collector rather than a fresh single-rule one.
|
|
231
|
+
* disposition of the freshness + replay gates differs, and the sink is the
|
|
232
|
+
* caller's collector rather than a fresh single-rule one.
|
|
226
233
|
*/
|
|
227
234
|
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;
|
|
228
298
|
export interface QuoteForTimestampArguments {
|
|
229
299
|
config: RawTransactionArgument<string>;
|
|
230
300
|
enclaveConfig: RawTransactionArgument<string>;
|
|
@@ -421,6 +491,27 @@ export interface BatchPriceIntentOptions {
|
|
|
421
491
|
];
|
|
422
492
|
}
|
|
423
493
|
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;
|
|
424
515
|
export interface MaxBatchSizeOptions {
|
|
425
516
|
package?: string;
|
|
426
517
|
arguments?: [
|
|
@@ -717,6 +808,48 @@ export interface SourceGataUsdtPerpWsOptions {
|
|
|
717
808
|
];
|
|
718
809
|
}
|
|
719
810
|
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
|
+
export interface SourcePythLazerWsOptions {
|
|
848
|
+
package?: string;
|
|
849
|
+
arguments?: [
|
|
850
|
+
];
|
|
851
|
+
}
|
|
852
|
+
export declare function sourcePythLazerWs(options?: SourcePythLazerWsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
|
|
720
853
|
export interface MethodDirectOptions {
|
|
721
854
|
package?: string;
|
|
722
855
|
arguments?: [
|
|
@@ -36,9 +36,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.BatchLatestUpdated = exports.HistoricalPriceVerified = exports.SignedTsHwmKey = exports.Config = exports.VerifiedPrice = exports.FeedConfig = exports.BatchPricePayload = exports.BatchPriceItem = exports.PricePayload = exports.WaterxRule = exports.WATERX_RULE = void 0;
|
|
39
|
+
exports.BatchLatestUpdated = exports.HistoricalPriceVerified = exports.SignedTsHwmKey = exports.Config = exports.VerifiedPrice = exports.FeedConfig = exports.MerkleRoot = exports.BatchPricePayload = exports.BatchPriceItem = exports.PricePayload = exports.WaterxRule = exports.WATERX_RULE = void 0;
|
|
40
40
|
exports.feedBatchLatest = feedBatchLatest;
|
|
41
41
|
exports.collectBatchLatest = collectBatchLatest;
|
|
42
|
+
exports.feedSingleWithProof = feedSingleWithProof;
|
|
43
|
+
exports.collectSingleWithProof = collectSingleWithProof;
|
|
42
44
|
exports.quoteForTimestamp = quoteForTimestamp;
|
|
43
45
|
exports.destroyVerifiedPrice = destroyVerifiedPrice;
|
|
44
46
|
exports.collectVerifiedPrice = collectVerifiedPrice;
|
|
@@ -50,6 +52,8 @@ exports.newBatchItem = newBatchItem;
|
|
|
50
52
|
exports.pushBatchItem = pushBatchItem;
|
|
51
53
|
exports.feedConfig = feedConfig;
|
|
52
54
|
exports.batchPriceIntent = batchPriceIntent;
|
|
55
|
+
exports.merkleRootIntent = merkleRootIntent;
|
|
56
|
+
exports.leafHashOf = leafHashOf;
|
|
53
57
|
exports.maxBatchSize = maxBatchSize;
|
|
54
58
|
exports.batchItems = batchItems;
|
|
55
59
|
exports.batchItemSymbol = batchItemSymbol;
|
|
@@ -82,6 +86,13 @@ exports.sourceBinanceUsdmPerpWs = sourceBinanceUsdmPerpWs;
|
|
|
82
86
|
exports.sourceBybitLinearPerpWs = sourceBybitLinearPerpWs;
|
|
83
87
|
exports.sourceGateioUsdtPerpWs = sourceGateioUsdtPerpWs;
|
|
84
88
|
exports.sourceGataUsdtPerpWs = sourceGataUsdtPerpWs;
|
|
89
|
+
exports.sourceBybitSpotWs = sourceBybitSpotWs;
|
|
90
|
+
exports.sourceXstockEquityRest = sourceXstockEquityRest;
|
|
91
|
+
exports.sourceOkxSpotWs = sourceOkxSpotWs;
|
|
92
|
+
exports.sourceHyperliquidPerpWs = sourceHyperliquidPerpWs;
|
|
93
|
+
exports.sourceGateioSpotWs = sourceGateioSpotWs;
|
|
94
|
+
exports.sourceKrakenSpotWs = sourceKrakenSpotWs;
|
|
95
|
+
exports.sourcePythLazerWs = sourcePythLazerWs;
|
|
85
96
|
exports.methodDirect = methodDirect;
|
|
86
97
|
exports.methodMedian = methodMedian;
|
|
87
98
|
exports.methodConfidence = methodConfidence;
|
|
@@ -132,6 +143,9 @@ exports.BatchPriceItem = new index_ts_1.MoveStruct({ name: `${$moduleName}::Batc
|
|
|
132
143
|
exports.BatchPricePayload = new index_ts_1.MoveStruct({ name: `${$moduleName}::BatchPricePayload`, fields: {
|
|
133
144
|
items: bcs_1.bcs.vector(exports.BatchPriceItem)
|
|
134
145
|
} });
|
|
146
|
+
exports.MerkleRoot = new index_ts_1.MoveStruct({ name: `${$moduleName}::MerkleRoot`, fields: {
|
|
147
|
+
root: bcs_1.bcs.vector(bcs_1.bcs.u8())
|
|
148
|
+
} });
|
|
135
149
|
exports.FeedConfig = new index_ts_1.MoveStruct({ name: `${$moduleName}::FeedConfig`, fields: {
|
|
136
150
|
ticker: bcs_1.bcs.string(),
|
|
137
151
|
sources: bcs_1.bcs.vector(bcs_1.bcs.u64()),
|
|
@@ -217,15 +231,17 @@ function feedBatchLatest(options) {
|
|
|
217
231
|
* and so aborts on any stale item, this path runs alongside Pyth/Supra. To let
|
|
218
232
|
* those cover a lagging TEE — the blast-radius bound in the GCP ADR — a
|
|
219
233
|
* _freshness_ miss ABSTAINS (records `none`, which `aggregator::remove_outliers`
|
|
220
|
-
* drops before the `weight_threshold` fail-closed check)
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
234
|
+
* drops before the `weight_threshold` fail-closed check), and so does a _replayed_
|
|
235
|
+
* signed timestamp (the chain already accepted that snapshot — the on-chain price
|
|
236
|
+
* is at least as fresh, and two concurrent keeper PTBs sharing one envelope must
|
|
237
|
+
* not kill each other). A _config/integrity_ mismatch (source / ticker / method /
|
|
238
|
+
* confidence / deviation) still ABORTS: an enclave whose signed payload disagrees
|
|
239
|
+
* with the on-chain feed config is a red flag, not a liveness blip. Bad signature,
|
|
240
|
+
* malformed batch, and a future timestamp always abort.
|
|
225
241
|
*
|
|
226
242
|
* Every gate is identical to `feed_batch_item_latest`; only the abort-vs-abstain
|
|
227
|
-
* disposition of the
|
|
228
|
-
* collector rather than a fresh single-rule one.
|
|
243
|
+
* disposition of the freshness + replay gates differs, and the sink is the
|
|
244
|
+
* caller's collector rather than a fresh single-rule one.
|
|
229
245
|
*/
|
|
230
246
|
function collectBatchLatest(options) {
|
|
231
247
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
@@ -247,6 +263,63 @@ function collectBatchLatest(options) {
|
|
|
247
263
|
arguments: (0, index_ts_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
248
264
|
});
|
|
249
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Streaming per-symbol sibling of `feed_batch_latest`. Verifies ONE enclave
|
|
268
|
+
* signature over a Merkle `root`, checks `item` is a leaf of that root via
|
|
269
|
+
* `proof`, then runs the identical per-item gates + `oracle::aggregate`. Use for a
|
|
270
|
+
* WaterxRule-only aggregator; for a Pyth-coexisting aggregator use
|
|
271
|
+
* `collect_single_with_proof`.
|
|
272
|
+
*/
|
|
273
|
+
function feedSingleWithProof(options) {
|
|
274
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
275
|
+
const argumentsTypes = [
|
|
276
|
+
null,
|
|
277
|
+
null,
|
|
278
|
+
'0x2::clock::Clock',
|
|
279
|
+
null,
|
|
280
|
+
null,
|
|
281
|
+
'u64',
|
|
282
|
+
null,
|
|
283
|
+
'vector<vector<u8>>',
|
|
284
|
+
'vector<u8>'
|
|
285
|
+
];
|
|
286
|
+
const parameterNames = ["oracleObj", "config", "enclaveConfig", "enclave", "timestampMs", "item", "proof", "sig"];
|
|
287
|
+
return (tx) => tx.moveCall({
|
|
288
|
+
package: packageAddress,
|
|
289
|
+
module: 'waterx_rule',
|
|
290
|
+
function: 'feed_single_with_proof',
|
|
291
|
+
arguments: (0, index_ts_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Collect-only sibling of `feed_single_with_proof` for the dual-rule latest path
|
|
296
|
+
* (WaterX alongside Pyth on one aggregator), mirroring `collect_batch_latest`:
|
|
297
|
+
* verifies root + proof, feeds the leaf into the caller's `PriceCollector` WITHOUT
|
|
298
|
+
* calling `oracle::aggregate`. Abort vs abstain matches `collect_batch_latest`
|
|
299
|
+
* exactly — a config/integrity mismatch aborts, a freshness miss abstains so Pyth
|
|
300
|
+
* can cover a lagging TEE.
|
|
301
|
+
*/
|
|
302
|
+
function collectSingleWithProof(options) {
|
|
303
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
304
|
+
const argumentsTypes = [
|
|
305
|
+
null,
|
|
306
|
+
null,
|
|
307
|
+
'0x2::clock::Clock',
|
|
308
|
+
null,
|
|
309
|
+
null,
|
|
310
|
+
'u64',
|
|
311
|
+
null,
|
|
312
|
+
'vector<vector<u8>>',
|
|
313
|
+
'vector<u8>'
|
|
314
|
+
];
|
|
315
|
+
const parameterNames = ["collector", "config", "enclaveConfig", "enclave", "timestampMs", "item", "proof", "sig"];
|
|
316
|
+
return (tx) => tx.moveCall({
|
|
317
|
+
package: packageAddress,
|
|
318
|
+
module: 'waterx_rule',
|
|
319
|
+
function: 'collect_single_with_proof',
|
|
320
|
+
arguments: (0, index_ts_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
321
|
+
});
|
|
322
|
+
}
|
|
250
323
|
/**
|
|
251
324
|
* Verifies a historical quote without touching `waterx_oracle`.
|
|
252
325
|
*
|
|
@@ -438,6 +511,32 @@ function batchPriceIntent(options = {}) {
|
|
|
438
511
|
function: 'batch_price_intent',
|
|
439
512
|
});
|
|
440
513
|
}
|
|
514
|
+
function merkleRootIntent(options = {}) {
|
|
515
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
516
|
+
return (tx) => tx.moveCall({
|
|
517
|
+
package: packageAddress,
|
|
518
|
+
module: 'waterx_rule',
|
|
519
|
+
function: 'merkle_root_intent',
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* The keccak256 leaf hash for `item` — `keccak256(0x00 || BCS(item))`. Exposed so
|
|
524
|
+
* the off-chain builder / SDK can be pinned against the on-chain encoding in a
|
|
525
|
+
* cross-implementation golden test.
|
|
526
|
+
*/
|
|
527
|
+
function leafHashOf(options) {
|
|
528
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
529
|
+
const argumentsTypes = [
|
|
530
|
+
null
|
|
531
|
+
];
|
|
532
|
+
const parameterNames = ["item"];
|
|
533
|
+
return (tx) => tx.moveCall({
|
|
534
|
+
package: packageAddress,
|
|
535
|
+
module: 'waterx_rule',
|
|
536
|
+
function: 'leaf_hash_of',
|
|
537
|
+
arguments: (0, index_ts_1.normalizeMoveArguments)(options.arguments, argumentsTypes, parameterNames),
|
|
538
|
+
});
|
|
539
|
+
}
|
|
441
540
|
function maxBatchSize(options = {}) {
|
|
442
541
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
443
542
|
return (tx) => tx.moveCall({
|
|
@@ -824,6 +923,62 @@ function sourceGataUsdtPerpWs(options = {}) {
|
|
|
824
923
|
function: 'source_gata_usdt_perp_ws',
|
|
825
924
|
});
|
|
826
925
|
}
|
|
926
|
+
function sourceBybitSpotWs(options = {}) {
|
|
927
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
928
|
+
return (tx) => tx.moveCall({
|
|
929
|
+
package: packageAddress,
|
|
930
|
+
module: 'waterx_rule',
|
|
931
|
+
function: 'source_bybit_spot_ws',
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
function sourceXstockEquityRest(options = {}) {
|
|
935
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
936
|
+
return (tx) => tx.moveCall({
|
|
937
|
+
package: packageAddress,
|
|
938
|
+
module: 'waterx_rule',
|
|
939
|
+
function: 'source_xstock_equity_rest',
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
function sourceOkxSpotWs(options = {}) {
|
|
943
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
944
|
+
return (tx) => tx.moveCall({
|
|
945
|
+
package: packageAddress,
|
|
946
|
+
module: 'waterx_rule',
|
|
947
|
+
function: 'source_okx_spot_ws',
|
|
948
|
+
});
|
|
949
|
+
}
|
|
950
|
+
function sourceHyperliquidPerpWs(options = {}) {
|
|
951
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
952
|
+
return (tx) => tx.moveCall({
|
|
953
|
+
package: packageAddress,
|
|
954
|
+
module: 'waterx_rule',
|
|
955
|
+
function: 'source_hyperliquid_perp_ws',
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
function sourceGateioSpotWs(options = {}) {
|
|
959
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
960
|
+
return (tx) => tx.moveCall({
|
|
961
|
+
package: packageAddress,
|
|
962
|
+
module: 'waterx_rule',
|
|
963
|
+
function: 'source_gateio_spot_ws',
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
function sourceKrakenSpotWs(options = {}) {
|
|
967
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
968
|
+
return (tx) => tx.moveCall({
|
|
969
|
+
package: packageAddress,
|
|
970
|
+
module: 'waterx_rule',
|
|
971
|
+
function: 'source_kraken_spot_ws',
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function sourcePythLazerWs(options = {}) {
|
|
975
|
+
const packageAddress = options.package ?? '@waterx/rule';
|
|
976
|
+
return (tx) => tx.moveCall({
|
|
977
|
+
package: packageAddress,
|
|
978
|
+
module: 'waterx_rule',
|
|
979
|
+
function: 'source_pyth_lazer_ws',
|
|
980
|
+
});
|
|
981
|
+
}
|
|
827
982
|
function methodDirect(options = {}) {
|
|
828
983
|
const packageAddress = options.package ?? '@waterx/rule';
|
|
829
984
|
return (tx) => tx.moveCall({
|