@waterx/sdk 2.4.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -21
- package/dist/src/{utils → account}/account-request.d.ts +2 -2
- package/dist/src/{user → account}/account.d.ts +23 -21
- package/dist/src/{user → account}/account.js +5 -5
- package/dist/src/account/client.d.ts +42 -0
- package/dist/src/account/client.js +17 -0
- package/dist/src/account/config.d.ts +151 -0
- package/dist/src/account/config.js +8 -0
- package/dist/src/account/constants.d.ts +5 -0
- package/dist/src/account/constants.js +5 -0
- package/dist/src/account/fetch/referral.d.ts +15 -0
- package/dist/src/account/fetch/referral.js +51 -0
- package/dist/src/account/fetch/simulate.d.ts +34 -0
- package/dist/src/account/fetch/simulate.js +43 -0
- package/dist/src/{utils/consolidate-balance.d.ts → account/funding/balance.d.ts} +3 -8
- package/dist/src/{utils/consolidate-balance.js → account/funding/balance.js} +6 -1
- package/dist/src/account/funding/consolidate.d.ts +46 -0
- package/dist/src/account/funding/consolidate.js +137 -0
- package/dist/src/{user → account/funding}/credit.d.ts +10 -10
- package/dist/src/{user → account/funding}/credit.js +6 -6
- package/dist/src/{user → account/funding}/custody.d.ts +4 -4
- package/dist/src/{user → account/funding}/custody.js +2 -2
- package/dist/src/{utils → account/funding}/wormhole.d.ts +4 -4
- package/dist/src/{utils → account/funding}/wormhole.js +1 -1
- package/dist/src/account/index.d.ts +29 -0
- package/dist/src/account/index.js +29 -0
- package/dist/src/{user → account}/referral.d.ts +3 -3
- package/dist/src/{user → account}/referral.js +1 -1
- package/dist/src/base-client.d.ts +74 -0
- package/dist/src/base-client.js +97 -0
- package/dist/src/constants.d.ts +4 -46
- package/dist/src/constants.js +8 -52
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +0 -26
- package/dist/src/generated/bucket_v2_framework/liability.js +0 -28
- package/dist/src/generated/waterx_account/account.d.ts +50 -15
- package/dist/src/generated/waterx_account/account.js +51 -15
- package/dist/src/generated/waterx_oracle/oracle.d.ts +7 -1
- package/dist/src/generated/waterx_oracle/oracle.js +7 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.d.ts +19 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.d.ts +3 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/sui/balance.d.ts +3 -1
- package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.d.ts +6 -1
- package/dist/src/generated/waterx_prediction/events.d.ts +288 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/events.js +39 -0
- package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.d.ts +6 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/order.d.ts +34 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/position.d.ts +16 -1
- package/dist/src/{prediction/generated → generated}/waterx_prediction/view.d.ts +69 -4
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.d.ts +162 -2
- package/dist/src/{prediction/generated → generated}/waterx_prediction/waterx_prediction.js +99 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.d.ts +102 -0
- package/dist/src/generated/waterx_pyth_rule/pyth_rule.js +99 -0
- package/dist/src/generated/waterx_supra_rule/supra_rule.d.ts +5 -5
- package/dist/src/generated/waterx_supra_rule/supra_rule.js +1 -2
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.d.ts +23 -23
- package/dist/src/generated/withdrawal_queue/withdrawal_queue.js +3 -6
- package/dist/src/oracle/aggregate.d.ts +74 -0
- package/dist/src/oracle/aggregate.js +112 -0
- package/dist/src/oracle/config.d.ts +99 -0
- package/dist/src/oracle/config.js +23 -0
- package/dist/src/oracle/host.d.ts +32 -0
- package/dist/src/oracle/host.js +10 -0
- package/dist/src/oracle/index.d.ts +16 -0
- package/dist/src/oracle/index.js +18 -0
- package/dist/src/oracle/pyth.d.ts +52 -0
- package/dist/src/oracle/pyth.js +220 -0
- package/dist/src/oracle/rules/constant-rule.d.ts +9 -0
- package/dist/src/oracle/rules/constant-rule.js +14 -0
- package/dist/src/oracle/rules/pyth-rule.d.ts +11 -0
- package/dist/src/oracle/rules/pyth-rule.js +20 -0
- package/dist/src/oracle/rules/sponsor.d.ts +28 -0
- package/dist/src/oracle/rules/sponsor.js +48 -0
- package/dist/src/oracle/rules/supra-rule.d.ts +11 -0
- package/dist/src/oracle/rules/supra-rule.js +22 -0
- package/dist/src/perp/client.d.ts +78 -0
- package/dist/src/perp/client.js +108 -0
- package/dist/src/{client.d.ts → perp/config-view.d.ts} +15 -60
- package/dist/src/{client.js → perp/config-view.js} +23 -95
- package/dist/src/perp/config.d.ts +126 -0
- package/dist/src/{config.js → perp/config.js} +11 -12
- package/dist/src/perp/constants.d.ts +49 -0
- package/dist/src/perp/constants.js +61 -0
- package/dist/src/perp/fetch/account.d.ts +43 -0
- package/dist/src/perp/fetch/account.js +64 -0
- package/dist/src/perp/fetch/bridge.d.ts +90 -0
- package/dist/src/perp/fetch/bridge.js +127 -0
- package/dist/src/perp/fetch/custody.d.ts +32 -0
- package/dist/src/perp/fetch/custody.js +62 -0
- package/dist/src/perp/fetch/market.d.ts +30 -0
- package/dist/src/perp/fetch/market.js +68 -0
- package/dist/src/perp/fetch/positions.d.ts +70 -0
- package/dist/src/perp/fetch/positions.js +185 -0
- package/dist/src/perp/fetch/simulate.d.ts +12 -0
- package/dist/src/perp/fetch/simulate.js +13 -0
- package/dist/src/perp/fetch.d.ts +23 -0
- package/dist/src/perp/fetch.js +23 -0
- package/dist/src/{index.d.ts → perp/index.d.ts} +21 -21
- package/dist/src/{index.js → perp/index.js} +21 -21
- package/dist/src/perp/tx-builders/common.d.ts +83 -0
- package/dist/src/perp/tx-builders/common.js +70 -0
- package/dist/src/perp/tx-builders/credit.d.ts +65 -0
- package/dist/src/perp/tx-builders/credit.js +62 -0
- package/dist/src/perp/tx-builders/rewards.d.ts +30 -0
- package/dist/src/perp/tx-builders/rewards.js +34 -0
- package/dist/src/perp/tx-builders/trading.d.ts +51 -0
- package/dist/src/perp/tx-builders/trading.js +59 -0
- package/dist/src/perp/tx-builders/wlp.d.ts +90 -0
- package/dist/src/perp/tx-builders/wlp.js +120 -0
- package/dist/src/perp/tx-builders.d.ts +23 -0
- package/dist/src/perp/tx-builders.js +23 -0
- package/dist/src/perp/user/index.d.ts +8 -0
- package/dist/src/perp/user/index.js +8 -0
- package/dist/src/{user → perp/user}/order.d.ts +7 -7
- package/dist/src/{user → perp/user}/order.js +3 -3
- package/dist/src/{user → perp/user}/staking.d.ts +4 -4
- package/dist/src/{user → perp/user}/staking.js +2 -2
- package/dist/src/{user → perp/user}/trading.d.ts +13 -13
- package/dist/src/{user → perp/user}/trading.js +2 -2
- package/dist/src/{user → perp/user}/wlp.d.ts +7 -7
- package/dist/src/{user → perp/user}/wlp.js +3 -3
- package/dist/src/prediction/account.js +40 -76
- package/dist/src/prediction/client.d.ts +8 -38
- package/dist/src/prediction/client.js +11 -67
- package/dist/src/prediction/config.d.ts +16 -2
- package/dist/src/prediction/config.js +10 -4
- package/dist/src/prediction/index.d.ts +11 -11
- package/dist/src/prediction/index.js +10 -10
- package/dist/src/prediction/prediction.d.ts +45 -0
- package/dist/src/prediction/prediction.js +71 -0
- package/dist/src/prediction/tx-builders.d.ts +4 -4
- package/dist/src/prediction/tx-builders.js +2 -2
- package/dist/src/prediction/user/index.d.ts +2 -2
- package/dist/src/prediction/user/index.js +1 -1
- package/dist/src/prediction/user/position.d.ts +2 -2
- package/dist/src/prediction/user/position.js +1 -1
- package/dist/src/prediction/utils/bcs.d.ts +5 -0
- package/dist/src/prediction/utils/bcs.js +5 -0
- package/dist/src/prediction/utils/index.d.ts +7 -0
- package/dist/src/prediction/utils/index.js +7 -0
- package/dist/src/sdk.d.ts +10 -6
- package/dist/src/sdk.js +9 -5
- package/dist/src/unified-client.d.ts +140 -145
- package/dist/src/unified-client.js +98 -40
- package/dist/src/utils/config.d.ts +1 -1
- package/package.json +22 -5
- package/dist/src/config.d.ts +0 -292
- package/dist/src/fetch.d.ts +0 -254
- package/dist/src/fetch.js +0 -564
- package/dist/src/prediction/generated/bucket_v2_framework/account.d.ts +0 -100
- package/dist/src/prediction/generated/bucket_v2_framework/account.js +0 -129
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/bucket_v2_framework/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/bucket_v2_framework/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/bucket_v2_framework/double.d.ts +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/double.js +0 -466
- package/dist/src/prediction/generated/bucket_v2_framework/float.d.ts +0 -362
- package/dist/src/prediction/generated/bucket_v2_framework/float.js +0 -440
- package/dist/src/prediction/generated/bucket_v2_framework/liability.d.ts +0 -193
- package/dist/src/prediction/generated/bucket_v2_framework/liability.js +0 -205
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.d.ts +0 -384
- package/dist/src/prediction/generated/bucket_v2_framework/linked_table.js +0 -382
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.d.ts +0 -344
- package/dist/src/prediction/generated/bucket_v2_framework/sheet.js +0 -338
- package/dist/src/prediction/generated/utils/index.d.ts +0 -30
- package/dist/src/prediction/generated/utils/index.js +0 -160
- package/dist/src/prediction/generated/waterx_account/account.d.ts +0 -1589
- package/dist/src/prediction/generated/waterx_account/account.js +0 -1758
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/liability.js +0 -13
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.d.ts +0 -7
- package/dist/src/prediction/generated/waterx_account/deps/bucket_v2_framework/sheet.js +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.d.ts +0 -6
- package/dist/src/prediction/generated/waterx_account/deps/std/type_name.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.d.ts +0 -10
- package/dist/src/prediction/generated/waterx_account/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.d.ts +0 -12
- package/dist/src/prediction/generated/waterx_account/deps/sui/object_table.js +0 -19
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.d.ts +0 -36
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_map.js +0 -27
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_account/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_account/direct_rule.d.ts +0 -75
- package/dist/src/prediction/generated/waterx_account/direct_rule.js +0 -78
- package/dist/src/prediction/generated/waterx_account/events.d.ts +0 -33
- package/dist/src/prediction/generated/waterx_account/events.js +0 -137
- package/dist/src/prediction/generated/waterx_account/version.js +0 -8
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.d.ts +0 -60
- package/dist/src/prediction/generated/waterx_prediction/bet_sharing.js +0 -83
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/balance.js +0 -14
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.d.ts +0 -24
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/table.js +0 -31
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.d.ts +0 -16
- package/dist/src/prediction/generated/waterx_prediction/deps/sui/vec_set.js +0 -19
- package/dist/src/prediction/generated/waterx_prediction/events.d.ts +0 -22
- package/dist/src/prediction/generated/waterx_prediction/version.d.ts +0 -10
- package/dist/src/tx-builders.d.ts +0 -296
- package/dist/src/tx-builders.js +0 -461
- package/dist/src/user/index.d.ts +0 -8
- package/dist/src/user/index.js +0 -8
- package/dist/src/utils/pyth.d.ts +0 -124
- package/dist/src/utils/pyth.js +0 -392
- /package/dist/src/{utils → account}/account-request.js +0 -0
- /package/dist/src/{core → account}/waterx-account.d.ts +0 -0
- /package/dist/src/{core → account}/waterx-account.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/account_data.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/admin.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/deps/bucket_v2_framework/linked_table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/balance.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/deps/sui/table.js +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.d.ts +0 -0
- /package/dist/src/{prediction/generated/bucket_v2_framework → generated/waterx_prediction}/deps/sui/vec_set.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/global_config.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/order.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/outcome.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/position.js +0 -0
- /package/dist/src/{prediction/generated/waterx_account → generated/waterx_prediction}/version.d.ts +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/version.js +0 -0
- /package/dist/src/{prediction/generated → generated}/waterx_prediction/view.js +0 -0
|
@@ -1,1758 +0,0 @@
|
|
|
1
|
-
/**************************************************************
|
|
2
|
-
* THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
|
|
3
|
-
**************************************************************/
|
|
4
|
-
/**
|
|
5
|
-
* Generalized multi-account framework for the WaterX ecosystem.
|
|
6
|
-
*
|
|
7
|
-
* Pure custody layer. Accounts hold per-T `Balance<T>` as dynamic fields keyed by
|
|
8
|
-
* `BalanceKey<T>()`, with a `VecMap<TypeName, u64>` mirror on each `Account` for
|
|
9
|
-
* fast enumeration. External flow in/out is mediated by hot-potato
|
|
10
|
-
* `DepositRequest<T>` / `WithdrawRequest<T>` that the framework issues; a
|
|
11
|
-
* registered policy module destroys the potato with its own witness and decides
|
|
12
|
-
* what final asset to put back into the account (e.g. a PSM policy turns
|
|
13
|
-
* `Coin<USDC>` into `Balance<USD>` and credits the account via `put<USD, P>`).
|
|
14
|
-
*
|
|
15
|
-
* Internal protocol ↔ account flow stays witness-gated via `take<T, P>` /
|
|
16
|
-
* `put<T, P>` with no policy registration involved — the protocol module's witness
|
|
17
|
-
* is the only authority needed, since only that module can construct a value of
|
|
18
|
-
* its witness type.
|
|
19
|
-
*
|
|
20
|
-
* Types of T:
|
|
21
|
-
*
|
|
22
|
-
* - Has registered deposit policy → `request_deposit<T>` works.
|
|
23
|
-
* - Has registered withdraw policy → `request_withdraw<T>` works.
|
|
24
|
-
* - Neither → "Parkable". Coins can sit on the account address via
|
|
25
|
-
* `transfer_coin<T>` or external `transfer::public_transfer`, but nothing the
|
|
26
|
-
* framework does will fold them into the account until a policy is registered
|
|
27
|
-
* (or owner drains via `receive_coin`).
|
|
28
|
-
*/
|
|
29
|
-
import { MoveStruct, MoveTuple, normalizeMoveArguments } from "../utils/index.js";
|
|
30
|
-
import { bcs } from '@mysten/sui/bcs';
|
|
31
|
-
import * as object_table from "./deps/sui/object_table.js";
|
|
32
|
-
import * as table from "./deps/sui/table.js";
|
|
33
|
-
import * as vec_map from "./deps/sui/vec_map.js";
|
|
34
|
-
import * as type_name from "./deps/std/type_name.js";
|
|
35
|
-
import * as vec_set from "./deps/sui/vec_set.js";
|
|
36
|
-
import * as balance_1 from "./deps/sui/balance.js";
|
|
37
|
-
import * as sheet from "./deps/bucket_v2_framework/sheet.js";
|
|
38
|
-
const $moduleName = '@waterx/account::account';
|
|
39
|
-
export const ACCOUNT = new MoveStruct({ name: `${$moduleName}::ACCOUNT`, fields: {
|
|
40
|
-
dummy_field: bcs.bool()
|
|
41
|
-
} });
|
|
42
|
-
export const AdminCap = new MoveStruct({ name: `${$moduleName}::AdminCap`, fields: {
|
|
43
|
-
id: bcs.Address
|
|
44
|
-
} });
|
|
45
|
-
export const WaterXAccount = new MoveStruct({ name: `${$moduleName}::WaterXAccount`, fields: {
|
|
46
|
-
dummy_field: bcs.bool()
|
|
47
|
-
} });
|
|
48
|
-
export const AccountRegistry = new MoveStruct({ name: `${$moduleName}::AccountRegistry`, fields: {
|
|
49
|
-
id: bcs.Address,
|
|
50
|
-
/**
|
|
51
|
-
* `ObjectTable` (not plain `Table`) so each `Account` retains a distinct on-chain
|
|
52
|
-
* address that off-chain callers can query directly via `getObject(account_id)`
|
|
53
|
-
* instead of walking dynamic-field handles on the registry UID.
|
|
54
|
-
*/
|
|
55
|
-
accounts: object_table.ObjectTable,
|
|
56
|
-
owner_index: table.Table,
|
|
57
|
-
/**
|
|
58
|
-
* Admin-managed whitelist of protocol witness types allowed to move funds
|
|
59
|
-
* (`take<T, P>` / `put<T, P>`) and mutate per-account protocol data
|
|
60
|
-
* (`new_data<P, D>` / `borrow_data_mut<P, D>` / `remove_data<P, D>`). For each
|
|
61
|
-
* whitelisted `P`, the value is the set of asset types `T` that protocol is
|
|
62
|
-
* allowed to draw via `take<T, P>` — admin opts each pair in via two phases:
|
|
63
|
-
* `whitelist_protocol<P>(registry, &AdminCap)` registers `P` with an empty asset
|
|
64
|
-
* set, then `allow_protocol_asset<P, T>(registry, &AdminCap)` adds each T.
|
|
65
|
-
*
|
|
66
|
-
* Gates:
|
|
67
|
-
*
|
|
68
|
-
* - `take<T, P>` requires both `P` whitelisted AND `T` in `protocol_whitelist[P]`
|
|
69
|
-
* (plus per-account auth on the caller).
|
|
70
|
-
* - `put<T, P>` requires only `P` whitelisted. The T-gate stays open even after
|
|
71
|
-
* `disallow_protocol_asset<P, T>`, so existing positions can always close.
|
|
72
|
-
* - `new_data<P, _>` / `borrow_data_mut<P, _>` / `remove_data<P, _>` require only
|
|
73
|
-
* `P` whitelisted.
|
|
74
|
-
*/
|
|
75
|
-
protocol_whitelist: vec_map.VecMap(type_name.TypeName, vec_set.VecSet(type_name.TypeName)),
|
|
76
|
-
/**
|
|
77
|
-
* `T → registered DepositPolicy witness TypeName`. Presence means
|
|
78
|
-
* `request_deposit<T>` / `request_deposit_from_receivings<T>` are permitted; only
|
|
79
|
-
* the module that defines the registered witness type can call
|
|
80
|
-
* `consume_deposit<T, P>` to unwrap the resulting `DepositRequest<T>`. Deposit
|
|
81
|
-
* policy registration is independent of `protocol_whitelist` — a policy can be the
|
|
82
|
-
* _consumer_ of a request without being allowed to `take`/`put`.
|
|
83
|
-
* `T → set of DepositPolicy witness TypeNames`. Multiple policies can be
|
|
84
|
-
* registered per T to support extension (a new policy added alongside the old) and
|
|
85
|
-
* migration (both coexist while consumers switch). `request_deposit<T>` requires
|
|
86
|
-
* the set to be non-empty; `consume_deposit<T, P>` requires P to be in the set.
|
|
87
|
-
*/
|
|
88
|
-
deposit_policies: vec_map.VecMap(type_name.TypeName, vec_set.VecSet(type_name.TypeName)),
|
|
89
|
-
/**
|
|
90
|
-
* `T → set of WithdrawPolicy witness TypeNames`. Symmetric to `deposit_policies`
|
|
91
|
-
* for `request_withdraw<T>` / `consume_withdraw`.
|
|
92
|
-
*/
|
|
93
|
-
withdraw_policies: vec_map.VecMap(type_name.TypeName, vec_set.VecSet(type_name.TypeName)),
|
|
94
|
-
/**
|
|
95
|
-
* Per-T aggregate of `Balance<T>` currently held inside accounts. Incremented in
|
|
96
|
-
* `put<T, P>`, decremented in `take<T, P>` and `request_withdraw<T>`. Does _not_
|
|
97
|
-
* include balance held by protocols (after `take`) or sitting in flight inside a
|
|
98
|
-
* `DepositRequest` / `WithdrawRequest` hot potato.
|
|
99
|
-
*/
|
|
100
|
-
balances: vec_map.VecMap(type_name.TypeName, bcs.u64()),
|
|
101
|
-
allowed_versions: vec_set.VecSet(bcs.u16()),
|
|
102
|
-
managers: vec_set.VecSet(bcs.Address),
|
|
103
|
-
paused: bcs.bool()
|
|
104
|
-
} });
|
|
105
|
-
export const VaultKey = new MoveTuple({ name: `${$moduleName}::VaultKey<phantom T>`, fields: [bcs.bool()] });
|
|
106
|
-
export const Vault = new MoveStruct({ name: `${$moduleName}::Vault<phantom T>`, fields: {
|
|
107
|
-
balance: balance_1.Balance,
|
|
108
|
-
sheet: sheet.Sheet
|
|
109
|
-
} });
|
|
110
|
-
export const ProtocolDataKey = new MoveTuple({ name: `${$moduleName}::ProtocolDataKey<phantom PROTOCOL>`, fields: [bcs.bool()] });
|
|
111
|
-
export const Delegate = new MoveStruct({ name: `${$moduleName}::Delegate`, fields: {
|
|
112
|
-
delegate_address: bcs.Address,
|
|
113
|
-
alias: bcs.string(),
|
|
114
|
-
/** Framework-level action bitmap (PERM_WITHDRAW etc). */
|
|
115
|
-
permissions: bcs.u32(),
|
|
116
|
-
/**
|
|
117
|
-
* Per-protocol bitmap. Missing key → delegate cannot drive that protocol. Each
|
|
118
|
-
* protocol's module interprets its own bits. Owner always has `PERM_ALL` per
|
|
119
|
-
* protocol regardless of this field.
|
|
120
|
-
*/
|
|
121
|
-
protocol_permissions: vec_map.VecMap(type_name.TypeName, bcs.u32()),
|
|
122
|
-
expires_at_ms: bcs.option(bcs.u64())
|
|
123
|
-
} });
|
|
124
|
-
export const Account = new MoveStruct({ name: `${$moduleName}::Account`, fields: {
|
|
125
|
-
id: bcs.Address,
|
|
126
|
-
owner_address: bcs.Address,
|
|
127
|
-
alias: bcs.string(),
|
|
128
|
-
delegates: bcs.vector(Delegate),
|
|
129
|
-
/**
|
|
130
|
-
* Mirror of the per-T `Balance<T>` values stored as dynamic fields under
|
|
131
|
-
* `BalanceKey<T>()` on this UID. Always equals the matching stored balance's
|
|
132
|
-
* `value()`.
|
|
133
|
-
*/
|
|
134
|
-
balances: vec_map.VecMap(type_name.TypeName, bcs.u64())
|
|
135
|
-
} });
|
|
136
|
-
export const DepositRequest = new MoveStruct({ name: `${$moduleName}::DepositRequest<phantom T>`, fields: {
|
|
137
|
-
account_id: bcs.Address,
|
|
138
|
-
balance: balance_1.Balance,
|
|
139
|
-
extra_data: bcs.vector(bcs.u8())
|
|
140
|
-
} });
|
|
141
|
-
export const WithdrawRequest = new MoveStruct({ name: `${$moduleName}::WithdrawRequest<phantom T>`, fields: {
|
|
142
|
-
account_id: bcs.Address,
|
|
143
|
-
balance: balance_1.Balance,
|
|
144
|
-
recipient: bcs.Address,
|
|
145
|
-
extra_data: bcs.vector(bcs.u8())
|
|
146
|
-
} });
|
|
147
|
-
export const PausedProtocolsKey = new MoveTuple({ name: `${$moduleName}::PausedProtocolsKey`, fields: [bcs.bool()] });
|
|
148
|
-
export const AccountKey = new MoveStruct({ name: `${$moduleName}::AccountKey`, fields: {
|
|
149
|
-
owner: bcs.Address,
|
|
150
|
-
index: bcs.u64()
|
|
151
|
-
} });
|
|
152
|
-
export function permNone(options = {}) {
|
|
153
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
154
|
-
return (tx) => tx.moveCall({
|
|
155
|
-
package: packageAddress,
|
|
156
|
-
module: 'account',
|
|
157
|
-
function: 'perm_none',
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
export function permWithdraw(options = {}) {
|
|
161
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
162
|
-
return (tx) => tx.moveCall({
|
|
163
|
-
package: packageAddress,
|
|
164
|
-
module: 'account',
|
|
165
|
-
function: 'perm_withdraw',
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
export function permManageDelegates(options = {}) {
|
|
169
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
170
|
-
return (tx) => tx.moveCall({
|
|
171
|
-
package: packageAddress,
|
|
172
|
-
module: 'account',
|
|
173
|
-
function: 'perm_manage_delegates',
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
export function permReceive(options = {}) {
|
|
177
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
178
|
-
return (tx) => tx.moveCall({
|
|
179
|
-
package: packageAddress,
|
|
180
|
-
module: 'account',
|
|
181
|
-
function: 'perm_receive',
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
export function permAll(options = {}) {
|
|
185
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
186
|
-
return (tx) => tx.moveCall({
|
|
187
|
-
package: packageAddress,
|
|
188
|
-
module: 'account',
|
|
189
|
-
function: 'perm_all',
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
export function aliasMaxLength(options = {}) {
|
|
193
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
194
|
-
return (tx) => tx.moveCall({
|
|
195
|
-
package: packageAddress,
|
|
196
|
-
module: 'account',
|
|
197
|
-
function: 'alias_max_length',
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
export function maxAccountsPerOwner(options = {}) {
|
|
201
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
202
|
-
return (tx) => tx.moveCall({
|
|
203
|
-
package: packageAddress,
|
|
204
|
-
module: 'account',
|
|
205
|
-
function: 'max_accounts_per_owner',
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
export function maxDelegatesPerAccount(options = {}) {
|
|
209
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
210
|
-
return (tx) => tx.moveCall({
|
|
211
|
-
package: packageAddress,
|
|
212
|
-
module: 'account',
|
|
213
|
-
function: 'max_delegates_per_account',
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
export function maxProtocolPermsPerDelegate(options = {}) {
|
|
217
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
218
|
-
return (tx) => tx.moveCall({
|
|
219
|
-
package: packageAddress,
|
|
220
|
-
module: 'account',
|
|
221
|
-
function: 'max_protocol_perms_per_delegate',
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
export function assertVersion(options) {
|
|
225
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
226
|
-
const argumentsTypes = [
|
|
227
|
-
null
|
|
228
|
-
];
|
|
229
|
-
const parameterNames = ["registry"];
|
|
230
|
-
return (tx) => tx.moveCall({
|
|
231
|
-
package: packageAddress,
|
|
232
|
-
module: 'account',
|
|
233
|
-
function: 'assert_version',
|
|
234
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
export function isVersionAllowed(options) {
|
|
238
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
239
|
-
const argumentsTypes = [
|
|
240
|
-
null,
|
|
241
|
-
'u16'
|
|
242
|
-
];
|
|
243
|
-
const parameterNames = ["registry", "v"];
|
|
244
|
-
return (tx) => tx.moveCall({
|
|
245
|
-
package: packageAddress,
|
|
246
|
-
module: 'account',
|
|
247
|
-
function: 'is_version_allowed',
|
|
248
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
export function allowVersion(options) {
|
|
252
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
253
|
-
const argumentsTypes = [
|
|
254
|
-
null,
|
|
255
|
-
null,
|
|
256
|
-
'u16'
|
|
257
|
-
];
|
|
258
|
-
const parameterNames = ["registry", "_", "v"];
|
|
259
|
-
return (tx) => tx.moveCall({
|
|
260
|
-
package: packageAddress,
|
|
261
|
-
module: 'account',
|
|
262
|
-
function: 'allow_version',
|
|
263
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
export function disallowVersion(options) {
|
|
267
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
268
|
-
const argumentsTypes = [
|
|
269
|
-
null,
|
|
270
|
-
null,
|
|
271
|
-
'u16'
|
|
272
|
-
];
|
|
273
|
-
const parameterNames = ["registry", "_", "v"];
|
|
274
|
-
return (tx) => tx.moveCall({
|
|
275
|
-
package: packageAddress,
|
|
276
|
-
module: 'account',
|
|
277
|
-
function: 'disallow_version',
|
|
278
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
export function isPaused(options) {
|
|
282
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
283
|
-
const argumentsTypes = [
|
|
284
|
-
null
|
|
285
|
-
];
|
|
286
|
-
const parameterNames = ["registry"];
|
|
287
|
-
return (tx) => tx.moveCall({
|
|
288
|
-
package: packageAddress,
|
|
289
|
-
module: 'account',
|
|
290
|
-
function: 'is_paused',
|
|
291
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
export function assertNotPaused(options) {
|
|
295
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
296
|
-
const argumentsTypes = [
|
|
297
|
-
null
|
|
298
|
-
];
|
|
299
|
-
const parameterNames = ["registry"];
|
|
300
|
-
return (tx) => tx.moveCall({
|
|
301
|
-
package: packageAddress,
|
|
302
|
-
module: 'account',
|
|
303
|
-
function: 'assert_not_paused',
|
|
304
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
export function pause(options) {
|
|
308
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
309
|
-
const argumentsTypes = [
|
|
310
|
-
null,
|
|
311
|
-
null
|
|
312
|
-
];
|
|
313
|
-
const parameterNames = ["registry", "managerRequest"];
|
|
314
|
-
return (tx) => tx.moveCall({
|
|
315
|
-
package: packageAddress,
|
|
316
|
-
module: 'account',
|
|
317
|
-
function: 'pause',
|
|
318
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
export function unpause(options) {
|
|
322
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
323
|
-
const argumentsTypes = [
|
|
324
|
-
null,
|
|
325
|
-
null
|
|
326
|
-
];
|
|
327
|
-
const parameterNames = ["registry", "_"];
|
|
328
|
-
return (tx) => tx.moveCall({
|
|
329
|
-
package: packageAddress,
|
|
330
|
-
module: 'account',
|
|
331
|
-
function: 'unpause',
|
|
332
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
export function isManager(options) {
|
|
336
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
337
|
-
const argumentsTypes = [
|
|
338
|
-
null,
|
|
339
|
-
'address'
|
|
340
|
-
];
|
|
341
|
-
const parameterNames = ["registry", "addr"];
|
|
342
|
-
return (tx) => tx.moveCall({
|
|
343
|
-
package: packageAddress,
|
|
344
|
-
module: 'account',
|
|
345
|
-
function: 'is_manager',
|
|
346
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
export function managers(options) {
|
|
350
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
351
|
-
const argumentsTypes = [
|
|
352
|
-
null
|
|
353
|
-
];
|
|
354
|
-
const parameterNames = ["registry"];
|
|
355
|
-
return (tx) => tx.moveCall({
|
|
356
|
-
package: packageAddress,
|
|
357
|
-
module: 'account',
|
|
358
|
-
function: 'managers',
|
|
359
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
export function addManager(options) {
|
|
363
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
364
|
-
const argumentsTypes = [
|
|
365
|
-
null,
|
|
366
|
-
null,
|
|
367
|
-
'address'
|
|
368
|
-
];
|
|
369
|
-
const parameterNames = ["registry", "_", "manager"];
|
|
370
|
-
return (tx) => tx.moveCall({
|
|
371
|
-
package: packageAddress,
|
|
372
|
-
module: 'account',
|
|
373
|
-
function: 'add_manager',
|
|
374
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
export function removeManager(options) {
|
|
378
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
379
|
-
const argumentsTypes = [
|
|
380
|
-
null,
|
|
381
|
-
null,
|
|
382
|
-
'address'
|
|
383
|
-
];
|
|
384
|
-
const parameterNames = ["registry", "_", "manager"];
|
|
385
|
-
return (tx) => tx.moveCall({
|
|
386
|
-
package: packageAddress,
|
|
387
|
-
module: 'account',
|
|
388
|
-
function: 'remove_manager',
|
|
389
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
export function isProtocolWhitelisted(options) {
|
|
393
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
394
|
-
const argumentsTypes = [
|
|
395
|
-
null
|
|
396
|
-
];
|
|
397
|
-
const parameterNames = ["registry"];
|
|
398
|
-
return (tx) => tx.moveCall({
|
|
399
|
-
package: packageAddress,
|
|
400
|
-
module: 'account',
|
|
401
|
-
function: 'is_protocol_whitelisted',
|
|
402
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
403
|
-
typeArguments: options.typeArguments
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
export function isProtocolAssetAllowed(options) {
|
|
407
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
408
|
-
const argumentsTypes = [
|
|
409
|
-
null
|
|
410
|
-
];
|
|
411
|
-
const parameterNames = ["registry"];
|
|
412
|
-
return (tx) => tx.moveCall({
|
|
413
|
-
package: packageAddress,
|
|
414
|
-
module: 'account',
|
|
415
|
-
function: 'is_protocol_asset_allowed',
|
|
416
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
417
|
-
typeArguments: options.typeArguments
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
export function protocolWhitelist(options) {
|
|
421
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
422
|
-
const argumentsTypes = [
|
|
423
|
-
null
|
|
424
|
-
];
|
|
425
|
-
const parameterNames = ["registry"];
|
|
426
|
-
return (tx) => tx.moveCall({
|
|
427
|
-
package: packageAddress,
|
|
428
|
-
module: 'account',
|
|
429
|
-
function: 'protocol_whitelist',
|
|
430
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Admin: register witness type `P` with an empty asset set. After this, admin must
|
|
435
|
-
* call `allow_protocol_asset<P, T>` for each T the protocol may draw. Strict —
|
|
436
|
-
* aborts if `P` is already listed.
|
|
437
|
-
*/
|
|
438
|
-
export function whitelistProtocol(options) {
|
|
439
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
440
|
-
const argumentsTypes = [
|
|
441
|
-
null,
|
|
442
|
-
null
|
|
443
|
-
];
|
|
444
|
-
const parameterNames = ["registry", "_"];
|
|
445
|
-
return (tx) => tx.moveCall({
|
|
446
|
-
package: packageAddress,
|
|
447
|
-
module: 'account',
|
|
448
|
-
function: 'whitelist_protocol',
|
|
449
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
450
|
-
typeArguments: options.typeArguments
|
|
451
|
-
});
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Admin: remove witness type `P` (and its entire asset set) from the protocol
|
|
455
|
-
* whitelist. After this, every `take<T, P>` / `put<T, P>` and witness-gated
|
|
456
|
-
* data-slot call aborts. Existing data slots and protocol-held balances are
|
|
457
|
-
* untouched — only future calls are blocked, so admin can pause a misbehaving
|
|
458
|
-
* protocol without stranding state on accounts.
|
|
459
|
-
*/
|
|
460
|
-
export function delistProtocol(options) {
|
|
461
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
462
|
-
const argumentsTypes = [
|
|
463
|
-
null,
|
|
464
|
-
null
|
|
465
|
-
];
|
|
466
|
-
const parameterNames = ["registry", "_"];
|
|
467
|
-
return (tx) => tx.moveCall({
|
|
468
|
-
package: packageAddress,
|
|
469
|
-
module: 'account',
|
|
470
|
-
function: 'delist_protocol',
|
|
471
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
472
|
-
typeArguments: options.typeArguments
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
/**
|
|
476
|
-
* Admin: pause protocol `P` WITHOUT delisting it. A paused protocol cannot
|
|
477
|
-
* `take<_, P>` (new outbound debits) or `new_data<P, _>` (new account state), but
|
|
478
|
-
* `put<_, P>`, `borrow_data_mut<P, _>`, and `remove_data<P, _>` keep working — so
|
|
479
|
-
* in-flight refunds, claims, and close/cleanup can complete. Use this instead of
|
|
480
|
-
* `delist_protocol` for emergency stops; delisting blocks the exit paths too and
|
|
481
|
-
* strands active per-account state (see audit M09).
|
|
482
|
-
*/
|
|
483
|
-
export function pauseProtocol(options) {
|
|
484
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
485
|
-
const argumentsTypes = [
|
|
486
|
-
null,
|
|
487
|
-
null
|
|
488
|
-
];
|
|
489
|
-
const parameterNames = ["registry", "_"];
|
|
490
|
-
return (tx) => tx.moveCall({
|
|
491
|
-
package: packageAddress,
|
|
492
|
-
module: 'account',
|
|
493
|
-
function: 'pause_protocol',
|
|
494
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
495
|
-
typeArguments: options.typeArguments
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
/** Admin: lift a `pause_protocol<P>`. Idempotent on a non-paused protocol. */
|
|
499
|
-
export function unpauseProtocol(options) {
|
|
500
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
501
|
-
const argumentsTypes = [
|
|
502
|
-
null,
|
|
503
|
-
null
|
|
504
|
-
];
|
|
505
|
-
const parameterNames = ["registry", "_"];
|
|
506
|
-
return (tx) => tx.moveCall({
|
|
507
|
-
package: packageAddress,
|
|
508
|
-
module: 'account',
|
|
509
|
-
function: 'unpause_protocol',
|
|
510
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
511
|
-
typeArguments: options.typeArguments
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
export function isProtocolPaused(options) {
|
|
515
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
516
|
-
const argumentsTypes = [
|
|
517
|
-
null
|
|
518
|
-
];
|
|
519
|
-
const parameterNames = ["registry"];
|
|
520
|
-
return (tx) => tx.moveCall({
|
|
521
|
-
package: packageAddress,
|
|
522
|
-
module: 'account',
|
|
523
|
-
function: 'is_protocol_paused',
|
|
524
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
525
|
-
typeArguments: options.typeArguments
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* Admin: add asset type `T` to protocol `P`'s allowed-asset set. After this,
|
|
530
|
-
* `take<T, P>` is permitted (subject to per-account auth). Aborts if `P` is not
|
|
531
|
-
* whitelisted or if `T` is already in the set.
|
|
532
|
-
*/
|
|
533
|
-
export function allowProtocolAsset(options) {
|
|
534
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
535
|
-
const argumentsTypes = [
|
|
536
|
-
null,
|
|
537
|
-
null
|
|
538
|
-
];
|
|
539
|
-
const parameterNames = ["registry", "_"];
|
|
540
|
-
return (tx) => tx.moveCall({
|
|
541
|
-
package: packageAddress,
|
|
542
|
-
module: 'account',
|
|
543
|
-
function: 'allow_protocol_asset',
|
|
544
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
545
|
-
typeArguments: options.typeArguments
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
/**
|
|
549
|
-
* Admin: remove asset type `T` from protocol `P`'s allowed-asset set. Blocks
|
|
550
|
-
* future `take<T, P>` calls but `put<T, P>` on `T` stays open so existing
|
|
551
|
-
* positions can always close. Aborts if `P` is not whitelisted or if `T` is not in
|
|
552
|
-
* the set.
|
|
553
|
-
*/
|
|
554
|
-
export function disallowProtocolAsset(options) {
|
|
555
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
556
|
-
const argumentsTypes = [
|
|
557
|
-
null,
|
|
558
|
-
null
|
|
559
|
-
];
|
|
560
|
-
const parameterNames = ["registry", "_"];
|
|
561
|
-
return (tx) => tx.moveCall({
|
|
562
|
-
package: packageAddress,
|
|
563
|
-
module: 'account',
|
|
564
|
-
function: 'disallow_protocol_asset',
|
|
565
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
566
|
-
typeArguments: options.typeArguments
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
/**
|
|
570
|
-
* Returns true if `T` has at least one deposit policy registered. Used by
|
|
571
|
-
* `request_deposit<T>` to gate inflow and by `withdraw_from_funds<T>` to refuse
|
|
572
|
-
* policy-managed types.
|
|
573
|
-
*/
|
|
574
|
-
export function isDepositPolicyRegistered(options) {
|
|
575
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
576
|
-
const argumentsTypes = [
|
|
577
|
-
null
|
|
578
|
-
];
|
|
579
|
-
const parameterNames = ["registry"];
|
|
580
|
-
return (tx) => tx.moveCall({
|
|
581
|
-
package: packageAddress,
|
|
582
|
-
module: 'account',
|
|
583
|
-
function: 'is_deposit_policy_registered',
|
|
584
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
585
|
-
typeArguments: options.typeArguments
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
|
-
/** Returns true if `T` has at least one withdraw policy registered. */
|
|
589
|
-
export function isWithdrawPolicyRegistered(options) {
|
|
590
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
591
|
-
const argumentsTypes = [
|
|
592
|
-
null
|
|
593
|
-
];
|
|
594
|
-
const parameterNames = ["registry"];
|
|
595
|
-
return (tx) => tx.moveCall({
|
|
596
|
-
package: packageAddress,
|
|
597
|
-
module: 'account',
|
|
598
|
-
function: 'is_withdraw_policy_registered',
|
|
599
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
600
|
-
typeArguments: options.typeArguments
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
/**
|
|
604
|
-
* Returns true if the specific witness `P` is one of T's registered deposit
|
|
605
|
-
* policies. `consume_deposit<T, P>` aborts `EPolicyMismatch` when this would
|
|
606
|
-
* return false.
|
|
607
|
-
*/
|
|
608
|
-
export function isDepositPolicyRegisteredFor(options) {
|
|
609
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
610
|
-
const argumentsTypes = [
|
|
611
|
-
null
|
|
612
|
-
];
|
|
613
|
-
const parameterNames = ["registry"];
|
|
614
|
-
return (tx) => tx.moveCall({
|
|
615
|
-
package: packageAddress,
|
|
616
|
-
module: 'account',
|
|
617
|
-
function: 'is_deposit_policy_registered_for',
|
|
618
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
619
|
-
typeArguments: options.typeArguments
|
|
620
|
-
});
|
|
621
|
-
}
|
|
622
|
-
export function isWithdrawPolicyRegisteredFor(options) {
|
|
623
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
624
|
-
const argumentsTypes = [
|
|
625
|
-
null
|
|
626
|
-
];
|
|
627
|
-
const parameterNames = ["registry"];
|
|
628
|
-
return (tx) => tx.moveCall({
|
|
629
|
-
package: packageAddress,
|
|
630
|
-
module: 'account',
|
|
631
|
-
function: 'is_withdraw_policy_registered_for',
|
|
632
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
633
|
-
typeArguments: options.typeArguments
|
|
634
|
-
});
|
|
635
|
-
}
|
|
636
|
-
/**
|
|
637
|
-
* Returns the full set of deposit-policy witness typenames registered for `T`, as
|
|
638
|
-
* a `vector<TypeName>` copy (TypeName is `copy + drop + store`, so this is
|
|
639
|
-
* cheap). Aborts if T has no policies. Off-chain consumers wanting iteration
|
|
640
|
-
* without the copy should walk the full `deposit_policies()` map instead.
|
|
641
|
-
*/
|
|
642
|
-
export function depositPoliciesFor(options) {
|
|
643
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
644
|
-
const argumentsTypes = [
|
|
645
|
-
null
|
|
646
|
-
];
|
|
647
|
-
const parameterNames = ["registry"];
|
|
648
|
-
return (tx) => tx.moveCall({
|
|
649
|
-
package: packageAddress,
|
|
650
|
-
module: 'account',
|
|
651
|
-
function: 'deposit_policies_for',
|
|
652
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
653
|
-
typeArguments: options.typeArguments
|
|
654
|
-
});
|
|
655
|
-
}
|
|
656
|
-
export function withdrawPoliciesFor(options) {
|
|
657
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
658
|
-
const argumentsTypes = [
|
|
659
|
-
null
|
|
660
|
-
];
|
|
661
|
-
const parameterNames = ["registry"];
|
|
662
|
-
return (tx) => tx.moveCall({
|
|
663
|
-
package: packageAddress,
|
|
664
|
-
module: 'account',
|
|
665
|
-
function: 'withdraw_policies_for',
|
|
666
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
667
|
-
typeArguments: options.typeArguments
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
export function depositPolicies(options) {
|
|
671
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
672
|
-
const argumentsTypes = [
|
|
673
|
-
null
|
|
674
|
-
];
|
|
675
|
-
const parameterNames = ["registry"];
|
|
676
|
-
return (tx) => tx.moveCall({
|
|
677
|
-
package: packageAddress,
|
|
678
|
-
module: 'account',
|
|
679
|
-
function: 'deposit_policies',
|
|
680
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
export function withdrawPolicies(options) {
|
|
684
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
685
|
-
const argumentsTypes = [
|
|
686
|
-
null
|
|
687
|
-
];
|
|
688
|
-
const parameterNames = ["registry"];
|
|
689
|
-
return (tx) => tx.moveCall({
|
|
690
|
-
package: packageAddress,
|
|
691
|
-
module: 'account',
|
|
692
|
-
function: 'withdraw_policies',
|
|
693
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
/**
|
|
697
|
-
* Admin: register witness type `P` as a deposit policy for `T`. Multiple policies
|
|
698
|
-
* can coexist per T to support extension (a new module added alongside the old)
|
|
699
|
-
* and migration (consumers switch one at a time). Idempotent — adding an
|
|
700
|
-
* already-registered `(T, P)` pair is a silent no-op so admin can re-run deploy
|
|
701
|
-
* scripts safely.
|
|
702
|
-
*/
|
|
703
|
-
export function registerDepositPolicy(options) {
|
|
704
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
705
|
-
const argumentsTypes = [
|
|
706
|
-
null,
|
|
707
|
-
null
|
|
708
|
-
];
|
|
709
|
-
const parameterNames = ["registry", "_"];
|
|
710
|
-
return (tx) => tx.moveCall({
|
|
711
|
-
package: packageAddress,
|
|
712
|
-
module: 'account',
|
|
713
|
-
function: 'register_deposit_policy',
|
|
714
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
715
|
-
typeArguments: options.typeArguments
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
export function registerWithdrawPolicy(options) {
|
|
719
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
720
|
-
const argumentsTypes = [
|
|
721
|
-
null,
|
|
722
|
-
null
|
|
723
|
-
];
|
|
724
|
-
const parameterNames = ["registry", "_"];
|
|
725
|
-
return (tx) => tx.moveCall({
|
|
726
|
-
package: packageAddress,
|
|
727
|
-
module: 'account',
|
|
728
|
-
function: 'register_withdraw_policy',
|
|
729
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
730
|
-
typeArguments: options.typeArguments
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Admin: remove `P` from T's deposit-policy set. Other registered policies for `T`
|
|
735
|
-
* keep working. If `P` is the last entry, the `T` key is cleaned up so
|
|
736
|
-
* `is_deposit_policy_registered<T>` returns false. Aborts if `(T, P)` isn't
|
|
737
|
-
* registered.
|
|
738
|
-
*/
|
|
739
|
-
export function unregisterDepositPolicy(options) {
|
|
740
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
741
|
-
const argumentsTypes = [
|
|
742
|
-
null,
|
|
743
|
-
null
|
|
744
|
-
];
|
|
745
|
-
const parameterNames = ["registry", "_"];
|
|
746
|
-
return (tx) => tx.moveCall({
|
|
747
|
-
package: packageAddress,
|
|
748
|
-
module: 'account',
|
|
749
|
-
function: 'unregister_deposit_policy',
|
|
750
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
751
|
-
typeArguments: options.typeArguments
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
export function unregisterWithdrawPolicy(options) {
|
|
755
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
756
|
-
const argumentsTypes = [
|
|
757
|
-
null,
|
|
758
|
-
null
|
|
759
|
-
];
|
|
760
|
-
const parameterNames = ["registry", "_"];
|
|
761
|
-
return (tx) => tx.moveCall({
|
|
762
|
-
package: packageAddress,
|
|
763
|
-
module: 'account',
|
|
764
|
-
function: 'unregister_withdraw_policy',
|
|
765
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
766
|
-
typeArguments: options.typeArguments
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
export function createAccount(options) {
|
|
770
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
771
|
-
const argumentsTypes = [
|
|
772
|
-
null,
|
|
773
|
-
null,
|
|
774
|
-
'0x1::string::String'
|
|
775
|
-
];
|
|
776
|
-
const parameterNames = ["registry", "senderRequest", "alias"];
|
|
777
|
-
return (tx) => tx.moveCall({
|
|
778
|
-
package: packageAddress,
|
|
779
|
-
module: 'account',
|
|
780
|
-
function: 'create_account',
|
|
781
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
782
|
-
});
|
|
783
|
-
}
|
|
784
|
-
/**
|
|
785
|
-
* Off-chain view: compute the address a future `create_account` call will produce
|
|
786
|
-
* for `(owner, index)`. Mirrors `derived_object::derive_address` keyed on
|
|
787
|
-
* `AccountKey`. Useful for SDKs that want to address an account before it exists,
|
|
788
|
-
* or to discover all of an owner's accounts by iterating index from 0 up to
|
|
789
|
-
* `MAX_ACCOUNTS_PER_OWNER` and checking `has_account` against each derived
|
|
790
|
-
* address.
|
|
791
|
-
*/
|
|
792
|
-
export function deriveAccountAddress(options) {
|
|
793
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
794
|
-
const argumentsTypes = [
|
|
795
|
-
null,
|
|
796
|
-
'address',
|
|
797
|
-
'u64'
|
|
798
|
-
];
|
|
799
|
-
const parameterNames = ["registry", "owner", "index"];
|
|
800
|
-
return (tx) => tx.moveCall({
|
|
801
|
-
package: packageAddress,
|
|
802
|
-
module: 'account',
|
|
803
|
-
function: 'derive_account_address',
|
|
804
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
export function setAlias(options) {
|
|
808
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
809
|
-
const argumentsTypes = [
|
|
810
|
-
null,
|
|
811
|
-
null,
|
|
812
|
-
'0x2::object::ID',
|
|
813
|
-
'0x1::string::String'
|
|
814
|
-
];
|
|
815
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "alias"];
|
|
816
|
-
return (tx) => tx.moveCall({
|
|
817
|
-
package: packageAddress,
|
|
818
|
-
module: 'account',
|
|
819
|
-
function: 'set_alias',
|
|
820
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
821
|
-
});
|
|
822
|
-
}
|
|
823
|
-
export function addDelegate(options) {
|
|
824
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
825
|
-
const argumentsTypes = [
|
|
826
|
-
null,
|
|
827
|
-
null,
|
|
828
|
-
'0x2::object::ID',
|
|
829
|
-
'address',
|
|
830
|
-
'0x1::string::String',
|
|
831
|
-
'u32',
|
|
832
|
-
'0x1::option::Option<u64>',
|
|
833
|
-
'0x2::clock::Clock'
|
|
834
|
-
];
|
|
835
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
|
|
836
|
-
return (tx) => tx.moveCall({
|
|
837
|
-
package: packageAddress,
|
|
838
|
-
module: 'account',
|
|
839
|
-
function: 'add_delegate',
|
|
840
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
/**
|
|
844
|
-
* Owner-only for live delegates; permissionless once the delegate has passed its
|
|
845
|
-
* `expires_at_ms`. Lets a keeper / bot prune dead entries without bothering the
|
|
846
|
-
* owner — an expired delegate carries no authority, so removing it is purely
|
|
847
|
-
* janitorial.
|
|
848
|
-
*/
|
|
849
|
-
export function removeDelegate(options) {
|
|
850
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
851
|
-
const argumentsTypes = [
|
|
852
|
-
null,
|
|
853
|
-
null,
|
|
854
|
-
'0x2::object::ID',
|
|
855
|
-
'address',
|
|
856
|
-
'0x2::clock::Clock'
|
|
857
|
-
];
|
|
858
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
|
|
859
|
-
return (tx) => tx.moveCall({
|
|
860
|
-
package: packageAddress,
|
|
861
|
-
module: 'account',
|
|
862
|
-
function: 'remove_delegate',
|
|
863
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
export function updateDelegate(options) {
|
|
867
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
868
|
-
const argumentsTypes = [
|
|
869
|
-
null,
|
|
870
|
-
null,
|
|
871
|
-
'0x2::object::ID',
|
|
872
|
-
'address',
|
|
873
|
-
'0x1::string::String',
|
|
874
|
-
'u32',
|
|
875
|
-
'0x1::option::Option<u64>',
|
|
876
|
-
'0x2::clock::Clock'
|
|
877
|
-
];
|
|
878
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
|
|
879
|
-
return (tx) => tx.moveCall({
|
|
880
|
-
package: packageAddress,
|
|
881
|
-
module: 'account',
|
|
882
|
-
function: 'update_delegate',
|
|
883
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
export function setDelegateProtocolPermission(options) {
|
|
887
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
888
|
-
const argumentsTypes = [
|
|
889
|
-
null,
|
|
890
|
-
null,
|
|
891
|
-
'0x2::object::ID',
|
|
892
|
-
'address',
|
|
893
|
-
'u32',
|
|
894
|
-
'0x2::clock::Clock'
|
|
895
|
-
];
|
|
896
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "permissions"];
|
|
897
|
-
return (tx) => tx.moveCall({
|
|
898
|
-
package: packageAddress,
|
|
899
|
-
module: 'account',
|
|
900
|
-
function: 'set_delegate_protocol_permission',
|
|
901
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
902
|
-
typeArguments: options.typeArguments
|
|
903
|
-
});
|
|
904
|
-
}
|
|
905
|
-
export function unsetDelegateProtocolPermission(options) {
|
|
906
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
907
|
-
const argumentsTypes = [
|
|
908
|
-
null,
|
|
909
|
-
null,
|
|
910
|
-
'0x2::object::ID',
|
|
911
|
-
'address',
|
|
912
|
-
'0x2::clock::Clock'
|
|
913
|
-
];
|
|
914
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
|
|
915
|
-
return (tx) => tx.moveCall({
|
|
916
|
-
package: packageAddress,
|
|
917
|
-
module: 'account',
|
|
918
|
-
function: 'unset_delegate_protocol_permission',
|
|
919
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
920
|
-
typeArguments: options.typeArguments
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* Wraps an in-PTB `Coin<T>` into a `DepositRequest<T>` for the account.
|
|
925
|
-
* Permissionless — anyone can pay into any account, since the policy (not the
|
|
926
|
-
* framework) decides what the eventual credited asset is. `T` must have a
|
|
927
|
-
* registered deposit policy; aborts otherwise.
|
|
928
|
-
*/
|
|
929
|
-
export function requestDeposit(options) {
|
|
930
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
931
|
-
const argumentsTypes = [
|
|
932
|
-
null,
|
|
933
|
-
'0x2::object::ID',
|
|
934
|
-
null,
|
|
935
|
-
'vector<u8>'
|
|
936
|
-
];
|
|
937
|
-
const parameterNames = ["registry", "accountId", "coin", "extraData"];
|
|
938
|
-
return (tx) => tx.moveCall({
|
|
939
|
-
package: packageAddress,
|
|
940
|
-
module: 'account',
|
|
941
|
-
function: 'request_deposit',
|
|
942
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
943
|
-
typeArguments: options.typeArguments
|
|
944
|
-
});
|
|
945
|
-
}
|
|
946
|
-
/**
|
|
947
|
-
* Drains `Receiving<Coin<T>>` entries addressed to the account's UID into a single
|
|
948
|
-
* merged `Coin<T>` and wraps it as a `DepositRequest<T>`. Used when a user (or
|
|
949
|
-
* anyone) previously `transfer_coin`-ed a `Coin<T>` onto the account address and
|
|
950
|
-
* now wants to fold it into custody. Permissionless for the same reason as
|
|
951
|
-
* `request_deposit<T>`.
|
|
952
|
-
*/
|
|
953
|
-
export function requestDepositFromReceivings(options) {
|
|
954
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
955
|
-
const argumentsTypes = [
|
|
956
|
-
null,
|
|
957
|
-
'0x2::object::ID',
|
|
958
|
-
'vector<null>',
|
|
959
|
-
'vector<u8>'
|
|
960
|
-
];
|
|
961
|
-
const parameterNames = ["registry", "accountId", "receivings", "extraData"];
|
|
962
|
-
return (tx) => tx.moveCall({
|
|
963
|
-
package: packageAddress,
|
|
964
|
-
module: 'account',
|
|
965
|
-
function: 'request_deposit_from_receivings',
|
|
966
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
967
|
-
typeArguments: options.typeArguments
|
|
968
|
-
});
|
|
969
|
-
}
|
|
970
|
-
/**
|
|
971
|
-
* Drains every `Balance<T>` sitting at the account's UID-derived address in Sui's
|
|
972
|
-
* native funds accumulator and wraps the total into a single `DepositRequest<T>`.
|
|
973
|
-
* Useful for accounts that receive `Coin<T>` via `0x2::balance::send_funds<T>` (or
|
|
974
|
-
* any path that lands T at `account_id.to_address()` directly) and want it folded
|
|
975
|
-
* into framework custody through the deposit-policy pipeline.
|
|
976
|
-
*
|
|
977
|
-
* The total drained equals `settled_funds_value<T>(root, addr)` as of the last
|
|
978
|
-
* consensus commit — within the writing PTB itself, that read returns the pre-tx
|
|
979
|
-
* value, so SDKs should treat this as a between-tx drain. Permissionless
|
|
980
|
-
* (crediting an account is always allowed), pause-free, requires `T` to have a
|
|
981
|
-
* registered deposit policy. Returns a deposit request even when the address holds
|
|
982
|
-
* zero T (the carried balance is `Balance::zero()` in that case) — callers can
|
|
983
|
-
* short-circuit off-chain by checking `settled_funds_value` first.
|
|
984
|
-
*/
|
|
985
|
-
export function requestDepositFromFunds(options) {
|
|
986
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
987
|
-
const argumentsTypes = [
|
|
988
|
-
null,
|
|
989
|
-
'0x2::object::ID',
|
|
990
|
-
null,
|
|
991
|
-
'vector<u8>'
|
|
992
|
-
];
|
|
993
|
-
const parameterNames = ["registry", "accountId", "accumulatorRoot", "extraData"];
|
|
994
|
-
return (tx) => tx.moveCall({
|
|
995
|
-
package: packageAddress,
|
|
996
|
-
module: 'account',
|
|
997
|
-
function: 'request_deposit_from_funds',
|
|
998
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
999
|
-
typeArguments: options.typeArguments
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Policy-side unwrap. Verifies that `P` is the registered deposit policy for `T`,
|
|
1004
|
-
* then destructures the hot potato. The policy module is responsible for what
|
|
1005
|
-
* happens next — typically swap / convert `Balance<T>` to some `Balance<T_OUT>`
|
|
1006
|
-
* and call `put<T_OUT, P>` to credit the account.
|
|
1007
|
-
*/
|
|
1008
|
-
export function consumeDeposit(options) {
|
|
1009
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1010
|
-
const argumentsTypes = [
|
|
1011
|
-
null,
|
|
1012
|
-
null,
|
|
1013
|
-
`${options.typeArguments[1]}`
|
|
1014
|
-
];
|
|
1015
|
-
const parameterNames = ["registry", "req", "Witness"];
|
|
1016
|
-
return (tx) => tx.moveCall({
|
|
1017
|
-
package: packageAddress,
|
|
1018
|
-
module: 'account',
|
|
1019
|
-
function: 'consume_deposit',
|
|
1020
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1021
|
-
typeArguments: options.typeArguments
|
|
1022
|
-
});
|
|
1023
|
-
}
|
|
1024
|
-
/**
|
|
1025
|
-
* Debits `amount` of the account's stored `Balance<T>` and packages it into a
|
|
1026
|
-
* `WithdrawRequest<T>` for the registered withdraw policy. Auth (`PERM_WITHDRAW`
|
|
1027
|
-
* on `T`'s account) and pause are checked here, not in `consume_withdraw`.
|
|
1028
|
-
*/
|
|
1029
|
-
export function requestWithdraw(options) {
|
|
1030
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1031
|
-
const argumentsTypes = [
|
|
1032
|
-
null,
|
|
1033
|
-
null,
|
|
1034
|
-
'0x2::object::ID',
|
|
1035
|
-
'u64',
|
|
1036
|
-
'address',
|
|
1037
|
-
'vector<u8>',
|
|
1038
|
-
'0x2::clock::Clock'
|
|
1039
|
-
];
|
|
1040
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "amount", "recipient", "extraData"];
|
|
1041
|
-
return (tx) => tx.moveCall({
|
|
1042
|
-
package: packageAddress,
|
|
1043
|
-
module: 'account',
|
|
1044
|
-
function: 'request_withdraw',
|
|
1045
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1046
|
-
typeArguments: options.typeArguments
|
|
1047
|
-
});
|
|
1048
|
-
}
|
|
1049
|
-
/**
|
|
1050
|
-
* Policy-side unwrap. Verifies that `P` is the registered withdraw policy for `T`,
|
|
1051
|
-
* then destructures the hot potato. The policy module decides what to do with the
|
|
1052
|
-
* `Balance<T>` (transfer to `recipient` as `Coin<T>`, swap to another asset and
|
|
1053
|
-
* transfer, queue for later settlement, etc.).
|
|
1054
|
-
*/
|
|
1055
|
-
export function consumeWithdraw(options) {
|
|
1056
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1057
|
-
const argumentsTypes = [
|
|
1058
|
-
null,
|
|
1059
|
-
null,
|
|
1060
|
-
`${options.typeArguments[1]}`
|
|
1061
|
-
];
|
|
1062
|
-
const parameterNames = ["registry", "req", "Witness"];
|
|
1063
|
-
return (tx) => tx.moveCall({
|
|
1064
|
-
package: packageAddress,
|
|
1065
|
-
module: 'account',
|
|
1066
|
-
function: 'consume_withdraw',
|
|
1067
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1068
|
-
typeArguments: options.typeArguments
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
/**
|
|
1072
|
-
* TTOs a `Coin<T>` to the account's UID address. The coin sits there until someone
|
|
1073
|
-
* calls `request_deposit_from_receivings<T>` (which requires a registered deposit
|
|
1074
|
-
* policy that then folds the coin into the account's stored balance) or
|
|
1075
|
-
* `receive<Coin<T>>` (owner / `PERM_RECEIVE` delegate, no policy needed). Useful
|
|
1076
|
-
* for async / cross-PTB deposits and for routing protocol payouts (e.g. reward
|
|
1077
|
-
* claims) into an account when `T` has no deposit policy.
|
|
1078
|
-
*/
|
|
1079
|
-
export function transferCoin(options) {
|
|
1080
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1081
|
-
const argumentsTypes = [
|
|
1082
|
-
null,
|
|
1083
|
-
'0x2::object::ID',
|
|
1084
|
-
null
|
|
1085
|
-
];
|
|
1086
|
-
const parameterNames = ["registry", "accountId", "coin"];
|
|
1087
|
-
return (tx) => tx.moveCall({
|
|
1088
|
-
package: packageAddress,
|
|
1089
|
-
module: 'account',
|
|
1090
|
-
function: 'transfer_coin',
|
|
1091
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1092
|
-
typeArguments: options.typeArguments
|
|
1093
|
-
});
|
|
1094
|
-
}
|
|
1095
|
-
/**
|
|
1096
|
-
* Account-owner drain of a TTO'd object on the account's UID. Generic over
|
|
1097
|
-
* `T: key + store` — works for NFTs, reward objects, or `Coin<X>` where `X` has no
|
|
1098
|
-
* registered deposit policy.
|
|
1099
|
-
*
|
|
1100
|
-
* **Policy-managed Coin<X> is rejected.** If `T == Coin<X>` and `X` has a deposit
|
|
1101
|
-
* policy registered, this aborts `EUseRequestDepositInstead` to keep policy-routed
|
|
1102
|
-
* inflow on the deposit-policy pipeline — bypassing via `receive` would skip the
|
|
1103
|
-
* conversion / authorization the policy is supposed to enforce. Use
|
|
1104
|
-
* `request_deposit_from_receivings<X>` or `request_deposit_from_funds<X>` for
|
|
1105
|
-
* inflow when X has a deposit policy.
|
|
1106
|
-
*
|
|
1107
|
-
* Auth: account owner or a `PERM_RECEIVE` delegate (kept separate from
|
|
1108
|
-
* `PERM_WITHDRAW` so reward-collection rights don't imply balance-drain rights).
|
|
1109
|
-
* Returns the received object to the caller's PTB.
|
|
1110
|
-
*/
|
|
1111
|
-
export function receive(options) {
|
|
1112
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1113
|
-
const argumentsTypes = [
|
|
1114
|
-
null,
|
|
1115
|
-
null,
|
|
1116
|
-
'0x2::object::ID',
|
|
1117
|
-
null,
|
|
1118
|
-
'0x2::clock::Clock'
|
|
1119
|
-
];
|
|
1120
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "receiving"];
|
|
1121
|
-
return (tx) => tx.moveCall({
|
|
1122
|
-
package: packageAddress,
|
|
1123
|
-
module: 'account',
|
|
1124
|
-
function: 'receive',
|
|
1125
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1126
|
-
typeArguments: options.typeArguments
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Drains every `Balance<T>` sitting at the account's UID-derived address in Sui's
|
|
1131
|
-
* native funds accumulator and returns it directly as a `Balance<T>`. Symmetric to
|
|
1132
|
-
* `request_deposit_from_funds<T>`, but explicitly for `T` that has **no**
|
|
1133
|
-
* registered deposit policy — policy-managed inflow must route through the
|
|
1134
|
-
* deposit-policy pipeline instead. The intent is to let owners (or `PERM_WITHDRAW`
|
|
1135
|
-
* delegates) pull policy-less inflow (reward tokens TTO'd via `send_funds`,
|
|
1136
|
-
* miscellaneous `Balance<T>` the SDK parked at the address) straight out.
|
|
1137
|
-
*
|
|
1138
|
-
* Auth: same as `request_withdraw<T>` — `PERM_WITHDRAW` or owner. Aborts
|
|
1139
|
-
* `EUseRequestDepositInstead` if `T` has a deposit policy registered. Pause-gated.
|
|
1140
|
-
* Returns `Balance::zero<T>()` when the address holds no T.
|
|
1141
|
-
*/
|
|
1142
|
-
export function withdrawFromFunds(options) {
|
|
1143
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1144
|
-
const argumentsTypes = [
|
|
1145
|
-
null,
|
|
1146
|
-
null,
|
|
1147
|
-
'0x2::object::ID',
|
|
1148
|
-
null,
|
|
1149
|
-
'0x2::clock::Clock'
|
|
1150
|
-
];
|
|
1151
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "accumulatorRoot"];
|
|
1152
|
-
return (tx) => tx.moveCall({
|
|
1153
|
-
package: packageAddress,
|
|
1154
|
-
module: 'account',
|
|
1155
|
-
function: 'withdraw_from_funds',
|
|
1156
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1157
|
-
typeArguments: options.typeArguments
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
/**
|
|
1161
|
-
* Splits `amount` of `Balance<T>` off `account_id` for protocol `P` to use. Three
|
|
1162
|
-
* gates compose:
|
|
1163
|
-
*
|
|
1164
|
-
* 1. **Witness privacy.** Only the module that defines `P` can produce a value of
|
|
1165
|
-
* `P`, so only that module can call `take<T, P>`.
|
|
1166
|
-
* 2. **Protocol whitelist.** `P` must be in `protocol_whitelist` (admin-managed).
|
|
1167
|
-
* Stops any deployed module that happens to own a `drop` witness from draining
|
|
1168
|
-
* accounts.
|
|
1169
|
-
* 3. **Per-account auth.** `sender_request.address()` must be the account's owner
|
|
1170
|
-
* OR a non-expired delegate — even a legitimate whitelisted protocol cannot
|
|
1171
|
-
* move funds out of an account that doesn't know the caller. This mirrors EOA
|
|
1172
|
-
* semantics: the account never pays out without the owner (or a delegated key)
|
|
1173
|
-
* signing. Per-action bit semantics on `protocol_permissions[P]` remain the
|
|
1174
|
-
* protocol's responsibility on top of this.
|
|
1175
|
-
*
|
|
1176
|
-
* No deposit/withdraw policy is consulted — `take` / `put` are the
|
|
1177
|
-
* protocol↔account flow and orthogonal to the external deposit/withdraw path that
|
|
1178
|
-
* policies own.
|
|
1179
|
-
*/
|
|
1180
|
-
export function take(options) {
|
|
1181
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1182
|
-
const argumentsTypes = [
|
|
1183
|
-
null,
|
|
1184
|
-
null,
|
|
1185
|
-
'0x2::object::ID',
|
|
1186
|
-
'u64',
|
|
1187
|
-
`${options.typeArguments[1]}`,
|
|
1188
|
-
'0x2::clock::Clock'
|
|
1189
|
-
];
|
|
1190
|
-
const parameterNames = ["registry", "senderRequest", "accountId", "amount", "Witness"];
|
|
1191
|
-
return (tx) => tx.moveCall({
|
|
1192
|
-
package: packageAddress,
|
|
1193
|
-
module: 'account',
|
|
1194
|
-
function: 'take',
|
|
1195
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1196
|
-
typeArguments: options.typeArguments
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
/**
|
|
1200
|
-
* Joins `bal` into `account_id`'s stored `Balance<T>`. Symmetric to `take<T, P>`.
|
|
1201
|
-
* Zero-value balances are silently destroyed.
|
|
1202
|
-
*/
|
|
1203
|
-
export function put(options) {
|
|
1204
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1205
|
-
const argumentsTypes = [
|
|
1206
|
-
null,
|
|
1207
|
-
'0x2::object::ID',
|
|
1208
|
-
null,
|
|
1209
|
-
`${options.typeArguments[1]}`
|
|
1210
|
-
];
|
|
1211
|
-
const parameterNames = ["registry", "accountId", "bal", "Witness"];
|
|
1212
|
-
return (tx) => tx.moveCall({
|
|
1213
|
-
package: packageAddress,
|
|
1214
|
-
module: 'account',
|
|
1215
|
-
function: 'put',
|
|
1216
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1217
|
-
typeArguments: options.typeArguments
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
export function hasAccount(options) {
|
|
1221
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1222
|
-
const argumentsTypes = [
|
|
1223
|
-
null,
|
|
1224
|
-
'0x2::object::ID'
|
|
1225
|
-
];
|
|
1226
|
-
const parameterNames = ["registry", "accountId"];
|
|
1227
|
-
return (tx) => tx.moveCall({
|
|
1228
|
-
package: packageAddress,
|
|
1229
|
-
module: 'account',
|
|
1230
|
-
function: 'has_account',
|
|
1231
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
/**
|
|
1235
|
-
* Returns `true` when `addr` is the account's owner or a non-expired delegate,
|
|
1236
|
-
* regardless of permission bits. The framework's "is this address known to the
|
|
1237
|
-
* account?" gate — per-action bit semantics are the protocol's responsibility on
|
|
1238
|
-
* top of this.
|
|
1239
|
-
*/
|
|
1240
|
-
export function isAccountAuthorized(options) {
|
|
1241
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1242
|
-
const argumentsTypes = [
|
|
1243
|
-
null,
|
|
1244
|
-
'0x2::object::ID',
|
|
1245
|
-
'address',
|
|
1246
|
-
'u64'
|
|
1247
|
-
];
|
|
1248
|
-
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
1249
|
-
return (tx) => tx.moveCall({
|
|
1250
|
-
package: packageAddress,
|
|
1251
|
-
module: 'account',
|
|
1252
|
-
function: 'is_account_authorized',
|
|
1253
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1254
|
-
});
|
|
1255
|
-
}
|
|
1256
|
-
export function accountCount(options) {
|
|
1257
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1258
|
-
const argumentsTypes = [
|
|
1259
|
-
null,
|
|
1260
|
-
'address'
|
|
1261
|
-
];
|
|
1262
|
-
const parameterNames = ["registry", "owner"];
|
|
1263
|
-
return (tx) => tx.moveCall({
|
|
1264
|
-
package: packageAddress,
|
|
1265
|
-
module: 'account',
|
|
1266
|
-
function: 'account_count',
|
|
1267
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1268
|
-
});
|
|
1269
|
-
}
|
|
1270
|
-
export function accountIds(options) {
|
|
1271
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1272
|
-
const argumentsTypes = [
|
|
1273
|
-
null,
|
|
1274
|
-
'address'
|
|
1275
|
-
];
|
|
1276
|
-
const parameterNames = ["registry", "owner"];
|
|
1277
|
-
return (tx) => tx.moveCall({
|
|
1278
|
-
package: packageAddress,
|
|
1279
|
-
module: 'account',
|
|
1280
|
-
function: 'account_ids',
|
|
1281
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
/**
|
|
1285
|
-
* Framework-level effective permissions (used by `request_withdraw`). Owner →
|
|
1286
|
-
* `PERM_ALL`. Delegate → its `permissions` bitmap unless expired. Stranger →
|
|
1287
|
-
* `PERM_NONE`.
|
|
1288
|
-
*/
|
|
1289
|
-
export function effectivePermissions(options) {
|
|
1290
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1291
|
-
const argumentsTypes = [
|
|
1292
|
-
null,
|
|
1293
|
-
'0x2::object::ID',
|
|
1294
|
-
'address',
|
|
1295
|
-
'u64'
|
|
1296
|
-
];
|
|
1297
|
-
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
1298
|
-
return (tx) => tx.moveCall({
|
|
1299
|
-
package: packageAddress,
|
|
1300
|
-
module: 'account',
|
|
1301
|
-
function: 'effective_permissions',
|
|
1302
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1303
|
-
});
|
|
1304
|
-
}
|
|
1305
|
-
export function hasPermission(options) {
|
|
1306
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1307
|
-
const argumentsTypes = [
|
|
1308
|
-
null,
|
|
1309
|
-
'0x2::object::ID',
|
|
1310
|
-
'address',
|
|
1311
|
-
'u32',
|
|
1312
|
-
'u64'
|
|
1313
|
-
];
|
|
1314
|
-
const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
|
|
1315
|
-
return (tx) => tx.moveCall({
|
|
1316
|
-
package: packageAddress,
|
|
1317
|
-
module: 'account',
|
|
1318
|
-
function: 'has_permission',
|
|
1319
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1320
|
-
});
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
* Per-protocol effective permissions (used by protocol modules). Owner →
|
|
1324
|
-
* `PERM_ALL` for any protocol. Delegate → the bitmap stored at
|
|
1325
|
-
* `protocol_permissions[TypeName(PROTOCOL)]`, or `PERM_NONE` if absent or expired.
|
|
1326
|
-
* Stranger → `PERM_NONE`.
|
|
1327
|
-
*/
|
|
1328
|
-
export function effectiveProtocolPermissions(options) {
|
|
1329
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1330
|
-
const argumentsTypes = [
|
|
1331
|
-
null,
|
|
1332
|
-
'0x2::object::ID',
|
|
1333
|
-
'address',
|
|
1334
|
-
'u64'
|
|
1335
|
-
];
|
|
1336
|
-
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
1337
|
-
return (tx) => tx.moveCall({
|
|
1338
|
-
package: packageAddress,
|
|
1339
|
-
module: 'account',
|
|
1340
|
-
function: 'effective_protocol_permissions',
|
|
1341
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1342
|
-
typeArguments: options.typeArguments
|
|
1343
|
-
});
|
|
1344
|
-
}
|
|
1345
|
-
export function hasProtocolPermission(options) {
|
|
1346
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1347
|
-
const argumentsTypes = [
|
|
1348
|
-
null,
|
|
1349
|
-
'0x2::object::ID',
|
|
1350
|
-
'address',
|
|
1351
|
-
'u32',
|
|
1352
|
-
'u64'
|
|
1353
|
-
];
|
|
1354
|
-
const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
|
|
1355
|
-
return (tx) => tx.moveCall({
|
|
1356
|
-
package: packageAddress,
|
|
1357
|
-
module: 'account',
|
|
1358
|
-
function: 'has_protocol_permission',
|
|
1359
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1360
|
-
typeArguments: options.typeArguments
|
|
1361
|
-
});
|
|
1362
|
-
}
|
|
1363
|
-
export function accountBalance(options) {
|
|
1364
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1365
|
-
const argumentsTypes = [
|
|
1366
|
-
null,
|
|
1367
|
-
'0x2::object::ID'
|
|
1368
|
-
];
|
|
1369
|
-
const parameterNames = ["registry", "accountId"];
|
|
1370
|
-
return (tx) => tx.moveCall({
|
|
1371
|
-
package: packageAddress,
|
|
1372
|
-
module: 'account',
|
|
1373
|
-
function: 'account_balance',
|
|
1374
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1375
|
-
typeArguments: options.typeArguments
|
|
1376
|
-
});
|
|
1377
|
-
}
|
|
1378
|
-
export function accountBalances(options) {
|
|
1379
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1380
|
-
const argumentsTypes = [
|
|
1381
|
-
null,
|
|
1382
|
-
'0x2::object::ID'
|
|
1383
|
-
];
|
|
1384
|
-
const parameterNames = ["registry", "accountId"];
|
|
1385
|
-
return (tx) => tx.moveCall({
|
|
1386
|
-
package: packageAddress,
|
|
1387
|
-
module: 'account',
|
|
1388
|
-
function: 'account_balances',
|
|
1389
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1390
|
-
});
|
|
1391
|
-
}
|
|
1392
|
-
/**
|
|
1393
|
-
* Total `Balance<T>` currently held across all accounts. Counter; not derived from
|
|
1394
|
-
* iterating accounts. Excludes balance held by protocols (after `take`) and
|
|
1395
|
-
* balance sitting in hot-potato requests in flight.
|
|
1396
|
-
*/
|
|
1397
|
-
export function balance(options) {
|
|
1398
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1399
|
-
const argumentsTypes = [
|
|
1400
|
-
null
|
|
1401
|
-
];
|
|
1402
|
-
const parameterNames = ["registry"];
|
|
1403
|
-
return (tx) => tx.moveCall({
|
|
1404
|
-
package: packageAddress,
|
|
1405
|
-
module: 'account',
|
|
1406
|
-
function: 'balance',
|
|
1407
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1408
|
-
typeArguments: options.typeArguments
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
export function accountOwner(options) {
|
|
1412
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1413
|
-
const argumentsTypes = [
|
|
1414
|
-
null
|
|
1415
|
-
];
|
|
1416
|
-
const parameterNames = ["account"];
|
|
1417
|
-
return (tx) => tx.moveCall({
|
|
1418
|
-
package: packageAddress,
|
|
1419
|
-
module: 'account',
|
|
1420
|
-
function: 'account_owner',
|
|
1421
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1422
|
-
});
|
|
1423
|
-
}
|
|
1424
|
-
export function accountAlias(options) {
|
|
1425
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1426
|
-
const argumentsTypes = [
|
|
1427
|
-
null
|
|
1428
|
-
];
|
|
1429
|
-
const parameterNames = ["account"];
|
|
1430
|
-
return (tx) => tx.moveCall({
|
|
1431
|
-
package: packageAddress,
|
|
1432
|
-
module: 'account',
|
|
1433
|
-
function: 'account_alias',
|
|
1434
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1435
|
-
});
|
|
1436
|
-
}
|
|
1437
|
-
export function accountId(options) {
|
|
1438
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1439
|
-
const argumentsTypes = [
|
|
1440
|
-
null
|
|
1441
|
-
];
|
|
1442
|
-
const parameterNames = ["account"];
|
|
1443
|
-
return (tx) => tx.moveCall({
|
|
1444
|
-
package: packageAddress,
|
|
1445
|
-
module: 'account',
|
|
1446
|
-
function: 'account_id',
|
|
1447
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1448
|
-
});
|
|
1449
|
-
}
|
|
1450
|
-
export function accountAddress(options) {
|
|
1451
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1452
|
-
const argumentsTypes = [
|
|
1453
|
-
null
|
|
1454
|
-
];
|
|
1455
|
-
const parameterNames = ["account"];
|
|
1456
|
-
return (tx) => tx.moveCall({
|
|
1457
|
-
package: packageAddress,
|
|
1458
|
-
module: 'account',
|
|
1459
|
-
function: 'account_address',
|
|
1460
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1461
|
-
});
|
|
1462
|
-
}
|
|
1463
|
-
export function accountDelegates(options) {
|
|
1464
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1465
|
-
const argumentsTypes = [
|
|
1466
|
-
null
|
|
1467
|
-
];
|
|
1468
|
-
const parameterNames = ["account"];
|
|
1469
|
-
return (tx) => tx.moveCall({
|
|
1470
|
-
package: packageAddress,
|
|
1471
|
-
module: 'account',
|
|
1472
|
-
function: 'account_delegates',
|
|
1473
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
export function accountBalancesField(options) {
|
|
1477
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1478
|
-
const argumentsTypes = [
|
|
1479
|
-
null
|
|
1480
|
-
];
|
|
1481
|
-
const parameterNames = ["account"];
|
|
1482
|
-
return (tx) => tx.moveCall({
|
|
1483
|
-
package: packageAddress,
|
|
1484
|
-
module: 'account',
|
|
1485
|
-
function: 'account_balances_field',
|
|
1486
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1487
|
-
});
|
|
1488
|
-
}
|
|
1489
|
-
export function delegateAddress(options) {
|
|
1490
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1491
|
-
const argumentsTypes = [
|
|
1492
|
-
null
|
|
1493
|
-
];
|
|
1494
|
-
const parameterNames = ["delegate"];
|
|
1495
|
-
return (tx) => tx.moveCall({
|
|
1496
|
-
package: packageAddress,
|
|
1497
|
-
module: 'account',
|
|
1498
|
-
function: 'delegate_address',
|
|
1499
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1500
|
-
});
|
|
1501
|
-
}
|
|
1502
|
-
export function delegateAlias(options) {
|
|
1503
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1504
|
-
const argumentsTypes = [
|
|
1505
|
-
null
|
|
1506
|
-
];
|
|
1507
|
-
const parameterNames = ["delegate"];
|
|
1508
|
-
return (tx) => tx.moveCall({
|
|
1509
|
-
package: packageAddress,
|
|
1510
|
-
module: 'account',
|
|
1511
|
-
function: 'delegate_alias',
|
|
1512
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1513
|
-
});
|
|
1514
|
-
}
|
|
1515
|
-
export function delegatePermissions(options) {
|
|
1516
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1517
|
-
const argumentsTypes = [
|
|
1518
|
-
null
|
|
1519
|
-
];
|
|
1520
|
-
const parameterNames = ["delegate"];
|
|
1521
|
-
return (tx) => tx.moveCall({
|
|
1522
|
-
package: packageAddress,
|
|
1523
|
-
module: 'account',
|
|
1524
|
-
function: 'delegate_permissions',
|
|
1525
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1526
|
-
});
|
|
1527
|
-
}
|
|
1528
|
-
export function delegateProtocolPermissions(options) {
|
|
1529
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1530
|
-
const argumentsTypes = [
|
|
1531
|
-
null
|
|
1532
|
-
];
|
|
1533
|
-
const parameterNames = ["delegate"];
|
|
1534
|
-
return (tx) => tx.moveCall({
|
|
1535
|
-
package: packageAddress,
|
|
1536
|
-
module: 'account',
|
|
1537
|
-
function: 'delegate_protocol_permissions',
|
|
1538
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1539
|
-
});
|
|
1540
|
-
}
|
|
1541
|
-
export function delegateExpiresAtMs(options) {
|
|
1542
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1543
|
-
const argumentsTypes = [
|
|
1544
|
-
null
|
|
1545
|
-
];
|
|
1546
|
-
const parameterNames = ["delegate"];
|
|
1547
|
-
return (tx) => tx.moveCall({
|
|
1548
|
-
package: packageAddress,
|
|
1549
|
-
module: 'account',
|
|
1550
|
-
function: 'delegate_expires_at_ms',
|
|
1551
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1552
|
-
});
|
|
1553
|
-
}
|
|
1554
|
-
export function depositRequestAccountId(options) {
|
|
1555
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1556
|
-
const argumentsTypes = [
|
|
1557
|
-
null
|
|
1558
|
-
];
|
|
1559
|
-
const parameterNames = ["r"];
|
|
1560
|
-
return (tx) => tx.moveCall({
|
|
1561
|
-
package: packageAddress,
|
|
1562
|
-
module: 'account',
|
|
1563
|
-
function: 'deposit_request_account_id',
|
|
1564
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1565
|
-
typeArguments: options.typeArguments
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1568
|
-
export function depositRequestBalance(options) {
|
|
1569
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1570
|
-
const argumentsTypes = [
|
|
1571
|
-
null
|
|
1572
|
-
];
|
|
1573
|
-
const parameterNames = ["r"];
|
|
1574
|
-
return (tx) => tx.moveCall({
|
|
1575
|
-
package: packageAddress,
|
|
1576
|
-
module: 'account',
|
|
1577
|
-
function: 'deposit_request_balance',
|
|
1578
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1579
|
-
typeArguments: options.typeArguments
|
|
1580
|
-
});
|
|
1581
|
-
}
|
|
1582
|
-
export function depositRequestAmount(options) {
|
|
1583
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1584
|
-
const argumentsTypes = [
|
|
1585
|
-
null
|
|
1586
|
-
];
|
|
1587
|
-
const parameterNames = ["r"];
|
|
1588
|
-
return (tx) => tx.moveCall({
|
|
1589
|
-
package: packageAddress,
|
|
1590
|
-
module: 'account',
|
|
1591
|
-
function: 'deposit_request_amount',
|
|
1592
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1593
|
-
typeArguments: options.typeArguments
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1596
|
-
export function depositRequestExtraData(options) {
|
|
1597
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1598
|
-
const argumentsTypes = [
|
|
1599
|
-
null
|
|
1600
|
-
];
|
|
1601
|
-
const parameterNames = ["r"];
|
|
1602
|
-
return (tx) => tx.moveCall({
|
|
1603
|
-
package: packageAddress,
|
|
1604
|
-
module: 'account',
|
|
1605
|
-
function: 'deposit_request_extra_data',
|
|
1606
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1607
|
-
typeArguments: options.typeArguments
|
|
1608
|
-
});
|
|
1609
|
-
}
|
|
1610
|
-
export function withdrawRequestAccountId(options) {
|
|
1611
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1612
|
-
const argumentsTypes = [
|
|
1613
|
-
null
|
|
1614
|
-
];
|
|
1615
|
-
const parameterNames = ["r"];
|
|
1616
|
-
return (tx) => tx.moveCall({
|
|
1617
|
-
package: packageAddress,
|
|
1618
|
-
module: 'account',
|
|
1619
|
-
function: 'withdraw_request_account_id',
|
|
1620
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1621
|
-
typeArguments: options.typeArguments
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
export function withdrawRequestBalance(options) {
|
|
1625
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1626
|
-
const argumentsTypes = [
|
|
1627
|
-
null
|
|
1628
|
-
];
|
|
1629
|
-
const parameterNames = ["r"];
|
|
1630
|
-
return (tx) => tx.moveCall({
|
|
1631
|
-
package: packageAddress,
|
|
1632
|
-
module: 'account',
|
|
1633
|
-
function: 'withdraw_request_balance',
|
|
1634
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1635
|
-
typeArguments: options.typeArguments
|
|
1636
|
-
});
|
|
1637
|
-
}
|
|
1638
|
-
export function withdrawRequestAmount(options) {
|
|
1639
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1640
|
-
const argumentsTypes = [
|
|
1641
|
-
null
|
|
1642
|
-
];
|
|
1643
|
-
const parameterNames = ["r"];
|
|
1644
|
-
return (tx) => tx.moveCall({
|
|
1645
|
-
package: packageAddress,
|
|
1646
|
-
module: 'account',
|
|
1647
|
-
function: 'withdraw_request_amount',
|
|
1648
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1649
|
-
typeArguments: options.typeArguments
|
|
1650
|
-
});
|
|
1651
|
-
}
|
|
1652
|
-
export function withdrawRequestRecipient(options) {
|
|
1653
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1654
|
-
const argumentsTypes = [
|
|
1655
|
-
null
|
|
1656
|
-
];
|
|
1657
|
-
const parameterNames = ["r"];
|
|
1658
|
-
return (tx) => tx.moveCall({
|
|
1659
|
-
package: packageAddress,
|
|
1660
|
-
module: 'account',
|
|
1661
|
-
function: 'withdraw_request_recipient',
|
|
1662
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1663
|
-
typeArguments: options.typeArguments
|
|
1664
|
-
});
|
|
1665
|
-
}
|
|
1666
|
-
export function withdrawRequestExtraData(options) {
|
|
1667
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1668
|
-
const argumentsTypes = [
|
|
1669
|
-
null
|
|
1670
|
-
];
|
|
1671
|
-
const parameterNames = ["r"];
|
|
1672
|
-
return (tx) => tx.moveCall({
|
|
1673
|
-
package: packageAddress,
|
|
1674
|
-
module: 'account',
|
|
1675
|
-
function: 'withdraw_request_extra_data',
|
|
1676
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1677
|
-
typeArguments: options.typeArguments
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
export function newData(options) {
|
|
1681
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1682
|
-
const argumentsTypes = [
|
|
1683
|
-
null,
|
|
1684
|
-
'0x2::object::ID',
|
|
1685
|
-
`${options.typeArguments[0]}`,
|
|
1686
|
-
`${options.typeArguments[1]}`
|
|
1687
|
-
];
|
|
1688
|
-
const parameterNames = ["registry", "accountId", "Witness", "data"];
|
|
1689
|
-
return (tx) => tx.moveCall({
|
|
1690
|
-
package: packageAddress,
|
|
1691
|
-
module: 'account',
|
|
1692
|
-
function: 'new_data',
|
|
1693
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1694
|
-
typeArguments: options.typeArguments
|
|
1695
|
-
});
|
|
1696
|
-
}
|
|
1697
|
-
export function borrowData(options) {
|
|
1698
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1699
|
-
const argumentsTypes = [
|
|
1700
|
-
null,
|
|
1701
|
-
'0x2::object::ID'
|
|
1702
|
-
];
|
|
1703
|
-
const parameterNames = ["registry", "accountId"];
|
|
1704
|
-
return (tx) => tx.moveCall({
|
|
1705
|
-
package: packageAddress,
|
|
1706
|
-
module: 'account',
|
|
1707
|
-
function: 'borrow_data',
|
|
1708
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1709
|
-
typeArguments: options.typeArguments
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
export function borrowDataMut(options) {
|
|
1713
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1714
|
-
const argumentsTypes = [
|
|
1715
|
-
null,
|
|
1716
|
-
'0x2::object::ID',
|
|
1717
|
-
`${options.typeArguments[0]}`
|
|
1718
|
-
];
|
|
1719
|
-
const parameterNames = ["registry", "accountId", "Witness"];
|
|
1720
|
-
return (tx) => tx.moveCall({
|
|
1721
|
-
package: packageAddress,
|
|
1722
|
-
module: 'account',
|
|
1723
|
-
function: 'borrow_data_mut',
|
|
1724
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1725
|
-
typeArguments: options.typeArguments
|
|
1726
|
-
});
|
|
1727
|
-
}
|
|
1728
|
-
export function hasData(options) {
|
|
1729
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1730
|
-
const argumentsTypes = [
|
|
1731
|
-
null,
|
|
1732
|
-
'0x2::object::ID'
|
|
1733
|
-
];
|
|
1734
|
-
const parameterNames = ["registry", "accountId"];
|
|
1735
|
-
return (tx) => tx.moveCall({
|
|
1736
|
-
package: packageAddress,
|
|
1737
|
-
module: 'account',
|
|
1738
|
-
function: 'has_data',
|
|
1739
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1740
|
-
typeArguments: options.typeArguments
|
|
1741
|
-
});
|
|
1742
|
-
}
|
|
1743
|
-
export function removeData(options) {
|
|
1744
|
-
const packageAddress = options.package ?? '@waterx/account';
|
|
1745
|
-
const argumentsTypes = [
|
|
1746
|
-
null,
|
|
1747
|
-
'0x2::object::ID',
|
|
1748
|
-
`${options.typeArguments[0]}`
|
|
1749
|
-
];
|
|
1750
|
-
const parameterNames = ["registry", "accountId", "Witness"];
|
|
1751
|
-
return (tx) => tx.moveCall({
|
|
1752
|
-
package: packageAddress,
|
|
1753
|
-
module: 'account',
|
|
1754
|
-
function: 'remove_data',
|
|
1755
|
-
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1756
|
-
typeArguments: options.typeArguments
|
|
1757
|
-
});
|
|
1758
|
-
}
|