@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.
Files changed (150) hide show
  1. package/.claude/skills/waterx-sdk-integration/SKILL.md +225 -0
  2. package/README.md +216 -45
  3. package/SKILLS.md +34 -0
  4. package/dist/cjs/src/account/config.d.ts +3 -5
  5. package/dist/cjs/src/account/funding/wormhole.d.ts +1 -2
  6. package/dist/cjs/src/account/funding/wormhole.js +1 -2
  7. package/dist/cjs/src/generated/waterx_rule/waterx_rule.d.ts +140 -7
  8. package/dist/cjs/src/generated/waterx_rule/waterx_rule.js +163 -8
  9. package/dist/cjs/src/oracle/aggregate.d.ts +49 -62
  10. package/dist/cjs/src/oracle/aggregate.js +208 -164
  11. package/dist/cjs/src/oracle/config.d.ts +38 -51
  12. package/dist/cjs/src/oracle/config.js +1 -1
  13. package/dist/cjs/src/oracle/host.d.ts +14 -19
  14. package/dist/cjs/src/oracle/host.js +3 -3
  15. package/dist/cjs/src/oracle/index.d.ts +25 -16
  16. package/dist/cjs/src/oracle/index.js +87 -69
  17. package/dist/cjs/src/oracle/price-update-rule.d.ts +104 -66
  18. package/dist/cjs/src/oracle/price-update-rule.js +24 -16
  19. package/dist/cjs/src/oracle/pyth-pro-history.d.ts +36 -0
  20. package/dist/cjs/src/oracle/pyth-pro-history.js +41 -0
  21. package/dist/cjs/src/oracle/read-plane.d.ts +35 -53
  22. package/dist/cjs/src/oracle/read-plane.js +26 -48
  23. package/dist/cjs/src/oracle/read-prices.d.ts +105 -0
  24. package/dist/cjs/src/oracle/read-prices.js +162 -0
  25. package/dist/cjs/src/oracle/rule-registry.d.ts +12 -12
  26. package/dist/cjs/src/oracle/rule-registry.js +12 -14
  27. package/dist/cjs/src/oracle/rules/pyth-lazer-rule.d.ts +24 -3
  28. package/dist/cjs/src/oracle/rules/pyth-lazer-rule.js +40 -20
  29. package/dist/cjs/src/oracle/rules/waterx-rule.d.ts +271 -57
  30. package/dist/cjs/src/oracle/rules/waterx-rule.js +743 -144
  31. package/dist/cjs/src/oracle/schedule.d.ts +109 -0
  32. package/dist/cjs/src/oracle/schedule.js +991 -0
  33. package/dist/cjs/src/oracle/source-list.d.ts +31 -27
  34. package/dist/cjs/src/oracle/source-list.js +43 -45
  35. package/dist/cjs/src/oracle/symbol-catalog.d.ts +54 -0
  36. package/dist/cjs/src/oracle/symbol-catalog.js +69 -0
  37. package/dist/cjs/src/oracle/update-fetch.d.ts +11 -15
  38. package/dist/cjs/src/oracle/update-fetch.js +12 -19
  39. package/dist/cjs/src/oracle/validate.d.ts +105 -0
  40. package/dist/cjs/src/oracle/validate.js +185 -0
  41. package/dist/cjs/src/oracle/weight-coverage.d.ts +79 -0
  42. package/dist/cjs/src/oracle/weight-coverage.js +173 -0
  43. package/dist/cjs/src/perp/client.d.ts +40 -55
  44. package/dist/cjs/src/perp/client.js +44 -17
  45. package/dist/cjs/src/perp/config-view.d.ts +5 -14
  46. package/dist/cjs/src/perp/config-view.js +5 -16
  47. package/dist/cjs/src/perp/config.d.ts +3 -3
  48. package/dist/cjs/src/perp/config.js +11 -13
  49. package/dist/cjs/src/perp/index.d.ts +4 -6
  50. package/dist/cjs/src/perp/index.js +43 -18
  51. package/dist/cjs/src/perp/tx-builders/common.d.ts +86 -48
  52. package/dist/cjs/src/perp/tx-builders/common.js +115 -47
  53. package/dist/cjs/src/perp/tx-builders/wlp.d.ts +3 -14
  54. package/dist/cjs/src/perp/tx-builders/wlp.js +6 -35
  55. package/dist/cjs/src/perp/tx-builders.d.ts +6 -5
  56. package/dist/cjs/src/perp/tx-builders.js +16 -10
  57. package/dist/cjs/src/unified-client.d.ts +9 -35
  58. package/dist/cjs/src/unified-client.js +3 -4
  59. package/dist/cjs/src/utils/config.d.ts +0 -8
  60. package/dist/cjs/src/utils/config.js +5 -13
  61. package/dist/src/account/config.d.ts +3 -5
  62. package/dist/src/account/funding/wormhole.d.ts +1 -2
  63. package/dist/src/account/funding/wormhole.js +1 -2
  64. package/dist/src/generated/waterx_rule/waterx_rule.d.ts +140 -7
  65. package/dist/src/generated/waterx_rule/waterx_rule.js +151 -7
  66. package/dist/src/oracle/aggregate.d.ts +49 -62
  67. package/dist/src/oracle/aggregate.js +209 -164
  68. package/dist/src/oracle/config.d.ts +38 -51
  69. package/dist/src/oracle/config.js +1 -1
  70. package/dist/src/oracle/host.d.ts +14 -19
  71. package/dist/src/oracle/host.js +3 -3
  72. package/dist/src/oracle/index.d.ts +25 -16
  73. package/dist/src/oracle/index.js +61 -54
  74. package/dist/src/oracle/price-update-rule.d.ts +104 -66
  75. package/dist/src/oracle/price-update-rule.js +23 -16
  76. package/dist/src/oracle/pyth-pro-history.d.ts +36 -0
  77. package/dist/src/oracle/pyth-pro-history.js +38 -0
  78. package/dist/src/oracle/read-plane.d.ts +35 -53
  79. package/dist/src/oracle/read-plane.js +25 -47
  80. package/dist/src/oracle/read-prices.d.ts +105 -0
  81. package/dist/src/oracle/read-prices.js +156 -0
  82. package/dist/src/oracle/rule-registry.d.ts +12 -12
  83. package/dist/src/oracle/rule-registry.js +12 -14
  84. package/dist/src/oracle/rules/pyth-lazer-rule.d.ts +24 -3
  85. package/dist/src/oracle/rules/pyth-lazer-rule.js +39 -20
  86. package/dist/src/oracle/rules/waterx-rule.d.ts +271 -57
  87. package/dist/src/oracle/rules/waterx-rule.js +735 -144
  88. package/dist/src/oracle/schedule.d.ts +109 -0
  89. package/dist/src/oracle/schedule.js +985 -0
  90. package/dist/src/oracle/source-list.d.ts +31 -27
  91. package/dist/src/oracle/source-list.js +42 -43
  92. package/dist/src/oracle/symbol-catalog.d.ts +54 -0
  93. package/dist/src/oracle/symbol-catalog.js +65 -0
  94. package/dist/src/oracle/update-fetch.d.ts +11 -15
  95. package/dist/src/oracle/update-fetch.js +12 -18
  96. package/dist/src/oracle/validate.d.ts +105 -0
  97. package/dist/src/oracle/validate.js +177 -0
  98. package/dist/src/oracle/weight-coverage.d.ts +79 -0
  99. package/dist/src/oracle/weight-coverage.js +166 -0
  100. package/dist/src/perp/client.d.ts +40 -55
  101. package/dist/src/perp/client.js +45 -18
  102. package/dist/src/perp/config-view.d.ts +5 -14
  103. package/dist/src/perp/config-view.js +5 -16
  104. package/dist/src/perp/config.d.ts +3 -3
  105. package/dist/src/perp/config.js +11 -13
  106. package/dist/src/perp/index.d.ts +4 -6
  107. package/dist/src/perp/index.js +17 -5
  108. package/dist/src/perp/tx-builders/common.d.ts +86 -48
  109. package/dist/src/perp/tx-builders/common.js +114 -48
  110. package/dist/src/perp/tx-builders/wlp.d.ts +3 -14
  111. package/dist/src/perp/tx-builders/wlp.js +6 -35
  112. package/dist/src/perp/tx-builders.d.ts +6 -5
  113. package/dist/src/perp/tx-builders.js +15 -6
  114. package/dist/src/unified-client.d.ts +9 -35
  115. package/dist/src/unified-client.js +3 -4
  116. package/dist/src/utils/config.d.ts +0 -8
  117. package/dist/src/utils/config.js +5 -12
  118. package/package.json +8 -2
  119. package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +0 -12
  120. package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.js +0 -17
  121. package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +0 -68
  122. package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +0 -113
  123. package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +0 -36
  124. package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +0 -31
  125. package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.d.ts +0 -192
  126. package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.js +0 -214
  127. package/dist/cjs/src/oracle/pyth.d.ts +0 -227
  128. package/dist/cjs/src/oracle/pyth.js +0 -652
  129. package/dist/cjs/src/oracle/rules/pyth-core-rule.d.ts +0 -15
  130. package/dist/cjs/src/oracle/rules/pyth-core-rule.js +0 -100
  131. package/dist/cjs/src/oracle/rules/pyth-rule.d.ts +0 -11
  132. package/dist/cjs/src/oracle/rules/pyth-rule.js +0 -29
  133. package/dist/cjs/src/oracle/rules/sponsor.d.ts +0 -32
  134. package/dist/cjs/src/oracle/rules/sponsor.js +0 -56
  135. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +0 -12
  136. package/dist/src/generated/pyth_sponsor_rule/deps/sui/balance.js +0 -14
  137. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +0 -68
  138. package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +0 -73
  139. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +0 -36
  140. package/dist/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +0 -27
  141. package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +0 -192
  142. package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +0 -170
  143. package/dist/src/oracle/pyth.d.ts +0 -227
  144. package/dist/src/oracle/pyth.js +0 -638
  145. package/dist/src/oracle/rules/pyth-core-rule.d.ts +0 -15
  146. package/dist/src/oracle/rules/pyth-core-rule.js +0 -97
  147. package/dist/src/oracle/rules/pyth-rule.d.ts +0 -11
  148. package/dist/src/oracle/rules/pyth-rule.js +0 -26
  149. package/dist/src/oracle/rules/sponsor.d.ts +0 -32
  150. package/dist/src/oracle/rules/sponsor.js +0 -52
