@waterx/predict-sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +67 -0
- package/dist/src/account.d.ts +64 -0
- package/dist/src/account.js +134 -0
- package/dist/src/admin.d.ts +47 -0
- package/dist/src/admin.js +104 -0
- package/dist/src/bcs.d.ts +20 -0
- package/dist/src/bcs.js +209 -0
- package/dist/src/client.d.ts +60 -0
- package/dist/src/client.js +59 -0
- package/dist/src/constants.d.ts +61 -0
- package/dist/src/constants.js +62 -0
- package/dist/src/fetch.d.ts +53 -0
- package/dist/src/fetch.js +187 -0
- package/dist/src/generated/bucket_v2_framework/account.d.ts +100 -0
- package/dist/src/generated/bucket_v2_framework/account.js +129 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.d.ts +6 -0
- package/dist/src/generated/bucket_v2_framework/deps/std/type_name.js +19 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/balance.js +14 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/bucket_v2_framework/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/bucket_v2_framework/double.d.ts +382 -0
- package/dist/src/generated/bucket_v2_framework/double.js +466 -0
- package/dist/src/generated/bucket_v2_framework/float.d.ts +362 -0
- package/dist/src/generated/bucket_v2_framework/float.js +440 -0
- package/dist/src/generated/bucket_v2_framework/liability.d.ts +193 -0
- package/dist/src/generated/bucket_v2_framework/liability.js +205 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.d.ts +384 -0
- package/dist/src/generated/bucket_v2_framework/linked_table.js +382 -0
- package/dist/src/generated/bucket_v2_framework/sheet.d.ts +344 -0
- package/dist/src/generated/bucket_v2_framework/sheet.js +344 -0
- package/dist/src/generated/utils/index.d.ts +30 -0
- package/dist/src/generated/utils/index.js +157 -0
- package/dist/src/generated/waterx_account/account.d.ts +1326 -0
- package/dist/src/generated/waterx_account/account.js +1487 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.d.ts +6 -0
- package/dist/src/generated/waterx_account/deps/std/type_name.js +19 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/waterx_account/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_account/deps/sui/table.d.ts +24 -0
- package/dist/src/generated/waterx_account/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.d.ts +36 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_map.js +27 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_account/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_account/direct_rule.d.ts +72 -0
- package/dist/src/generated/waterx_account/direct_rule.js +75 -0
- package/dist/src/generated/waterx_account/events.d.ts +30 -0
- package/dist/src/generated/waterx_account/events.js +145 -0
- package/dist/src/generated/waterx_account/version.d.ts +10 -0
- package/dist/src/generated/waterx_account/version.js +8 -0
- package/dist/src/generated/waterx_prediction/account_data.d.ts +321 -0
- package/dist/src/generated/waterx_prediction/account_data.js +399 -0
- package/dist/src/generated/waterx_prediction/admin.d.ts +5 -0
- package/dist/src/generated/waterx_prediction/admin.js +9 -0
- package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.d.ts +8 -0
- package/dist/src/generated/waterx_prediction/deps/bucket_v2_framework/linked_table.js +18 -0
- package/dist/src/generated/waterx_prediction/deps/sui/balance.d.ts +10 -0
- package/dist/src/generated/waterx_prediction/deps/sui/balance.js +14 -0
- package/dist/src/generated/waterx_prediction/deps/sui/table.d.ts +24 -0
- package/dist/src/generated/waterx_prediction/deps/sui/table.js +31 -0
- package/dist/src/generated/waterx_prediction/deps/sui/vec_set.d.ts +16 -0
- package/dist/src/generated/waterx_prediction/deps/sui/vec_set.js +19 -0
- package/dist/src/generated/waterx_prediction/events.d.ts +19 -0
- package/dist/src/generated/waterx_prediction/events.js +99 -0
- package/dist/src/generated/waterx_prediction/global_config.d.ts +68 -0
- package/dist/src/generated/waterx_prediction/global_config.js +83 -0
- package/dist/src/generated/waterx_prediction/order.d.ts +170 -0
- package/dist/src/generated/waterx_prediction/order.js +237 -0
- package/dist/src/generated/waterx_prediction/outcome.d.ts +58 -0
- package/dist/src/generated/waterx_prediction/outcome.js +73 -0
- package/dist/src/generated/waterx_prediction/position.d.ts +150 -0
- package/dist/src/generated/waterx_prediction/position.js +200 -0
- package/dist/src/generated/waterx_prediction/view.d.ts +353 -0
- package/dist/src/generated/waterx_prediction/view.js +426 -0
- package/dist/src/generated/waterx_prediction/waterx_prediction.d.ts +1520 -0
- package/dist/src/generated/waterx_prediction/waterx_prediction.js +1550 -0
- package/dist/src/index.d.ts +22 -0
- package/dist/src/index.js +17 -0
- package/dist/src/prediction.d.ts +81 -0
- package/dist/src/prediction.js +220 -0
- package/dist/src/types.d.ts +81 -0
- package/dist/src/types.js +1 -0
- package/dist/src/user/account.d.ts +2 -0
- package/dist/src/user/account.js +1 -0
- package/dist/src/user/admin.d.ts +4 -0
- package/dist/src/user/admin.js +2 -0
- package/dist/src/user/index.d.ts +4 -0
- package/dist/src/user/index.js +2 -0
- package/dist/src/user/keeper.d.ts +2 -0
- package/dist/src/user/keeper.js +1 -0
- package/dist/src/user/order.d.ts +2 -0
- package/dist/src/user/order.js +1 -0
- package/dist/src/user/position.d.ts +2 -0
- package/dist/src/user/position.js +1 -0
- package/dist/src/utils/bcs.d.ts +1 -0
- package/dist/src/utils/bcs.js +1 -0
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils.d.ts +29 -0
- package/dist/src/utils.js +170 -0
- package/package.json +62 -0
|
@@ -0,0 +1,1487 @@
|
|
|
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<USDX>` and credits the account via `put<USDX, 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 table from "./deps/sui/table.js";
|
|
32
|
+
import * as table_1 from "./deps/sui/table.js";
|
|
33
|
+
import * as vec_set from "./deps/sui/vec_set.js";
|
|
34
|
+
import * as type_name from "./deps/std/type_name.js";
|
|
35
|
+
import * as vec_map from "./deps/sui/vec_map.js";
|
|
36
|
+
import * as type_name_1 from "./deps/std/type_name.js";
|
|
37
|
+
import * as type_name_2 from "./deps/std/type_name.js";
|
|
38
|
+
import * as vec_map_1 from "./deps/sui/vec_map.js";
|
|
39
|
+
import * as type_name_3 from "./deps/std/type_name.js";
|
|
40
|
+
import * as type_name_4 from "./deps/std/type_name.js";
|
|
41
|
+
import * as vec_map_2 from "./deps/sui/vec_map.js";
|
|
42
|
+
import * as type_name_5 from "./deps/std/type_name.js";
|
|
43
|
+
import * as vec_set_1 from "./deps/sui/vec_set.js";
|
|
44
|
+
import * as vec_set_2 from "./deps/sui/vec_set.js";
|
|
45
|
+
import * as vec_map_3 from "./deps/sui/vec_map.js";
|
|
46
|
+
import * as type_name_6 from "./deps/std/type_name.js";
|
|
47
|
+
import * as vec_map_4 from "./deps/sui/vec_map.js";
|
|
48
|
+
import * as type_name_7 from "./deps/std/type_name.js";
|
|
49
|
+
import * as balance_1 from "./deps/sui/balance.js";
|
|
50
|
+
import * as balance_2 from "./deps/sui/balance.js";
|
|
51
|
+
const $moduleName = '@waterx/account::account';
|
|
52
|
+
export const ACCOUNT = new MoveStruct({ name: `${$moduleName}::ACCOUNT`, fields: {
|
|
53
|
+
dummy_field: bcs.bool()
|
|
54
|
+
} });
|
|
55
|
+
export const AdminCap = new MoveStruct({ name: `${$moduleName}::AdminCap`, fields: {
|
|
56
|
+
id: bcs.Address
|
|
57
|
+
} });
|
|
58
|
+
export const AccountRegistry = new MoveStruct({ name: `${$moduleName}::AccountRegistry`, fields: {
|
|
59
|
+
id: bcs.Address,
|
|
60
|
+
accounts: table.Table,
|
|
61
|
+
owner_index: table_1.Table,
|
|
62
|
+
/**
|
|
63
|
+
* Admin-managed whitelist of protocol witness types allowed to move funds
|
|
64
|
+
* (`take<T, P>` / `put<T, P>`) and mutate per-account protocol data
|
|
65
|
+
* (`new_data<P, D>` / `borrow_data_mut<P, D>` / `remove_data<P, D>`).
|
|
66
|
+
* Witness-construction privacy alone is not sufficient — any package can deploy
|
|
67
|
+
* its own witness type, so without this whitelist any deployed module could drain
|
|
68
|
+
* any account. Admin opts each protocol in once via
|
|
69
|
+
* `whitelist_protocol<P>(&AdminCap, registry, clock)`.
|
|
70
|
+
*/
|
|
71
|
+
protocol_whitelist: vec_set.VecSet(type_name.TypeName),
|
|
72
|
+
/**
|
|
73
|
+
* `T → registered DepositPolicy witness TypeName`. Presence means
|
|
74
|
+
* `request_deposit<T>` / `request_deposit_from_receivings<T>` are permitted; only
|
|
75
|
+
* the module that defines the registered witness type can call
|
|
76
|
+
* `consume_deposit<T, P>` to unwrap the resulting `DepositRequest<T>`. Deposit
|
|
77
|
+
* policy registration is independent of `protocol_whitelist` — a policy can be the
|
|
78
|
+
* _consumer_ of a request without being allowed to `take`/`put`.
|
|
79
|
+
*/
|
|
80
|
+
deposit_policies: vec_map.VecMap(type_name_1.TypeName, type_name_2.TypeName),
|
|
81
|
+
/**
|
|
82
|
+
* `T → registered WithdrawPolicy witness TypeName`. Symmetric to
|
|
83
|
+
* `deposit_policies` for `request_withdraw<T>` / `consume_withdraw`.
|
|
84
|
+
*/
|
|
85
|
+
withdraw_policies: vec_map_1.VecMap(type_name_3.TypeName, type_name_4.TypeName),
|
|
86
|
+
/**
|
|
87
|
+
* Per-T aggregate of `Balance<T>` currently held inside accounts. Incremented in
|
|
88
|
+
* `put<T, P>`, decremented in `take<T, P>` and `request_withdraw<T>`. Does _not_
|
|
89
|
+
* include balance held by protocols (after `take`) or sitting in flight inside a
|
|
90
|
+
* `DepositRequest` / `WithdrawRequest` hot potato.
|
|
91
|
+
*/
|
|
92
|
+
balances: vec_map_2.VecMap(type_name_5.TypeName, bcs.u64()),
|
|
93
|
+
allowed_versions: vec_set_1.VecSet(bcs.u16()),
|
|
94
|
+
managers: vec_set_2.VecSet(bcs.Address),
|
|
95
|
+
paused: bcs.bool()
|
|
96
|
+
} });
|
|
97
|
+
export const BalanceKey = new MoveTuple({ name: `${$moduleName}::BalanceKey<phantom T>`, fields: [bcs.bool()] });
|
|
98
|
+
export const ProtocolDataKey = new MoveTuple({ name: `${$moduleName}::ProtocolDataKey<phantom PROTOCOL>`, fields: [bcs.bool()] });
|
|
99
|
+
export const Delegate = new MoveStruct({ name: `${$moduleName}::Delegate`, fields: {
|
|
100
|
+
delegate_address: bcs.Address,
|
|
101
|
+
alias: bcs.string(),
|
|
102
|
+
/** Framework-level action bitmap (PERM_WITHDRAW etc). */
|
|
103
|
+
permissions: bcs.u32(),
|
|
104
|
+
/**
|
|
105
|
+
* Per-protocol bitmap. Missing key → delegate cannot drive that protocol. Each
|
|
106
|
+
* protocol's module interprets its own bits. Owner always has `PERM_ALL` per
|
|
107
|
+
* protocol regardless of this field.
|
|
108
|
+
*/
|
|
109
|
+
protocol_permissions: vec_map_3.VecMap(type_name_6.TypeName, bcs.u32()),
|
|
110
|
+
expires_at_ms: bcs.option(bcs.u64())
|
|
111
|
+
} });
|
|
112
|
+
export const Account = new MoveStruct({ name: `${$moduleName}::Account`, fields: {
|
|
113
|
+
id: bcs.Address,
|
|
114
|
+
owner_address: bcs.Address,
|
|
115
|
+
alias: bcs.string(),
|
|
116
|
+
delegates: bcs.vector(Delegate),
|
|
117
|
+
/**
|
|
118
|
+
* Mirror of the per-T `Balance<T>` values stored as dynamic fields under
|
|
119
|
+
* `BalanceKey<T>()` on this UID. Always equals the matching stored balance's
|
|
120
|
+
* `value()`.
|
|
121
|
+
*/
|
|
122
|
+
balances: vec_map_4.VecMap(type_name_7.TypeName, bcs.u64())
|
|
123
|
+
} });
|
|
124
|
+
export const DepositRequest = new MoveStruct({ name: `${$moduleName}::DepositRequest<phantom T>`, fields: {
|
|
125
|
+
account_id: bcs.Address,
|
|
126
|
+
balance: balance_1.Balance,
|
|
127
|
+
extra_data: bcs.vector(bcs.u8())
|
|
128
|
+
} });
|
|
129
|
+
export const WithdrawRequest = new MoveStruct({ name: `${$moduleName}::WithdrawRequest<phantom T>`, fields: {
|
|
130
|
+
account_id: bcs.Address,
|
|
131
|
+
balance: balance_2.Balance,
|
|
132
|
+
recipient: bcs.Address,
|
|
133
|
+
extra_data: bcs.vector(bcs.u8())
|
|
134
|
+
} });
|
|
135
|
+
export function permNone(options = {}) {
|
|
136
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
137
|
+
return (tx) => tx.moveCall({
|
|
138
|
+
package: packageAddress,
|
|
139
|
+
module: 'account',
|
|
140
|
+
function: 'perm_none',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
export function permWithdraw(options = {}) {
|
|
144
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
145
|
+
return (tx) => tx.moveCall({
|
|
146
|
+
package: packageAddress,
|
|
147
|
+
module: 'account',
|
|
148
|
+
function: 'perm_withdraw',
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
export function permManageDelegates(options = {}) {
|
|
152
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
153
|
+
return (tx) => tx.moveCall({
|
|
154
|
+
package: packageAddress,
|
|
155
|
+
module: 'account',
|
|
156
|
+
function: 'perm_manage_delegates',
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export function permReceive(options = {}) {
|
|
160
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
161
|
+
return (tx) => tx.moveCall({
|
|
162
|
+
package: packageAddress,
|
|
163
|
+
module: 'account',
|
|
164
|
+
function: 'perm_receive',
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
export function permAll(options = {}) {
|
|
168
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
169
|
+
return (tx) => tx.moveCall({
|
|
170
|
+
package: packageAddress,
|
|
171
|
+
module: 'account',
|
|
172
|
+
function: 'perm_all',
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
export function aliasMaxLength(options = {}) {
|
|
176
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
177
|
+
return (tx) => tx.moveCall({
|
|
178
|
+
package: packageAddress,
|
|
179
|
+
module: 'account',
|
|
180
|
+
function: 'alias_max_length',
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
export function maxAccountsPerOwner(options = {}) {
|
|
184
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
185
|
+
return (tx) => tx.moveCall({
|
|
186
|
+
package: packageAddress,
|
|
187
|
+
module: 'account',
|
|
188
|
+
function: 'max_accounts_per_owner',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
export function maxDelegatesPerAccount(options = {}) {
|
|
192
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
193
|
+
return (tx) => tx.moveCall({
|
|
194
|
+
package: packageAddress,
|
|
195
|
+
module: 'account',
|
|
196
|
+
function: 'max_delegates_per_account',
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
export function maxProtocolPermsPerDelegate(options = {}) {
|
|
200
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
201
|
+
return (tx) => tx.moveCall({
|
|
202
|
+
package: packageAddress,
|
|
203
|
+
module: 'account',
|
|
204
|
+
function: 'max_protocol_perms_per_delegate',
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
export function assertVersion(options) {
|
|
208
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
209
|
+
const argumentsTypes = [
|
|
210
|
+
null
|
|
211
|
+
];
|
|
212
|
+
const parameterNames = ["registry"];
|
|
213
|
+
return (tx) => tx.moveCall({
|
|
214
|
+
package: packageAddress,
|
|
215
|
+
module: 'account',
|
|
216
|
+
function: 'assert_version',
|
|
217
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
export function isVersionAllowed(options) {
|
|
221
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
222
|
+
const argumentsTypes = [
|
|
223
|
+
null,
|
|
224
|
+
'u16'
|
|
225
|
+
];
|
|
226
|
+
const parameterNames = ["registry", "v"];
|
|
227
|
+
return (tx) => tx.moveCall({
|
|
228
|
+
package: packageAddress,
|
|
229
|
+
module: 'account',
|
|
230
|
+
function: 'is_version_allowed',
|
|
231
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
export function allowVersion(options) {
|
|
235
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
236
|
+
const argumentsTypes = [
|
|
237
|
+
null,
|
|
238
|
+
null,
|
|
239
|
+
'u16'
|
|
240
|
+
];
|
|
241
|
+
const parameterNames = ["registry", "_", "v"];
|
|
242
|
+
return (tx) => tx.moveCall({
|
|
243
|
+
package: packageAddress,
|
|
244
|
+
module: 'account',
|
|
245
|
+
function: 'allow_version',
|
|
246
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
export function disallowVersion(options) {
|
|
250
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
251
|
+
const argumentsTypes = [
|
|
252
|
+
null,
|
|
253
|
+
null,
|
|
254
|
+
'u16'
|
|
255
|
+
];
|
|
256
|
+
const parameterNames = ["registry", "_", "v"];
|
|
257
|
+
return (tx) => tx.moveCall({
|
|
258
|
+
package: packageAddress,
|
|
259
|
+
module: 'account',
|
|
260
|
+
function: 'disallow_version',
|
|
261
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
export function isPaused(options) {
|
|
265
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
266
|
+
const argumentsTypes = [
|
|
267
|
+
null
|
|
268
|
+
];
|
|
269
|
+
const parameterNames = ["registry"];
|
|
270
|
+
return (tx) => tx.moveCall({
|
|
271
|
+
package: packageAddress,
|
|
272
|
+
module: 'account',
|
|
273
|
+
function: 'is_paused',
|
|
274
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
export function assertNotPaused(options) {
|
|
278
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
279
|
+
const argumentsTypes = [
|
|
280
|
+
null
|
|
281
|
+
];
|
|
282
|
+
const parameterNames = ["registry"];
|
|
283
|
+
return (tx) => tx.moveCall({
|
|
284
|
+
package: packageAddress,
|
|
285
|
+
module: 'account',
|
|
286
|
+
function: 'assert_not_paused',
|
|
287
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
export function pause(options) {
|
|
291
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
292
|
+
const argumentsTypes = [
|
|
293
|
+
null,
|
|
294
|
+
null
|
|
295
|
+
];
|
|
296
|
+
const parameterNames = ["registry", "managerRequest"];
|
|
297
|
+
return (tx) => tx.moveCall({
|
|
298
|
+
package: packageAddress,
|
|
299
|
+
module: 'account',
|
|
300
|
+
function: 'pause',
|
|
301
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
export function unpause(options) {
|
|
305
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
306
|
+
const argumentsTypes = [
|
|
307
|
+
null,
|
|
308
|
+
null
|
|
309
|
+
];
|
|
310
|
+
const parameterNames = ["registry", "_"];
|
|
311
|
+
return (tx) => tx.moveCall({
|
|
312
|
+
package: packageAddress,
|
|
313
|
+
module: 'account',
|
|
314
|
+
function: 'unpause',
|
|
315
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
export function isManager(options) {
|
|
319
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
320
|
+
const argumentsTypes = [
|
|
321
|
+
null,
|
|
322
|
+
'address'
|
|
323
|
+
];
|
|
324
|
+
const parameterNames = ["registry", "addr"];
|
|
325
|
+
return (tx) => tx.moveCall({
|
|
326
|
+
package: packageAddress,
|
|
327
|
+
module: 'account',
|
|
328
|
+
function: 'is_manager',
|
|
329
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
export function managers(options) {
|
|
333
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
334
|
+
const argumentsTypes = [
|
|
335
|
+
null
|
|
336
|
+
];
|
|
337
|
+
const parameterNames = ["registry"];
|
|
338
|
+
return (tx) => tx.moveCall({
|
|
339
|
+
package: packageAddress,
|
|
340
|
+
module: 'account',
|
|
341
|
+
function: 'managers',
|
|
342
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
export function addManager(options) {
|
|
346
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
347
|
+
const argumentsTypes = [
|
|
348
|
+
null,
|
|
349
|
+
null,
|
|
350
|
+
'address'
|
|
351
|
+
];
|
|
352
|
+
const parameterNames = ["registry", "_", "manager"];
|
|
353
|
+
return (tx) => tx.moveCall({
|
|
354
|
+
package: packageAddress,
|
|
355
|
+
module: 'account',
|
|
356
|
+
function: 'add_manager',
|
|
357
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
export function removeManager(options) {
|
|
361
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
362
|
+
const argumentsTypes = [
|
|
363
|
+
null,
|
|
364
|
+
null,
|
|
365
|
+
'address'
|
|
366
|
+
];
|
|
367
|
+
const parameterNames = ["registry", "_", "manager"];
|
|
368
|
+
return (tx) => tx.moveCall({
|
|
369
|
+
package: packageAddress,
|
|
370
|
+
module: 'account',
|
|
371
|
+
function: 'remove_manager',
|
|
372
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
export function isProtocolWhitelisted(options) {
|
|
376
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
377
|
+
const argumentsTypes = [
|
|
378
|
+
null
|
|
379
|
+
];
|
|
380
|
+
const parameterNames = ["registry"];
|
|
381
|
+
return (tx) => tx.moveCall({
|
|
382
|
+
package: packageAddress,
|
|
383
|
+
module: 'account',
|
|
384
|
+
function: 'is_protocol_whitelisted',
|
|
385
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
386
|
+
typeArguments: options.typeArguments
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
export function protocolWhitelist(options) {
|
|
390
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
391
|
+
const argumentsTypes = [
|
|
392
|
+
null
|
|
393
|
+
];
|
|
394
|
+
const parameterNames = ["registry"];
|
|
395
|
+
return (tx) => tx.moveCall({
|
|
396
|
+
package: packageAddress,
|
|
397
|
+
module: 'account',
|
|
398
|
+
function: 'protocol_whitelist',
|
|
399
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Admin: add witness type `P` to the protocol whitelist. Only modules whose
|
|
404
|
+
* witness type is whitelisted can call `take` / `put` and the witness-gated
|
|
405
|
+
* data-slot helpers. Strict — aborts if `P` is already listed.
|
|
406
|
+
*/
|
|
407
|
+
export function whitelistProtocol(options) {
|
|
408
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
409
|
+
const argumentsTypes = [
|
|
410
|
+
null,
|
|
411
|
+
null
|
|
412
|
+
];
|
|
413
|
+
const parameterNames = ["registry", "_"];
|
|
414
|
+
return (tx) => tx.moveCall({
|
|
415
|
+
package: packageAddress,
|
|
416
|
+
module: 'account',
|
|
417
|
+
function: 'whitelist_protocol',
|
|
418
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
419
|
+
typeArguments: options.typeArguments
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Admin: remove witness type `P` from the protocol whitelist. After this, every
|
|
424
|
+
* `take<T, P>` / `put<T, P>` and witness-gated data-slot call aborts. Existing
|
|
425
|
+
* data slots and protocol-held balances are untouched — only future calls are
|
|
426
|
+
* blocked, so admin can pause a misbehaving protocol without stranding state on
|
|
427
|
+
* accounts.
|
|
428
|
+
*/
|
|
429
|
+
export function delistProtocol(options) {
|
|
430
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
431
|
+
const argumentsTypes = [
|
|
432
|
+
null,
|
|
433
|
+
null
|
|
434
|
+
];
|
|
435
|
+
const parameterNames = ["registry", "_"];
|
|
436
|
+
return (tx) => tx.moveCall({
|
|
437
|
+
package: packageAddress,
|
|
438
|
+
module: 'account',
|
|
439
|
+
function: 'delist_protocol',
|
|
440
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
441
|
+
typeArguments: options.typeArguments
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
export function isDepositPolicyRegistered(options) {
|
|
445
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
446
|
+
const argumentsTypes = [
|
|
447
|
+
null
|
|
448
|
+
];
|
|
449
|
+
const parameterNames = ["registry"];
|
|
450
|
+
return (tx) => tx.moveCall({
|
|
451
|
+
package: packageAddress,
|
|
452
|
+
module: 'account',
|
|
453
|
+
function: 'is_deposit_policy_registered',
|
|
454
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
455
|
+
typeArguments: options.typeArguments
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
export function isWithdrawPolicyRegistered(options) {
|
|
459
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
460
|
+
const argumentsTypes = [
|
|
461
|
+
null
|
|
462
|
+
];
|
|
463
|
+
const parameterNames = ["registry"];
|
|
464
|
+
return (tx) => tx.moveCall({
|
|
465
|
+
package: packageAddress,
|
|
466
|
+
module: 'account',
|
|
467
|
+
function: 'is_withdraw_policy_registered',
|
|
468
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
469
|
+
typeArguments: options.typeArguments
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
export function depositPolicy(options) {
|
|
473
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
474
|
+
const argumentsTypes = [
|
|
475
|
+
null
|
|
476
|
+
];
|
|
477
|
+
const parameterNames = ["registry"];
|
|
478
|
+
return (tx) => tx.moveCall({
|
|
479
|
+
package: packageAddress,
|
|
480
|
+
module: 'account',
|
|
481
|
+
function: 'deposit_policy',
|
|
482
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
483
|
+
typeArguments: options.typeArguments
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
export function withdrawPolicy(options) {
|
|
487
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
488
|
+
const argumentsTypes = [
|
|
489
|
+
null
|
|
490
|
+
];
|
|
491
|
+
const parameterNames = ["registry"];
|
|
492
|
+
return (tx) => tx.moveCall({
|
|
493
|
+
package: packageAddress,
|
|
494
|
+
module: 'account',
|
|
495
|
+
function: 'withdraw_policy',
|
|
496
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
497
|
+
typeArguments: options.typeArguments
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
export function depositPolicies(options) {
|
|
501
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
502
|
+
const argumentsTypes = [
|
|
503
|
+
null
|
|
504
|
+
];
|
|
505
|
+
const parameterNames = ["registry"];
|
|
506
|
+
return (tx) => tx.moveCall({
|
|
507
|
+
package: packageAddress,
|
|
508
|
+
module: 'account',
|
|
509
|
+
function: 'deposit_policies',
|
|
510
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
export function withdrawPolicies(options) {
|
|
514
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
515
|
+
const argumentsTypes = [
|
|
516
|
+
null
|
|
517
|
+
];
|
|
518
|
+
const parameterNames = ["registry"];
|
|
519
|
+
return (tx) => tx.moveCall({
|
|
520
|
+
package: packageAddress,
|
|
521
|
+
module: 'account',
|
|
522
|
+
function: 'withdraw_policies',
|
|
523
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Admin: register witness type `P` as the deposit policy for `T`. Only the module
|
|
528
|
+
* that defines `P` can construct one, so this binds `T`'s deposit flow exclusively
|
|
529
|
+
* to that module. Aborts if `T` is already registered — admin must
|
|
530
|
+
* `unregister_deposit_policy<T>` first to swap.
|
|
531
|
+
*/
|
|
532
|
+
export function registerDepositPolicy(options) {
|
|
533
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
534
|
+
const argumentsTypes = [
|
|
535
|
+
null,
|
|
536
|
+
null
|
|
537
|
+
];
|
|
538
|
+
const parameterNames = ["registry", "_"];
|
|
539
|
+
return (tx) => tx.moveCall({
|
|
540
|
+
package: packageAddress,
|
|
541
|
+
module: 'account',
|
|
542
|
+
function: 'register_deposit_policy',
|
|
543
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
544
|
+
typeArguments: options.typeArguments
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
export function registerWithdrawPolicy(options) {
|
|
548
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
549
|
+
const argumentsTypes = [
|
|
550
|
+
null,
|
|
551
|
+
null
|
|
552
|
+
];
|
|
553
|
+
const parameterNames = ["registry", "_"];
|
|
554
|
+
return (tx) => tx.moveCall({
|
|
555
|
+
package: packageAddress,
|
|
556
|
+
module: 'account',
|
|
557
|
+
function: 'register_withdraw_policy',
|
|
558
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
559
|
+
typeArguments: options.typeArguments
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Admin: remove the deposit policy for `T`. Existing `Balance<T>` on accounts is
|
|
564
|
+
* unaffected; only new `request_deposit<T>` is blocked.
|
|
565
|
+
*/
|
|
566
|
+
export function unregisterDepositPolicy(options) {
|
|
567
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
568
|
+
const argumentsTypes = [
|
|
569
|
+
null,
|
|
570
|
+
null
|
|
571
|
+
];
|
|
572
|
+
const parameterNames = ["registry", "_"];
|
|
573
|
+
return (tx) => tx.moveCall({
|
|
574
|
+
package: packageAddress,
|
|
575
|
+
module: 'account',
|
|
576
|
+
function: 'unregister_deposit_policy',
|
|
577
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
578
|
+
typeArguments: options.typeArguments
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
export function unregisterWithdrawPolicy(options) {
|
|
582
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
583
|
+
const argumentsTypes = [
|
|
584
|
+
null,
|
|
585
|
+
null
|
|
586
|
+
];
|
|
587
|
+
const parameterNames = ["registry", "_"];
|
|
588
|
+
return (tx) => tx.moveCall({
|
|
589
|
+
package: packageAddress,
|
|
590
|
+
module: 'account',
|
|
591
|
+
function: 'unregister_withdraw_policy',
|
|
592
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
593
|
+
typeArguments: options.typeArguments
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
export function createAccount(options) {
|
|
597
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
598
|
+
const argumentsTypes = [
|
|
599
|
+
null,
|
|
600
|
+
null,
|
|
601
|
+
'0x1::string::String'
|
|
602
|
+
];
|
|
603
|
+
const parameterNames = ["registry", "senderRequest", "alias"];
|
|
604
|
+
return (tx) => tx.moveCall({
|
|
605
|
+
package: packageAddress,
|
|
606
|
+
module: 'account',
|
|
607
|
+
function: 'create_account',
|
|
608
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
export function setAlias(options) {
|
|
612
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
613
|
+
const argumentsTypes = [
|
|
614
|
+
null,
|
|
615
|
+
null,
|
|
616
|
+
'0x2::object::ID',
|
|
617
|
+
'0x1::string::String'
|
|
618
|
+
];
|
|
619
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "alias"];
|
|
620
|
+
return (tx) => tx.moveCall({
|
|
621
|
+
package: packageAddress,
|
|
622
|
+
module: 'account',
|
|
623
|
+
function: 'set_alias',
|
|
624
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
export function addDelegate(options) {
|
|
628
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
629
|
+
const argumentsTypes = [
|
|
630
|
+
null,
|
|
631
|
+
null,
|
|
632
|
+
'0x2::object::ID',
|
|
633
|
+
'address',
|
|
634
|
+
'0x1::string::String',
|
|
635
|
+
'u32',
|
|
636
|
+
'0x1::option::Option<u64>',
|
|
637
|
+
'0x2::clock::Clock'
|
|
638
|
+
];
|
|
639
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
|
|
640
|
+
return (tx) => tx.moveCall({
|
|
641
|
+
package: packageAddress,
|
|
642
|
+
module: 'account',
|
|
643
|
+
function: 'add_delegate',
|
|
644
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
export function removeDelegate(options) {
|
|
648
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
649
|
+
const argumentsTypes = [
|
|
650
|
+
null,
|
|
651
|
+
null,
|
|
652
|
+
'0x2::object::ID',
|
|
653
|
+
'address',
|
|
654
|
+
'0x2::clock::Clock'
|
|
655
|
+
];
|
|
656
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
|
|
657
|
+
return (tx) => tx.moveCall({
|
|
658
|
+
package: packageAddress,
|
|
659
|
+
module: 'account',
|
|
660
|
+
function: 'remove_delegate',
|
|
661
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
export function updateDelegate(options) {
|
|
665
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
666
|
+
const argumentsTypes = [
|
|
667
|
+
null,
|
|
668
|
+
null,
|
|
669
|
+
'0x2::object::ID',
|
|
670
|
+
'address',
|
|
671
|
+
'0x1::string::String',
|
|
672
|
+
'u32',
|
|
673
|
+
'0x1::option::Option<u64>',
|
|
674
|
+
'0x2::clock::Clock'
|
|
675
|
+
];
|
|
676
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "alias", "permissions", "expiresAtMs"];
|
|
677
|
+
return (tx) => tx.moveCall({
|
|
678
|
+
package: packageAddress,
|
|
679
|
+
module: 'account',
|
|
680
|
+
function: 'update_delegate',
|
|
681
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
export function setDelegateProtocolPermission(options) {
|
|
685
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
686
|
+
const argumentsTypes = [
|
|
687
|
+
null,
|
|
688
|
+
null,
|
|
689
|
+
'0x2::object::ID',
|
|
690
|
+
'address',
|
|
691
|
+
'u32',
|
|
692
|
+
'0x2::clock::Clock'
|
|
693
|
+
];
|
|
694
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress", "permissions"];
|
|
695
|
+
return (tx) => tx.moveCall({
|
|
696
|
+
package: packageAddress,
|
|
697
|
+
module: 'account',
|
|
698
|
+
function: 'set_delegate_protocol_permission',
|
|
699
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
700
|
+
typeArguments: options.typeArguments
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
export function unsetDelegateProtocolPermission(options) {
|
|
704
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
705
|
+
const argumentsTypes = [
|
|
706
|
+
null,
|
|
707
|
+
null,
|
|
708
|
+
'0x2::object::ID',
|
|
709
|
+
'address',
|
|
710
|
+
'0x2::clock::Clock'
|
|
711
|
+
];
|
|
712
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "delegateAddress"];
|
|
713
|
+
return (tx) => tx.moveCall({
|
|
714
|
+
package: packageAddress,
|
|
715
|
+
module: 'account',
|
|
716
|
+
function: 'unset_delegate_protocol_permission',
|
|
717
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
718
|
+
typeArguments: options.typeArguments
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Wraps an in-PTB `Coin<T>` into a `DepositRequest<T>` for the account.
|
|
723
|
+
* Permissionless — anyone can pay into any account, since the policy (not the
|
|
724
|
+
* framework) decides what the eventual credited asset is. `T` must have a
|
|
725
|
+
* registered deposit policy; aborts otherwise.
|
|
726
|
+
*/
|
|
727
|
+
export function requestDeposit(options) {
|
|
728
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
729
|
+
const argumentsTypes = [
|
|
730
|
+
null,
|
|
731
|
+
'0x2::object::ID',
|
|
732
|
+
null,
|
|
733
|
+
'vector<u8>'
|
|
734
|
+
];
|
|
735
|
+
const parameterNames = ["registry", "accountId", "coin", "extraData"];
|
|
736
|
+
return (tx) => tx.moveCall({
|
|
737
|
+
package: packageAddress,
|
|
738
|
+
module: 'account',
|
|
739
|
+
function: 'request_deposit',
|
|
740
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
741
|
+
typeArguments: options.typeArguments
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Drains `Receiving<Coin<T>>` entries addressed to the account's UID into a single
|
|
746
|
+
* merged `Coin<T>` and wraps it as a `DepositRequest<T>`. Used when a user (or
|
|
747
|
+
* anyone) previously `transfer_coin`-ed a `Coin<T>` onto the account address and
|
|
748
|
+
* now wants to fold it into custody. Permissionless for the same reason as
|
|
749
|
+
* `request_deposit<T>`.
|
|
750
|
+
*/
|
|
751
|
+
export function requestDepositFromReceivings(options) {
|
|
752
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
753
|
+
const argumentsTypes = [
|
|
754
|
+
null,
|
|
755
|
+
'0x2::object::ID',
|
|
756
|
+
'vector<null>',
|
|
757
|
+
'vector<u8>'
|
|
758
|
+
];
|
|
759
|
+
const parameterNames = ["registry", "accountId", "receivings", "extraData"];
|
|
760
|
+
return (tx) => tx.moveCall({
|
|
761
|
+
package: packageAddress,
|
|
762
|
+
module: 'account',
|
|
763
|
+
function: 'request_deposit_from_receivings',
|
|
764
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
765
|
+
typeArguments: options.typeArguments
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Policy-side unwrap. Verifies that `P` is the registered deposit policy for `T`,
|
|
770
|
+
* then destructures the hot potato. The policy module is responsible for what
|
|
771
|
+
* happens next — typically swap / convert `Balance<T>` to some `Balance<T_OUT>`
|
|
772
|
+
* and call `put<T_OUT, P>` to credit the account.
|
|
773
|
+
*/
|
|
774
|
+
export function consumeDeposit(options) {
|
|
775
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
776
|
+
const argumentsTypes = [
|
|
777
|
+
null,
|
|
778
|
+
null,
|
|
779
|
+
`${options.typeArguments[1]}`
|
|
780
|
+
];
|
|
781
|
+
const parameterNames = ["registry", "req", "Witness"];
|
|
782
|
+
return (tx) => tx.moveCall({
|
|
783
|
+
package: packageAddress,
|
|
784
|
+
module: 'account',
|
|
785
|
+
function: 'consume_deposit',
|
|
786
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
787
|
+
typeArguments: options.typeArguments
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Debits `amount` of the account's stored `Balance<T>` and packages it into a
|
|
792
|
+
* `WithdrawRequest<T>` for the registered withdraw policy. Auth (`PERM_WITHDRAW`
|
|
793
|
+
* on `T`'s account) and pause are checked here, not in `consume_withdraw`.
|
|
794
|
+
*/
|
|
795
|
+
export function requestWithdraw(options) {
|
|
796
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
797
|
+
const argumentsTypes = [
|
|
798
|
+
null,
|
|
799
|
+
null,
|
|
800
|
+
'0x2::object::ID',
|
|
801
|
+
'u64',
|
|
802
|
+
'address',
|
|
803
|
+
'vector<u8>',
|
|
804
|
+
'0x2::clock::Clock'
|
|
805
|
+
];
|
|
806
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "amount", "recipient", "extraData"];
|
|
807
|
+
return (tx) => tx.moveCall({
|
|
808
|
+
package: packageAddress,
|
|
809
|
+
module: 'account',
|
|
810
|
+
function: 'request_withdraw',
|
|
811
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
812
|
+
typeArguments: options.typeArguments
|
|
813
|
+
});
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Policy-side unwrap. Verifies that `P` is the registered withdraw policy for `T`,
|
|
817
|
+
* then destructures the hot potato. The policy module decides what to do with the
|
|
818
|
+
* `Balance<T>` (transfer to `recipient` as `Coin<T>`, swap to another asset and
|
|
819
|
+
* transfer, queue for later settlement, etc.).
|
|
820
|
+
*/
|
|
821
|
+
export function consumeWithdraw(options) {
|
|
822
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
823
|
+
const argumentsTypes = [
|
|
824
|
+
null,
|
|
825
|
+
null,
|
|
826
|
+
`${options.typeArguments[1]}`
|
|
827
|
+
];
|
|
828
|
+
const parameterNames = ["registry", "req", "Witness"];
|
|
829
|
+
return (tx) => tx.moveCall({
|
|
830
|
+
package: packageAddress,
|
|
831
|
+
module: 'account',
|
|
832
|
+
function: 'consume_withdraw',
|
|
833
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
834
|
+
typeArguments: options.typeArguments
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* TTOs a `Coin<T>` to the account's UID address. The coin sits there until someone
|
|
839
|
+
* calls `request_deposit_from_receivings<T>` (which requires a registered deposit
|
|
840
|
+
* policy that then folds the coin into the account's stored balance) or
|
|
841
|
+
* `receive<Coin<T>>` (owner / `PERM_RECEIVE` delegate, no policy needed). Useful
|
|
842
|
+
* for async / cross-PTB deposits and for routing protocol payouts (e.g. reward
|
|
843
|
+
* claims) into an account when `T` has no deposit policy.
|
|
844
|
+
*/
|
|
845
|
+
export function transferCoin(options) {
|
|
846
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
847
|
+
const argumentsTypes = [
|
|
848
|
+
null,
|
|
849
|
+
'0x2::object::ID',
|
|
850
|
+
null
|
|
851
|
+
];
|
|
852
|
+
const parameterNames = ["registry", "accountId", "coin"];
|
|
853
|
+
return (tx) => tx.moveCall({
|
|
854
|
+
package: packageAddress,
|
|
855
|
+
module: 'account',
|
|
856
|
+
function: 'transfer_coin',
|
|
857
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
858
|
+
typeArguments: options.typeArguments
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Account-owner drain of a TTO'd object on the account's UID. Generic over
|
|
863
|
+
* `T: key + store` — works for `Coin<X>`, NFTs, or any other transferable object
|
|
864
|
+
* externally transferred to the account address. Auth: account owner or a
|
|
865
|
+
* `PERM_RECEIVE` delegate (kept separate from `PERM_WITHDRAW` so reward-collection
|
|
866
|
+
* rights don't imply balance-drain rights). Returns the received object to the
|
|
867
|
+
* caller's PTB. Bypasses the deposit-policy flow — use this for tokens / objects
|
|
868
|
+
* that have no registered deposit policy (e.g. reward coins TTO'd via
|
|
869
|
+
* `transfer_coin` from a protocol's claim path).
|
|
870
|
+
*/
|
|
871
|
+
export function receive(options) {
|
|
872
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
873
|
+
const argumentsTypes = [
|
|
874
|
+
null,
|
|
875
|
+
null,
|
|
876
|
+
'0x2::object::ID',
|
|
877
|
+
null,
|
|
878
|
+
'0x2::clock::Clock'
|
|
879
|
+
];
|
|
880
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "receiving"];
|
|
881
|
+
return (tx) => tx.moveCall({
|
|
882
|
+
package: packageAddress,
|
|
883
|
+
module: 'account',
|
|
884
|
+
function: 'receive',
|
|
885
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
886
|
+
typeArguments: options.typeArguments
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Splits `amount` of `Balance<T>` off `account_id` for protocol `P` to use. Three
|
|
891
|
+
* gates compose:
|
|
892
|
+
*
|
|
893
|
+
* 1. **Witness privacy.** Only the module that defines `P` can produce a value of
|
|
894
|
+
* `P`, so only that module can call `take<T, P>`.
|
|
895
|
+
* 2. **Protocol whitelist.** `P` must be in `protocol_whitelist` (admin-managed).
|
|
896
|
+
* Stops any deployed module that happens to own a `drop` witness from draining
|
|
897
|
+
* accounts.
|
|
898
|
+
* 3. **Per-account auth.** `sender_request.address()` must be the account's owner
|
|
899
|
+
* OR a non-expired delegate — even a legitimate whitelisted protocol cannot
|
|
900
|
+
* move funds out of an account that doesn't know the caller. This mirrors EOA
|
|
901
|
+
* semantics: the account never pays out without the owner (or a delegated key)
|
|
902
|
+
* signing. Per-action bit semantics on `protocol_permissions[P]` remain the
|
|
903
|
+
* protocol's responsibility on top of this.
|
|
904
|
+
*
|
|
905
|
+
* No deposit/withdraw policy is consulted — `take` / `put` are the
|
|
906
|
+
* protocol↔account flow and orthogonal to the external deposit/withdraw path that
|
|
907
|
+
* policies own.
|
|
908
|
+
*/
|
|
909
|
+
export function take(options) {
|
|
910
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
911
|
+
const argumentsTypes = [
|
|
912
|
+
null,
|
|
913
|
+
null,
|
|
914
|
+
'0x2::object::ID',
|
|
915
|
+
'u64',
|
|
916
|
+
`${options.typeArguments[1]}`,
|
|
917
|
+
'0x2::clock::Clock'
|
|
918
|
+
];
|
|
919
|
+
const parameterNames = ["registry", "senderRequest", "accountId", "amount", "Witness"];
|
|
920
|
+
return (tx) => tx.moveCall({
|
|
921
|
+
package: packageAddress,
|
|
922
|
+
module: 'account',
|
|
923
|
+
function: 'take',
|
|
924
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
925
|
+
typeArguments: options.typeArguments
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Joins `bal` into `account_id`'s stored `Balance<T>`. Symmetric to `take<T, P>`.
|
|
930
|
+
* Zero-value balances are silently destroyed.
|
|
931
|
+
*/
|
|
932
|
+
export function put(options) {
|
|
933
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
934
|
+
const argumentsTypes = [
|
|
935
|
+
null,
|
|
936
|
+
'0x2::object::ID',
|
|
937
|
+
null,
|
|
938
|
+
`${options.typeArguments[1]}`
|
|
939
|
+
];
|
|
940
|
+
const parameterNames = ["registry", "accountId", "bal", "Witness"];
|
|
941
|
+
return (tx) => tx.moveCall({
|
|
942
|
+
package: packageAddress,
|
|
943
|
+
module: 'account',
|
|
944
|
+
function: 'put',
|
|
945
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
946
|
+
typeArguments: options.typeArguments
|
|
947
|
+
});
|
|
948
|
+
}
|
|
949
|
+
export function hasAccount(options) {
|
|
950
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
951
|
+
const argumentsTypes = [
|
|
952
|
+
null,
|
|
953
|
+
'0x2::object::ID'
|
|
954
|
+
];
|
|
955
|
+
const parameterNames = ["registry", "accountId"];
|
|
956
|
+
return (tx) => tx.moveCall({
|
|
957
|
+
package: packageAddress,
|
|
958
|
+
module: 'account',
|
|
959
|
+
function: 'has_account',
|
|
960
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Returns `true` when `addr` is the account's owner or a non-expired delegate,
|
|
965
|
+
* regardless of permission bits. The framework's "is this address known to the
|
|
966
|
+
* account?" gate — per-action bit semantics are the protocol's responsibility on
|
|
967
|
+
* top of this.
|
|
968
|
+
*/
|
|
969
|
+
export function isAccountAuthorized(options) {
|
|
970
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
971
|
+
const argumentsTypes = [
|
|
972
|
+
null,
|
|
973
|
+
'0x2::object::ID',
|
|
974
|
+
'address',
|
|
975
|
+
'u64'
|
|
976
|
+
];
|
|
977
|
+
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
978
|
+
return (tx) => tx.moveCall({
|
|
979
|
+
package: packageAddress,
|
|
980
|
+
module: 'account',
|
|
981
|
+
function: 'is_account_authorized',
|
|
982
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
export function accountCount(options) {
|
|
986
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
987
|
+
const argumentsTypes = [
|
|
988
|
+
null,
|
|
989
|
+
'address'
|
|
990
|
+
];
|
|
991
|
+
const parameterNames = ["registry", "owner"];
|
|
992
|
+
return (tx) => tx.moveCall({
|
|
993
|
+
package: packageAddress,
|
|
994
|
+
module: 'account',
|
|
995
|
+
function: 'account_count',
|
|
996
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
export function accountIds(options) {
|
|
1000
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1001
|
+
const argumentsTypes = [
|
|
1002
|
+
null,
|
|
1003
|
+
'address'
|
|
1004
|
+
];
|
|
1005
|
+
const parameterNames = ["registry", "owner"];
|
|
1006
|
+
return (tx) => tx.moveCall({
|
|
1007
|
+
package: packageAddress,
|
|
1008
|
+
module: 'account',
|
|
1009
|
+
function: 'account_ids',
|
|
1010
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Framework-level effective permissions (used by `request_withdraw`). Owner →
|
|
1015
|
+
* `PERM_ALL`. Delegate → its `permissions` bitmap unless expired. Stranger →
|
|
1016
|
+
* `PERM_NONE`.
|
|
1017
|
+
*/
|
|
1018
|
+
export function effectivePermissions(options) {
|
|
1019
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1020
|
+
const argumentsTypes = [
|
|
1021
|
+
null,
|
|
1022
|
+
'0x2::object::ID',
|
|
1023
|
+
'address',
|
|
1024
|
+
'u64'
|
|
1025
|
+
];
|
|
1026
|
+
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
1027
|
+
return (tx) => tx.moveCall({
|
|
1028
|
+
package: packageAddress,
|
|
1029
|
+
module: 'account',
|
|
1030
|
+
function: 'effective_permissions',
|
|
1031
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
export function hasPermission(options) {
|
|
1035
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1036
|
+
const argumentsTypes = [
|
|
1037
|
+
null,
|
|
1038
|
+
'0x2::object::ID',
|
|
1039
|
+
'address',
|
|
1040
|
+
'u32',
|
|
1041
|
+
'u64'
|
|
1042
|
+
];
|
|
1043
|
+
const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
|
|
1044
|
+
return (tx) => tx.moveCall({
|
|
1045
|
+
package: packageAddress,
|
|
1046
|
+
module: 'account',
|
|
1047
|
+
function: 'has_permission',
|
|
1048
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Per-protocol effective permissions (used by protocol modules). Owner →
|
|
1053
|
+
* `PERM_ALL` for any protocol. Delegate → the bitmap stored at
|
|
1054
|
+
* `protocol_permissions[TypeName(PROTOCOL)]`, or `PERM_NONE` if absent or expired.
|
|
1055
|
+
* Stranger → `PERM_NONE`.
|
|
1056
|
+
*/
|
|
1057
|
+
export function effectiveProtocolPermissions(options) {
|
|
1058
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1059
|
+
const argumentsTypes = [
|
|
1060
|
+
null,
|
|
1061
|
+
'0x2::object::ID',
|
|
1062
|
+
'address',
|
|
1063
|
+
'u64'
|
|
1064
|
+
];
|
|
1065
|
+
const parameterNames = ["registry", "accountId", "addr", "nowMs"];
|
|
1066
|
+
return (tx) => tx.moveCall({
|
|
1067
|
+
package: packageAddress,
|
|
1068
|
+
module: 'account',
|
|
1069
|
+
function: 'effective_protocol_permissions',
|
|
1070
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1071
|
+
typeArguments: options.typeArguments
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
export function hasProtocolPermission(options) {
|
|
1075
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1076
|
+
const argumentsTypes = [
|
|
1077
|
+
null,
|
|
1078
|
+
'0x2::object::ID',
|
|
1079
|
+
'address',
|
|
1080
|
+
'u32',
|
|
1081
|
+
'u64'
|
|
1082
|
+
];
|
|
1083
|
+
const parameterNames = ["registry", "accountId", "addr", "permission", "nowMs"];
|
|
1084
|
+
return (tx) => tx.moveCall({
|
|
1085
|
+
package: packageAddress,
|
|
1086
|
+
module: 'account',
|
|
1087
|
+
function: 'has_protocol_permission',
|
|
1088
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1089
|
+
typeArguments: options.typeArguments
|
|
1090
|
+
});
|
|
1091
|
+
}
|
|
1092
|
+
export function accountBalance(options) {
|
|
1093
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1094
|
+
const argumentsTypes = [
|
|
1095
|
+
null,
|
|
1096
|
+
'0x2::object::ID'
|
|
1097
|
+
];
|
|
1098
|
+
const parameterNames = ["registry", "accountId"];
|
|
1099
|
+
return (tx) => tx.moveCall({
|
|
1100
|
+
package: packageAddress,
|
|
1101
|
+
module: 'account',
|
|
1102
|
+
function: 'account_balance',
|
|
1103
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1104
|
+
typeArguments: options.typeArguments
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
export function accountBalances(options) {
|
|
1108
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1109
|
+
const argumentsTypes = [
|
|
1110
|
+
null,
|
|
1111
|
+
'0x2::object::ID'
|
|
1112
|
+
];
|
|
1113
|
+
const parameterNames = ["registry", "accountId"];
|
|
1114
|
+
return (tx) => tx.moveCall({
|
|
1115
|
+
package: packageAddress,
|
|
1116
|
+
module: 'account',
|
|
1117
|
+
function: 'account_balances',
|
|
1118
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* Total `Balance<T>` currently held across all accounts. Counter; not derived from
|
|
1123
|
+
* iterating accounts. Excludes balance held by protocols (after `take`) and
|
|
1124
|
+
* balance sitting in hot-potato requests in flight.
|
|
1125
|
+
*/
|
|
1126
|
+
export function balance(options) {
|
|
1127
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1128
|
+
const argumentsTypes = [
|
|
1129
|
+
null
|
|
1130
|
+
];
|
|
1131
|
+
const parameterNames = ["registry"];
|
|
1132
|
+
return (tx) => tx.moveCall({
|
|
1133
|
+
package: packageAddress,
|
|
1134
|
+
module: 'account',
|
|
1135
|
+
function: 'balance',
|
|
1136
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1137
|
+
typeArguments: options.typeArguments
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
export function accountOwner(options) {
|
|
1141
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1142
|
+
const argumentsTypes = [
|
|
1143
|
+
null
|
|
1144
|
+
];
|
|
1145
|
+
const parameterNames = ["account"];
|
|
1146
|
+
return (tx) => tx.moveCall({
|
|
1147
|
+
package: packageAddress,
|
|
1148
|
+
module: 'account',
|
|
1149
|
+
function: 'account_owner',
|
|
1150
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1151
|
+
});
|
|
1152
|
+
}
|
|
1153
|
+
export function accountAlias(options) {
|
|
1154
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1155
|
+
const argumentsTypes = [
|
|
1156
|
+
null
|
|
1157
|
+
];
|
|
1158
|
+
const parameterNames = ["account"];
|
|
1159
|
+
return (tx) => tx.moveCall({
|
|
1160
|
+
package: packageAddress,
|
|
1161
|
+
module: 'account',
|
|
1162
|
+
function: 'account_alias',
|
|
1163
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
export function accountId(options) {
|
|
1167
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1168
|
+
const argumentsTypes = [
|
|
1169
|
+
null
|
|
1170
|
+
];
|
|
1171
|
+
const parameterNames = ["account"];
|
|
1172
|
+
return (tx) => tx.moveCall({
|
|
1173
|
+
package: packageAddress,
|
|
1174
|
+
module: 'account',
|
|
1175
|
+
function: 'account_id',
|
|
1176
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
export function accountAddress(options) {
|
|
1180
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1181
|
+
const argumentsTypes = [
|
|
1182
|
+
null
|
|
1183
|
+
];
|
|
1184
|
+
const parameterNames = ["account"];
|
|
1185
|
+
return (tx) => tx.moveCall({
|
|
1186
|
+
package: packageAddress,
|
|
1187
|
+
module: 'account',
|
|
1188
|
+
function: 'account_address',
|
|
1189
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
export function accountDelegates(options) {
|
|
1193
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1194
|
+
const argumentsTypes = [
|
|
1195
|
+
null
|
|
1196
|
+
];
|
|
1197
|
+
const parameterNames = ["account"];
|
|
1198
|
+
return (tx) => tx.moveCall({
|
|
1199
|
+
package: packageAddress,
|
|
1200
|
+
module: 'account',
|
|
1201
|
+
function: 'account_delegates',
|
|
1202
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
export function accountBalancesField(options) {
|
|
1206
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1207
|
+
const argumentsTypes = [
|
|
1208
|
+
null
|
|
1209
|
+
];
|
|
1210
|
+
const parameterNames = ["account"];
|
|
1211
|
+
return (tx) => tx.moveCall({
|
|
1212
|
+
package: packageAddress,
|
|
1213
|
+
module: 'account',
|
|
1214
|
+
function: 'account_balances_field',
|
|
1215
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
export function delegateAddress(options) {
|
|
1219
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1220
|
+
const argumentsTypes = [
|
|
1221
|
+
null
|
|
1222
|
+
];
|
|
1223
|
+
const parameterNames = ["delegate"];
|
|
1224
|
+
return (tx) => tx.moveCall({
|
|
1225
|
+
package: packageAddress,
|
|
1226
|
+
module: 'account',
|
|
1227
|
+
function: 'delegate_address',
|
|
1228
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
export function delegateAlias(options) {
|
|
1232
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1233
|
+
const argumentsTypes = [
|
|
1234
|
+
null
|
|
1235
|
+
];
|
|
1236
|
+
const parameterNames = ["delegate"];
|
|
1237
|
+
return (tx) => tx.moveCall({
|
|
1238
|
+
package: packageAddress,
|
|
1239
|
+
module: 'account',
|
|
1240
|
+
function: 'delegate_alias',
|
|
1241
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1242
|
+
});
|
|
1243
|
+
}
|
|
1244
|
+
export function delegatePermissions(options) {
|
|
1245
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1246
|
+
const argumentsTypes = [
|
|
1247
|
+
null
|
|
1248
|
+
];
|
|
1249
|
+
const parameterNames = ["delegate"];
|
|
1250
|
+
return (tx) => tx.moveCall({
|
|
1251
|
+
package: packageAddress,
|
|
1252
|
+
module: 'account',
|
|
1253
|
+
function: 'delegate_permissions',
|
|
1254
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
export function delegateProtocolPermissions(options) {
|
|
1258
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1259
|
+
const argumentsTypes = [
|
|
1260
|
+
null
|
|
1261
|
+
];
|
|
1262
|
+
const parameterNames = ["delegate"];
|
|
1263
|
+
return (tx) => tx.moveCall({
|
|
1264
|
+
package: packageAddress,
|
|
1265
|
+
module: 'account',
|
|
1266
|
+
function: 'delegate_protocol_permissions',
|
|
1267
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
export function delegateExpiresAtMs(options) {
|
|
1271
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1272
|
+
const argumentsTypes = [
|
|
1273
|
+
null
|
|
1274
|
+
];
|
|
1275
|
+
const parameterNames = ["delegate"];
|
|
1276
|
+
return (tx) => tx.moveCall({
|
|
1277
|
+
package: packageAddress,
|
|
1278
|
+
module: 'account',
|
|
1279
|
+
function: 'delegate_expires_at_ms',
|
|
1280
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1281
|
+
});
|
|
1282
|
+
}
|
|
1283
|
+
export function depositRequestAccountId(options) {
|
|
1284
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1285
|
+
const argumentsTypes = [
|
|
1286
|
+
null
|
|
1287
|
+
];
|
|
1288
|
+
const parameterNames = ["r"];
|
|
1289
|
+
return (tx) => tx.moveCall({
|
|
1290
|
+
package: packageAddress,
|
|
1291
|
+
module: 'account',
|
|
1292
|
+
function: 'deposit_request_account_id',
|
|
1293
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1294
|
+
typeArguments: options.typeArguments
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
export function depositRequestBalance(options) {
|
|
1298
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1299
|
+
const argumentsTypes = [
|
|
1300
|
+
null
|
|
1301
|
+
];
|
|
1302
|
+
const parameterNames = ["r"];
|
|
1303
|
+
return (tx) => tx.moveCall({
|
|
1304
|
+
package: packageAddress,
|
|
1305
|
+
module: 'account',
|
|
1306
|
+
function: 'deposit_request_balance',
|
|
1307
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1308
|
+
typeArguments: options.typeArguments
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
export function depositRequestAmount(options) {
|
|
1312
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1313
|
+
const argumentsTypes = [
|
|
1314
|
+
null
|
|
1315
|
+
];
|
|
1316
|
+
const parameterNames = ["r"];
|
|
1317
|
+
return (tx) => tx.moveCall({
|
|
1318
|
+
package: packageAddress,
|
|
1319
|
+
module: 'account',
|
|
1320
|
+
function: 'deposit_request_amount',
|
|
1321
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1322
|
+
typeArguments: options.typeArguments
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
export function depositRequestExtraData(options) {
|
|
1326
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1327
|
+
const argumentsTypes = [
|
|
1328
|
+
null
|
|
1329
|
+
];
|
|
1330
|
+
const parameterNames = ["r"];
|
|
1331
|
+
return (tx) => tx.moveCall({
|
|
1332
|
+
package: packageAddress,
|
|
1333
|
+
module: 'account',
|
|
1334
|
+
function: 'deposit_request_extra_data',
|
|
1335
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1336
|
+
typeArguments: options.typeArguments
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
export function withdrawRequestAccountId(options) {
|
|
1340
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1341
|
+
const argumentsTypes = [
|
|
1342
|
+
null
|
|
1343
|
+
];
|
|
1344
|
+
const parameterNames = ["r"];
|
|
1345
|
+
return (tx) => tx.moveCall({
|
|
1346
|
+
package: packageAddress,
|
|
1347
|
+
module: 'account',
|
|
1348
|
+
function: 'withdraw_request_account_id',
|
|
1349
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1350
|
+
typeArguments: options.typeArguments
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
export function withdrawRequestBalance(options) {
|
|
1354
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1355
|
+
const argumentsTypes = [
|
|
1356
|
+
null
|
|
1357
|
+
];
|
|
1358
|
+
const parameterNames = ["r"];
|
|
1359
|
+
return (tx) => tx.moveCall({
|
|
1360
|
+
package: packageAddress,
|
|
1361
|
+
module: 'account',
|
|
1362
|
+
function: 'withdraw_request_balance',
|
|
1363
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1364
|
+
typeArguments: options.typeArguments
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1367
|
+
export function withdrawRequestAmount(options) {
|
|
1368
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1369
|
+
const argumentsTypes = [
|
|
1370
|
+
null
|
|
1371
|
+
];
|
|
1372
|
+
const parameterNames = ["r"];
|
|
1373
|
+
return (tx) => tx.moveCall({
|
|
1374
|
+
package: packageAddress,
|
|
1375
|
+
module: 'account',
|
|
1376
|
+
function: 'withdraw_request_amount',
|
|
1377
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1378
|
+
typeArguments: options.typeArguments
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
export function withdrawRequestRecipient(options) {
|
|
1382
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1383
|
+
const argumentsTypes = [
|
|
1384
|
+
null
|
|
1385
|
+
];
|
|
1386
|
+
const parameterNames = ["r"];
|
|
1387
|
+
return (tx) => tx.moveCall({
|
|
1388
|
+
package: packageAddress,
|
|
1389
|
+
module: 'account',
|
|
1390
|
+
function: 'withdraw_request_recipient',
|
|
1391
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1392
|
+
typeArguments: options.typeArguments
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
export function withdrawRequestExtraData(options) {
|
|
1396
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1397
|
+
const argumentsTypes = [
|
|
1398
|
+
null
|
|
1399
|
+
];
|
|
1400
|
+
const parameterNames = ["r"];
|
|
1401
|
+
return (tx) => tx.moveCall({
|
|
1402
|
+
package: packageAddress,
|
|
1403
|
+
module: 'account',
|
|
1404
|
+
function: 'withdraw_request_extra_data',
|
|
1405
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1406
|
+
typeArguments: options.typeArguments
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
export function newData(options) {
|
|
1410
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1411
|
+
const argumentsTypes = [
|
|
1412
|
+
null,
|
|
1413
|
+
'0x2::object::ID',
|
|
1414
|
+
`${options.typeArguments[0]}`,
|
|
1415
|
+
`${options.typeArguments[1]}`
|
|
1416
|
+
];
|
|
1417
|
+
const parameterNames = ["registry", "accountId", "Witness", "data"];
|
|
1418
|
+
return (tx) => tx.moveCall({
|
|
1419
|
+
package: packageAddress,
|
|
1420
|
+
module: 'account',
|
|
1421
|
+
function: 'new_data',
|
|
1422
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1423
|
+
typeArguments: options.typeArguments
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
export function borrowData(options) {
|
|
1427
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1428
|
+
const argumentsTypes = [
|
|
1429
|
+
null,
|
|
1430
|
+
'0x2::object::ID'
|
|
1431
|
+
];
|
|
1432
|
+
const parameterNames = ["registry", "accountId"];
|
|
1433
|
+
return (tx) => tx.moveCall({
|
|
1434
|
+
package: packageAddress,
|
|
1435
|
+
module: 'account',
|
|
1436
|
+
function: 'borrow_data',
|
|
1437
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1438
|
+
typeArguments: options.typeArguments
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
export function borrowDataMut(options) {
|
|
1442
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1443
|
+
const argumentsTypes = [
|
|
1444
|
+
null,
|
|
1445
|
+
'0x2::object::ID',
|
|
1446
|
+
`${options.typeArguments[0]}`
|
|
1447
|
+
];
|
|
1448
|
+
const parameterNames = ["registry", "accountId", "Witness"];
|
|
1449
|
+
return (tx) => tx.moveCall({
|
|
1450
|
+
package: packageAddress,
|
|
1451
|
+
module: 'account',
|
|
1452
|
+
function: 'borrow_data_mut',
|
|
1453
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1454
|
+
typeArguments: options.typeArguments
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
export function hasData(options) {
|
|
1458
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1459
|
+
const argumentsTypes = [
|
|
1460
|
+
null,
|
|
1461
|
+
'0x2::object::ID'
|
|
1462
|
+
];
|
|
1463
|
+
const parameterNames = ["registry", "accountId"];
|
|
1464
|
+
return (tx) => tx.moveCall({
|
|
1465
|
+
package: packageAddress,
|
|
1466
|
+
module: 'account',
|
|
1467
|
+
function: 'has_data',
|
|
1468
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1469
|
+
typeArguments: options.typeArguments
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
export function removeData(options) {
|
|
1473
|
+
const packageAddress = options.package ?? '@waterx/account';
|
|
1474
|
+
const argumentsTypes = [
|
|
1475
|
+
null,
|
|
1476
|
+
'0x2::object::ID',
|
|
1477
|
+
`${options.typeArguments[0]}`
|
|
1478
|
+
];
|
|
1479
|
+
const parameterNames = ["registry", "accountId", "Witness"];
|
|
1480
|
+
return (tx) => tx.moveCall({
|
|
1481
|
+
package: packageAddress,
|
|
1482
|
+
module: 'account',
|
|
1483
|
+
function: 'remove_data',
|
|
1484
|
+
arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
|
|
1485
|
+
typeArguments: options.typeArguments
|
|
1486
|
+
});
|
|
1487
|
+
}
|