@waterx/sdk 2.1.0 → 2.3.1-dev.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 +75 -169
- package/dist/src/client.d.ts +52 -2
- package/dist/src/client.js +76 -6
- package/dist/src/config.d.ts +57 -3
- package/dist/src/config.js +10 -4
- package/dist/src/constants.d.ts +6 -0
- package/dist/src/constants.js +6 -0
- package/dist/src/core/waterx-account.d.ts +31 -0
- package/dist/src/core/waterx-account.js +26 -0
- package/dist/src/fetch.d.ts +110 -0
- package/dist/src/fetch.js +149 -4
- package/dist/src/generated/bucket_v2_framework/account.d.ts +5 -5
- package/dist/src/generated/bucket_v2_framework/double.d.ts +77 -77
- package/dist/src/generated/bucket_v2_framework/float.d.ts +73 -73
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +33 -33
- package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +5 -5
- package/dist/src/generated/bucket_v2_framework/linked_table.js +2 -2
- package/dist/src/generated/bucket_v2_framework/sheet.d.ts +57 -57
- package/dist/src/generated/bucket_v2_framework/sheet.js +5 -11
- package/dist/src/generated/native_custody/custody_vault.d.ts +46 -32
- package/dist/src/generated/native_custody/custody_vault.js +19 -10
- package/dist/src/generated/native_custody/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/native_custody/events.js +1 -2
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.d.ts +7 -7
- package/dist/src/generated/pyth_sponsor_rule/pyth_sponsor_rule.js +1 -2
- package/dist/src/generated/utils/index.d.ts +7 -7
- package/dist/src/generated/utils/index.js +9 -6
- package/dist/src/generated/waterx_account/account.d.ts +124 -71
- package/dist/src/generated/waterx_account/account.js +64 -29
- package/dist/src/generated/waterx_account/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/waterx_account/direct_rule.d.ts +5 -5
- package/dist/src/generated/waterx_account/events.d.ts +10 -0
- package/dist/src/generated/waterx_account/events.js +31 -50
- package/dist/src/generated/waterx_constant_rule/constant_rule.d.ts +68 -0
- package/dist/src/generated/waterx_constant_rule/constant_rule.js +59 -0
- package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/waterx_constant_rule/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_constant_rule/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_credit/credit_registry.d.ts +9 -9
- package/dist/src/generated/waterx_credit/credit_registry.js +1 -2
- package/dist/src/generated/waterx_credit/limited_supply.d.ts +17 -17
- package/dist/src/generated/waterx_oracle/aggregator.js +1 -2
- package/dist/src/generated/waterx_oracle/collector.d.ts +17 -17
- package/dist/src/generated/waterx_oracle/collector.js +1 -1
- package/dist/src/generated/waterx_oracle/oracle.d.ts +5 -5
- package/dist/src/generated/waterx_perp/account_data.d.ts +5 -5
- package/dist/src/generated/waterx_perp/account_data.js +1 -2
- package/dist/src/generated/waterx_perp/deps/bucket_v2_framework/sheet.js +1 -3
- package/dist/src/generated/waterx_perp/events.d.ts +181 -181
- package/dist/src/generated/waterx_perp/events.js +87 -173
- package/dist/src/generated/waterx_perp/global_config.d.ts +3 -3
- package/dist/src/generated/waterx_perp/global_config.js +6 -12
- package/dist/src/generated/waterx_perp/keyed_big_vector.d.ts +9 -9
- package/dist/src/generated/waterx_perp/keyed_big_vector.js +1 -2
- package/dist/src/generated/waterx_perp/lp_pool.d.ts +115 -115
- package/dist/src/generated/waterx_perp/lp_pool.js +11 -22
- package/dist/src/generated/waterx_perp/market_config.d.ts +61 -43
- package/dist/src/generated/waterx_perp/market_config.js +29 -22
- package/dist/src/generated/waterx_perp/math.d.ts +7 -7
- package/dist/src/generated/waterx_perp/order_book.d.ts +47 -47
- package/dist/src/generated/waterx_perp/position.d.ts +99 -99
- package/dist/src/generated/waterx_perp/position.js +6 -12
- package/dist/src/generated/waterx_perp/request.d.ts +67 -67
- package/dist/src/generated/waterx_perp/request.js +2 -3
- package/dist/src/generated/waterx_perp/response.d.ts +35 -35
- package/dist/src/generated/waterx_perp/response.js +1 -2
- package/dist/src/generated/waterx_perp/trading.d.ts +303 -179
- package/dist/src/generated/waterx_perp/trading.js +99 -14
- package/dist/src/generated/waterx_perp_view/view.js +5 -10
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +5 -5
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +1 -2
- package/dist/src/generated/waterx_referral/referral_table.d.ts +5 -5
- package/dist/src/generated/waterx_referral/referral_table.js +1 -2
- package/dist/src/generated/waterx_staking/waterx_staking.d.ts +19 -19
- package/dist/src/generated/waterx_staking/waterx_staking.js +10 -20
- package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_supra_rule/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +158 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.js +148 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.d.ts +8 -0
- package/dist/src/generated/withdrawal_queue/deps/bucket_v2_framework/float.js +10 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/withdrawal_queue/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +444 -4
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +417 -4
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.d.ts +214 -74
- package/dist/src/generated/wormhole_bridge/wormhole_bridge.js +158 -29
- package/dist/src/index.d.ts +4 -3
- package/dist/src/index.js +3 -2
- package/dist/src/prediction/account.d.ts +96 -0
- package/dist/src/prediction/account.js +230 -0
- package/dist/src/prediction/admin.d.ts +47 -0
- package/dist/src/prediction/admin.js +105 -0
- package/dist/src/prediction/bcs.d.ts +22 -0
- package/dist/src/prediction/bcs.js +240 -0
- package/dist/src/prediction/client.d.ts +75 -0
- package/dist/src/prediction/client.js +164 -0
- package/dist/src/prediction/config.d.ts +60 -0
- package/dist/src/prediction/config.js +75 -0
- package/dist/src/prediction/constants.d.ts +44 -0
- package/dist/src/prediction/constants.js +46 -0
- package/dist/src/prediction/fetch.d.ts +82 -0
- package/dist/src/prediction/fetch.js +270 -0
- package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +100 -0
- package/dist/src/prediction/generated/bucket_v2_framework/account.js +129 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +382 -0
- package/dist/src/prediction/generated/bucket_v2_framework/double.js +466 -0
- package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +362 -0
- package/dist/src/prediction/generated/bucket_v2_framework/float.js +440 -0
- package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +193 -0
- package/dist/src/prediction/generated/bucket_v2_framework/liability.js +205 -0
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +382 -0
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +344 -0
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +338 -0
- package/dist/src/prediction/generated/utils/index.d.ts +30 -0
- package/dist/src/prediction/generated/utils/index.js +160 -0
- package/dist/src/prediction/generated/waterx_account/account.d.ts +1589 -0
- package/dist/src/prediction/generated/waterx_account/account.js +1758 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +7 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +13 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +7 -0
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +16 -0
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +6 -0
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +19 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +12 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +19 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/table.d.ts +24 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/table.js +31 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +27 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +75 -0
- package/dist/src/prediction/generated/waterx_account/direct_rule.js +78 -0
- package/dist/src/prediction/generated/waterx_account/events.d.ts +33 -0
- package/dist/src/prediction/generated/waterx_account/events.js +137 -0
- package/dist/src/prediction/generated/waterx_account/version.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_account/version.js +8 -0
- package/dist/src/prediction/generated/waterx_prediction/account_data.d.ts +327 -0
- package/dist/src/prediction/generated/waterx_prediction/account_data.js +405 -0
- package/dist/src/prediction/generated/waterx_prediction/admin.d.ts +5 -0
- package/dist/src/prediction/generated/waterx_prediction/admin.js +9 -0
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +60 -0
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +83 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +14 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +31 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
- package/dist/src/prediction/generated/waterx_prediction/events.d.ts +22 -0
- package/dist/src/prediction/generated/waterx_prediction/events.js +179 -0
- package/dist/src/prediction/generated/waterx_prediction/global_config.d.ts +116 -0
- package/dist/src/prediction/generated/waterx_prediction/global_config.js +141 -0
- package/dist/src/prediction/generated/waterx_prediction/order.d.ts +200 -0
- package/dist/src/prediction/generated/waterx_prediction/order.js +284 -0
- package/dist/src/prediction/generated/waterx_prediction/outcome.d.ts +58 -0
- package/dist/src/prediction/generated/waterx_prediction/outcome.js +73 -0
- package/dist/src/prediction/generated/waterx_prediction/position.d.ts +160 -0
- package/dist/src/prediction/generated/waterx_prediction/position.js +214 -0
- package/dist/src/prediction/generated/waterx_prediction/version.d.ts +10 -0
- package/dist/src/prediction/generated/waterx_prediction/version.js +8 -0
- package/dist/src/prediction/generated/waterx_prediction/view.d.ts +353 -0
- package/dist/src/prediction/generated/waterx_prediction/view.js +432 -0
- package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.d.ts +1698 -0
- package/dist/src/prediction/generated/waterx_prediction/waterx_prediction.js +1733 -0
- package/dist/src/prediction/gift-link.d.ts +6 -0
- package/dist/src/prediction/gift-link.js +5 -0
- package/dist/src/prediction/gift.d.ts +223 -0
- package/dist/src/prediction/gift.js +451 -0
- package/dist/src/prediction/index.d.ts +29 -0
- package/dist/src/prediction/index.js +21 -0
- package/dist/src/prediction/prediction.d.ts +104 -0
- package/dist/src/prediction/prediction.js +317 -0
- package/dist/src/prediction/tx-builders.d.ts +44 -0
- package/dist/src/prediction/tx-builders.js +52 -0
- package/dist/src/prediction/types.d.ts +93 -0
- package/dist/src/prediction/types.js +1 -0
- package/dist/src/prediction/user/account.d.ts +2 -0
- package/dist/src/prediction/user/account.js +1 -0
- package/dist/src/prediction/user/admin.d.ts +6 -0
- package/dist/src/prediction/user/admin.js +3 -0
- package/dist/src/prediction/user/gift.d.ts +2 -0
- package/dist/src/prediction/user/gift.js +1 -0
- package/dist/src/prediction/user/index.d.ts +5 -0
- package/dist/src/prediction/user/index.js +3 -0
- package/dist/src/prediction/user/keeper.d.ts +2 -0
- package/dist/src/prediction/user/keeper.js +1 -0
- package/dist/src/prediction/user/order.d.ts +2 -0
- package/dist/src/prediction/user/order.js +1 -0
- package/dist/src/prediction/user/position.d.ts +2 -0
- package/dist/src/prediction/user/position.js +1 -0
- package/dist/src/prediction/utils/bcs.d.ts +1 -0
- package/dist/src/prediction/utils/bcs.js +1 -0
- package/dist/src/prediction/utils/index.d.ts +1 -0
- package/dist/src/prediction/utils/index.js +1 -0
- package/dist/src/prediction/utils.d.ts +30 -0
- package/dist/src/prediction/utils.js +177 -0
- package/dist/src/sdk.d.ts +18 -0
- package/dist/src/sdk.js +17 -0
- package/dist/src/tx-builders.d.ts +54 -0
- package/dist/src/tx-builders.js +141 -0
- package/dist/src/unified-client.d.ts +407 -0
- package/dist/src/unified-client.js +123 -0
- package/dist/src/user/account.d.ts +27 -0
- package/dist/src/user/account.js +34 -8
- package/dist/src/user/credit.d.ts +8 -14
- package/dist/src/user/credit.js +9 -23
- package/dist/src/user/custody.d.ts +4 -18
- package/dist/src/user/custody.js +14 -25
- package/dist/src/utils/consolidate-balance.d.ts +37 -0
- package/dist/src/utils/consolidate-balance.js +89 -0
- package/dist/src/utils/math.d.ts +86 -0
- package/dist/src/utils/math.js +100 -0
- package/dist/src/utils/pyth.d.ts +35 -3
- package/dist/src/utils/pyth.js +145 -14
- package/package.json +129 -34
|
@@ -8,6 +8,10 @@ import * as balance from "./deps/sui/balance.js";
|
|
|
8
8
|
import * as linked_table from "./deps/bucket_v2_framework/linked_table.js";
|
|
9
9
|
import * as vec_set from "./deps/sui/vec_set.js";
|
|
10
10
|
import * as vec_set_1 from "./deps/sui/vec_set.js";
|
|
11
|
+
import * as float from "./deps/bucket_v2_framework/float.js";
|
|
12
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
13
|
+
import * as float_1 from "./deps/bucket_v2_framework/float.js";
|
|
14
|
+
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
11
15
|
const $moduleName = '@waterx/withdrawal-queue::withdrawal_queue';
|
|
12
16
|
export const WithdrawQueue = new MoveStruct({ name: `${$moduleName}::WithdrawQueue`, fields: {
|
|
13
17
|
dummy_field: bcs.bool()
|
|
@@ -18,7 +22,14 @@ export const WormholeRoute = new MoveStruct({ name: `${$moduleName}::WormholeRou
|
|
|
18
22
|
evm_token: bcs.vector(bcs.u8())
|
|
19
23
|
} });
|
|
20
24
|
export const NativeRoute = new MoveStruct({ name: `${$moduleName}::NativeRoute`, fields: {
|
|
21
|
-
asset_type: type_name.TypeName
|
|
25
|
+
asset_type: type_name.TypeName,
|
|
26
|
+
/**
|
|
27
|
+
* User-supplied minimum acceptable `Coin<T>` output (after the burn fee).
|
|
28
|
+
* Snapshotted into `extra_data` at withdraw time and enforced in `execute_native`,
|
|
29
|
+
* so an admin burn-fee change between enqueue and execute cannot silently reprice
|
|
30
|
+
* an already-debited withdrawal (audit M15).
|
|
31
|
+
*/
|
|
32
|
+
min_output: bcs.u64()
|
|
22
33
|
} });
|
|
23
34
|
export const Entry = new MoveStruct({ name: `${$moduleName}::Entry<phantom CREDIT>`, fields: {
|
|
24
35
|
balance: balance.Balance,
|
|
@@ -54,6 +65,37 @@ export const Queue = new MoveStruct({ name: `${$moduleName}::Queue<phantom CREDI
|
|
|
54
65
|
*/
|
|
55
66
|
allowed_versions: vec_set_1.VecSet(bcs.u16())
|
|
56
67
|
} });
|
|
68
|
+
export const BridgeFeeKey = new MoveStruct({ name: `${$moduleName}::BridgeFeeKey`, fields: {
|
|
69
|
+
dummy_field: bcs.bool()
|
|
70
|
+
} });
|
|
71
|
+
export const BridgeFeeConfig = new MoveStruct({ name: `${$moduleName}::BridgeFeeConfig`, fields: {
|
|
72
|
+
default_rate: float.Float,
|
|
73
|
+
chain_rates: vec_map.VecMap(bcs.u16(), float_1.Float)
|
|
74
|
+
} });
|
|
75
|
+
export const BridgeMinFeeKey = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeKey`, fields: {
|
|
76
|
+
dummy_field: bcs.bool()
|
|
77
|
+
} });
|
|
78
|
+
export const BridgeMinFeeConfig = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeConfig`, fields: {
|
|
79
|
+
default_min_fee: bcs.u64(),
|
|
80
|
+
chain_min_fees: vec_map_1.VecMap(bcs.u16(), bcs.u64())
|
|
81
|
+
} });
|
|
82
|
+
export const BridgeFeeUpdated = new MoveStruct({ name: `${$moduleName}::BridgeFeeUpdated<phantom CREDIT>`, fields: {
|
|
83
|
+
/** 1e9-scaled default fee rate now in effect. */
|
|
84
|
+
fee_rate: bcs.u128()
|
|
85
|
+
} });
|
|
86
|
+
export const ChainBridgeFeeUpdated = new MoveStruct({ name: `${$moduleName}::ChainBridgeFeeUpdated<phantom CREDIT>`, fields: {
|
|
87
|
+
evm_destination_chain: bcs.u16(),
|
|
88
|
+
fee_rate: bcs.u128(),
|
|
89
|
+
removed: bcs.bool()
|
|
90
|
+
} });
|
|
91
|
+
export const BridgeMinFeeUpdated = new MoveStruct({ name: `${$moduleName}::BridgeMinFeeUpdated<phantom CREDIT>`, fields: {
|
|
92
|
+
min_fee: bcs.u64()
|
|
93
|
+
} });
|
|
94
|
+
export const ChainBridgeMinFeeUpdated = new MoveStruct({ name: `${$moduleName}::ChainBridgeMinFeeUpdated<phantom CREDIT>`, fields: {
|
|
95
|
+
evm_destination_chain: bcs.u16(),
|
|
96
|
+
min_fee: bcs.u64(),
|
|
97
|
+
removed: bcs.bool()
|
|
98
|
+
} });
|
|
57
99
|
export const Enqueued = new MoveStruct({ name: `${$moduleName}::Enqueued<phantom CREDIT>`, fields: {
|
|
58
100
|
key: bcs.u64(),
|
|
59
101
|
account_id: bcs.Address,
|
|
@@ -66,6 +108,12 @@ export const ExecutedWormhole = new MoveStruct({ name: `${$moduleName}::Executed
|
|
|
66
108
|
evm_destination_chain: bcs.u16(),
|
|
67
109
|
amount: bcs.u64()
|
|
68
110
|
} });
|
|
111
|
+
export const BridgeFeeCharged = new MoveStruct({ name: `${$moduleName}::BridgeFeeCharged<phantom CREDIT>`, fields: {
|
|
112
|
+
key: bcs.u64(),
|
|
113
|
+
evm_destination_chain: bcs.u16(),
|
|
114
|
+
amount: bcs.u64(),
|
|
115
|
+
fee_amount: bcs.u64()
|
|
116
|
+
} });
|
|
69
117
|
export const ExecutedNative = new MoveStruct({ name: `${$moduleName}::ExecutedNative<phantom CREDIT, phantom T>`, fields: {
|
|
70
118
|
key: bcs.u64(),
|
|
71
119
|
recipient: bcs.Address,
|
|
@@ -107,14 +155,22 @@ export function routeWormhole(options) {
|
|
|
107
155
|
}
|
|
108
156
|
/**
|
|
109
157
|
* User helper: encode a Native-bound route as `extra_data` bytes. `T` is the
|
|
110
|
-
* backing asset of the destination `SingleVault<T>`.
|
|
158
|
+
* backing asset of the destination `SingleVault<T>`. `min_output` is the minimum
|
|
159
|
+
* `Coin<T>` the user will accept after the native burn fee; `execute_native`
|
|
160
|
+
* aborts `EOutputBelowMin` if a later fee change would deliver less (audit M15).
|
|
161
|
+
* Pass 0 to opt out.
|
|
111
162
|
*/
|
|
112
163
|
export function routeNative(options) {
|
|
113
164
|
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
165
|
+
const argumentsTypes = [
|
|
166
|
+
'u64'
|
|
167
|
+
];
|
|
168
|
+
const parameterNames = ["minOutput"];
|
|
114
169
|
return (tx) => tx.moveCall({
|
|
115
170
|
package: packageAddress,
|
|
116
171
|
module: 'withdrawal_queue',
|
|
117
172
|
function: 'route_native',
|
|
173
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
118
174
|
typeArguments: options.typeArguments
|
|
119
175
|
});
|
|
120
176
|
}
|
|
@@ -222,6 +278,158 @@ export function removeVersion(options) {
|
|
|
222
278
|
typeArguments: options.typeArguments
|
|
223
279
|
});
|
|
224
280
|
}
|
|
281
|
+
/**
|
|
282
|
+
* Admin: set the **default** bridge-withdrawal fee charged on the
|
|
283
|
+
* `execute_wormhole` exit for every destination chain that has no explicit
|
|
284
|
+
* per-chain override. `fee_rate` is the 1e9-scaled `Float` value (`0` disables;
|
|
285
|
+
* capped at 10% = `MAX_BRIDGE_FEE_RATE_SCALED`, rejected with `EFeeRateAboveCap`
|
|
286
|
+
* above that — audit L4). Stored in a dynamic field on `Queue.id` so it could be
|
|
287
|
+
* introduced as a package upgrade without touching the published `Queue<CREDIT>`
|
|
288
|
+
* layout. Idempotent. Mirrors the `Float`-as-`u128` public-ABI convention used by
|
|
289
|
+
* `native_custody::custody_vault::set_fee_config`.
|
|
290
|
+
*/
|
|
291
|
+
export function setBridgeFee(options) {
|
|
292
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
293
|
+
const argumentsTypes = [
|
|
294
|
+
null,
|
|
295
|
+
null,
|
|
296
|
+
'u128'
|
|
297
|
+
];
|
|
298
|
+
const parameterNames = ["queue", "_", "feeRate"];
|
|
299
|
+
return (tx) => tx.moveCall({
|
|
300
|
+
package: packageAddress,
|
|
301
|
+
module: 'withdrawal_queue',
|
|
302
|
+
function: 'set_bridge_fee',
|
|
303
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
304
|
+
typeArguments: options.typeArguments
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Admin: set (or overwrite) a per-chain bridge-fee override for
|
|
309
|
+
* `evm_destination_chain`. Takes precedence over `default_rate` for wormhole exits
|
|
310
|
+
* to that chain. Same `Float`-as-`u128` rate convention and 10% `EFeeRateAboveCap`
|
|
311
|
+
* ceiling as `set_bridge_fee`. To make a chain fee-free while the default is
|
|
312
|
+
* non-zero, set its override to `0` (an override of `0` is distinct from "no
|
|
313
|
+
* override" — the latter falls back to the default). Use `unset_chain_bridge_fee`
|
|
314
|
+
* to drop back to default.
|
|
315
|
+
*/
|
|
316
|
+
export function setChainBridgeFee(options) {
|
|
317
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
318
|
+
const argumentsTypes = [
|
|
319
|
+
null,
|
|
320
|
+
null,
|
|
321
|
+
'u16',
|
|
322
|
+
'u128'
|
|
323
|
+
];
|
|
324
|
+
const parameterNames = ["queue", "_", "evmDestinationChain", "feeRate"];
|
|
325
|
+
return (tx) => tx.moveCall({
|
|
326
|
+
package: packageAddress,
|
|
327
|
+
module: 'withdrawal_queue',
|
|
328
|
+
function: 'set_chain_bridge_fee',
|
|
329
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
330
|
+
typeArguments: options.typeArguments
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Admin: drop a per-chain override so `evm_destination_chain` falls back to
|
|
335
|
+
* `default_rate`. Always emits `ChainBridgeFeeUpdated` (audit L3) with `removed`
|
|
336
|
+
* reflecting whether an override was actually present and `fee_rate` set to the
|
|
337
|
+
* resulting **effective** rate for the chain (audit L2) — i.e. the default after a
|
|
338
|
+
* real removal, so indexers don't have to cross-reference
|
|
339
|
+
* `bridge_default_fee_rate`. Functionally a no-op when no override existed.
|
|
340
|
+
*/
|
|
341
|
+
export function unsetChainBridgeFee(options) {
|
|
342
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
343
|
+
const argumentsTypes = [
|
|
344
|
+
null,
|
|
345
|
+
null,
|
|
346
|
+
'u16'
|
|
347
|
+
];
|
|
348
|
+
const parameterNames = ["queue", "_", "evmDestinationChain"];
|
|
349
|
+
return (tx) => tx.moveCall({
|
|
350
|
+
package: packageAddress,
|
|
351
|
+
module: 'withdrawal_queue',
|
|
352
|
+
function: 'unset_chain_bridge_fee',
|
|
353
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
354
|
+
typeArguments: options.typeArguments
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Admin: set the **default** minimum-fee floor (absolute CREDIT units) charged on
|
|
359
|
+
* the `execute_wormhole` exit for every destination chain that has no explicit
|
|
360
|
+
* per-chain min-fee override. The charged fee is
|
|
361
|
+
* `max(ceil(rate * amount), min_fee)`, so a non-zero floor with a zero rate is a
|
|
362
|
+
* flat per-exit fee. `0` disables the floor. **No cap** (unlike the rate's 10%
|
|
363
|
+
* `MAX_BRIDGE_FEE_RATE_SCALED`): the floor is an absolute amount, so on small
|
|
364
|
+
* withdrawals it can exceed 10% of the amount by design — and if it meets/exceeds
|
|
365
|
+
* the entry amount, `execute_wormhole`'s net-zero guard aborts
|
|
366
|
+
* `EFeeConsumesEntireAmount` (recoverable via `cancel_entry`). Idempotent.
|
|
367
|
+
*/
|
|
368
|
+
export function setBridgeMinFee(options) {
|
|
369
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
370
|
+
const argumentsTypes = [
|
|
371
|
+
null,
|
|
372
|
+
null,
|
|
373
|
+
'u64'
|
|
374
|
+
];
|
|
375
|
+
const parameterNames = ["queue", "_", "minFee"];
|
|
376
|
+
return (tx) => tx.moveCall({
|
|
377
|
+
package: packageAddress,
|
|
378
|
+
module: 'withdrawal_queue',
|
|
379
|
+
function: 'set_bridge_min_fee',
|
|
380
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
381
|
+
typeArguments: options.typeArguments
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Admin: set (or overwrite) a per-chain minimum-fee-floor override for
|
|
386
|
+
* `evm_destination_chain`. Takes precedence over `default_min_fee` for wormhole
|
|
387
|
+
* exits to that chain — on an axis independent of the rate override. Set its
|
|
388
|
+
* override to `0` to exempt a chain from the floor while `default_min_fee` still
|
|
389
|
+
* floors others (distinct from "no override", which falls back to the default).
|
|
390
|
+
* Use `unset_chain_bridge_min_fee` to drop back to the default. Same no-cap
|
|
391
|
+
* semantics as `set_bridge_min_fee`.
|
|
392
|
+
*/
|
|
393
|
+
export function setChainBridgeMinFee(options) {
|
|
394
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
395
|
+
const argumentsTypes = [
|
|
396
|
+
null,
|
|
397
|
+
null,
|
|
398
|
+
'u16',
|
|
399
|
+
'u64'
|
|
400
|
+
];
|
|
401
|
+
const parameterNames = ["queue", "_", "evmDestinationChain", "minFee"];
|
|
402
|
+
return (tx) => tx.moveCall({
|
|
403
|
+
package: packageAddress,
|
|
404
|
+
module: 'withdrawal_queue',
|
|
405
|
+
function: 'set_chain_bridge_min_fee',
|
|
406
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
407
|
+
typeArguments: options.typeArguments
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Admin: drop a per-chain min-fee override so `evm_destination_chain` falls back
|
|
412
|
+
* to `default_min_fee`. Always emits `ChainBridgeMinFeeUpdated` with `removed`
|
|
413
|
+
* reflecting whether an override was actually present and `min_fee` set to the
|
|
414
|
+
* resulting **effective** floor for the chain (the default after a real removal).
|
|
415
|
+
* Functionally a no-op when no override existed.
|
|
416
|
+
*/
|
|
417
|
+
export function unsetChainBridgeMinFee(options) {
|
|
418
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
419
|
+
const argumentsTypes = [
|
|
420
|
+
null,
|
|
421
|
+
null,
|
|
422
|
+
'u16'
|
|
423
|
+
];
|
|
424
|
+
const parameterNames = ["queue", "_", "evmDestinationChain"];
|
|
425
|
+
return (tx) => tx.moveCall({
|
|
426
|
+
package: packageAddress,
|
|
427
|
+
module: 'withdrawal_queue',
|
|
428
|
+
function: 'unset_chain_bridge_min_fee',
|
|
429
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
430
|
+
typeArguments: options.typeArguments
|
|
431
|
+
});
|
|
432
|
+
}
|
|
225
433
|
/**
|
|
226
434
|
* Refund a parked entry's `Balance<CREDIT>` back to the **originating wxa
|
|
227
435
|
* account** when the entry can no longer be executed — e.g. the `extra_data` body
|
|
@@ -310,8 +518,8 @@ export function executeWormhole(options) {
|
|
|
310
518
|
});
|
|
311
519
|
}
|
|
312
520
|
/**
|
|
313
|
-
* Execute a queued entry via `native_custody::custody_vault::burn<T>`.
|
|
314
|
-
*
|
|
521
|
+
* Execute a queued entry via `native_custody::custody_vault::burn<T>`. Decodes the
|
|
522
|
+
* native route, verifying its `asset_type` matches `T` — if `T` was not the
|
|
315
523
|
* asset_type the user specified, aborts with `ERouteMismatch`.
|
|
316
524
|
*/
|
|
317
525
|
export function executeNative(options) {
|
|
@@ -478,3 +686,208 @@ export function routeTag(options) {
|
|
|
478
686
|
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
479
687
|
});
|
|
480
688
|
}
|
|
689
|
+
/**
|
|
690
|
+
* The **effective** bridge-fee rate for `evm_destination_chain` as a 1e9-scaled
|
|
691
|
+
* `u128`: the per-chain override if one is set, else the default rate, else `0`
|
|
692
|
+
* when no fee config exists. Mirrors the `Float`-as-`u128` ABI convention.
|
|
693
|
+
*/
|
|
694
|
+
export function bridgeFeeRate(options) {
|
|
695
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
696
|
+
const argumentsTypes = [
|
|
697
|
+
null,
|
|
698
|
+
'u16'
|
|
699
|
+
];
|
|
700
|
+
const parameterNames = ["queue", "evmDestinationChain"];
|
|
701
|
+
return (tx) => tx.moveCall({
|
|
702
|
+
package: packageAddress,
|
|
703
|
+
module: 'withdrawal_queue',
|
|
704
|
+
function: 'bridge_fee_rate',
|
|
705
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
706
|
+
typeArguments: options.typeArguments
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* The configured **default** rate (all-chains-without-override) as a 1e9-scaled
|
|
711
|
+
* `u128`; `0` when no fee config exists.
|
|
712
|
+
*/
|
|
713
|
+
export function bridgeDefaultFeeRate(options) {
|
|
714
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
715
|
+
const argumentsTypes = [
|
|
716
|
+
null
|
|
717
|
+
];
|
|
718
|
+
const parameterNames = ["queue"];
|
|
719
|
+
return (tx) => tx.moveCall({
|
|
720
|
+
package: packageAddress,
|
|
721
|
+
module: 'withdrawal_queue',
|
|
722
|
+
function: 'bridge_default_fee_rate',
|
|
723
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
724
|
+
typeArguments: options.typeArguments
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Whether `evm_destination_chain` has an explicit per-chain override (distinct
|
|
729
|
+
* from falling back to the default).
|
|
730
|
+
*/
|
|
731
|
+
export function hasChainBridgeFee(options) {
|
|
732
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
733
|
+
const argumentsTypes = [
|
|
734
|
+
null,
|
|
735
|
+
'u16'
|
|
736
|
+
];
|
|
737
|
+
const parameterNames = ["queue", "evmDestinationChain"];
|
|
738
|
+
return (tx) => tx.moveCall({
|
|
739
|
+
package: packageAddress,
|
|
740
|
+
module: 'withdrawal_queue',
|
|
741
|
+
function: 'has_chain_bridge_fee',
|
|
742
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
743
|
+
typeArguments: options.typeArguments
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* The bridge fee that would be charged on a wormhole exit of `amount` CREDIT to
|
|
748
|
+
* `evm_destination_chain` —
|
|
749
|
+
* `max(ceil(effective_rate * amount), effective_min_fee)`, or `0` when both the
|
|
750
|
+
* effective rate and floor are zero (and always `0` on `amount == 0`). NOTE: this
|
|
751
|
+
* is the _raw_ fee; it can equal or exceed `amount` (`ceil` rounding on a 1-unit
|
|
752
|
+
* dust entry, or a min-fee floor larger than the entry), in which case
|
|
753
|
+
* `execute_wormhole` would abort the net-zero guard. SDKs surfacing an "estimated
|
|
754
|
+
* fee" should gate on `would_execute_wormhole` (audit L1).
|
|
755
|
+
*/
|
|
756
|
+
export function bridgeFeeAmount(options) {
|
|
757
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
758
|
+
const argumentsTypes = [
|
|
759
|
+
null,
|
|
760
|
+
'u16',
|
|
761
|
+
'u64'
|
|
762
|
+
];
|
|
763
|
+
const parameterNames = ["queue", "evmDestinationChain", "amount"];
|
|
764
|
+
return (tx) => tx.moveCall({
|
|
765
|
+
package: packageAddress,
|
|
766
|
+
module: 'withdrawal_queue',
|
|
767
|
+
function: 'bridge_fee_amount',
|
|
768
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
769
|
+
typeArguments: options.typeArguments
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Whether `execute_wormhole` would clear the net-zero guard for an exit of
|
|
774
|
+
* `amount` to `evm_destination_chain` — i.e. a strictly positive amount remains
|
|
775
|
+
* after the fee. `false` ⇒ `execute_wormhole` would abort
|
|
776
|
+
* `EFeeConsumesEntireAmount` (and `amount == 0` is also `false`). SDKs should gate
|
|
777
|
+
* "estimated fee" UI on this rather than `bridge_fee_amount` alone (audit L1).
|
|
778
|
+
*/
|
|
779
|
+
export function wouldExecuteWormhole(options) {
|
|
780
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
781
|
+
const argumentsTypes = [
|
|
782
|
+
null,
|
|
783
|
+
'u16',
|
|
784
|
+
'u64'
|
|
785
|
+
];
|
|
786
|
+
const parameterNames = ["queue", "evmDestinationChain", "amount"];
|
|
787
|
+
return (tx) => tx.moveCall({
|
|
788
|
+
package: packageAddress,
|
|
789
|
+
module: 'withdrawal_queue',
|
|
790
|
+
function: 'would_execute_wormhole',
|
|
791
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
792
|
+
typeArguments: options.typeArguments
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Enumerate the per-chain overrides as parallel vectors of
|
|
797
|
+
* `(evm_destination_chain, 1e9-scaled rate)`, in insertion order. Empty when no
|
|
798
|
+
* overrides are set (or no fee config exists). The default rate is separate — see
|
|
799
|
+
* `bridge_default_fee_rate` (audit N1). Lets off-chain config tooling discover
|
|
800
|
+
* which chains carry overrides without probing every chain id.
|
|
801
|
+
*/
|
|
802
|
+
export function bridgeChainRates(options) {
|
|
803
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
804
|
+
const argumentsTypes = [
|
|
805
|
+
null
|
|
806
|
+
];
|
|
807
|
+
const parameterNames = ["queue"];
|
|
808
|
+
return (tx) => tx.moveCall({
|
|
809
|
+
package: packageAddress,
|
|
810
|
+
module: 'withdrawal_queue',
|
|
811
|
+
function: 'bridge_chain_rates',
|
|
812
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
813
|
+
typeArguments: options.typeArguments
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* The **effective** minimum-fee floor (absolute CREDIT units) for
|
|
818
|
+
* `evm_destination_chain`: the per-chain override if one is set, else the default
|
|
819
|
+
* floor, else `0` when no fee config exists.
|
|
820
|
+
*/
|
|
821
|
+
export function bridgeMinFee(options) {
|
|
822
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
823
|
+
const argumentsTypes = [
|
|
824
|
+
null,
|
|
825
|
+
'u16'
|
|
826
|
+
];
|
|
827
|
+
const parameterNames = ["queue", "evmDestinationChain"];
|
|
828
|
+
return (tx) => tx.moveCall({
|
|
829
|
+
package: packageAddress,
|
|
830
|
+
module: 'withdrawal_queue',
|
|
831
|
+
function: 'bridge_min_fee',
|
|
832
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
833
|
+
typeArguments: options.typeArguments
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* The configured **default** minimum-fee floor (all-chains-without-override) in
|
|
838
|
+
* CREDIT units; `0` when no fee config exists.
|
|
839
|
+
*/
|
|
840
|
+
export function bridgeDefaultMinFee(options) {
|
|
841
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
842
|
+
const argumentsTypes = [
|
|
843
|
+
null
|
|
844
|
+
];
|
|
845
|
+
const parameterNames = ["queue"];
|
|
846
|
+
return (tx) => tx.moveCall({
|
|
847
|
+
package: packageAddress,
|
|
848
|
+
module: 'withdrawal_queue',
|
|
849
|
+
function: 'bridge_default_min_fee',
|
|
850
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
851
|
+
typeArguments: options.typeArguments
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Whether `evm_destination_chain` has an explicit per-chain min-fee override
|
|
856
|
+
* (distinct from falling back to the default floor).
|
|
857
|
+
*/
|
|
858
|
+
export function hasChainBridgeMinFee(options) {
|
|
859
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
860
|
+
const argumentsTypes = [
|
|
861
|
+
null,
|
|
862
|
+
'u16'
|
|
863
|
+
];
|
|
864
|
+
const parameterNames = ["queue", "evmDestinationChain"];
|
|
865
|
+
return (tx) => tx.moveCall({
|
|
866
|
+
package: packageAddress,
|
|
867
|
+
module: 'withdrawal_queue',
|
|
868
|
+
function: 'has_chain_bridge_min_fee',
|
|
869
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
870
|
+
typeArguments: options.typeArguments
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Enumerate the per-chain min-fee overrides as parallel vectors of
|
|
875
|
+
* `(evm_destination_chain, min_fee)`, in insertion order. Empty when none are set
|
|
876
|
+
* (or no fee config exists). The default floor is separate — see
|
|
877
|
+
* `bridge_default_min_fee`. Lets off-chain config tooling discover which chains
|
|
878
|
+
* carry min-fee overrides without probing every chain id.
|
|
879
|
+
*/
|
|
880
|
+
export function bridgeChainMinFees(options) {
|
|
881
|
+
const packageAddress = options.package ?? '@waterx/withdrawal-queue';
|
|
882
|
+
const argumentsTypes = [
|
|
883
|
+
null
|
|
884
|
+
];
|
|
885
|
+
const parameterNames = ["queue"];
|
|
886
|
+
return (tx) => tx.moveCall({
|
|
887
|
+
package: packageAddress,
|
|
888
|
+
module: 'withdrawal_queue',
|
|
889
|
+
function: 'bridge_chain_min_fees',
|
|
890
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
891
|
+
typeArguments: options.typeArguments
|
|
892
|
+
});
|
|
893
|
+
}
|