@@ -1,100 +0,0 @@
1
- "use strict";
2
- /**
3
- * `PythCoreRule` — `PriceUpdateRule` wrapper around the existing Pyth Core
4
- * (Hermes VAA) source in `../pyth.ts`. Delegates to `fetchPriceFeedsUpdateData`
5
- * / `buildPythPriceUpdateCalls` verbatim; this file only adapts them to the
6
- * `PriceUpdateRule` port shape (fetch → build) so a future router can select
7
- * across rules by `kind`. Mechanical wrap only — no on-chain/off-chain logic
8
- * changes vs `../pyth.ts` / `./pyth-rule.ts`.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.PythCoreRule = void 0;
12
- const record_ts_1 = require("../../utils/record.js");
13
- const price_update_rule_ts_1 = require("../price-update-rule.js");
14
- const pyth_ts_1 = require("../pyth.js");
15
- /**
16
- * Shape check ONLY — the `kind` discriminant is checked separately by the
17
- * caller before this runs, since a same-shaped payload from a different rule
18
- * (e.g. a hypothetical Lazer payload also carrying `updates`/`feedIds`) must
19
- * not silently pass as a Pyth Core VAA block.
20
- */
21
- function isPythCoreUpdatePayloadShape(payload) {
22
- return (typeof payload === "object" &&
23
- payload !== null &&
24
- Array.isArray(payload.updates) &&
25
- Array.isArray(payload.feedIds));
26
- }
27
- exports.PythCoreRule = {
28
- kind: "pyth_rule",
29
- // Charges a per-feed `base_update_fee` via `pyth::update_single_price_feed` —
30
- // see `PriceUpdateRule.requiresFeeSource`.
31
- requiresFeeSource: true,
32
- /** Tickers with a `pyth_rule.feeds` entry (mirrors `refreshOraclePrices`'s filter). */
33
- supportedTickers(host) {
34
- return Object.keys(host.config.packages.pyth_rule?.feeds ?? {});
35
- },
36
- /** Resolves feed ids for `tickers`, then fetches their Hermes accumulator update. */
37
- async fetchUpdateData(host, tickers) {
38
- if (tickers.length === 0)
39
- return null;
40
- // Endpoint is this source's own per-network infra (`PYTH_CORE_INFRA`);
41
- // credential + retry/timeout policy are the caller-supplied `client.pyth`
42
- // access slice.
43
- const endpoint = (0, pyth_ts_1.pythCoreHermesEndpoint)(host.network);
44
- const feedIds = tickers.map((ticker) => host.getPythFeed(ticker).feed_id);
45
- const updates = await (0, pyth_ts_1.fetchPriceFeedsUpdateData)(endpoint, feedIds, {
46
- apiKey: host.pyth.api_key,
47
- fetch: host.pyth.fetch,
48
- });
49
- // `updates` covers only the feeds this endpoint actually served — the fetch
50
- // drops (and memoizes) any it lacks, e.g. Core feeds absent from Pyth Pro
51
- // (WTIUSD/BRENTUSD). Align `feedIds` with them: buildPythPriceUpdateCalls
52
- // emits one moveCall per feedId and must not reference a feed the
53
- // accumulator blob doesn't cover.
54
- return {
55
- kind: "pyth_rule",
56
- payload: {
57
- updates,
58
- feedIds: (0, pyth_ts_1.endpointSupportedFeedIds)(endpoint, feedIds, host.pyth.api_key),
59
- },
60
- };
61
- },
62
- /**
63
- * Subsets a (typically whole-universe) payload from {@link fetchUpdateData}
64
- * down to exactly `tickers`. Pyth Core charges a per-feed update fee (one
65
- * `update_single_price_feed` moveCall per `feedIds` entry — see
66
- * `buildPythPriceUpdateCalls`), so serving a full all-registry payload for a
67
- * 2-ticker build would multiply both the fee and the PTB size ~N× — a
68
- * per-feed subset is valid input by construction. Narrows `feedIds` only:
69
- * the single combined Hermes accumulator blob in `updates` already covers
70
- * every packed feed and needs no re-slicing. A ticker with no
71
- * `pyth_rule.feeds` entry, or whose feed id is not packed in THIS payload's
72
- * `feedIds`, is a coverage gap → `null` (miss), never a silent partial.
73
- */
74
- narrowUpdateData(host, data, tickers) {
75
- const payload = (0, price_update_rule_ts_1.assertRuleUpdateData)(data, "pyth_rule", isPythCoreUpdatePayloadShape, "{ updates: Uint8Array[]; feedIds: string[] }");
76
- if (!payload || tickers.length === 0)
77
- return null;
78
- const packedFeedIds = new Set(payload.feedIds);
79
- const feedIds = [];
80
- for (const ticker of tickers) {
81
- // Same lookup as `host.getPythFeed(ticker)` minus its throw — an
82
- // unlisted ticker is a miss here, not an error.
83
- const feedId = (0, record_ts_1.ownEntry)(host.config.packages.pyth_rule?.feeds, ticker)?.feed_id;
84
- if (feedId === undefined || !packedFeedIds.has(feedId))
85
- return null;
86
- feedIds.push(feedId);
87
- }
88
- return { kind: "pyth_rule", payload: { updates: payload.updates, feedIds } };
89
- },
90
- /** Appends the wormhole/pyth update PTB block for the payload from {@link fetchUpdateData}. */
91
- async buildUpdateCalls(tx, host, data, opts) {
92
- const payload = (0, price_update_rule_ts_1.assertRuleUpdateData)(data, "pyth_rule", isPythCoreUpdatePayloadShape, "{ updates: Uint8Array[]; feedIds: string[] }");
93
- if (!payload)
94
- return;
95
- await (0, pyth_ts_1.buildPythPriceUpdateCalls)(tx, host, payload.updates, payload.feedIds, {
96
- cache: opts?.cache,
97
- feeSource: opts?.feeSource,
98
- });
99
- },
100
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * `pyth_rule::feed` — feed a refreshed Pyth `PriceInfoObject` into an oracle
3
- * `PriceCollector`. The rule resolves the on-chain feed by ticker via its
4
- * `Config.identifier_map`, so it is not typed `<T>`.
5
- *
6
- * Caller must run the Pyth on-chain update first (see `../pyth.ts`) so the
7
- * `PriceInfoObject` is fresh.
8
- */
9
- import type { Transaction, TransactionArgument } from "@mysten/sui/transactions";
10
- import type { OracleHost } from "../host.ts";
11
- export declare function feedPythRule(tx: Transaction, host: OracleHost, collector: TransactionArgument, priceInfoObjectId: string): void;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- /**
3
- * `pyth_rule::feed` — feed a refreshed Pyth `PriceInfoObject` into an oracle
4
- * `PriceCollector`. The rule resolves the on-chain feed by ticker via its
5
- * `Config.identifier_map`, so it is not typed `<T>`.
6
- *
7
- * Caller must run the Pyth on-chain update first (see `../pyth.ts`) so the
8
- * `PriceInfoObject` is fresh.
9
- */
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.feedPythRule = feedPythRule;
12
- const pyth_rule_ts_1 = require("../../generated/waterx_pyth_rule/pyth_rule.js");
13
- const pyth_ts_1 = require("../pyth.js");
14
- function feedPythRule(tx, host, collector, priceInfoObjectId) {
15
- (0, pyth_rule_ts_1.feed)({
16
- package: host.config.packages.pyth_rule.published_at,
17
- arguments: {
18
- collector,
19
- config: tx.object(host.config.packages.pyth_rule.config),
20
- // The deployed pyth_rule package is compiled against the Core pyth
21
- // dependency, so its `&PythState` parameter is the Core-package-qualified
22
- // type and the Core source's own per-network state (`PYTH_CORE_INFRA`)
23
- // is always the right state to pass. The config's price_info_object
24
- // entries are Core objects to match.
25
- pythState: tx.object(pyth_ts_1.PYTH_CORE_INFRA[host.network].state_id),
26
- pythPriceInfo: tx.object(priceInfoObjectId),
27
- },
28
- })(tx);
29
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * `pyth_sponsor_rule` — pay Pyth update fees from a shared sponsor pool AND
3
- * attach the `PythSponsorRule` witness to a `TradingRequest`. Required when the
4
- * market's `request_checklist` contains `PythSponsorRule`.
5
- *
6
- * Flow: {@link openPythSponsorFund} opens a `Fund` hot potato; the caller wraps
7
- * the returned `{ fund, packageId }` into an `OracleFeeSource` (`{ kind:
8
- * 'sponsor', fund, packageId }`) and passes that to the Pyth update path (it
9
- * draws per-feed fees via `pyth_sponsor_rule::split`); then
10
- * {@link reimbursePythSponsor} consumes the `Fund`, returns leftover SUI, and
11
- * attaches the witness.
12
- */
13
- import type { Transaction, TransactionArgument } from "@mysten/sui/transactions";
14
- import type { OracleHost } from "../host.ts";
15
- /**
16
- * Opens a `Fund` hot potato from the shared PythSponsor pool. Wrap the
17
- * returned `{ fund, packageId }` into an `OracleFeeSource`
18
- * (`{ kind: 'sponsor', fund, packageId }`) and pass that to
19
- * `refreshOraclePrices` as `feeSource`, then {@link reimbursePythSponsor} once
20
- * the TradingRequest is built.
21
- */
22
- export declare function openPythSponsorFund(tx: Transaction, host: OracleHost): {
23
- fund: TransactionArgument;
24
- packageId: string;
25
- };
26
- /**
27
- * Consumes the `Fund` hot potato from {@link openPythSponsorFund}, returns any
28
- * leftover SUI to the sponsor pool, and attaches the `PythSponsorRule` witness to
29
- * the given `TradingRequest<C_TOKEN>` so `trading::execute` can satisfy a
30
- * checklist that includes `PythSponsorRule`.
31
- */
32
- export declare function reimbursePythSponsor(tx: Transaction, host: OracleHost, fund: TransactionArgument, tradingRequest: TransactionArgument, collateralType: string): void;
@@ -1,56 +0,0 @@
1
- "use strict";
2
- /**
3
- * `pyth_sponsor_rule` — pay Pyth update fees from a shared sponsor pool AND
4
- * attach the `PythSponsorRule` witness to a `TradingRequest`. Required when the
5
- * market's `request_checklist` contains `PythSponsorRule`.
6
- *
7
- * Flow: {@link openPythSponsorFund} opens a `Fund` hot potato; the caller wraps
8
- * the returned `{ fund, packageId }` into an `OracleFeeSource` (`{ kind:
9
- * 'sponsor', fund, packageId }`) and passes that to the Pyth update path (it
10
- * draws per-feed fees via `pyth_sponsor_rule::split`); then
11
- * {@link reimbursePythSponsor} consumes the `Fund`, returns leftover SUI, and
12
- * attaches the witness.
13
- */
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.openPythSponsorFund = openPythSponsorFund;
16
- exports.reimbursePythSponsor = reimbursePythSponsor;
17
- const pyth_sponsor_rule_ts_1 = require("../../generated/pyth_sponsor_rule/pyth_sponsor_rule.js");
18
- /**
19
- * Opens a `Fund` hot potato from the shared PythSponsor pool. Wrap the
20
- * returned `{ fund, packageId }` into an `OracleFeeSource`
21
- * (`{ kind: 'sponsor', fund, packageId }`) and pass that to
22
- * `refreshOraclePrices` as `feeSource`, then {@link reimbursePythSponsor} once
23
- * the TradingRequest is built.
24
- */
25
- function openPythSponsorFund(tx, host) {
26
- const entry = host.config.packages.pyth_sponsor_rule;
27
- if (!entry?.published_at || !entry.pyth_sponsor) {
28
- throw new Error("pyth_sponsor_rule.{published_at,pyth_sponsor} missing — sponsor flow unavailable");
29
- }
30
- const [fund] = (0, pyth_sponsor_rule_ts_1.request)({
31
- package: entry.published_at,
32
- arguments: { self: tx.object(entry.pyth_sponsor) },
33
- })(tx);
34
- return { fund: fund, packageId: entry.published_at };
35
- }
36
- /**
37
- * Consumes the `Fund` hot potato from {@link openPythSponsorFund}, returns any
38
- * leftover SUI to the sponsor pool, and attaches the `PythSponsorRule` witness to
39
- * the given `TradingRequest<C_TOKEN>` so `trading::execute` can satisfy a
40
- * checklist that includes `PythSponsorRule`.
41
- */
42
- function reimbursePythSponsor(tx, host, fund, tradingRequest, collateralType) {
43
- const entry = host.config.packages.pyth_sponsor_rule;
44
- if (!entry?.published_at || !entry.pyth_sponsor) {
45
- throw new Error("pyth_sponsor_rule missing from config");
46
- }
47
- (0, pyth_sponsor_rule_ts_1.reimburse)({
48
- package: entry.published_at,
49
- arguments: {
50
- self: tx.object(entry.pyth_sponsor),
51
- fund: fund,
52
- tradingReq: tradingRequest,
53
- },
54
- typeArguments: [collateralType],
55
- })(tx);
56
- }
@@ -1,12 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A storable handler for Balances in general. Is used in the `Coin` module to
6
- * allow balance operations and can be used to implement custom coins with `Supply`
7
- * and `Balance`s.
8
- */
9
- import { MoveStruct } from '../../../utils/index.ts';
10
- export declare const Balance: MoveStruct<{
11
- value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
12
- }, "0x2::balance::Balance<phantom T>">;
@@ -1,14 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- /**
5
- * A storable handler for Balances in general. Is used in the `Coin` module to
6
- * allow balance operations and can be used to implement custom coins with `Supply`
7
- * and `Balance`s.
8
- */
9
- import { MoveStruct } from "../../../utils/index.js";
10
- import { bcs } from '@mysten/sui/bcs';
11
- const $moduleName = '0x2::balance';
12
- export const Balance = new MoveStruct({ name: `${$moduleName}::Balance<phantom T>`, fields: {
13
- value: bcs.u64()
14
- } });
@@ -1,68 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
5
- import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
6
- export declare const PythSponsorRule: MoveStruct<{
7
- dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
8
- }, "@waterx/pyth-sponsor-rule::pyth_sponsor_rule::PythSponsorRule">;
9
- export declare const PythSponsor: MoveStruct<{
10
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
11
- balance: MoveStruct<{
12
- value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
13
- }, "0x2::balance::Balance<phantom T>">;
14
- }, "@waterx/pyth-sponsor-rule::pyth_sponsor_rule::PythSponsor">;
15
- export declare const Fund: MoveStruct<{
16
- balance: MoveStruct<{
17
- value: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
18
- }, "0x2::balance::Balance<phantom T>">;
19
- }, "@waterx/pyth-sponsor-rule::pyth_sponsor_rule::Fund">;
20
- export interface RequestArguments {
21
- self: RawTransactionArgument<string>;
22
- }
23
- export interface RequestOptions {
24
- package?: string;
25
- arguments: RequestArguments | [
26
- self: RawTransactionArgument<string>
27
- ];
28
- }
29
- export declare function request(options: RequestOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
30
- export interface SplitArguments {
31
- fund: TransactionArgument;
32
- }
33
- export interface SplitOptions {
34
- package?: string;
35
- arguments: SplitArguments | [
36
- fund: TransactionArgument
37
- ];
38
- }
39
- export declare function split(options: SplitOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
40
- export interface ReimburseArguments {
41
- self: RawTransactionArgument<string>;
42
- fund: TransactionArgument;
43
- tradingReq: TransactionArgument;
44
- }
45
- export interface ReimburseOptions {
46
- package?: string;
47
- arguments: ReimburseArguments | [
48
- self: RawTransactionArgument<string>,
49
- fund: TransactionArgument,
50
- tradingReq: TransactionArgument
51
- ];
52
- typeArguments: [
53
- string
54
- ];
55
- }
56
- export declare function reimburse(options: ReimburseOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
57
- export interface SupplyArguments {
58
- self: RawTransactionArgument<string>;
59
- coin: RawTransactionArgument<string>;
60
- }
61
- export interface SupplyOptions {
62
- package?: string;
63
- arguments: SupplyArguments | [
64
- self: RawTransactionArgument<string>,
65
- coin: RawTransactionArgument<string>
66
- ];
67
- }
68
- export declare function supply(options: SupplyOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
@@ -1,73 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
5
- import { bcs } from '@mysten/sui/bcs';
6
- import * as balance from "./deps/sui/balance.js";
7
- const $moduleName = '@waterx/pyth-sponsor-rule::pyth_sponsor_rule';
8
- export const PythSponsorRule = new MoveStruct({ name: `${$moduleName}::PythSponsorRule`, fields: {
9
- dummy_field: bcs.bool()
10
- } });
11
- export const PythSponsor = new MoveStruct({ name: `${$moduleName}::PythSponsor`, fields: {
12
- id: bcs.Address,
13
- balance: balance.Balance
14
- } });
15
- export const Fund = new MoveStruct({ name: `${$moduleName}::Fund`, fields: {
16
- balance: balance.Balance
17
- } });
18
- export function request(options) {
19
- const packageAddress = options.package ?? '@waterx/pyth-sponsor-rule';
20
- const argumentsTypes = [
21
- null
22
- ];
23
- const parameterNames = ["self"];
24
- return (tx) => tx.moveCall({
25
- package: packageAddress,
26
- module: 'pyth_sponsor_rule',
27
- function: 'request',
28
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
29
- });
30
- }
31
- export function split(options) {
32
- const packageAddress = options.package ?? '@waterx/pyth-sponsor-rule';
33
- const argumentsTypes = [
34
- null
35
- ];
36
- const parameterNames = ["fund"];
37
- return (tx) => tx.moveCall({
38
- package: packageAddress,
39
- module: 'pyth_sponsor_rule',
40
- function: 'split',
41
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
42
- });
43
- }
44
- export function reimburse(options) {
45
- const packageAddress = options.package ?? '@waterx/pyth-sponsor-rule';
46
- const argumentsTypes = [
47
- null,
48
- null,
49
- null
50
- ];
51
- const parameterNames = ["self", "fund", "tradingReq"];
52
- return (tx) => tx.moveCall({
53
- package: packageAddress,
54
- module: 'pyth_sponsor_rule',
55
- function: 'reimburse',
56
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
57
- typeArguments: options.typeArguments
58
- });
59
- }
60
- export function supply(options) {
61
- const packageAddress = options.package ?? '@waterx/pyth-sponsor-rule';
62
- const argumentsTypes = [
63
- null,
64
- null
65
- ];
66
- const parameterNames = ["self", "coin"];
67
- return (tx) => tx.moveCall({
68
- package: packageAddress,
69
- module: 'pyth_sponsor_rule',
70
- function: 'supply',
71
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
72
- });
73
- }
@@ -1,36 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { type BcsType } from '@mysten/sui/bcs';
5
- import { MoveStruct } from '../../../utils/index.ts';
6
- /** An entry in the map */
7
- export declare function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
8
- K,
9
- V
10
- ]): MoveStruct<{
11
- key: K;
12
- value: V;
13
- }, `0x2::vec_map::Entry<${K["name"]}, ${V["name"]}>`>;
14
- /**
15
- * A map data structure backed by a vector. The map is guaranteed not to contain
16
- * duplicate keys, but entries are _not_ sorted by key--entries are included in
17
- * insertion order. All operations are O(N) in the size of the map--the intention
18
- * of this data structure is only to provide the convenience of programming against
19
- * a map API. Large maps should use handwritten parent/child relationships instead.
20
- * Maps that need sorted iteration rather than insertion order iteration should
21
- * also be handwritten.
22
- */
23
- export declare function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [
24
- K,
25
- V
26
- ]): MoveStruct<{
27
- contents: BcsType<{
28
- key: K extends BcsType<infer U, any, string> ? U : never;
29
- value: V extends BcsType<infer U, any, string> ? U : never;
30
- }[], Iterable<{
31
- key: K extends BcsType<any, infer U_1, string> ? U_1 : never;
32
- value: V extends BcsType<any, infer U_1, string> ? U_1 : never;
33
- }> & {
34
- length: number;
35
- }, string>;
36
- }, `0x2::vec_map::VecMap<${K["name"]}, ${V["name"]}>`>;
@@ -1,27 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { bcs } from '@mysten/sui/bcs';
5
- import { MoveStruct } from "../../../utils/index.js";
6
- const $moduleName = '0x2::vec_map';
7
- /** An entry in the map */
8
- export function Entry(...typeParameters) {
9
- return new MoveStruct({ name: `${$moduleName}::Entry<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
10
- key: typeParameters[0],
11
- value: typeParameters[1]
12
- } });
13
- }
14
- /**
15
- * A map data structure backed by a vector. The map is guaranteed not to contain
16
- * duplicate keys, but entries are _not_ sorted by key--entries are included in
17
- * insertion order. All operations are O(N) in the size of the map--the intention
18
- * of this data structure is only to provide the convenience of programming against
19
- * a map API. Large maps should use handwritten parent/child relationships instead.
20
- * Maps that need sorted iteration rather than insertion order iteration should
21
- * also be handwritten.
22
- */
23
- export function VecMap(...typeParameters) {
24
- return new MoveStruct({ name: `${$moduleName}::VecMap<${typeParameters[0].name}, ${typeParameters[1].name}>`, fields: {
25
- contents: bcs.vector(Entry(typeParameters[0], typeParameters[1]))
26
- } });
27
- }
@@ -1,192 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct, type RawTransactionArgument } from '../utils/index.ts';
5
- import { type Transaction, type TransactionArgument } from '@mysten/sui/transactions';
6
- export declare const PythRule: MoveStruct<{
7
- dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
8
- }, "@waterx/pyth-rule::pyth_rule::PythRule">;
9
- export declare const Config: MoveStruct<{
10
- id: import("@mysten/sui/bcs").BcsType<string, string | Uint8Array<ArrayBufferLike>, "bytes[32]">;
11
- /** Ticker (e.g. `b"BTC_USD".to_string()`) → Pyth feed identifier bytes. */
12
- identifier_map: MoveStruct<{
13
- contents: import("@mysten/sui/bcs").BcsType<{
14
- key: string;
15
- value: number[];
16
- }[], Iterable<{
17
- key: string;
18
- value: Iterable<number> & {
19
- length: number;
20
- };
21
- }> & {
22
- length: number;
23
- }, string>;
24
- }, "0x2::vec_map::VecMap<string, vector<u8>>">;
25
- /** Per-ticker timestamp tolerance in seconds. Falls back to DEFAULT_TOLERANCE_SEC. */
26
- tolerance_sec_map: MoveStruct<{
27
- contents: import("@mysten/sui/bcs").BcsType<{
28
- key: string;
29
- value: string;
30
- }[], Iterable<{
31
- key: string;
32
- value: string | number | bigint;
33
- }> & {
34
- length: number;
35
- }, string>;
36
- }, "0x2::vec_map::VecMap<string, u64>">;
37
- }, "@waterx/pyth-rule::pyth_rule::Config">;
38
- export declare const MaxConfBpsKey: MoveStruct<{
39
- dummy_field: import("@mysten/sui/bcs").BcsType<boolean, boolean, "bool">;
40
- }, "@waterx/pyth-rule::pyth_rule::MaxConfBpsKey">;
41
- export declare const MaxConfBpsConfig: MoveStruct<{
42
- /** Default max confidence band (bps of price) for symbols without an override. */
43
- default_bps: import("@mysten/sui/bcs").BcsType<string, string | number | bigint, "u64">;
44
- /** Per-symbol overrides. */
45
- by_symbol: MoveStruct<{
46
- contents: import("@mysten/sui/bcs").BcsType<{
47
- key: string;
48
- value: string;
49
- }[], Iterable<{
50
- key: string;
51
- value: string | number | bigint;
52
- }> & {
53
- length: number;
54
- }, string>;
55
- }, "0x2::vec_map::VecMap<string, u64>">;
56
- }, "@waterx/pyth-rule::pyth_rule::MaxConfBpsConfig">;
57
- export interface FeedArguments {
58
- collector: TransactionArgument;
59
- config: RawTransactionArgument<string>;
60
- pythState: RawTransactionArgument<string>;
61
- pythPriceInfo: RawTransactionArgument<string>;
62
- }
63
- export interface FeedOptions {
64
- package?: string;
65
- arguments: FeedArguments | [
66
- collector: TransactionArgument,
67
- config: RawTransactionArgument<string>,
68
- pythState: RawTransactionArgument<string>,
69
- pythPriceInfo: RawTransactionArgument<string>
70
- ];
71
- }
72
- /**
73
- * Reads a Pyth price for `collector.symbol()` and feeds it. Drops the value
74
- * (records `none`) if the on-chain timestamp diverges from the Pyth feed timestamp
75
- * by more than the configured tolerance.
76
- */
77
- export declare function feed(options: FeedOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
78
- export interface SetIdentifierArguments {
79
- config: RawTransactionArgument<string>;
80
- Cap: RawTransactionArgument<string>;
81
- symbol: RawTransactionArgument<string>;
82
- identifier: RawTransactionArgument<Array<number>>;
83
- }
84
- export interface SetIdentifierOptions {
85
- package?: string;
86
- arguments: SetIdentifierArguments | [
87
- config: RawTransactionArgument<string>,
88
- Cap: RawTransactionArgument<string>,
89
- symbol: RawTransactionArgument<string>,
90
- identifier: RawTransactionArgument<Array<number>>
91
- ];
92
- }
93
- export declare function setIdentifier(options: SetIdentifierOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
94
- export interface SetToleranceSecArguments {
95
- config: RawTransactionArgument<string>;
96
- Cap: RawTransactionArgument<string>;
97
- symbol: RawTransactionArgument<string>;
98
- toleranceSec: RawTransactionArgument<number | bigint>;
99
- }
100
- export interface SetToleranceSecOptions {
101
- package?: string;
102
- arguments: SetToleranceSecArguments | [
103
- config: RawTransactionArgument<string>,
104
- Cap: RawTransactionArgument<string>,
105
- symbol: RawTransactionArgument<string>,
106
- toleranceSec: RawTransactionArgument<number | bigint>
107
- ];
108
- }
109
- export declare function setToleranceSec(options: SetToleranceSecOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
110
- export interface SetDefaultMaxConfidenceBpsArguments {
111
- config: RawTransactionArgument<string>;
112
- Cap: RawTransactionArgument<string>;
113
- defaultBps: RawTransactionArgument<number | bigint>;
114
- }
115
- export interface SetDefaultMaxConfidenceBpsOptions {
116
- package?: string;
117
- arguments: SetDefaultMaxConfidenceBpsArguments | [
118
- config: RawTransactionArgument<string>,
119
- Cap: RawTransactionArgument<string>,
120
- defaultBps: RawTransactionArgument<number | bigint>
121
- ];
122
- }
123
- /**
124
- * Sets the default confidence gate (bps of price) applied to symbols without an
125
- * explicit override. `10_000` = 100%. Lazily creates the confidence-gate DF.
126
- */
127
- export declare function setDefaultMaxConfidenceBps(options: SetDefaultMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
128
- export interface SetSymbolMaxConfidenceBpsArguments {
129
- config: RawTransactionArgument<string>;
130
- Cap: RawTransactionArgument<string>;
131
- symbol: RawTransactionArgument<string>;
132
- bps: RawTransactionArgument<number | bigint>;
133
- }
134
- export interface SetSymbolMaxConfidenceBpsOptions {
135
- package?: string;
136
- arguments: SetSymbolMaxConfidenceBpsArguments | [
137
- config: RawTransactionArgument<string>,
138
- Cap: RawTransactionArgument<string>,
139
- symbol: RawTransactionArgument<string>,
140
- bps: RawTransactionArgument<number | bigint>
141
- ];
142
- }
143
- /** Sets a per-symbol confidence gate (bps of price), overriding the default. */
144
- export declare function setSymbolMaxConfidenceBps(options: SetSymbolMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
145
- export interface UnsetSymbolMaxConfidenceBpsArguments {
146
- config: RawTransactionArgument<string>;
147
- Cap: RawTransactionArgument<string>;
148
- symbol: RawTransactionArgument<string>;
149
- }
150
- export interface UnsetSymbolMaxConfidenceBpsOptions {
151
- package?: string;
152
- arguments: UnsetSymbolMaxConfidenceBpsArguments | [
153
- config: RawTransactionArgument<string>,
154
- Cap: RawTransactionArgument<string>,
155
- symbol: RawTransactionArgument<string>
156
- ];
157
- }
158
- /**
159
- * Removes a per-symbol confidence override (no-op if absent); the symbol then
160
- * falls back to the default.
161
- */
162
- export declare function unsetSymbolMaxConfidenceBps(options: UnsetSymbolMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
163
- export interface MaxConfidenceBpsArguments {
164
- config: RawTransactionArgument<string>;
165
- symbol: RawTransactionArgument<string>;
166
- }
167
- export interface MaxConfidenceBpsOptions {
168
- package?: string;
169
- arguments: MaxConfidenceBpsArguments | [
170
- config: RawTransactionArgument<string>,
171
- symbol: RawTransactionArgument<string>
172
- ];
173
- }
174
- /**
175
- * The effective confidence gate (bps of price) `feed` applies for `symbol`:
176
- * per-symbol override → default → `DEFAULT_MAX_CONFIDENCE_BPS`.
177
- */
178
- export declare function maxConfidenceBps(options: MaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;
179
- export interface DefaultMaxConfidenceBpsArguments {
180
- config: RawTransactionArgument<string>;
181
- }
182
- export interface DefaultMaxConfidenceBpsOptions {
183
- package?: string;
184
- arguments: DefaultMaxConfidenceBpsArguments | [
185
- config: RawTransactionArgument<string>
186
- ];
187
- }
188
- /**
189
- * The configured default confidence gate, or `DEFAULT_MAX_CONFIDENCE_BPS` if
190
- * unset.
191
- */
192
- export declare function defaultMaxConfidenceBps(options: DefaultMaxConfidenceBpsOptions): (tx: Transaction) => import("@mysten/sui/transactions").TransactionResult;