@waterx/sdk 2.4.1 → 3.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/README.md +25 -21
- package/dist/src/{utils → account}/account-request.d.ts +2 -2
- package/dist/src/{user → account}/account.d.ts +23 -21
- package/dist/src/{user → account}/account.js +5 -5
- package/dist/src/account/client.d.ts +42 -0
- package/dist/src/account/client.js +17 -0
- package/dist/src/account/config.d.ts +151 -0
- package/dist/src/account/config.js +8 -0
- package/dist/src/account/constants.d.ts +5 -0
- package/dist/src/account/constants.js +5 -0
- package/dist/src/account/fetch/referral.d.ts +15 -0
- package/dist/src/account/fetch/referral.js +51 -0
- package/dist/src/account/fetch/simulate.d.ts +34 -0
- package/dist/src/account/fetch/simulate.js +43 -0
- package/dist/src/{utils/consolidate-balance.d.ts → account/funding/balance.d.ts} +3 -8
- package/dist/src/{utils/consolidate-balance.js → account/funding/balance.js} +6 -1
- package/dist/src/account/funding/consolidate.d.ts +46 -0
- package/dist/src/account/funding/consolidate.js +137 -0
- package/dist/src/{user → account/funding}/credit.d.ts +10 -10
- package/dist/src/{user → account/funding}/credit.js +6 -6
- package/dist/src/{user → account/funding}/custody.d.ts +4 -4
- package/dist/src/{user → account/funding}/custody.js +2 -2
- package/dist/src/{utils → account/funding}/wormhole.d.ts +4 -4
- package/dist/src/{utils → account/funding}/wormhole.js +1 -1
- package/dist/src/account/index.d.ts +29 -0
- package/dist/src/account/index.js +29 -0
- package/dist/src/{user → account}/referral.d.ts +3 -3
- package/dist/src/{user → account}/referral.js +1 -1
- package/dist/src/base-client.d.ts +74 -0
- package/dist/src/base-client.js +97 -0
- package/dist/src/constants.d.ts +4 -46
- package/dist/src/constants.js +8 -52
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +0 -26
- package/dist/src/generated/bucket_v2_framework/liability.js +0 -28
- package/dist/src/generated/waterx_account/account.d.ts +50 -15
- package/dist/src/generated/waterx_account/account.js +51 -15
- package/dist/src/generated/waterx_oracle/oracle.d.ts +7 -1
- package/dist/src/generated/waterx_oracle/oracle.js +7 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.d.ts +19 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.d.ts +3 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/sui/balance.d.ts +3 -1
- package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.d.ts +6 -1
- package/dist/src/generated/waterx_prediction/events.d.ts +288 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/events.js +39 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.d.ts +6 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/order.d.ts +34 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/position.d.ts +16 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/view.d.ts +69 -4
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts +162 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.js +99 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +102 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +99 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +5 -5
- package/dist/src/generated/waterx_supra_rule/supra_rule.js +1 -2
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +23 -23
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +3 -6
- package/dist/src/oracle/aggregate.d.ts +74 -0
- package/dist/src/oracle/aggregate.js +112 -0
- package/dist/src/oracle/config.d.ts +99 -0
- package/dist/src/oracle/config.js +23 -0
- package/dist/src/oracle/host.d.ts +32 -0
- package/dist/src/oracle/host.js +10 -0
- package/dist/src/oracle/index.d.ts +16 -0
- package/dist/src/oracle/index.js +18 -0
- package/dist/src/oracle/pyth.d.ts +52 -0
- package/dist/src/oracle/pyth.js +220 -0
- package/dist/src/oracle/rules/constant-rule.d.ts +9 -0
- package/dist/src/oracle/rules/constant-rule.js +14 -0
- package/dist/src/oracle/rules/pyth-rule.d.ts +11 -0
- package/dist/src/oracle/rules/pyth-rule.js +20 -0
- package/dist/src/oracle/rules/sponsor.d.ts +28 -0
- package/dist/src/oracle/rules/sponsor.js +48 -0
- package/dist/src/oracle/rules/supra-rule.d.ts +11 -0
- package/dist/src/oracle/rules/supra-rule.js +22 -0
- package/dist/src/perp/client.d.ts +78 -0
- package/dist/src/perp/client.js +108 -0
- package/dist/src/{client.d.ts → perp/config-view.d.ts} +15 -60
- package/dist/src/{client.js → perp/config-view.js} +23 -95
- package/dist/src/perp/config.d.ts +126 -0
- package/dist/src/{config.js → perp/config.js} +11 -12
- package/dist/src/perp/constants.d.ts +49 -0
- package/dist/src/perp/constants.js +61 -0
- package/dist/src/perp/fetch/account.d.ts +43 -0
- package/dist/src/perp/fetch/account.js +64 -0
- package/dist/src/perp/fetch/bridge.d.ts +90 -0
- package/dist/src/perp/fetch/bridge.js +127 -0
- package/dist/src/perp/fetch/custody.d.ts +32 -0
- package/dist/src/perp/fetch/custody.js +62 -0
- package/dist/src/perp/fetch/market.d.ts +30 -0
- package/dist/src/perp/fetch/market.js +68 -0
- package/dist/src/perp/fetch/positions.d.ts +70 -0
- package/dist/src/perp/fetch/positions.js +185 -0
- package/dist/src/perp/fetch/simulate.d.ts +12 -0
- package/dist/src/perp/fetch/simulate.js +13 -0
- package/dist/src/perp/fetch.d.ts +23 -0
- package/dist/src/perp/fetch.js +23 -0
- package/dist/src/{index.d.ts → perp/index.d.ts} +21 -21
- package/dist/src/{index.js → perp/index.js} +21 -21
- package/dist/src/perp/tx-builders/common.d.ts +83 -0
- package/dist/src/perp/tx-builders/common.js +70 -0
- package/dist/src/perp/tx-builders/credit.d.ts +65 -0
- package/dist/src/perp/tx-builders/credit.js +62 -0
- package/dist/src/perp/tx-builders/rewards.d.ts +30 -0
- package/dist/src/perp/tx-builders/rewards.js +34 -0
- package/dist/src/perp/tx-builders/trading.d.ts +51 -0
- package/dist/src/perp/tx-builders/trading.js +59 -0
- package/dist/src/perp/tx-builders/wlp.d.ts +90 -0
- package/dist/src/perp/tx-builders/wlp.js +120 -0
- package/dist/src/perp/tx-builders.d.ts +23 -0
- package/dist/src/perp/tx-builders.js +23 -0
- package/dist/src/perp/user/index.d.ts +8 -0
- package/dist/src/perp/user/index.js +8 -0
- package/dist/src/{user → perp/user}/order.d.ts +7 -7
- package/dist/src/{user → perp/user}/order.js +3 -3
- package/dist/src/{user → perp/user}/staking.d.ts +4 -4
- package/dist/src/{user → perp/user}/staking.js +2 -2
- package/dist/src/{user → perp/user}/trading.d.ts +13 -13
- package/dist/src/{user → perp/user}/trading.js +2 -2
- package/dist/src/{user → perp/user}/wlp.d.ts +7 -7
- package/dist/src/{user → perp/user}/wlp.js +3 -3
- package/dist/src/prediction/account.js +40 -76
- package/dist/src/prediction/client.d.ts +8 -38
- package/dist/src/prediction/client.js +11 -67
- package/dist/src/prediction/config.d.ts +16 -2
- package/dist/src/prediction/config.js +10 -4
- package/dist/src/prediction/index.d.ts +11 -11
- package/dist/src/prediction/index.js +10 -10
- package/dist/src/prediction/prediction.d.ts +45 -0
- package/dist/src/prediction/prediction.js +71 -0
- package/dist/src/prediction/tx-builders.d.ts +4 -4
- package/dist/src/prediction/tx-builders.js +2 -2
- package/dist/src/prediction/user/index.d.ts +2 -2
- package/dist/src/prediction/user/index.js +1 -1
- package/dist/src/prediction/user/position.d.ts +2 -2
- package/dist/src/prediction/user/position.js +1 -1
- package/dist/src/prediction/utils/bcs.d.ts +5 -0
- package/dist/src/prediction/utils/bcs.js +5 -0
- package/dist/src/prediction/utils/index.d.ts +7 -0
- package/dist/src/prediction/utils/index.js +7 -0
- package/dist/src/sdk.d.ts +10 -6
- package/dist/src/sdk.js +9 -5
- package/dist/src/unified-client.d.ts +140 -145
- package/dist/src/unified-client.js +98 -40
- package/dist/src/utils/config.d.ts +1 -1
- package/package.json +22 -5
- package/dist/src/config.d.ts +0 -292
- package/dist/src/fetch.d.ts +0 -254
- package/dist/src/fetch.js +0 -564
- package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
- package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
- package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
- package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
- package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
- package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
- package/dist/src/prediction/generated/utils/index.d.ts +0 -30
- package/dist/src/prediction/generated/utils/index.js +0 -160
- package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
- package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
- package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
- package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
- package/dist/src/prediction/generated/waterx_account/events.js +0 -137
- package/dist/src/prediction/generated/waterx_account/version.js +0 -8
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
- package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
- package/dist/src/tx-builders.d.ts +0 -296
- package/dist/src/tx-builders.js +0 -461
- package/dist/src/user/index.d.ts +0 -8
- package/dist/src/user/index.js +0 -8
- package/dist/src/utils/pyth.d.ts +0 -124
- package/dist/src/utils/pyth.js +0 -392
- /package/dist/src/{utils → account}/account-request.js +0 -0
- /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
- /package/dist/src/{core → account}/waterx-account.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { addDelegate, consumeDepositDirect, createAccount, deposit, removeDelegate, requestDeposit, requestDepositFromReceivings, requestWithdraw, setDelegatePredictionPermission, transferCoinToAccount, whitelistPredictionProtocol, } from "../account.ts";
|
|
2
2
|
export type { AddDelegateParams, ConsumeDepositDirectParams, CreateAccountParams, RemoveDelegateParams, RequestDepositFromReceivingsParams, RequestDepositParams, RequestWithdrawParams, SetDelegatePredictionPermissionParams, TransferCoinToAccountParams, WhitelistPredictionProtocolParams, } from "../account.ts";
|
|
3
|
-
export { batchClaim, claim, placeOrder, requestClose, selectionArg, selfCancelClose, selfCancelOrder, } from "../prediction.ts";
|
|
4
|
-
export type { BatchClaimParams, ClaimParams, PlaceOrderParams, RequestCloseParams, SelfCancelCloseParams, SelfCancelOrderParams, } from "../prediction.ts";
|
|
3
|
+
export { batchClaim, claim, placeOrder, requestClose, requestPartialClose, selectionArg, selfCancelClose, selfCancelOrder, splitPosition, transferPosition, } from "../prediction.ts";
|
|
4
|
+
export type { BatchClaimParams, ClaimParams, PlaceOrderParams, RequestCloseParams, RequestPartialCloseParams, SelfCancelCloseParams, SelfCancelOrderParams, SplitPositionParams, TransferPositionParams, } from "../prediction.ts";
|
|
5
5
|
export * as gift from "./gift.ts";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { addDelegate, consumeDepositDirect, createAccount, deposit, removeDelegate, requestDeposit, requestDepositFromReceivings, requestWithdraw, setDelegatePredictionPermission, transferCoinToAccount, whitelistPredictionProtocol, } from "../account.js";
|
|
2
|
-
export { batchClaim, claim, placeOrder, requestClose, selectionArg, selfCancelClose, selfCancelOrder, } from "../prediction.js";
|
|
2
|
+
export { batchClaim, claim, placeOrder, requestClose, requestPartialClose, selectionArg, selfCancelClose, selfCancelOrder, splitPosition, transferPosition, } from "../prediction.js";
|
|
3
3
|
export * as gift from "./gift.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { batchClaim, claim, requestClose, selfCancelClose } from "../prediction.ts";
|
|
2
|
-
export type { BatchClaimParams, ClaimParams, RequestCloseParams, SelfCancelCloseParams, } from "../prediction.ts";
|
|
1
|
+
export { batchClaim, claim, requestClose, requestPartialClose, selfCancelClose, splitPosition, transferPosition, } from "../prediction.ts";
|
|
2
|
+
export type { BatchClaimParams, ClaimParams, RequestCloseParams, RequestPartialCloseParams, SelfCancelCloseParams, SplitPositionParams, TransferPositionParams, } from "../prediction.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { batchClaim, claim, requestClose, selfCancelClose } from "../prediction.js";
|
|
1
|
+
export { batchClaim, claim, requestClose, requestPartialClose, selfCancelClose, splitPosition, transferPosition, } from "../prediction.js";
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public-subpath barrel for `@waterx/sdk/prediction/utils/bcs` (package.json `exports`).
|
|
3
|
+
* Thin re-export of the flat impl in `../bcs.ts`; pinned by `user-exports.test.ts`
|
|
4
|
+
* ("utils/bcs re-exports BCS helpers from prediction/bcs"). Not dead duplication.
|
|
5
|
+
*/
|
|
1
6
|
export { AccountDataViewBcs, MarketViewBcs, OrderKindBcs, OrderViewBcs, OutcomeBcs, PositionViewBcs, RegistryViewBcs, SelectionBcs, StatusBcs, decodeEnumVariant, mapAccountDataView, mapCursorView, mapMarketView, mapOrderKind, mapOrderView, mapOutcome, mapPositionView, mapRegistryView, mapSelection, mapStatus, } from "../bcs.ts";
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public-subpath barrel for `@waterx/sdk/prediction/utils/bcs` (package.json `exports`).
|
|
3
|
+
* Thin re-export of the flat impl in `../bcs.ts`; pinned by `user-exports.test.ts`
|
|
4
|
+
* ("utils/bcs re-exports BCS helpers from prediction/bcs"). Not dead duplication.
|
|
5
|
+
*/
|
|
1
6
|
export { AccountDataViewBcs, MarketViewBcs, OrderKindBcs, OrderViewBcs, OutcomeBcs, PositionViewBcs, RegistryViewBcs, SelectionBcs, StatusBcs, decodeEnumVariant, mapAccountDataView, mapCursorView, mapMarketView, mapOrderKind, mapOrderView, mapOutcome, mapPositionView, mapRegistryView, mapSelection, mapStatus, } from "../bcs.js";
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public-subpath barrel for `@waterx/sdk/prediction/utils` (package.json `exports`).
|
|
3
|
+
* Intentionally a thin re-export of the flat impl in `../utils.ts` — the flat file
|
|
4
|
+
* keeps its own `~predict/utils.ts` subpath + internal relative imports, while this
|
|
5
|
+
* folder exposes the grouped `prediction/utils` / `prediction/utils/bcs` namespace.
|
|
6
|
+
* Pinned by `test/post-build/package-exports.test.ts`. Not dead duplication.
|
|
7
|
+
*/
|
|
1
8
|
export { assertOutcome, assertSelection, assertU64, bytesToHex, clockArg, createAccountRequest, marketIdArg, marketIdBytesFromUnknown, normalizeMarketId, objectArg, optionU64, receivingCoinArg, requireConfig, resolveAccountPackageId, resolveAccountRegistry, resolveGlobalConfig, resolveMarketRegistry, resolvePackageId, resolveSettlementCoinType, toBigInt, } from "../utils.ts";
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public-subpath barrel for `@waterx/sdk/prediction/utils` (package.json `exports`).
|
|
3
|
+
* Intentionally a thin re-export of the flat impl in `../utils.ts` — the flat file
|
|
4
|
+
* keeps its own `~predict/utils.ts` subpath + internal relative imports, while this
|
|
5
|
+
* folder exposes the grouped `prediction/utils` / `prediction/utils/bcs` namespace.
|
|
6
|
+
* Pinned by `test/post-build/package-exports.test.ts`. Not dead duplication.
|
|
7
|
+
*/
|
|
1
8
|
export { assertOutcome, assertSelection, assertU64, bytesToHex, clockArg, createAccountRequest, marketIdArg, marketIdBytesFromUnknown, normalizeMarketId, objectArg, optionU64, receivingCoinArg, requireConfig, resolveAccountPackageId, resolveAccountRegistry, resolveGlobalConfig, resolveMarketRegistry, resolvePackageId, resolveSettlementCoinType, toBigInt, } from "../utils.js";
|
package/dist/src/sdk.d.ts
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Package root for `@waterx/sdk` (`.` export).
|
|
3
3
|
*
|
|
4
|
-
* - `
|
|
4
|
+
* - `WaterXClient` — the umbrella entry point
|
|
5
|
+
* (`client.account.*` / `client.perp.*` / `client.predict.*`).
|
|
5
6
|
* - `perp` / `prediction` — namespaces exposing each line's full API; use these
|
|
6
|
-
* to disambiguate the builder names that collide across the two lines.
|
|
7
|
+
* to disambiguate the builder names that collide across the two lines. The perp
|
|
8
|
+
* sub-client itself is exported (flat + `perp.PerpClient`) as `PerpClient`.
|
|
7
9
|
* - The flat re-export below preserves the legacy `@waterx/perp-sdk` surface at
|
|
8
10
|
* the package root for one major cycle (DEPRECATED — removed next major).
|
|
9
11
|
*
|
|
10
12
|
* Prediction is reachable only via the `prediction` namespace / `@waterx/sdk/prediction`
|
|
11
13
|
* (never flat at the root) because its builder names collide with perp's.
|
|
12
14
|
*/
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
+
export { WaterXClient } from "./unified-client.ts";
|
|
16
|
+
/** @deprecated Renamed to `WaterXClient` (the umbrella). Removed next major. */
|
|
17
|
+
export { WaterXClient as Client } from "./unified-client.ts";
|
|
18
|
+
export type { AccountModule, ClientCreateOptions, PerpModule, PredictModule, } from "./unified-client.ts";
|
|
15
19
|
export type { BuildBatchClaimTxParams as BuildPredictBatchClaimTxParams, BuildPlaceOrderTxParams as BuildPredictPlaceOrderTxParams, } from "./prediction/tx-builders.ts";
|
|
16
|
-
export * as perp from "./index.ts";
|
|
20
|
+
export * as perp from "./perp/index.ts";
|
|
17
21
|
export * as prediction from "./prediction/index.ts";
|
|
18
|
-
export * from "./index.ts";
|
|
22
|
+
export * from "./perp/index.ts";
|
package/dist/src/sdk.js
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Package root for `@waterx/sdk` (`.` export).
|
|
3
3
|
*
|
|
4
|
-
* - `
|
|
4
|
+
* - `WaterXClient` — the umbrella entry point
|
|
5
|
+
* (`client.account.*` / `client.perp.*` / `client.predict.*`).
|
|
5
6
|
* - `perp` / `prediction` — namespaces exposing each line's full API; use these
|
|
6
|
-
* to disambiguate the builder names that collide across the two lines.
|
|
7
|
+
* to disambiguate the builder names that collide across the two lines. The perp
|
|
8
|
+
* sub-client itself is exported (flat + `perp.PerpClient`) as `PerpClient`.
|
|
7
9
|
* - The flat re-export below preserves the legacy `@waterx/perp-sdk` surface at
|
|
8
10
|
* the package root for one major cycle (DEPRECATED — removed next major).
|
|
9
11
|
*
|
|
10
12
|
* Prediction is reachable only via the `prediction` namespace / `@waterx/sdk/prediction`
|
|
11
13
|
* (never flat at the root) because its builder names collide with perp's.
|
|
12
14
|
*/
|
|
13
|
-
export {
|
|
14
|
-
|
|
15
|
+
export { WaterXClient } from "./unified-client.js";
|
|
16
|
+
/** @deprecated Renamed to `WaterXClient` (the umbrella). Removed next major. */
|
|
17
|
+
export { WaterXClient as Client } from "./unified-client.js";
|
|
18
|
+
export * as perp from "./perp/index.js";
|
|
15
19
|
export * as prediction from "./prediction/index.js";
|
|
16
20
|
// DEPRECATED flat perp surface (migration aid from `@waterx/perp-sdk`).
|
|
17
|
-
export * from "./index.js";
|
|
21
|
+
export * from "./perp/index.js";
|
|
@@ -1,34 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Umbrella WaterX SDK client — the main entry point.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* for prediction) behind a single object with namespaced modules, so the
|
|
6
|
-
* colliding builder names (`placeOrder`, `createAccount`, `deposit`, …) can be
|
|
7
|
-
* called unambiguously:
|
|
4
|
+
* Exposes three namespaces over the two product-line sub-clients:
|
|
8
5
|
*
|
|
9
|
-
* const client = await
|
|
10
|
-
* client.
|
|
11
|
-
* client.
|
|
6
|
+
* const client = await WaterXClient.create({ network: "TESTNET" });
|
|
7
|
+
* client.account.createAccount(tx, { alias }); // -> shared waterx_account + funding
|
|
8
|
+
* client.perp.placeOrderRequest(tx, params); // -> perp builder
|
|
9
|
+
* client.predict.placeOrder(tx, params); // -> prediction builder
|
|
12
10
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* `client.perp` **is** the `PerpClient` instance with the perp builder/view
|
|
12
|
+
* methods grafted on, and `client.predict` **is** the `PredictClient` instance
|
|
13
|
+
* likewise — so signing & execution live on the same object
|
|
14
|
+
* (`client.perp.signAndExecuteTransaction(...)`) right next to the builders.
|
|
15
|
+
* There are no separate `.perpClient` / `.predictClient` accessors.
|
|
16
|
+
*
|
|
17
|
+
* `client.account` is a thin namespace (no own client) bound to the perp
|
|
18
|
+
* sub-client: the perp config carries the shared `waterx_account` registry plus
|
|
19
|
+
* the bridge / native_custody / withdrawal_queue / credit_registry that the
|
|
20
|
+
* credit & custody builders read. `waterx_account` is one shared on-chain object,
|
|
21
|
+
* so an account created here serves both lines — except when the two lines target
|
|
22
|
+
* different networks (`opts.perp.network !== opts.predict.network`), where
|
|
23
|
+
* `client.account` follows the perp line; split-network callers should reach the
|
|
24
|
+
* predict line's generic account builders via the `prediction` namespace directly.
|
|
25
|
+
*
|
|
26
|
+
* Each namespace method forwards to the existing free-function builder with the
|
|
27
|
+
* line's client pre-bound as the first argument; builders are build-only (they
|
|
28
|
+
* return / mutate a `Transaction`), so frontend wallet flows and multi-step Pyth
|
|
29
|
+
* injection keep working.
|
|
18
30
|
*/
|
|
19
31
|
import { Transaction } from "@mysten/sui/transactions";
|
|
20
|
-
import
|
|
32
|
+
import * as accountOps from "./account/index.ts";
|
|
33
|
+
import * as perpReferral from "./account/referral.ts";
|
|
21
34
|
import type { Network } from "./constants.ts";
|
|
22
|
-
import
|
|
23
|
-
import * as
|
|
35
|
+
import { PerpClient, type CreateClientOptions as PerpCreateOptions } from "./perp/client.ts";
|
|
36
|
+
import * as perpFetch from "./perp/fetch.ts";
|
|
37
|
+
import * as perpTx from "./perp/tx-builders.ts";
|
|
38
|
+
import * as perpOrder from "./perp/user/order.ts";
|
|
39
|
+
import * as perpStaking from "./perp/user/staking.ts";
|
|
40
|
+
import * as perpTrading from "./perp/user/trading.ts";
|
|
41
|
+
import * as perpWlp from "./perp/user/wlp.ts";
|
|
42
|
+
import { allowPredictionProtocolAsset, disallowPredictionProtocolAsset, setDelegatePredictionPermission, whitelistPredictionProtocol } from "./prediction/account.ts";
|
|
24
43
|
import * as predAdmin from "./prediction/admin.ts";
|
|
25
44
|
import { PredictClient, type CreateClientOptions as PredictCreateOptions } from "./prediction/client.ts";
|
|
26
45
|
import * as predFetch from "./prediction/fetch.ts";
|
|
27
46
|
import * as predGift from "./prediction/gift.ts";
|
|
28
47
|
import * as predOps from "./prediction/prediction.ts";
|
|
29
48
|
import { type BuildBatchClaimTxParams, type BuildPlaceOrderTxParams } from "./prediction/tx-builders.ts";
|
|
30
|
-
import * as perpTx from "./tx-builders.ts";
|
|
31
|
-
import * as perpUser from "./user/index.ts";
|
|
32
49
|
/**
|
|
33
50
|
* Exports from the spread builder/view modules that are NOT client-first — their
|
|
34
51
|
* first argument is not the line client, so they must not become bound facade
|
|
@@ -47,32 +64,35 @@ type ClientBound<NS, C> = {
|
|
|
47
64
|
[K in keyof Omit<NS, NonClientFirstKey>]: NS[K] extends (client: C, ...args: infer A) => infer R ? (...args: A) => R : NS[K];
|
|
48
65
|
};
|
|
49
66
|
declare const perpOps: {
|
|
50
|
-
|
|
51
|
-
|
|
67
|
+
getRefererFor(client: import("./account/client.ts").WxaClientLike, referee: string): Promise<string | undefined>;
|
|
68
|
+
isValidReferralCode(client: import("./account/client.ts").WxaClientLike, code: string): Promise<boolean>;
|
|
69
|
+
referralCodeExists(client: import("./account/client.ts").WxaClientLike, code: string): Promise<boolean>;
|
|
70
|
+
getAccountData(client: PerpClient, accountId: string): Promise<perpFetch.AccountDataView | undefined>;
|
|
71
|
+
getMarketData(client: PerpClient, args: {
|
|
52
72
|
ticker: string;
|
|
53
73
|
lpType?: string;
|
|
54
74
|
}): Promise<perpFetch.MarketDataView>;
|
|
55
|
-
getPoolData(client:
|
|
75
|
+
getPoolData(client: PerpClient, args?: {
|
|
56
76
|
lpType?: string;
|
|
57
77
|
}): Promise<perpFetch.PoolDataView>;
|
|
58
|
-
getTokenPoolData(client:
|
|
78
|
+
getTokenPoolData(client: PerpClient, args: {
|
|
59
79
|
tokenIndex: bigint | number;
|
|
60
80
|
lpType?: string;
|
|
61
81
|
}): Promise<perpFetch.TokenPoolDataView>;
|
|
62
|
-
getGlobalConfigData(client:
|
|
63
|
-
positionExists(client:
|
|
82
|
+
getGlobalConfigData(client: PerpClient): Promise<perpFetch.GlobalConfigDataView>;
|
|
83
|
+
positionExists(client: PerpClient, args: {
|
|
64
84
|
ticker: string;
|
|
65
85
|
positionId: bigint | number;
|
|
66
86
|
lpType?: string;
|
|
67
87
|
}): Promise<boolean>;
|
|
68
|
-
getPosition(client:
|
|
88
|
+
getPosition(client: PerpClient, args: {
|
|
69
89
|
ticker: string;
|
|
70
90
|
positionId: bigint | number;
|
|
71
91
|
basePriceUsd: bigint | number;
|
|
72
92
|
collateralPriceUsd: bigint | number;
|
|
73
93
|
lpType?: string;
|
|
74
94
|
}): Promise<perpFetch.PositionDataView>;
|
|
75
|
-
getOrder(client:
|
|
95
|
+
getOrder(client: PerpClient, args: {
|
|
76
96
|
ticker: string;
|
|
77
97
|
orderId: bigint | number;
|
|
78
98
|
orderTypeTag: number;
|
|
@@ -80,7 +100,7 @@ declare const perpOps: {
|
|
|
80
100
|
basePriceUsd: bigint | number;
|
|
81
101
|
lpType?: string;
|
|
82
102
|
}): Promise<perpFetch.OrderDataView>;
|
|
83
|
-
getMarketOrders(client:
|
|
103
|
+
getMarketOrders(client: PerpClient, args: {
|
|
84
104
|
ticker: string;
|
|
85
105
|
basePriceUsd?: bigint | number;
|
|
86
106
|
lpType?: string;
|
|
@@ -88,7 +108,7 @@ declare const perpOps: {
|
|
|
88
108
|
orders: perpFetch.OrderDataView[];
|
|
89
109
|
nextCursor?: bigint;
|
|
90
110
|
}>;
|
|
91
|
-
getMarketPositions(client:
|
|
111
|
+
getMarketPositions(client: PerpClient, args: {
|
|
92
112
|
ticker: string;
|
|
93
113
|
basePriceUsd: bigint | number;
|
|
94
114
|
collateralPriceUsd?: bigint | number;
|
|
@@ -97,121 +117,95 @@ declare const perpOps: {
|
|
|
97
117
|
positions: perpFetch.PositionDataView[];
|
|
98
118
|
nextCursor?: bigint;
|
|
99
119
|
}>;
|
|
100
|
-
getAccountPositions(client:
|
|
120
|
+
getAccountPositions(client: PerpClient, args: {
|
|
101
121
|
ticker: string;
|
|
102
122
|
accountObjectAddress: string;
|
|
103
123
|
basePriceUsd: bigint | number;
|
|
104
124
|
collateralPriceUsd?: bigint | number;
|
|
105
125
|
lpType?: string;
|
|
106
126
|
}): Promise<perpFetch.PositionDataView[]>;
|
|
107
|
-
getAccountOrders(client:
|
|
127
|
+
getAccountOrders(client: PerpClient, args: {
|
|
108
128
|
ticker: string;
|
|
109
129
|
accountObjectAddress: string;
|
|
110
130
|
basePriceUsd?: bigint | number;
|
|
111
131
|
lpType?: string;
|
|
112
132
|
}): Promise<perpFetch.OrderDataView[]>;
|
|
113
|
-
getRedeemRequests(client:
|
|
133
|
+
getRedeemRequests(client: PerpClient, args?: {
|
|
114
134
|
lpType?: string;
|
|
115
135
|
} & perpFetch.PageOpts): Promise<{
|
|
116
136
|
requests: perpFetch.RedeemRequestDataView[];
|
|
117
137
|
nextCursor?: bigint;
|
|
118
138
|
}>;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
getCustodyAssetData(client: WaterXClient, assetType: string): Promise<perpFetch.CustodyAssetData>;
|
|
127
|
-
getBridgeLimits(client: WaterXClient, args?: perpFetch.BridgeLimitsArgs): Promise<perpFetch.BridgeLimitsView>;
|
|
128
|
-
getBridgeFee(client: WaterXClient, args: {
|
|
139
|
+
getAccountsByOwner(client: PerpClient, owner: string): Promise<string[]>;
|
|
140
|
+
getAccountBalance(client: PerpClient, accountId: string, coinType?: string): Promise<bigint>;
|
|
141
|
+
getSpendableCreditBalance(client: PerpClient, accountId: string): Promise<perpFetch.SpendableCreditBalance>;
|
|
142
|
+
getCustodyVaultData(client: PerpClient): Promise<perpFetch.CustodyVaultData>;
|
|
143
|
+
getCustodyAssetData(client: PerpClient, assetType: string): Promise<perpFetch.CustodyAssetData>;
|
|
144
|
+
getBridgeLimits(client: PerpClient, args?: perpFetch.BridgeLimitsArgs): Promise<perpFetch.BridgeLimitsView>;
|
|
145
|
+
getBridgeFee(client: PerpClient, args: {
|
|
129
146
|
evmDestinationChain: number;
|
|
130
147
|
amount: bigint | number;
|
|
131
148
|
creditType?: string;
|
|
132
149
|
}): Promise<perpFetch.BridgeFeeView>;
|
|
133
|
-
appendConsolidateToUsd(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
|
|
134
|
-
appendConsolidateAddressCredit(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
|
|
135
|
-
appendConsolidateForSpend(client: WaterXClient, tx: Transaction, accountId: string): Promise<number>;
|
|
136
|
-
buildConsolidateToUsdTx(client: WaterXClient, accountId: string, tx?: Transaction): Promise<Transaction>;
|
|
137
|
-
buildClosePositionTx(client: WaterXClient, params: perpTx.BuildClosePositionParams): Promise<Transaction>;
|
|
138
|
-
buildIncreasePositionTx(client: WaterXClient, params: perpTx.BuildIncreasePositionParams): Promise<Transaction>;
|
|
139
|
-
buildDecreasePositionTx(client: WaterXClient, params: perpTx.BuildDecreasePositionParams): Promise<Transaction>;
|
|
140
|
-
buildDepositCollateralTx(client: WaterXClient, params: perpTx.BuildDepositCollateralParams): Promise<Transaction>;
|
|
141
|
-
buildWithdrawCollateralTx(client: WaterXClient, params: perpTx.BuildWithdrawCollateralParams): Promise<Transaction>;
|
|
142
|
-
buildPlaceOrderTx(client: WaterXClient, params: perpTx.BuildPlaceOrderParams): Promise<Transaction>;
|
|
143
|
-
buildCancelOrderTx(client: WaterXClient, params: perpTx.BuildCancelOrderParams): Promise<Transaction>;
|
|
144
|
-
buildUpdateOrderTx(client: WaterXClient, params: perpTx.BuildUpdateOrderParams): Promise<Transaction>;
|
|
145
|
-
buildCancelPreOrderTx(client: WaterXClient, params: perpTx.BuildCancelPreOrderParams): Promise<Transaction>;
|
|
146
|
-
buildAddPreOrderTx(client: WaterXClient, params: perpTx.BuildAddPreOrderParams): Promise<Transaction>;
|
|
147
|
-
buildMintWlpTx(client: WaterXClient, params: perpTx.BuildMintWlpParams): Promise<Transaction>;
|
|
148
|
-
buildMintAndStakeWlpTx(client: WaterXClient, params: perpTx.BuildMintAndStakeWlpParams): Promise<Transaction>;
|
|
149
|
-
buildUnstakeAndRequestRedeemWlpTx(client: WaterXClient, params: perpTx.BuildUnstakeAndRequestRedeemWlpParams): Promise<Transaction>;
|
|
150
|
-
buildCancelRedeemAndStakeWlpTx(client: WaterXClient, params: perpTx.BuildCancelRedeemAndStakeWlpParams): Transaction;
|
|
151
|
-
buildClaimRewardsToAccountTx(client: WaterXClient, params: perpTx.BuildClaimRewardsToAccountParams): Transaction;
|
|
152
|
-
buildRedeemVaaTx(client: WaterXClient, params: perpTx.BuildRedeemVaaParams): Transaction;
|
|
153
|
-
buildRequestCreditWithdrawTx(client: WaterXClient, params: perpTx.BuildRequestCreditWithdrawParams): Transaction;
|
|
154
|
-
buildExecuteWithdrawalTx(client: WaterXClient, params: perpTx.BuildExecuteWithdrawalParams): Transaction;
|
|
155
150
|
openPythSponsorFund: typeof perpTx.openPythSponsorFund;
|
|
156
151
|
PythCache: typeof perpTx.PythCache;
|
|
157
152
|
refreshOraclePrices: typeof perpTx.refreshOraclePrices;
|
|
158
153
|
reimbursePythSponsor: typeof perpTx.reimbursePythSponsor;
|
|
159
154
|
updatePythPrices: typeof perpTx.updatePythPrices;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
unstake(client: WaterXClient, tx: Transaction, params: perpUser.UnstakeParams): void;
|
|
193
|
-
claimReward(client: WaterXClient, tx: Transaction, params: perpUser.ClaimRewardParams): void;
|
|
194
|
-
closePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.ClosePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
195
|
-
increasePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.IncreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
196
|
-
decreasePositionRequest(client: WaterXClient, tx: Transaction, params: perpUser.DecreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
197
|
-
depositCollateralRequest(client: WaterXClient, tx: Transaction, params: perpUser.DepositCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
198
|
-
withdrawCollateralRequest(client: WaterXClient, tx: Transaction, params: perpUser.WithdrawCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
199
|
-
executeTrading(client: WaterXClient, tx: Transaction, params: perpUser.ExecuteTradingParams): void;
|
|
200
|
-
liquidate(client: WaterXClient, tx: Transaction, params: perpUser.LiquidateParams): void;
|
|
201
|
-
batchLiquidate(client: WaterXClient, tx: Transaction, params: perpUser.BatchLiquidateParams): void;
|
|
202
|
-
matchOrders(client: WaterXClient, tx: Transaction, params: perpUser.MatchOrdersParams): void;
|
|
203
|
-
updateFundingRate(client: WaterXClient, tx: Transaction, params: perpUser.UpdateFundingRateParams): void;
|
|
204
|
-
openPositionByKeeper(client: WaterXClient, tx: Transaction, params: perpUser.OpenPositionByKeeperParams): void;
|
|
205
|
-
closePositionByKeeper(client: WaterXClient, tx: Transaction, params: perpUser.ClosePositionByKeeperParams): void;
|
|
206
|
-
ORDER_TAG_WILDCARD_VALUE: 255;
|
|
207
|
-
mintWlp(client: WaterXClient, tx: Transaction, params: perpUser.MintWlpParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
208
|
-
requestRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.RequestRedeemWlpParams): void;
|
|
209
|
-
cancelRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.CancelRedeemWlpParams): void;
|
|
210
|
-
settleRedeemWlp(client: WaterXClient, tx: Transaction, params: perpUser.SettleRedeemWlpParams): void;
|
|
211
|
-
updateTokenValue(client: WaterXClient, tx: Transaction, args: {
|
|
155
|
+
appendConsolidateToUsd(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
|
|
156
|
+
appendConsolidateAddressCredit(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
|
|
157
|
+
appendConsolidateForSpend(client: import("./account/client.ts").AccountClientLike, tx: Transaction, accountId: string): Promise<number>;
|
|
158
|
+
buildConsolidateToUsdTx(client: import("./account/client.ts").AccountClientLike, accountId: string, tx?: Transaction): Promise<Transaction>;
|
|
159
|
+
buildClosePositionTx(client: PerpClient, params: perpTx.BuildClosePositionParams): Promise<Transaction>;
|
|
160
|
+
buildIncreasePositionTx(client: PerpClient, params: perpTx.BuildIncreasePositionParams): Promise<Transaction>;
|
|
161
|
+
buildDecreasePositionTx(client: PerpClient, params: perpTx.BuildDecreasePositionParams): Promise<Transaction>;
|
|
162
|
+
buildDepositCollateralTx(client: PerpClient, params: perpTx.BuildDepositCollateralParams): Promise<Transaction>;
|
|
163
|
+
buildWithdrawCollateralTx(client: PerpClient, params: perpTx.BuildWithdrawCollateralParams): Promise<Transaction>;
|
|
164
|
+
buildPlaceOrderTx(client: PerpClient, params: perpTx.BuildPlaceOrderParams): Promise<Transaction>;
|
|
165
|
+
buildCancelOrderTx(client: PerpClient, params: perpTx.BuildCancelOrderParams): Promise<Transaction>;
|
|
166
|
+
buildUpdateOrderTx(client: PerpClient, params: perpTx.BuildUpdateOrderParams): Promise<Transaction>;
|
|
167
|
+
buildCancelPreOrderTx(client: PerpClient, params: perpTx.BuildCancelPreOrderParams): Promise<Transaction>;
|
|
168
|
+
buildAddPreOrderTx(client: PerpClient, params: perpTx.BuildAddPreOrderParams): Promise<Transaction>;
|
|
169
|
+
buildMintWlpTx(client: PerpClient, params: perpTx.BuildMintWlpParams): Promise<Transaction>;
|
|
170
|
+
buildMintAndStakeWlpTx(client: PerpClient, params: perpTx.BuildMintAndStakeWlpParams): Promise<Transaction>;
|
|
171
|
+
buildUnstakeAndRequestRedeemWlpTx(client: PerpClient, params: perpTx.BuildUnstakeAndRequestRedeemWlpParams): Promise<Transaction>;
|
|
172
|
+
buildCancelRedeemAndStakeWlpTx(client: PerpClient, params: perpTx.BuildCancelRedeemAndStakeWlpParams): Transaction;
|
|
173
|
+
buildClaimRewardsToAccountTx(client: PerpClient, params: perpTx.BuildClaimRewardsToAccountParams): Transaction;
|
|
174
|
+
buildRedeemVaaTx(client: PerpClient, params: perpTx.BuildRedeemVaaParams): Transaction;
|
|
175
|
+
buildRequestCreditWithdrawTx(client: PerpClient, params: perpTx.BuildRequestCreditWithdrawParams): Transaction;
|
|
176
|
+
buildExecuteWithdrawalTx(client: PerpClient, params: perpTx.BuildExecuteWithdrawalParams): Transaction;
|
|
177
|
+
setReferralCode(client: import("./account/client.ts").WxaClientLike, tx: Transaction, params: perpReferral.SetReferralCodeParams): void;
|
|
178
|
+
useReferralCode(client: import("./account/client.ts").WxaClientLike, tx: Transaction, params: perpReferral.UseReferralCodeParams): void;
|
|
179
|
+
stake(client: PerpClient, tx: Transaction, params: perpStaking.StakeParams): void;
|
|
180
|
+
unstake(client: PerpClient, tx: Transaction, params: perpStaking.UnstakeParams): void;
|
|
181
|
+
claimReward(client: PerpClient, tx: Transaction, params: perpStaking.ClaimRewardParams): void;
|
|
182
|
+
mintWlp(client: PerpClient, tx: Transaction, params: perpWlp.MintWlpParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
183
|
+
requestRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.RequestRedeemWlpParams): void;
|
|
184
|
+
cancelRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.CancelRedeemWlpParams): void;
|
|
185
|
+
settleRedeemWlp(client: PerpClient, tx: Transaction, params: perpWlp.SettleRedeemWlpParams): void;
|
|
186
|
+
updateTokenValue(client: PerpClient, tx: Transaction, args: {
|
|
212
187
|
tokenType: string;
|
|
213
188
|
lpType?: string;
|
|
214
189
|
}): void;
|
|
190
|
+
buildPlaceOrderArgument(client: PerpClient, tx: Transaction, p: perpOrder.PlaceOrderArgumentParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
191
|
+
placeOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.PlaceOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
192
|
+
cancelOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.CancelOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
193
|
+
updateOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.UpdateOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
194
|
+
cancelPreOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.CancelPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
195
|
+
addPreOrderRequest(client: PerpClient, tx: Transaction, params: perpOrder.AddPreOrderRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
196
|
+
closePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.ClosePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
197
|
+
increasePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.IncreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
198
|
+
decreasePositionRequest(client: PerpClient, tx: Transaction, params: perpTrading.DecreasePositionRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
199
|
+
depositCollateralRequest(client: PerpClient, tx: Transaction, params: perpTrading.DepositCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
200
|
+
withdrawCollateralRequest(client: PerpClient, tx: Transaction, params: perpTrading.WithdrawCollateralRequestParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
201
|
+
executeTrading(client: PerpClient, tx: Transaction, params: perpTrading.ExecuteTradingParams): void;
|
|
202
|
+
liquidate(client: PerpClient, tx: Transaction, params: perpTrading.LiquidateParams): void;
|
|
203
|
+
batchLiquidate(client: PerpClient, tx: Transaction, params: perpTrading.BatchLiquidateParams): void;
|
|
204
|
+
matchOrders(client: PerpClient, tx: Transaction, params: perpTrading.MatchOrdersParams): void;
|
|
205
|
+
updateFundingRate(client: PerpClient, tx: Transaction, params: perpTrading.UpdateFundingRateParams): void;
|
|
206
|
+
openPositionByKeeper(client: PerpClient, tx: Transaction, params: perpTrading.OpenPositionByKeeperParams): void;
|
|
207
|
+
closePositionByKeeper(client: PerpClient, tx: Transaction, params: perpTrading.ClosePositionByKeeperParams): void;
|
|
208
|
+
ORDER_TAG_WILDCARD_VALUE: 255;
|
|
215
209
|
};
|
|
216
210
|
declare const predictOps: {
|
|
217
211
|
base64UrlNoPadEncode(bytes: Uint8Array): string;
|
|
@@ -315,7 +309,10 @@ declare const predictOps: {
|
|
|
315
309
|
claim(client: PredictClient, tx: Transaction, params: predOps.ClaimParams): Transaction;
|
|
316
310
|
batchClaim(client: PredictClient, tx: Transaction, params: predOps.BatchClaimParams): Transaction;
|
|
317
311
|
requestClose(client: PredictClient, tx: Transaction, params: predOps.RequestCloseParams): Transaction;
|
|
312
|
+
requestPartialClose(client: PredictClient, tx: Transaction, params: predOps.RequestPartialCloseParams): Transaction;
|
|
318
313
|
selfCancelClose(client: PredictClient, tx: Transaction, params: predOps.SelfCancelCloseParams): Transaction;
|
|
314
|
+
transferPosition(client: PredictClient, tx: Transaction, params: predOps.TransferPositionParams): Transaction;
|
|
315
|
+
splitPosition(client: PredictClient, tx: Transaction, params: predOps.SplitPositionParams): Transaction;
|
|
319
316
|
fillOrder(client: PredictClient, tx: Transaction, params: predOps.FillOrderParams): Transaction;
|
|
320
317
|
cancelOrder(client: PredictClient, tx: Transaction, params: predOps.CancelOrderParams): Transaction;
|
|
321
318
|
confirmClose(client: PredictClient, tx: Transaction, params: predOps.ConfirmCloseParams): Transaction;
|
|
@@ -334,25 +331,15 @@ declare const predictOps: {
|
|
|
334
331
|
unpauseMarket(client: PredictClient, tx: Transaction, params: predAdmin.MarketPauseParams): Transaction;
|
|
335
332
|
addKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
|
|
336
333
|
removeKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
consumeDepositDirect(client: PredictClient, tx: Transaction, params: predAccount.ConsumeDepositDirectParams): Transaction;
|
|
342
|
-
deposit(client: PredictClient, tx: Transaction, params: predAccount.RequestDepositParams): Transaction;
|
|
343
|
-
requestDepositFromReceivings(client: PredictClient, tx: Transaction, params: predAccount.RequestDepositFromReceivingsParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
344
|
-
requestWithdraw(client: PredictClient, tx: Transaction, params: predAccount.RequestWithdrawParams): import("@mysten/sui/transactions").TransactionArgument;
|
|
345
|
-
consumeWithdrawDirect(client: PredictClient, tx: Transaction, params: predAccount.ConsumeWithdrawDirectParams): Transaction;
|
|
346
|
-
withdraw(client: PredictClient, tx: Transaction, params: predAccount.RequestWithdrawParams): Transaction;
|
|
347
|
-
addDelegate(client: PredictClient, tx: Transaction, params: predAccount.AddDelegateParams): Transaction;
|
|
348
|
-
removeDelegate(client: PredictClient, tx: Transaction, params: predAccount.RemoveDelegateParams): Transaction;
|
|
349
|
-
setDelegatePredictionPermission(client: PredictClient, tx: Transaction, params: predAccount.SetDelegatePredictionPermissionParams): Transaction;
|
|
350
|
-
whitelistPredictionProtocol(client: PredictClient, tx: Transaction, params: predAccount.WhitelistPredictionProtocolParams): Transaction;
|
|
351
|
-
allowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: predAccount.PredictionProtocolAssetParams): Transaction;
|
|
352
|
-
disallowPredictionProtocolAsset(client: PredictClient, tx: Transaction, params: predAccount.PredictionProtocolAssetParams): Transaction;
|
|
334
|
+
setDelegatePredictionPermission: typeof setDelegatePredictionPermission;
|
|
335
|
+
whitelistPredictionProtocol: typeof whitelistPredictionProtocol;
|
|
336
|
+
allowPredictionProtocolAsset: typeof allowPredictionProtocolAsset;
|
|
337
|
+
disallowPredictionProtocolAsset: typeof disallowPredictionProtocolAsset;
|
|
353
338
|
};
|
|
339
|
+
/** Account namespace exposed as `client.account` — generic wxa + credit + custody, perp-backed. */
|
|
340
|
+
export type AccountModule = ClientBound<typeof accountOps, PerpClient>;
|
|
354
341
|
/** Perp namespace exposed as `client.perp` — builder/view methods, client pre-bound. */
|
|
355
|
-
export type PerpModule = ClientBound<typeof perpOps,
|
|
342
|
+
export type PerpModule = ClientBound<typeof perpOps, PerpClient>;
|
|
356
343
|
/** Prediction namespace exposed as `client.predict` — builder/view methods, client pre-bound. */
|
|
357
344
|
export type PredictModule = ClientBound<typeof predictOps, PredictClient>;
|
|
358
345
|
/** Per-line network/config override. Falls back to the shared top-level options. */
|
|
@@ -376,18 +363,22 @@ export interface ClientCreateOptions {
|
|
|
376
363
|
/** Prediction-line overrides (network, grpcUrl, configUrl, cache, settlement, …). */
|
|
377
364
|
predict?: PredictLineOptions;
|
|
378
365
|
}
|
|
379
|
-
export declare class
|
|
380
|
-
/**
|
|
381
|
-
readonly
|
|
382
|
-
/**
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
366
|
+
export declare class WaterXClient {
|
|
367
|
+
/** Shared account namespace (`client.account.createAccount(tx, params)`) — perp-backed. */
|
|
368
|
+
readonly account: AccountModule;
|
|
369
|
+
/**
|
|
370
|
+
* Perp sub-client **with** the perp builders/views grafted on
|
|
371
|
+
* (`client.perp.placeOrderRequest(...)`, `client.perp.signAndExecuteTransaction(...)`).
|
|
372
|
+
*/
|
|
373
|
+
readonly perp: PerpClient & PerpModule;
|
|
374
|
+
/**
|
|
375
|
+
* Prediction sub-client **with** the prediction builders/views grafted on
|
|
376
|
+
* (`client.predict.placeOrder(...)`, `client.predict.signAndExecuteTransaction(...)`).
|
|
377
|
+
*/
|
|
378
|
+
readonly predict: PredictClient & PredictModule;
|
|
388
379
|
/**
|
|
389
380
|
* Async prediction builder: optional consolidate + `placeOrder`.
|
|
390
|
-
* Uses
|
|
381
|
+
* Uses the perp client for the sweep and the predict client for the bet leg.
|
|
391
382
|
*/
|
|
392
383
|
buildPredictPlaceOrderTx(params: BuildPlaceOrderTxParams): Promise<Transaction>;
|
|
393
384
|
/**
|
|
@@ -395,13 +386,17 @@ export declare class Client {
|
|
|
395
386
|
*/
|
|
396
387
|
buildPredictBatchClaimTx(params: BuildBatchClaimTxParams): Promise<Transaction>;
|
|
397
388
|
private constructor();
|
|
398
|
-
/**
|
|
399
|
-
|
|
389
|
+
/**
|
|
390
|
+
* Combine two pre-built line clients (advanced — full control over each).
|
|
391
|
+
* Note: this grafts the bound builder methods onto the provided client
|
|
392
|
+
* instances in place.
|
|
393
|
+
*/
|
|
394
|
+
static fromClients(perpClient: PerpClient, predictClient: PredictClient): WaterXClient;
|
|
400
395
|
/**
|
|
401
396
|
* Async factory — loads each line's deployment config (from the canonical
|
|
402
397
|
* `waterx-config` JSON) and returns a ready client. Each line can target a
|
|
403
398
|
* different network via `opts.perp.network` / `opts.predict.network`.
|
|
404
399
|
*/
|
|
405
|
-
static create(opts?: ClientCreateOptions): Promise<
|
|
400
|
+
static create(opts?: ClientCreateOptions): Promise<WaterXClient>;
|
|
406
401
|
}
|
|
407
402
|
export {};
|