@waterx/sdk 3.0.1 → 3.1.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/dist/cjs/package.json +3 -0
- package/dist/cjs/src/account/account-request.d.ts +9 -0
- package/dist/cjs/src/account/account-request.js +20 -0
- package/dist/cjs/src/account/account.d.ts +158 -0
- package/dist/cjs/src/account/account.js +238 -0
- package/dist/cjs/src/account/client.d.ts +42 -0
- package/dist/cjs/src/account/client.js +18 -0
- package/dist/cjs/src/account/config.d.ts +151 -0
- package/dist/cjs/src/account/config.js +9 -0
- package/dist/cjs/src/account/constants.d.ts +5 -0
- package/dist/cjs/src/account/constants.js +8 -0
- package/dist/cjs/src/account/fetch/referral.d.ts +15 -0
- package/dist/cjs/src/account/fetch/referral.js +56 -0
- package/dist/cjs/src/account/fetch/simulate.d.ts +34 -0
- package/dist/cjs/src/account/fetch/simulate.js +49 -0
- package/dist/cjs/src/account/funding/balance.d.ts +32 -0
- package/dist/cjs/src/account/funding/balance.js +100 -0
- package/dist/cjs/src/account/funding/consolidate.d.ts +46 -0
- package/dist/cjs/src/account/funding/consolidate.js +143 -0
- package/dist/cjs/src/account/funding/credit.d.ts +129 -0
- package/dist/cjs/src/account/funding/credit.js +252 -0
- package/dist/cjs/src/account/funding/custody.d.ts +57 -0
- package/dist/cjs/src/account/funding/custody.js +139 -0
- package/dist/cjs/src/account/funding/wormhole.d.ts +86 -0
- package/dist/cjs/src/account/funding/wormhole.js +166 -0
- package/dist/cjs/src/account/index.d.ts +29 -0
- package/dist/cjs/src/account/index.js +45 -0
- package/dist/cjs/src/account/referral.d.ts +21 -0
- package/dist/cjs/src/account/referral.js +78 -0
- package/dist/cjs/src/account/waterx-account.d.ts +31 -0
- package/dist/cjs/src/account/waterx-account.js +29 -0
- package/dist/cjs/src/base-client.d.ts +74 -0
- package/dist/cjs/src/base-client.js +101 -0
- package/dist/cjs/src/constants.d.ts +32 -0
- package/dist/cjs/src/constants.js +41 -0
- package/dist/cjs/src/generated/bucket_v2_framework/account.d.ts +107 -0
- package/dist/cjs/src/generated/bucket_v2_framework/account.js +141 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/bucket_v2_framework/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/bucket_v2_framework/double.d.ts +384 -0
- package/dist/cjs/src/generated/bucket_v2_framework/double.js +504 -0
- package/dist/cjs/src/generated/bucket_v2_framework/float.d.ts +364 -0
- package/dist/cjs/src/generated/bucket_v2_framework/float.js +476 -0
- package/dist/cjs/src/generated/bucket_v2_framework/liability.d.ts +171 -0
- package/dist/cjs/src/generated/bucket_v2_framework/liability.js +192 -0
- package/dist/cjs/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/cjs/src/generated/bucket_v2_framework/linked_table.js +405 -0
- package/dist/cjs/src/generated/bucket_v2_framework/sheet.d.ts +424 -0
- package/dist/cjs/src/generated/bucket_v2_framework/sheet.js +395 -0
- package/dist/cjs/src/generated/native_custody/custody_vault.d.ts +586 -0
- package/dist/cjs/src/generated/native_custody/custody_vault.js +555 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/float.js +13 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/liability.js +16 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/cjs/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +52 -0
- package/dist/cjs/src/generated/native_custody/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/native_custody/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/native_custody/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/native_custody/events.d.ts +36 -0
- package/dist/cjs/src/generated/native_custody/events.js +71 -0
- package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/pyth_sponsor_rule/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +68 -0
- package/dist/cjs/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +113 -0
- package/dist/cjs/src/generated/utils/index.d.ts +30 -0
- package/dist/cjs/src/generated/utils/index.js +168 -0
- package/dist/cjs/src/generated/waterx_account/account.d.ts +1906 -0
- package/dist/cjs/src/generated/waterx_account/account.js +1929 -0
- package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/liability.js +16 -0
- package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/cjs/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +52 -0
- package/dist/cjs/src/generated/waterx_account/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_account/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/object_table.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/object_table.js +22 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_account/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_account/direct_rule.d.ts +77 -0
- package/dist/cjs/src/generated/waterx_account/direct_rule.js +83 -0
- package/dist/cjs/src/generated/waterx_account/events.d.ts +190 -0
- package/dist/cjs/src/generated/waterx_account/events.js +173 -0
- package/dist/cjs/src/generated/waterx_account/version.d.ts +10 -0
- package/dist/cjs/src/generated/waterx_account/version.js +11 -0
- package/dist/cjs/src/generated/waterx_constant_rule/constant_rule.d.ts +68 -0
- package/dist/cjs/src/generated/waterx_constant_rule/constant_rule.js +97 -0
- package/dist/cjs/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.js +13 -0
- package/dist/cjs/src/generated/waterx_constant_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_constant_rule/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_credit/credit_registry.d.ts +708 -0
- package/dist/cjs/src/generated/waterx_credit/credit_registry.js +728 -0
- package/dist/cjs/src/generated/waterx_credit/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_credit/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_credit/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_credit/limited_supply.d.ts +107 -0
- package/dist/cjs/src/generated/waterx_credit/limited_supply.js +143 -0
- package/dist/cjs/src/generated/waterx_oracle/aggregator.d.ts +211 -0
- package/dist/cjs/src/generated/waterx_oracle/aggregator.js +258 -0
- package/dist/cjs/src/generated/waterx_oracle/collector.d.ts +119 -0
- package/dist/cjs/src/generated/waterx_oracle/collector.js +147 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/bucket_v2_framework/float.js +13 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_oracle/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_oracle/oracle.d.ts +304 -0
- package/dist/cjs/src/generated/waterx_oracle/oracle.js +381 -0
- package/dist/cjs/src/generated/waterx_oracle/version.d.ts +10 -0
- package/dist/cjs/src/generated/waterx_oracle/version.js +11 -0
- package/dist/cjs/src/generated/waterx_perp/account_data.d.ts +269 -0
- package/dist/cjs/src/generated/waterx_perp/account_data.js +340 -0
- package/dist/cjs/src/generated/waterx_perp/admin.d.ts +19 -0
- package/dist/cjs/src/generated/waterx_perp/admin.js +26 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/double.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/double.js +13 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/float.js +13 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/liability.d.ts +11 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/liability.js +16 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/linked_table.js +21 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.d.ts +49 -0
- package/dist/cjs/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +52 -0
- package/dist/cjs/src/generated/waterx_perp/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_perp/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/balance.d.ts +15 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/balance.js +20 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/coin.d.ts +14 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/coin.js +51 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_perp/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_perp/events.d.ts +1283 -0
- package/dist/cjs/src/generated/waterx_perp/events.js +990 -0
- package/dist/cjs/src/generated/waterx_perp/global_config.d.ts +775 -0
- package/dist/cjs/src/generated/waterx_perp/global_config.js +918 -0
- package/dist/cjs/src/generated/waterx_perp/keyed_big_vector.d.ts +553 -0
- package/dist/cjs/src/generated/waterx_perp/keyed_big_vector.js +626 -0
- package/dist/cjs/src/generated/waterx_perp/lp_pool.d.ts +1648 -0
- package/dist/cjs/src/generated/waterx_perp/lp_pool.js +1630 -0
- package/dist/cjs/src/generated/waterx_perp/market_config.d.ts +733 -0
- package/dist/cjs/src/generated/waterx_perp/market_config.js +871 -0
- package/dist/cjs/src/generated/waterx_perp/math.d.ts +63 -0
- package/dist/cjs/src/generated/waterx_perp/math.js +70 -0
- package/dist/cjs/src/generated/waterx_perp/memo.d.ts +251 -0
- package/dist/cjs/src/generated/waterx_perp/memo.js +360 -0
- package/dist/cjs/src/generated/waterx_perp/order_book.d.ts +290 -0
- package/dist/cjs/src/generated/waterx_perp/order_book.js +388 -0
- package/dist/cjs/src/generated/waterx_perp/position.d.ts +1005 -0
- package/dist/cjs/src/generated/waterx_perp/position.js +1200 -0
- package/dist/cjs/src/generated/waterx_perp/request.d.ts +544 -0
- package/dist/cjs/src/generated/waterx_perp/request.js +609 -0
- package/dist/cjs/src/generated/waterx_perp/response.d.ts +247 -0
- package/dist/cjs/src/generated/waterx_perp/response.js +331 -0
- package/dist/cjs/src/generated/waterx_perp/trading.d.ts +2945 -0
- package/dist/cjs/src/generated/waterx_perp/trading.js +2616 -0
- package/dist/cjs/src/generated/waterx_perp/version.d.ts +10 -0
- package/dist/cjs/src/generated/waterx_perp/version.js +11 -0
- package/dist/cjs/src/generated/waterx_perp/witness.d.ts +18 -0
- package/dist/cjs/src/generated/waterx_perp/witness.js +25 -0
- package/dist/cjs/src/generated/waterx_perp_view/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/waterx_perp_view/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/waterx_perp_view/view.d.ts +447 -0
- package/dist/cjs/src/generated/waterx_perp_view/view.js +459 -0
- package/dist/cjs/src/generated/waterx_prediction/account_data.d.ts +344 -0
- package/dist/cjs/src/generated/waterx_prediction/account_data.js +470 -0
- package/dist/cjs/src/generated/waterx_prediction/admin.d.ts +7 -0
- package/dist/cjs/src/generated/waterx_prediction/admin.js +12 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +21 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_prediction/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_prediction/events.d.ts +288 -0
- package/dist/cjs/src/generated/waterx_prediction/events.js +254 -0
- package/dist/cjs/src/generated/waterx_prediction/global_config.d.ts +121 -0
- package/dist/cjs/src/generated/waterx_prediction/global_config.js +186 -0
- package/dist/cjs/src/generated/waterx_prediction/order.d.ts +233 -0
- package/dist/cjs/src/generated/waterx_prediction/order.js +339 -0
- package/dist/cjs/src/generated/waterx_prediction/outcome.d.ts +58 -0
- package/dist/cjs/src/generated/waterx_prediction/outcome.js +82 -0
- package/dist/cjs/src/generated/waterx_prediction/position.d.ts +175 -0
- package/dist/cjs/src/generated/waterx_prediction/position.js +232 -0
- package/dist/cjs/src/generated/waterx_prediction/version.d.ts +10 -0
- package/dist/cjs/src/generated/waterx_prediction/version.js +11 -0
- package/dist/cjs/src/generated/waterx_prediction/view.d.ts +418 -0
- package/dist/cjs/src/generated/waterx_prediction/view.js +492 -0
- package/dist/cjs/src/generated/waterx_prediction/waterx_prediction.d.ts +1858 -0
- package/dist/cjs/src/generated/waterx_prediction/waterx_prediction.js +1972 -0
- package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_pyth_rule/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.d.ts +192 -0
- package/dist/cjs/src/generated/waterx_pyth_rule/pyth_rule.js +214 -0
- package/dist/cjs/src/generated/waterx_referral/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/waterx_referral/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/waterx_referral/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_referral/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_referral/referral_table.d.ts +171 -0
- package/dist/cjs/src/generated/waterx_referral/referral_table.js +239 -0
- package/dist/cjs/src/generated/waterx_staking/deps/bucket_v2_framework/double.d.ts +8 -0
- package/dist/cjs/src/generated/waterx_staking/deps/bucket_v2_framework/double.js +13 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_staking/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/waterx_staking/waterx_staking.d.ts +746 -0
- package/dist/cjs/src/generated/waterx_staking/waterx_staking.js +797 -0
- package/dist/cjs/src/generated/waterx_staking/witness.d.ts +16 -0
- package/dist/cjs/src/generated/waterx_staking/witness.js +21 -0
- package/dist/cjs/src/generated/waterx_supra_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/waterx_supra_rule/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/waterx_supra_rule/supra_rule.d.ts +158 -0
- package/dist/cjs/src/generated/waterx_supra_rule/supra_rule.js +189 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.js +13 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/bucket_v2_framework/linked_table.js +21 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/std/type_name.d.ts +17 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/std/type_name.js +22 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/balance.d.ts +12 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/balance.js +17 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/withdrawal_queue/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/withdrawal_queue/withdrawal_queue.d.ts +923 -0
- package/dist/cjs/src/generated/withdrawal_queue/withdrawal_queue.js +965 -0
- package/dist/cjs/src/generated/wlp/wlp.d.ts +28 -0
- package/dist/cjs/src/generated/wlp/wlp.js +37 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/table.d.ts +29 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/table.js +34 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_map.d.ts +36 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_map.js +31 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_set.d.ts +16 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/sui/vec_set.js +22 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.d.ts +12 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/consumed_vaas.js +45 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.d.ts +14 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/emitter.js +19 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/set.d.ts +16 -0
- package/dist/cjs/src/generated/wormhole_bridge/deps/wormhole_sdk/set.js +51 -0
- package/dist/cjs/src/generated/wormhole_bridge/events.d.ts +32 -0
- package/dist/cjs/src/generated/wormhole_bridge/events.js +31 -0
- package/dist/cjs/src/generated/wormhole_bridge/wormhole_bridge.d.ts +638 -0
- package/dist/cjs/src/generated/wormhole_bridge/wormhole_bridge.js +692 -0
- package/dist/cjs/src/oracle/aggregate.d.ts +74 -0
- package/dist/cjs/src/oracle/aggregate.js +118 -0
- package/dist/cjs/src/oracle/config.d.ts +99 -0
- package/dist/cjs/src/oracle/config.js +26 -0
- package/dist/cjs/src/oracle/host.d.ts +32 -0
- package/dist/cjs/src/oracle/host.js +11 -0
- package/dist/cjs/src/oracle/index.d.ts +16 -0
- package/dist/cjs/src/oracle/index.js +31 -0
- package/dist/cjs/src/oracle/pyth.d.ts +52 -0
- package/dist/cjs/src/oracle/pyth.js +227 -0
- package/dist/cjs/src/oracle/rules/constant-rule.d.ts +9 -0
- package/dist/cjs/src/oracle/rules/constant-rule.js +17 -0
- package/dist/cjs/src/oracle/rules/pyth-rule.d.ts +11 -0
- package/dist/cjs/src/oracle/rules/pyth-rule.js +23 -0
- package/dist/cjs/src/oracle/rules/sponsor.d.ts +28 -0
- package/dist/cjs/src/oracle/rules/sponsor.js +52 -0
- package/dist/cjs/src/oracle/rules/supra-rule.d.ts +11 -0
- package/dist/cjs/src/oracle/rules/supra-rule.js +25 -0
- package/dist/cjs/src/perp/client.d.ts +78 -0
- package/dist/cjs/src/perp/client.js +112 -0
- package/dist/cjs/src/perp/config-view.d.ts +102 -0
- package/dist/cjs/src/perp/config-view.js +178 -0
- package/dist/cjs/src/perp/config.d.ts +126 -0
- package/dist/cjs/src/perp/config.js +119 -0
- package/dist/cjs/src/perp/constants.d.ts +49 -0
- package/dist/cjs/src/perp/constants.js +79 -0
- package/dist/cjs/src/perp/fetch/account.d.ts +43 -0
- package/dist/cjs/src/perp/fetch/account.js +69 -0
- package/dist/cjs/src/perp/fetch/bridge.d.ts +90 -0
- package/dist/cjs/src/perp/fetch/bridge.js +131 -0
- package/dist/cjs/src/perp/fetch/custody.d.ts +32 -0
- package/dist/cjs/src/perp/fetch/custody.js +66 -0
- package/dist/cjs/src/perp/fetch/market.d.ts +30 -0
- package/dist/cjs/src/perp/fetch/market.js +75 -0
- package/dist/cjs/src/perp/fetch/positions.d.ts +70 -0
- package/dist/cjs/src/perp/fetch/positions.js +195 -0
- package/dist/cjs/src/perp/fetch/simulate.d.ts +12 -0
- package/dist/cjs/src/perp/fetch/simulate.js +21 -0
- package/dist/cjs/src/perp/fetch.d.ts +23 -0
- package/dist/cjs/src/perp/fetch.js +39 -0
- package/dist/cjs/src/perp/index.d.ts +29 -0
- package/dist/cjs/src/perp/index.js +183 -0
- package/dist/cjs/src/perp/tx-builders/common.d.ts +83 -0
- package/dist/cjs/src/perp/tx-builders/common.js +76 -0
- package/dist/cjs/src/perp/tx-builders/credit.d.ts +65 -0
- package/dist/cjs/src/perp/tx-builders/credit.js +67 -0
- package/dist/cjs/src/perp/tx-builders/rewards.d.ts +30 -0
- package/dist/cjs/src/perp/tx-builders/rewards.js +37 -0
- package/dist/cjs/src/perp/tx-builders/trading.d.ts +51 -0
- package/dist/cjs/src/perp/tx-builders/trading.js +71 -0
- package/dist/cjs/src/perp/tx-builders/wlp.d.ts +90 -0
- package/dist/cjs/src/perp/tx-builders/wlp.js +126 -0
- package/dist/cjs/src/perp/tx-builders.d.ts +23 -0
- package/dist/cjs/src/perp/tx-builders.js +45 -0
- package/dist/cjs/src/perp/user/index.d.ts +8 -0
- package/dist/cjs/src/perp/user/index.js +24 -0
- package/dist/cjs/src/perp/user/order.d.ts +89 -0
- package/dist/cjs/src/perp/user/order.js +175 -0
- package/dist/cjs/src/perp/user/staking.d.ts +54 -0
- package/dist/cjs/src/perp/user/staking.js +147 -0
- package/dist/cjs/src/perp/user/trading.d.ts +119 -0
- package/dist/cjs/src/perp/user/trading.js +310 -0
- package/dist/cjs/src/perp/user/wlp.d.ts +58 -0
- package/dist/cjs/src/perp/user/wlp.js +139 -0
- package/dist/cjs/src/prediction/account.d.ts +96 -0
- package/dist/cjs/src/prediction/account.js +212 -0
- package/dist/cjs/src/prediction/admin.d.ts +47 -0
- package/dist/cjs/src/prediction/admin.js +116 -0
- package/dist/cjs/src/prediction/bcs.d.ts +28 -0
- package/dist/cjs/src/prediction/bcs.js +189 -0
- package/dist/cjs/src/prediction/client.d.ts +56 -0
- package/dist/cjs/src/prediction/client.js +128 -0
- package/dist/cjs/src/prediction/config.d.ts +74 -0
- package/dist/cjs/src/prediction/config.js +86 -0
- package/dist/cjs/src/prediction/constants.d.ts +44 -0
- package/dist/cjs/src/prediction/constants.js +49 -0
- package/dist/cjs/src/prediction/fetch.d.ts +82 -0
- package/dist/cjs/src/prediction/fetch.js +294 -0
- package/dist/cjs/src/prediction/gift-link.d.ts +6 -0
- package/dist/cjs/src/prediction/gift-link.js +16 -0
- package/dist/cjs/src/prediction/gift.d.ts +242 -0
- package/dist/cjs/src/prediction/gift.js +490 -0
- package/dist/cjs/src/prediction/index.d.ts +29 -0
- package/dist/cjs/src/prediction/index.js +154 -0
- package/dist/cjs/src/prediction/prediction.d.ts +149 -0
- package/dist/cjs/src/prediction/prediction.js +410 -0
- package/dist/cjs/src/prediction/tx-builders.d.ts +44 -0
- package/dist/cjs/src/prediction/tx-builders.js +56 -0
- package/dist/cjs/src/prediction/types.d.ts +95 -0
- package/dist/cjs/src/prediction/types.js +2 -0
- package/dist/cjs/src/prediction/user/account.d.ts +2 -0
- package/dist/cjs/src/prediction/user/account.js +17 -0
- package/dist/cjs/src/prediction/user/admin.d.ts +6 -0
- package/dist/cjs/src/prediction/user/admin.js +19 -0
- package/dist/cjs/src/prediction/user/gift.d.ts +2 -0
- package/dist/cjs/src/prediction/user/gift.js +24 -0
- package/dist/cjs/src/prediction/user/index.d.ts +5 -0
- package/dist/cjs/src/prediction/user/index.js +60 -0
- package/dist/cjs/src/prediction/user/keeper.d.ts +2 -0
- package/dist/cjs/src/prediction/user/keeper.js +13 -0
- package/dist/cjs/src/prediction/user/order.d.ts +2 -0
- package/dist/cjs/src/prediction/user/order.js +6 -0
- package/dist/cjs/src/prediction/user/position.d.ts +2 -0
- package/dist/cjs/src/prediction/user/position.js +11 -0
- package/dist/cjs/src/prediction/utils/bcs.d.ts +6 -0
- package/dist/cjs/src/prediction/utils/bcs.js +29 -0
- package/dist/cjs/src/prediction/utils/index.d.ts +8 -0
- package/dist/cjs/src/prediction/utils/index.js +31 -0
- package/dist/cjs/src/prediction/utils.d.ts +30 -0
- package/dist/cjs/src/prediction/utils.js +200 -0
- package/dist/cjs/src/sdk.d.ts +22 -0
- package/dist/cjs/src/sdk.js +62 -0
- package/dist/cjs/src/unified-client.d.ts +402 -0
- package/dist/cjs/src/unified-client.js +218 -0
- package/dist/cjs/src/utils/config.d.ts +11 -0
- package/dist/cjs/src/utils/config.js +19 -0
- package/dist/cjs/src/utils/math.d.ts +287 -0
- package/dist/cjs/src/utils/math.js +469 -0
- package/dist/src/prediction/client.d.ts +11 -0
- package/dist/src/prediction/client.js +16 -0
- package/dist/src/prediction/gift.d.ts +19 -0
- package/dist/src/prediction/gift.js +26 -1
- package/package.json +119 -31
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella WaterX SDK client — the main entry point.
|
|
3
|
+
*
|
|
4
|
+
* Exposes three namespaces over the two product-line sub-clients:
|
|
5
|
+
*
|
|
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
|
|
10
|
+
*
|
|
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.
|
|
30
|
+
*/
|
|
31
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
32
|
+
import * as accountOps from "./account/index.ts";
|
|
33
|
+
import * as perpReferral from "./account/referral.ts";
|
|
34
|
+
import type { Network } from "./constants.ts";
|
|
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";
|
|
43
|
+
import * as predAdmin from "./prediction/admin.ts";
|
|
44
|
+
import { PredictClient, type CreateClientOptions as PredictCreateOptions } from "./prediction/client.ts";
|
|
45
|
+
import * as predFetch from "./prediction/fetch.ts";
|
|
46
|
+
import * as predGift from "./prediction/gift.ts";
|
|
47
|
+
import * as predOps from "./prediction/prediction.ts";
|
|
48
|
+
import { type BuildBatchClaimTxParams, type BuildPlaceOrderTxParams } from "./prediction/tx-builders.ts";
|
|
49
|
+
/**
|
|
50
|
+
* Exports from the spread builder/view modules that are NOT client-first — their
|
|
51
|
+
* first argument is not the line client, so they must not become bound facade
|
|
52
|
+
* methods (binding would pass the client where a value is expected). This is the
|
|
53
|
+
* single source of truth shared by the runtime (skip) and the type (`Omit`).
|
|
54
|
+
* Keep in sync by auditing `export function` first-params across the spread modules.
|
|
55
|
+
*/
|
|
56
|
+
declare const NON_CLIENT_FIRST: readonly ["extractReturnBytes", "base64UrlNoPadEncode", "base64UrlNoPadDecode", "generateGiftSeed", "encodeGiftUrl", "parseGiftUrl", "deriveGiftKeypair", "buildGiftClaimMessage", "signGiftClaim"];
|
|
57
|
+
type NonClientFirstKey = (typeof NON_CLIENT_FIRST)[number];
|
|
58
|
+
/**
|
|
59
|
+
* Map a namespace of `(client, ...args) => R` free functions to the same surface
|
|
60
|
+
* with the client pre-bound: `(...args) => R`. Non-client-first helpers (see
|
|
61
|
+
* `NON_CLIENT_FIRST`) are dropped, so the static type and the runtime agree.
|
|
62
|
+
*/
|
|
63
|
+
type ClientBound<NS, C> = {
|
|
64
|
+
[K in keyof Omit<NS, NonClientFirstKey>]: NS[K] extends (client: C, ...args: infer A) => infer R ? (...args: A) => R : NS[K];
|
|
65
|
+
};
|
|
66
|
+
declare const perpOps: {
|
|
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: {
|
|
72
|
+
ticker: string;
|
|
73
|
+
lpType?: string;
|
|
74
|
+
}): Promise<perpFetch.MarketDataView>;
|
|
75
|
+
getPoolData(client: PerpClient, args?: {
|
|
76
|
+
lpType?: string;
|
|
77
|
+
}): Promise<perpFetch.PoolDataView>;
|
|
78
|
+
getTokenPoolData(client: PerpClient, args: {
|
|
79
|
+
tokenIndex: bigint | number;
|
|
80
|
+
lpType?: string;
|
|
81
|
+
}): Promise<perpFetch.TokenPoolDataView>;
|
|
82
|
+
getGlobalConfigData(client: PerpClient): Promise<perpFetch.GlobalConfigDataView>;
|
|
83
|
+
positionExists(client: PerpClient, args: {
|
|
84
|
+
ticker: string;
|
|
85
|
+
positionId: bigint | number;
|
|
86
|
+
lpType?: string;
|
|
87
|
+
}): Promise<boolean>;
|
|
88
|
+
getPosition(client: PerpClient, args: {
|
|
89
|
+
ticker: string;
|
|
90
|
+
positionId: bigint | number;
|
|
91
|
+
basePriceUsd: bigint | number;
|
|
92
|
+
collateralPriceUsd: bigint | number;
|
|
93
|
+
lpType?: string;
|
|
94
|
+
}): Promise<perpFetch.PositionDataView>;
|
|
95
|
+
getOrder(client: PerpClient, args: {
|
|
96
|
+
ticker: string;
|
|
97
|
+
orderId: bigint | number;
|
|
98
|
+
orderTypeTag: number;
|
|
99
|
+
triggerPrice: bigint | number;
|
|
100
|
+
basePriceUsd: bigint | number;
|
|
101
|
+
lpType?: string;
|
|
102
|
+
}): Promise<perpFetch.OrderDataView>;
|
|
103
|
+
getMarketOrders(client: PerpClient, args: {
|
|
104
|
+
ticker: string;
|
|
105
|
+
basePriceUsd?: bigint | number;
|
|
106
|
+
lpType?: string;
|
|
107
|
+
} & perpFetch.PageOpts): Promise<{
|
|
108
|
+
orders: perpFetch.OrderDataView[];
|
|
109
|
+
nextCursor?: bigint;
|
|
110
|
+
}>;
|
|
111
|
+
getMarketPositions(client: PerpClient, args: {
|
|
112
|
+
ticker: string;
|
|
113
|
+
basePriceUsd: bigint | number;
|
|
114
|
+
collateralPriceUsd?: bigint | number;
|
|
115
|
+
lpType?: string;
|
|
116
|
+
} & perpFetch.PageOpts): Promise<{
|
|
117
|
+
positions: perpFetch.PositionDataView[];
|
|
118
|
+
nextCursor?: bigint;
|
|
119
|
+
}>;
|
|
120
|
+
getAccountPositions(client: PerpClient, args: {
|
|
121
|
+
ticker: string;
|
|
122
|
+
accountObjectAddress: string;
|
|
123
|
+
basePriceUsd: bigint | number;
|
|
124
|
+
collateralPriceUsd?: bigint | number;
|
|
125
|
+
lpType?: string;
|
|
126
|
+
}): Promise<perpFetch.PositionDataView[]>;
|
|
127
|
+
getAccountOrders(client: PerpClient, args: {
|
|
128
|
+
ticker: string;
|
|
129
|
+
accountObjectAddress: string;
|
|
130
|
+
basePriceUsd?: bigint | number;
|
|
131
|
+
lpType?: string;
|
|
132
|
+
}): Promise<perpFetch.OrderDataView[]>;
|
|
133
|
+
getRedeemRequests(client: PerpClient, args?: {
|
|
134
|
+
lpType?: string;
|
|
135
|
+
} & perpFetch.PageOpts): Promise<{
|
|
136
|
+
requests: perpFetch.RedeemRequestDataView[];
|
|
137
|
+
nextCursor?: bigint;
|
|
138
|
+
}>;
|
|
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: {
|
|
146
|
+
evmDestinationChain: number;
|
|
147
|
+
amount: bigint | number;
|
|
148
|
+
creditType?: string;
|
|
149
|
+
}): Promise<perpFetch.BridgeFeeView>;
|
|
150
|
+
openPythSponsorFund: typeof perpTx.openPythSponsorFund;
|
|
151
|
+
PythCache: typeof perpTx.PythCache;
|
|
152
|
+
refreshOraclePrices: typeof perpTx.refreshOraclePrices;
|
|
153
|
+
reimbursePythSponsor: typeof perpTx.reimbursePythSponsor;
|
|
154
|
+
updatePythPrices: typeof perpTx.updatePythPrices;
|
|
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: {
|
|
187
|
+
tokenType: string;
|
|
188
|
+
lpType?: string;
|
|
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;
|
|
209
|
+
};
|
|
210
|
+
declare const predictOps: {
|
|
211
|
+
base64UrlNoPadEncode(bytes: Uint8Array): string;
|
|
212
|
+
base64UrlNoPadDecode(value: string): Uint8Array;
|
|
213
|
+
generateGiftSeed(): Uint8Array;
|
|
214
|
+
encodeGiftUrl(seed: Uint8Array, parts?: predGift.GiftUrlParts): string;
|
|
215
|
+
parseGiftUrl(url: string): {
|
|
216
|
+
seed: Uint8Array;
|
|
217
|
+
};
|
|
218
|
+
deriveGiftKeypair(seed: Uint8Array): import("@mysten/sui/keypairs/ed25519").Ed25519Keypair;
|
|
219
|
+
buildGiftClaimMessage(giftId: string, sender: string): Uint8Array;
|
|
220
|
+
signGiftClaim(giftKeypair: import("@mysten/sui/keypairs/ed25519").Ed25519Keypair, giftId: string, sender: string): Promise<Uint8Array>;
|
|
221
|
+
deriveGiftAddress(client: PredictClient, pubkey: Uint8Array, params?: predGift.GiftBaseParams): string;
|
|
222
|
+
createGift(client: PredictClient, tx: Transaction, params: predGift.CreateGiftParams): Transaction;
|
|
223
|
+
claimShare(client: PredictClient, tx: Transaction, params: predGift.ClaimShareParams): Transaction;
|
|
224
|
+
deleteGift(client: PredictClient, tx: Transaction, params: predGift.DeleteGiftParams): Transaction;
|
|
225
|
+
getGift(client: PredictClient, params: predGift.GiftBaseParams & {
|
|
226
|
+
giftId: string;
|
|
227
|
+
}): Promise<predGift.GiftView>;
|
|
228
|
+
getCreatorGiftIds(client: PredictClient, params: predGift.GiftBaseParams & {
|
|
229
|
+
creator: string;
|
|
230
|
+
}): Promise<string[]>;
|
|
231
|
+
getCreatorGiftCount(client: PredictClient, params: predGift.GiftBaseParams & {
|
|
232
|
+
creator: string;
|
|
233
|
+
}): Promise<bigint>;
|
|
234
|
+
getGiftControllerAddress(client: PredictClient, params?: predGift.GiftBaseParams): Promise<string>;
|
|
235
|
+
getGiftConfigPaused(client: PredictClient, params?: predGift.GiftBaseParams): Promise<boolean>;
|
|
236
|
+
getGiftHasClaimed(client: PredictClient, params: predGift.GiftBaseParams & {
|
|
237
|
+
giftId: string;
|
|
238
|
+
addr: string;
|
|
239
|
+
}): Promise<boolean>;
|
|
240
|
+
buildCreateGiftFlow(client: PredictClient, tx: Transaction, params: Omit<predGift.CreateGiftParams, "pubkey">): predGift.BuildCreateGiftFlowResult;
|
|
241
|
+
buildClaimShareFlow(client: PredictClient, tx: Transaction, params: predGift.BuildClaimShareFlowParams): Promise<predGift.BuildClaimShareFlowResult>;
|
|
242
|
+
extractReturnBytes(result: any, commandIndex?: number, returnIndex?: number): Uint8Array;
|
|
243
|
+
getRegistry(client: PredictClient, params?: predFetch.ViewBaseParams): Promise<import("./prediction/types.ts").RegistryView>;
|
|
244
|
+
getOrder(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
245
|
+
orderId: bigint | number | string;
|
|
246
|
+
}): Promise<import("./prediction/types.ts").OrderView>;
|
|
247
|
+
getPosition(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
248
|
+
positionId: bigint | number | string;
|
|
249
|
+
}): Promise<import("./prediction/types.ts").PositionView>;
|
|
250
|
+
getMarketById(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
251
|
+
marketId: import("./prediction/types.ts").MarketIdInput;
|
|
252
|
+
}): Promise<import("./prediction/types.ts").MarketView>;
|
|
253
|
+
getMarketByKey(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
254
|
+
marketKey: bigint | number | string;
|
|
255
|
+
}): Promise<import("./prediction/types.ts").MarketView>;
|
|
256
|
+
getMarketExposure(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
257
|
+
marketId: import("./prediction/types.ts").MarketIdInput;
|
|
258
|
+
}): Promise<import("./prediction/types.ts").MarketExposure>;
|
|
259
|
+
getMarketExposureByKey(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
260
|
+
marketKey: bigint | number | string;
|
|
261
|
+
}): Promise<import("./prediction/types.ts").MarketExposure>;
|
|
262
|
+
getOrderCursor(client: PredictClient, params?: predFetch.ViewBaseParams): Promise<import("./prediction/types.ts").CursorView>;
|
|
263
|
+
getPositionCursor(client: PredictClient, params?: predFetch.ViewBaseParams): Promise<import("./prediction/types.ts").CursorView>;
|
|
264
|
+
getUnresolvedMarketCursor(client: PredictClient, params?: predFetch.ViewBaseParams): Promise<import("./prediction/types.ts").CursorView>;
|
|
265
|
+
getResolvedMarketCursor(client: PredictClient, params?: predFetch.ViewBaseParams): Promise<import("./prediction/types.ts").CursorView>;
|
|
266
|
+
getAccountIds(client: PredictClient, params: predFetch.GetAccountIdsParams): Promise<string[]>;
|
|
267
|
+
getAccountData(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
268
|
+
accountId: string;
|
|
269
|
+
}): Promise<import("./prediction/types.ts").AccountDataView>;
|
|
270
|
+
getAccountOrderIds(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
271
|
+
accountId: string;
|
|
272
|
+
marketKey: bigint | number | string;
|
|
273
|
+
}): Promise<bigint[]>;
|
|
274
|
+
getAccountPositionIds(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
275
|
+
accountId: string;
|
|
276
|
+
marketKey: bigint | number | string;
|
|
277
|
+
}): Promise<bigint[]>;
|
|
278
|
+
getAccountOrderIdsByMarketId(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
279
|
+
accountId: string;
|
|
280
|
+
marketId: import("./prediction/types.ts").MarketIdInput;
|
|
281
|
+
}): Promise<bigint[]>;
|
|
282
|
+
getAccountPositionIdsByMarketId(client: PredictClient, params: predFetch.ViewBaseParams & {
|
|
283
|
+
accountId: string;
|
|
284
|
+
marketId: import("./prediction/types.ts").MarketIdInput;
|
|
285
|
+
}): Promise<bigint[]>;
|
|
286
|
+
isKeeper(client: PredictClient, params: {
|
|
287
|
+
packageId?: string;
|
|
288
|
+
globalConfig?: string;
|
|
289
|
+
keeper: string;
|
|
290
|
+
}): Promise<boolean>;
|
|
291
|
+
getKeeperAddresses(client: PredictClient, params?: {
|
|
292
|
+
packageId?: string;
|
|
293
|
+
globalConfig?: string;
|
|
294
|
+
}): Promise<string[]>;
|
|
295
|
+
getAllowedVersions(client: PredictClient, params?: {
|
|
296
|
+
packageId?: string;
|
|
297
|
+
globalConfig?: string;
|
|
298
|
+
}): Promise<number[]>;
|
|
299
|
+
isPredictionProtocolAssetAllowed(client: PredictClient, params?: {
|
|
300
|
+
accountPackageId?: string;
|
|
301
|
+
accountRegistry?: string;
|
|
302
|
+
predictionPackageId?: string;
|
|
303
|
+
coinType?: string;
|
|
304
|
+
}): Promise<boolean>;
|
|
305
|
+
selectionArg(client: PredictClient, tx: Transaction, selection: import("./prediction/types.ts").Selection | import("@mysten/sui/transactions").TransactionArgument, packageId?: string): import("@mysten/sui/transactions").TransactionArgument;
|
|
306
|
+
outcomeArg(client: PredictClient, tx: Transaction, outcome: import("./prediction/types.ts").Outcome | import("@mysten/sui/transactions").TransactionArgument, packageId?: string): import("@mysten/sui/transactions").TransactionArgument;
|
|
307
|
+
placeOrder(client: PredictClient, tx: Transaction, params: predOps.PlaceOrderParams): Transaction;
|
|
308
|
+
selfCancelOrder(client: PredictClient, tx: Transaction, params: predOps.SelfCancelOrderParams): Transaction;
|
|
309
|
+
claim(client: PredictClient, tx: Transaction, params: predOps.ClaimParams): Transaction;
|
|
310
|
+
batchClaim(client: PredictClient, tx: Transaction, params: predOps.BatchClaimParams): Transaction;
|
|
311
|
+
requestClose(client: PredictClient, tx: Transaction, params: predOps.RequestCloseParams): Transaction;
|
|
312
|
+
requestPartialClose(client: PredictClient, tx: Transaction, params: predOps.RequestPartialCloseParams): Transaction;
|
|
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;
|
|
316
|
+
fillOrder(client: PredictClient, tx: Transaction, params: predOps.FillOrderParams): Transaction;
|
|
317
|
+
cancelOrder(client: PredictClient, tx: Transaction, params: predOps.CancelOrderParams): Transaction;
|
|
318
|
+
confirmClose(client: PredictClient, tx: Transaction, params: predOps.ConfirmCloseParams): Transaction;
|
|
319
|
+
cancelClose(client: PredictClient, tx: Transaction, params: predOps.CancelCloseParams): Transaction;
|
|
320
|
+
forceClaim(client: PredictClient, tx: Transaction, params: predOps.ForceClaimParams): Transaction;
|
|
321
|
+
batchForceClaim(client: PredictClient, tx: Transaction, params: predOps.BatchForceClaimParams): Transaction;
|
|
322
|
+
buildBatchForceClaimTransactions(client: PredictClient, params: predOps.BuildBatchForceClaimTransactionsParams): Transaction[];
|
|
323
|
+
resolveMarket(client: PredictClient, tx: Transaction, params: predOps.ResolveMarketParams): Transaction;
|
|
324
|
+
adminPlaceOrderFor(client: PredictClient, tx: Transaction, params: predOps.AdminPlaceOrderForParams): Transaction;
|
|
325
|
+
createMarketRegistry(client: PredictClient, tx: Transaction, params: predAdmin.CreateMarketRegistryParams): Transaction;
|
|
326
|
+
depositSettlement(client: PredictClient, tx: Transaction, params: predAdmin.DepositSettlementParams): Transaction;
|
|
327
|
+
adminWithdraw(client: PredictClient, tx: Transaction, params: predAdmin.AdminWithdrawParams): Transaction;
|
|
328
|
+
setMinReserve(client: PredictClient, tx: Transaction, params: predAdmin.SetMinReserveParams): Transaction;
|
|
329
|
+
setOrderCancelCooldownMs(client: PredictClient, tx: Transaction, params: predAdmin.SetOrderCancelCooldownParams): Transaction;
|
|
330
|
+
pauseMarket(client: PredictClient, tx: Transaction, params: predAdmin.MarketPauseParams): Transaction;
|
|
331
|
+
unpauseMarket(client: PredictClient, tx: Transaction, params: predAdmin.MarketPauseParams): Transaction;
|
|
332
|
+
addKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
|
|
333
|
+
removeKeeper(client: PredictClient, tx: Transaction, params: predAdmin.KeeperAdminParams): Transaction;
|
|
334
|
+
setDelegatePredictionPermission: typeof setDelegatePredictionPermission;
|
|
335
|
+
whitelistPredictionProtocol: typeof whitelistPredictionProtocol;
|
|
336
|
+
allowPredictionProtocolAsset: typeof allowPredictionProtocolAsset;
|
|
337
|
+
disallowPredictionProtocolAsset: typeof disallowPredictionProtocolAsset;
|
|
338
|
+
};
|
|
339
|
+
/** Account namespace exposed as `client.account` — generic wxa + credit + custody, perp-backed. */
|
|
340
|
+
export type AccountModule = ClientBound<typeof accountOps, PerpClient>;
|
|
341
|
+
/** Perp namespace exposed as `client.perp` — builder/view methods, client pre-bound. */
|
|
342
|
+
export type PerpModule = ClientBound<typeof perpOps, PerpClient>;
|
|
343
|
+
/** Prediction namespace exposed as `client.predict` — builder/view methods, client pre-bound. */
|
|
344
|
+
export type PredictModule = ClientBound<typeof predictOps, PredictClient>;
|
|
345
|
+
/** Per-line network/config override. Falls back to the shared top-level options. */
|
|
346
|
+
type PerpLineOptions = Partial<PerpCreateOptions> & {
|
|
347
|
+
network?: Network;
|
|
348
|
+
};
|
|
349
|
+
type PredictLineOptions = Partial<PredictCreateOptions> & {
|
|
350
|
+
network?: Network;
|
|
351
|
+
};
|
|
352
|
+
export interface ClientCreateOptions {
|
|
353
|
+
/** Default network for both lines (per-line `network` overrides). Default: `"TESTNET"`. */
|
|
354
|
+
network?: Network;
|
|
355
|
+
/** Default gRPC URL for both lines. */
|
|
356
|
+
grpcUrl?: string;
|
|
357
|
+
/** Default `waterx-config` JSON URL for both lines. */
|
|
358
|
+
configUrl?: string;
|
|
359
|
+
/** Memoize the fetched config JSON. */
|
|
360
|
+
cache?: boolean;
|
|
361
|
+
/** Perp-line overrides (network, grpcUrl, configUrl, cache, …). */
|
|
362
|
+
perp?: PerpLineOptions;
|
|
363
|
+
/** Prediction-line overrides (network, grpcUrl, configUrl, cache, settlement, …). */
|
|
364
|
+
predict?: PredictLineOptions;
|
|
365
|
+
}
|
|
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;
|
|
379
|
+
/**
|
|
380
|
+
* Async prediction builder: optional consolidate + `placeOrder`.
|
|
381
|
+
* Uses the perp client for the sweep and the predict client for the bet leg.
|
|
382
|
+
*/
|
|
383
|
+
buildPredictPlaceOrderTx(params: BuildPlaceOrderTxParams): Promise<Transaction>;
|
|
384
|
+
/**
|
|
385
|
+
* Async prediction builder: optional consolidate + `batchClaim`.
|
|
386
|
+
*/
|
|
387
|
+
buildPredictBatchClaimTx(params: BuildBatchClaimTxParams): Promise<Transaction>;
|
|
388
|
+
private constructor();
|
|
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;
|
|
395
|
+
/**
|
|
396
|
+
* Async factory — loads each line's deployment config (from the canonical
|
|
397
|
+
* `waterx-config` JSON) and returns a ready client. Each line can target a
|
|
398
|
+
* different network via `opts.perp.network` / `opts.predict.network`.
|
|
399
|
+
*/
|
|
400
|
+
static create(opts?: ClientCreateOptions): Promise<WaterXClient>;
|
|
401
|
+
}
|
|
402
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Umbrella WaterX SDK client — the main entry point.
|
|
4
|
+
*
|
|
5
|
+
* Exposes three namespaces over the two product-line sub-clients:
|
|
6
|
+
*
|
|
7
|
+
* const client = await WaterXClient.create({ network: "TESTNET" });
|
|
8
|
+
* client.account.createAccount(tx, { alias }); // -> shared waterx_account + funding
|
|
9
|
+
* client.perp.placeOrderRequest(tx, params); // -> perp builder
|
|
10
|
+
* client.predict.placeOrder(tx, params); // -> prediction builder
|
|
11
|
+
*
|
|
12
|
+
* `client.perp` **is** the `PerpClient` instance with the perp builder/view
|
|
13
|
+
* methods grafted on, and `client.predict` **is** the `PredictClient` instance
|
|
14
|
+
* likewise — so signing & execution live on the same object
|
|
15
|
+
* (`client.perp.signAndExecuteTransaction(...)`) right next to the builders.
|
|
16
|
+
* There are no separate `.perpClient` / `.predictClient` accessors.
|
|
17
|
+
*
|
|
18
|
+
* `client.account` is a thin namespace (no own client) bound to the perp
|
|
19
|
+
* sub-client: the perp config carries the shared `waterx_account` registry plus
|
|
20
|
+
* the bridge / native_custody / withdrawal_queue / credit_registry that the
|
|
21
|
+
* credit & custody builders read. `waterx_account` is one shared on-chain object,
|
|
22
|
+
* so an account created here serves both lines — except when the two lines target
|
|
23
|
+
* different networks (`opts.perp.network !== opts.predict.network`), where
|
|
24
|
+
* `client.account` follows the perp line; split-network callers should reach the
|
|
25
|
+
* predict line's generic account builders via the `prediction` namespace directly.
|
|
26
|
+
*
|
|
27
|
+
* Each namespace method forwards to the existing free-function builder with the
|
|
28
|
+
* line's client pre-bound as the first argument; builders are build-only (they
|
|
29
|
+
* return / mutate a `Transaction`), so frontend wallet flows and multi-step Pyth
|
|
30
|
+
* injection keep working.
|
|
31
|
+
*/
|
|
32
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
35
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
36
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
37
|
+
}
|
|
38
|
+
Object.defineProperty(o, k2, desc);
|
|
39
|
+
}) : (function(o, m, k, k2) {
|
|
40
|
+
if (k2 === undefined) k2 = k;
|
|
41
|
+
o[k2] = m[k];
|
|
42
|
+
}));
|
|
43
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
44
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
45
|
+
}) : function(o, v) {
|
|
46
|
+
o["default"] = v;
|
|
47
|
+
});
|
|
48
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
49
|
+
var ownKeys = function(o) {
|
|
50
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
51
|
+
var ar = [];
|
|
52
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
53
|
+
return ar;
|
|
54
|
+
};
|
|
55
|
+
return ownKeys(o);
|
|
56
|
+
};
|
|
57
|
+
return function (mod) {
|
|
58
|
+
if (mod && mod.__esModule) return mod;
|
|
59
|
+
var result = {};
|
|
60
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
61
|
+
__setModuleDefault(result, mod);
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
64
|
+
})();
|
|
65
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.WaterXClient = void 0;
|
|
67
|
+
// Unified account namespace: generic waterx_account framework + funding (credit + custody).
|
|
68
|
+
const accountOps = __importStar(require("./account/index.js"));
|
|
69
|
+
const perpReferral = __importStar(require("./account/referral.js"));
|
|
70
|
+
const client_ts_1 = require("./perp/client.js");
|
|
71
|
+
// Perp builder/view modules (every export takes the client as its first arg).
|
|
72
|
+
const perpFetch = __importStar(require("./perp/fetch.js"));
|
|
73
|
+
const perpTx = __importStar(require("./perp/tx-builders.js"));
|
|
74
|
+
// Perp-only user builders — account/credit/custody are excluded here; they live
|
|
75
|
+
// under `client.account`. trading / order / wlp / staking / referral only.
|
|
76
|
+
const perpOrder = __importStar(require("./perp/user/order.js"));
|
|
77
|
+
const perpStaking = __importStar(require("./perp/user/staking.js"));
|
|
78
|
+
const perpTrading = __importStar(require("./perp/user/trading.js"));
|
|
79
|
+
const perpWlp = __importStar(require("./perp/user/wlp.js"));
|
|
80
|
+
// Prediction-specific account ops (need the prediction package; NOT generic account).
|
|
81
|
+
const account_ts_1 = require("./prediction/account.js");
|
|
82
|
+
const predAdmin = __importStar(require("./prediction/admin.js"));
|
|
83
|
+
const client_ts_2 = require("./prediction/client.js");
|
|
84
|
+
const predFetch = __importStar(require("./prediction/fetch.js"));
|
|
85
|
+
const predGift = __importStar(require("./prediction/gift.js"));
|
|
86
|
+
const predOps = __importStar(require("./prediction/prediction.js"));
|
|
87
|
+
const tx_builders_ts_1 = require("./prediction/tx-builders.js");
|
|
88
|
+
/**
|
|
89
|
+
* Exports from the spread builder/view modules that are NOT client-first — their
|
|
90
|
+
* first argument is not the line client, so they must not become bound facade
|
|
91
|
+
* methods (binding would pass the client where a value is expected). This is the
|
|
92
|
+
* single source of truth shared by the runtime (skip) and the type (`Omit`).
|
|
93
|
+
* Keep in sync by auditing `export function` first-params across the spread modules.
|
|
94
|
+
*/
|
|
95
|
+
const NON_CLIENT_FIRST = [
|
|
96
|
+
"extractReturnBytes",
|
|
97
|
+
// gift.ts — pure crypto / URL helpers (first arg is not PredictClient)
|
|
98
|
+
"base64UrlNoPadEncode",
|
|
99
|
+
"base64UrlNoPadDecode",
|
|
100
|
+
"generateGiftSeed",
|
|
101
|
+
"encodeGiftUrl",
|
|
102
|
+
"parseGiftUrl",
|
|
103
|
+
"deriveGiftKeypair",
|
|
104
|
+
"buildGiftClaimMessage",
|
|
105
|
+
"signGiftClaim",
|
|
106
|
+
];
|
|
107
|
+
const NON_CLIENT_FIRST_SET = new Set(NON_CLIENT_FIRST);
|
|
108
|
+
function bindClient(client, ns) {
|
|
109
|
+
const out = {};
|
|
110
|
+
for (const key of Object.keys(ns)) {
|
|
111
|
+
if (NON_CLIENT_FIRST_SET.has(key))
|
|
112
|
+
continue; // not client-first → not a facade method
|
|
113
|
+
const value = ns[key];
|
|
114
|
+
out[key] =
|
|
115
|
+
typeof value === "function"
|
|
116
|
+
? (...args) => value(client, ...args)
|
|
117
|
+
: value;
|
|
118
|
+
}
|
|
119
|
+
return out;
|
|
120
|
+
}
|
|
121
|
+
// Prediction-specific account ops kept on `client.predict` (generic account ops
|
|
122
|
+
// moved to `client.account`).
|
|
123
|
+
const predAccountSpecific = {
|
|
124
|
+
setDelegatePredictionPermission: account_ts_1.setDelegatePredictionPermission,
|
|
125
|
+
whitelistPredictionProtocol: account_ts_1.whitelistPredictionProtocol,
|
|
126
|
+
allowPredictionProtocolAsset: account_ts_1.allowPredictionProtocolAsset,
|
|
127
|
+
disallowPredictionProtocolAsset: account_ts_1.disallowPredictionProtocolAsset,
|
|
128
|
+
};
|
|
129
|
+
// Frozen, reused for both the runtime binding and the public module types.
|
|
130
|
+
const perpOps = {
|
|
131
|
+
...perpTrading,
|
|
132
|
+
...perpOrder,
|
|
133
|
+
...perpWlp,
|
|
134
|
+
...perpStaking,
|
|
135
|
+
...perpReferral,
|
|
136
|
+
...perpTx,
|
|
137
|
+
...perpFetch,
|
|
138
|
+
};
|
|
139
|
+
const predictOps = { ...predAccountSpecific, ...predAdmin, ...predOps, ...predFetch, ...predGift };
|
|
140
|
+
class WaterXClient {
|
|
141
|
+
/** Shared account namespace (`client.account.createAccount(tx, params)`) — perp-backed. */
|
|
142
|
+
account;
|
|
143
|
+
/**
|
|
144
|
+
* Perp sub-client **with** the perp builders/views grafted on
|
|
145
|
+
* (`client.perp.placeOrderRequest(...)`, `client.perp.signAndExecuteTransaction(...)`).
|
|
146
|
+
*/
|
|
147
|
+
perp;
|
|
148
|
+
/**
|
|
149
|
+
* Prediction sub-client **with** the prediction builders/views grafted on
|
|
150
|
+
* (`client.predict.placeOrder(...)`, `client.predict.signAndExecuteTransaction(...)`).
|
|
151
|
+
*/
|
|
152
|
+
predict;
|
|
153
|
+
/**
|
|
154
|
+
* Async prediction builder: optional consolidate + `placeOrder`.
|
|
155
|
+
* Uses the perp client for the sweep and the predict client for the bet leg.
|
|
156
|
+
*/
|
|
157
|
+
buildPredictPlaceOrderTx(params) {
|
|
158
|
+
return (0, tx_builders_ts_1.buildPlaceOrderTx)(this.perp, this.predict, params);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Async prediction builder: optional consolidate + `batchClaim`.
|
|
162
|
+
*/
|
|
163
|
+
buildPredictBatchClaimTx(params) {
|
|
164
|
+
return (0, tx_builders_ts_1.buildBatchClaimTx)(this.perp, this.predict, params);
|
|
165
|
+
}
|
|
166
|
+
constructor(perpClient, predictClient) {
|
|
167
|
+
// Graft the bound builders onto the sub-client instances. No builder name
|
|
168
|
+
// collides with the client's own (transport/config) methods — enforced by the
|
|
169
|
+
// "graft guard" unit test (disjoint from the prototype chain), not just a
|
|
170
|
+
// comment. The instances stay `instanceof PerpClient` / `PredictClient`, so
|
|
171
|
+
// signing/config methods work.
|
|
172
|
+
this.perp = Object.assign(perpClient, bindClient(perpClient, perpOps));
|
|
173
|
+
this.predict = Object.assign(predictClient, bindClient(predictClient, predictOps));
|
|
174
|
+
this.account = bindClient(perpClient, accountOps);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Combine two pre-built line clients (advanced — full control over each).
|
|
178
|
+
* Note: this grafts the bound builder methods onto the provided client
|
|
179
|
+
* instances in place.
|
|
180
|
+
*/
|
|
181
|
+
static fromClients(perpClient, predictClient) {
|
|
182
|
+
return new WaterXClient(perpClient, predictClient);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Async factory — loads each line's deployment config (from the canonical
|
|
186
|
+
* `waterx-config` JSON) and returns a ready client. Each line can target a
|
|
187
|
+
* different network via `opts.perp.network` / `opts.predict.network`.
|
|
188
|
+
*/
|
|
189
|
+
static async create(opts = {}) {
|
|
190
|
+
const baseNetwork = opts.network ?? "TESTNET";
|
|
191
|
+
const { network: perpNetwork, ...perpRest } = opts.perp ?? {};
|
|
192
|
+
const { network: predictNetwork, ...predictRest } = opts.predict ?? {};
|
|
193
|
+
const resolvedPerpNetwork = perpNetwork ?? baseNetwork;
|
|
194
|
+
const resolvedPredictNetwork = predictNetwork ?? baseNetwork;
|
|
195
|
+
if (resolvedPerpNetwork !== resolvedPredictNetwork) {
|
|
196
|
+
// `client.account` always follows the perp line (see the class header).
|
|
197
|
+
// On a split-network setup a caller reaching for `client.account.*` would
|
|
198
|
+
// silently build against the perp deployment — warn so it isn't a surprise.
|
|
199
|
+
console.warn(`[WaterXClient] split-network: perp=${resolvedPerpNetwork} predict=${resolvedPredictNetwork}. ` +
|
|
200
|
+
`client.account follows the perp line (${resolvedPerpNetwork}); reach the predict line's ` +
|
|
201
|
+
`generic account builders via the prediction namespace directly.`);
|
|
202
|
+
}
|
|
203
|
+
const perpClient = await client_ts_1.PerpClient.create(resolvedPerpNetwork, {
|
|
204
|
+
grpcUrl: opts.grpcUrl,
|
|
205
|
+
configUrl: opts.configUrl,
|
|
206
|
+
cache: opts.cache,
|
|
207
|
+
...perpRest,
|
|
208
|
+
});
|
|
209
|
+
const predictClient = await client_ts_2.PredictClient.create(resolvedPredictNetwork, {
|
|
210
|
+
grpcUrl: opts.grpcUrl,
|
|
211
|
+
configUrl: opts.configUrl,
|
|
212
|
+
cache: opts.cache,
|
|
213
|
+
...predictRest,
|
|
214
|
+
});
|
|
215
|
+
return new WaterXClient(perpClient, predictClient);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
exports.WaterXClient = WaterXClient;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { WaterXConfig } from "../perp/config.ts";
|
|
2
|
+
/** Returns all registered market tickers (e.g. "BTCUSD") from waterx-config. */
|
|
3
|
+
export declare function getMarketTickers(config: WaterXConfig): string[];
|
|
4
|
+
/**
|
|
5
|
+
* Returns WLP pool-token tickers that also have a registered pyth_rule feed —
|
|
6
|
+
* the canonical testnet config keys `pool_tokens` by coin symbol (e.g. `"USD"`)
|
|
7
|
+
* while `pyth_rule.feeds` is keyed by oracle ticker (e.g. `"USDCUSD"`), so a
|
|
8
|
+
* naive `Object.keys(pool_tokens)` blows up at `refreshOraclePrices` for any
|
|
9
|
+
* key without a feed. Filter so the auto-refresh path stays tolerant.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCollateralAssets(config: WaterXConfig): string[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMarketTickers = getMarketTickers;
|
|
4
|
+
exports.getCollateralAssets = getCollateralAssets;
|
|
5
|
+
/** Returns all registered market tickers (e.g. "BTCUSD") from waterx-config. */
|
|
6
|
+
function getMarketTickers(config) {
|
|
7
|
+
return Object.keys(config.packages.waterx_perp.markets);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Returns WLP pool-token tickers that also have a registered pyth_rule feed —
|
|
11
|
+
* the canonical testnet config keys `pool_tokens` by coin symbol (e.g. `"USD"`)
|
|
12
|
+
* while `pyth_rule.feeds` is keyed by oracle ticker (e.g. `"USDCUSD"`), so a
|
|
13
|
+
* naive `Object.keys(pool_tokens)` blows up at `refreshOraclePrices` for any
|
|
14
|
+
* key without a feed. Filter so the auto-refresh path stays tolerant.
|
|
15
|
+
*/
|
|
16
|
+
function getCollateralAssets(config) {
|
|
17
|
+
const feeds = config.packages.pyth_rule?.feeds ?? {};
|
|
18
|
+
return Object.keys(config.packages.wlp.pool_tokens).filter((t) => feeds[t] !== undefined);
|
|
19
|
+
}
|