@mysten/pas 0.0.1

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.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/dist/client.d.mts +117 -0
  3. package/dist/client.d.mts.map +1 -0
  4. package/dist/client.mjs +89 -0
  5. package/dist/client.mjs.map +1 -0
  6. package/dist/constants.mjs +9 -0
  7. package/dist/constants.mjs.map +1 -0
  8. package/dist/contracts/pas/deps/std/type_name.mjs +17 -0
  9. package/dist/contracts/pas/deps/std/type_name.mjs.map +1 -0
  10. package/dist/contracts/pas/deps/sui/vec_map.mjs +37 -0
  11. package/dist/contracts/pas/deps/sui/vec_map.mjs.map +1 -0
  12. package/dist/contracts/pas/deps/sui/vec_set.mjs +26 -0
  13. package/dist/contracts/pas/deps/sui/vec_set.mjs.map +1 -0
  14. package/dist/contracts/pas/policy.mjs +33 -0
  15. package/dist/contracts/pas/policy.mjs.map +1 -0
  16. package/dist/contracts/pas/versioning.mjs +25 -0
  17. package/dist/contracts/pas/versioning.mjs.map +1 -0
  18. package/dist/contracts/ptb/ptb.mjs +162 -0
  19. package/dist/contracts/ptb/ptb.mjs.map +1 -0
  20. package/dist/contracts/sui/dynamic_field.mjs +22 -0
  21. package/dist/contracts/sui/dynamic_field.mjs.map +1 -0
  22. package/dist/contracts/utils/index.mjs +37 -0
  23. package/dist/contracts/utils/index.mjs.map +1 -0
  24. package/dist/derivation.mjs +70 -0
  25. package/dist/derivation.mjs.map +1 -0
  26. package/dist/error.d.mts +16 -0
  27. package/dist/error.d.mts.map +1 -0
  28. package/dist/error.mjs +26 -0
  29. package/dist/error.mjs.map +1 -0
  30. package/dist/index.d.mts +4 -0
  31. package/dist/index.mjs +4 -0
  32. package/dist/intents.mjs +494 -0
  33. package/dist/intents.mjs.map +1 -0
  34. package/dist/resolution.mjs +185 -0
  35. package/dist/resolution.mjs.map +1 -0
  36. package/dist/types.d.mts +34 -0
  37. package/dist/types.d.mts.map +1 -0
  38. package/package.json +59 -0
  39. package/src/client.ts +173 -0
  40. package/src/constants.ts +15 -0
  41. package/src/contracts/pas/account.ts +343 -0
  42. package/src/contracts/pas/clawback_funds.ts +114 -0
  43. package/src/contracts/pas/deps/std/type_name.ts +24 -0
  44. package/src/contracts/pas/deps/sui/vec_map.ts +33 -0
  45. package/src/contracts/pas/deps/sui/vec_set.ts +22 -0
  46. package/src/contracts/pas/keys.ts +90 -0
  47. package/src/contracts/pas/namespace.ts +207 -0
  48. package/src/contracts/pas/policy.ts +212 -0
  49. package/src/contracts/pas/request.ts +87 -0
  50. package/src/contracts/pas/send_funds.ts +174 -0
  51. package/src/contracts/pas/templates.ts +101 -0
  52. package/src/contracts/pas/unlock_funds.ts +155 -0
  53. package/src/contracts/pas/versioning.ts +69 -0
  54. package/src/contracts/ptb/ptb.ts +821 -0
  55. package/src/contracts/sui/dynamic_field.ts +171 -0
  56. package/src/contracts/utils/index.ts +235 -0
  57. package/src/derivation.ts +107 -0
  58. package/src/error.ts +29 -0
  59. package/src/index.ts +6 -0
  60. package/src/intents.ts +852 -0
  61. package/src/resolution.ts +294 -0
  62. package/src/types.ts +34 -0
@@ -0,0 +1,343 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /** Account logic */
6
+
7
+ import {
8
+ MoveStruct,
9
+ MoveTuple,
10
+ normalizeMoveArguments,
11
+ type RawTransactionArgument,
12
+ } from '../utils/index.js';
13
+ import { bcs } from '@mysten/sui/bcs';
14
+ import { type Transaction } from '@mysten/sui/transactions';
15
+ import * as versioning from './versioning.js';
16
+ const $moduleName = '@mysten/pas::account';
17
+ export const Account = new MoveStruct({
18
+ name: `${$moduleName}::Account`,
19
+ fields: {
20
+ id: bcs.Address,
21
+ /** The owner of the account (address or object) */
22
+ owner: bcs.Address,
23
+ /**
24
+ * The ID of the namespace that created this account. There's ONLY ONE namespace in
25
+ * the system, but this helps us avoid having `&Namespace` inputs in all functions
26
+ * that need to derive the IDs.
27
+ */
28
+ namespace_id: bcs.Address,
29
+ /**
30
+ * Block versions to break backwards compatibility -- only used in case of
31
+ * emergency.
32
+ */
33
+ versioning: versioning.Versioning,
34
+ },
35
+ });
36
+ export const Auth = new MoveTuple({ name: `${$moduleName}::Auth`, fields: [bcs.Address] });
37
+ export interface CreateArguments {
38
+ namespace: RawTransactionArgument<string>;
39
+ owner: RawTransactionArgument<string>;
40
+ }
41
+ export interface CreateOptions {
42
+ package?: string;
43
+ arguments:
44
+ | CreateArguments
45
+ | [namespace: RawTransactionArgument<string>, owner: RawTransactionArgument<string>];
46
+ }
47
+ /** Create a new account for `owner`. This is a permission-less action. */
48
+ export function create(options: CreateOptions) {
49
+ const packageAddress = options.package ?? '@mysten/pas';
50
+ const argumentsTypes = [null, 'address'] satisfies (string | null)[];
51
+ const parameterNames = ['namespace', 'owner'];
52
+ return (tx: Transaction) =>
53
+ tx.moveCall({
54
+ package: packageAddress,
55
+ module: 'account',
56
+ function: 'create',
57
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
58
+ });
59
+ }
60
+ export interface ShareArguments {
61
+ account: RawTransactionArgument<string>;
62
+ }
63
+ export interface ShareOptions {
64
+ package?: string;
65
+ arguments: ShareArguments | [account: RawTransactionArgument<string>];
66
+ }
67
+ /**
68
+ * The only way to finalize the TX is by sharing the account. All accounts are
69
+ * shared by default.
70
+ */
71
+ export function share(options: ShareOptions) {
72
+ const packageAddress = options.package ?? '@mysten/pas';
73
+ const argumentsTypes = [null] satisfies (string | null)[];
74
+ const parameterNames = ['account'];
75
+ return (tx: Transaction) =>
76
+ tx.moveCall({
77
+ package: packageAddress,
78
+ module: 'account',
79
+ function: 'share',
80
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
81
+ });
82
+ }
83
+ export interface CreateAndShareArguments {
84
+ namespace: RawTransactionArgument<string>;
85
+ owner: RawTransactionArgument<string>;
86
+ }
87
+ export interface CreateAndShareOptions {
88
+ package?: string;
89
+ arguments:
90
+ | CreateAndShareArguments
91
+ | [namespace: RawTransactionArgument<string>, owner: RawTransactionArgument<string>];
92
+ }
93
+ /** Create and share a account in a single step. */
94
+ export function createAndShare(options: CreateAndShareOptions) {
95
+ const packageAddress = options.package ?? '@mysten/pas';
96
+ const argumentsTypes = [null, 'address'] satisfies (string | null)[];
97
+ const parameterNames = ['namespace', 'owner'];
98
+ return (tx: Transaction) =>
99
+ tx.moveCall({
100
+ package: packageAddress,
101
+ module: 'account',
102
+ function: 'create_and_share',
103
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
104
+ });
105
+ }
106
+ export interface UnlockBalanceArguments {
107
+ account: RawTransactionArgument<string>;
108
+ auth: RawTransactionArgument<string>;
109
+ amount: RawTransactionArgument<number | bigint>;
110
+ }
111
+ export interface UnlockBalanceOptions {
112
+ package?: string;
113
+ arguments:
114
+ | UnlockBalanceArguments
115
+ | [
116
+ account: RawTransactionArgument<string>,
117
+ auth: RawTransactionArgument<string>,
118
+ amount: RawTransactionArgument<number | bigint>,
119
+ ];
120
+ typeArguments: [string];
121
+ }
122
+ /**
123
+ * Enables a fund unlock flow. This is useful for assets that are not managed by a
124
+ * Policy within the system, or if there's a special case where an issuer allows
125
+ * balances to flow out of the system.
126
+ */
127
+ export function unlockBalance(options: UnlockBalanceOptions) {
128
+ const packageAddress = options.package ?? '@mysten/pas';
129
+ const argumentsTypes = [null, null, 'u64'] satisfies (string | null)[];
130
+ const parameterNames = ['account', 'auth', 'amount'];
131
+ return (tx: Transaction) =>
132
+ tx.moveCall({
133
+ package: packageAddress,
134
+ module: 'account',
135
+ function: 'unlock_balance',
136
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
137
+ typeArguments: options.typeArguments,
138
+ });
139
+ }
140
+ export interface SendBalanceArguments {
141
+ from: RawTransactionArgument<string>;
142
+ auth: RawTransactionArgument<string>;
143
+ to: RawTransactionArgument<string>;
144
+ amount: RawTransactionArgument<number | bigint>;
145
+ }
146
+ export interface SendBalanceOptions {
147
+ package?: string;
148
+ arguments:
149
+ | SendBalanceArguments
150
+ | [
151
+ from: RawTransactionArgument<string>,
152
+ auth: RawTransactionArgument<string>,
153
+ to: RawTransactionArgument<string>,
154
+ amount: RawTransactionArgument<number | bigint>,
155
+ ];
156
+ typeArguments: [string];
157
+ }
158
+ /** Initiate a transfer from account A to account B. */
159
+ export function sendBalance(options: SendBalanceOptions) {
160
+ const packageAddress = options.package ?? '@mysten/pas';
161
+ const argumentsTypes = [null, null, null, 'u64'] satisfies (string | null)[];
162
+ const parameterNames = ['from', 'auth', 'to', 'amount'];
163
+ return (tx: Transaction) =>
164
+ tx.moveCall({
165
+ package: packageAddress,
166
+ module: 'account',
167
+ function: 'send_balance',
168
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
169
+ typeArguments: options.typeArguments,
170
+ });
171
+ }
172
+ export interface ClawbackBalanceArguments {
173
+ from: RawTransactionArgument<string>;
174
+ amount: RawTransactionArgument<number | bigint>;
175
+ }
176
+ export interface ClawbackBalanceOptions {
177
+ package?: string;
178
+ arguments:
179
+ | ClawbackBalanceArguments
180
+ | [from: RawTransactionArgument<string>, amount: RawTransactionArgument<number | bigint>];
181
+ typeArguments: [string];
182
+ }
183
+ /**
184
+ * Initiate a clawback request for an amount of funds. This takes no `Auth`, as
185
+ * it's an admin action.
186
+ *
187
+ * This can only ever finalize if clawback is enabled in the policy.
188
+ */
189
+ export function clawbackBalance(options: ClawbackBalanceOptions) {
190
+ const packageAddress = options.package ?? '@mysten/pas';
191
+ const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
192
+ const parameterNames = ['from', 'amount'];
193
+ return (tx: Transaction) =>
194
+ tx.moveCall({
195
+ package: packageAddress,
196
+ module: 'account',
197
+ function: 'clawback_balance',
198
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
199
+ typeArguments: options.typeArguments,
200
+ });
201
+ }
202
+ export interface UnsafeSendBalanceArguments {
203
+ from: RawTransactionArgument<string>;
204
+ auth: RawTransactionArgument<string>;
205
+ recipientAddress: RawTransactionArgument<string>;
206
+ amount: RawTransactionArgument<number | bigint>;
207
+ }
208
+ export interface UnsafeSendBalanceOptions {
209
+ package?: string;
210
+ arguments:
211
+ | UnsafeSendBalanceArguments
212
+ | [
213
+ from: RawTransactionArgument<string>,
214
+ auth: RawTransactionArgument<string>,
215
+ recipientAddress: RawTransactionArgument<string>,
216
+ amount: RawTransactionArgument<number | bigint>,
217
+ ];
218
+ typeArguments: [string];
219
+ }
220
+ /**
221
+ * Transfer `amount` from account to an address. This unlocks transfers to a
222
+ * account before it has been created.
223
+ *
224
+ * It's marked as `unsafe_` as it's easy to accidentally pick the wrong recipient
225
+ * address.
226
+ */
227
+ export function unsafeSendBalance(options: UnsafeSendBalanceOptions) {
228
+ const packageAddress = options.package ?? '@mysten/pas';
229
+ const argumentsTypes = [null, null, 'address', 'u64'] satisfies (string | null)[];
230
+ const parameterNames = ['from', 'auth', 'recipientAddress', 'amount'];
231
+ return (tx: Transaction) =>
232
+ tx.moveCall({
233
+ package: packageAddress,
234
+ module: 'account',
235
+ function: 'unsafe_send_balance',
236
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
237
+ typeArguments: options.typeArguments,
238
+ });
239
+ }
240
+ export interface NewAuthOptions {
241
+ package?: string;
242
+ arguments?: [];
243
+ }
244
+ /** Generate an ownership proof from the sender of the transaction. */
245
+ export function newAuth(options: NewAuthOptions = {}) {
246
+ const packageAddress = options.package ?? '@mysten/pas';
247
+ return (tx: Transaction) =>
248
+ tx.moveCall({
249
+ package: packageAddress,
250
+ module: 'account',
251
+ function: 'new_auth',
252
+ });
253
+ }
254
+ export interface NewAuthAsObjectArguments {
255
+ uid: RawTransactionArgument<string>;
256
+ }
257
+ export interface NewAuthAsObjectOptions {
258
+ package?: string;
259
+ arguments: NewAuthAsObjectArguments | [uid: RawTransactionArgument<string>];
260
+ }
261
+ /**
262
+ * Generate an ownership proof from a `UID` object, to allow objects to own
263
+ * accounts. `&mut UID` is intentional — it serves as proof of ownership over the
264
+ * object.
265
+ */
266
+ export function newAuthAsObject(options: NewAuthAsObjectOptions) {
267
+ const packageAddress = options.package ?? '@mysten/pas';
268
+ const argumentsTypes = ['0x2::object::ID'] satisfies (string | null)[];
269
+ const parameterNames = ['uid'];
270
+ return (tx: Transaction) =>
271
+ tx.moveCall({
272
+ package: packageAddress,
273
+ module: 'account',
274
+ function: 'new_auth_as_object',
275
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
276
+ });
277
+ }
278
+ export interface OwnerArguments {
279
+ account: RawTransactionArgument<string>;
280
+ }
281
+ export interface OwnerOptions {
282
+ package?: string;
283
+ arguments: OwnerArguments | [account: RawTransactionArgument<string>];
284
+ }
285
+ export function owner(options: OwnerOptions) {
286
+ const packageAddress = options.package ?? '@mysten/pas';
287
+ const argumentsTypes = [null] satisfies (string | null)[];
288
+ const parameterNames = ['account'];
289
+ return (tx: Transaction) =>
290
+ tx.moveCall({
291
+ package: packageAddress,
292
+ module: 'account',
293
+ function: 'owner',
294
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
295
+ });
296
+ }
297
+ export interface DepositBalanceArguments {
298
+ account: RawTransactionArgument<string>;
299
+ balance: RawTransactionArgument<string>;
300
+ }
301
+ export interface DepositBalanceOptions {
302
+ package?: string;
303
+ arguments:
304
+ | DepositBalanceArguments
305
+ | [account: RawTransactionArgument<string>, balance: RawTransactionArgument<string>];
306
+ typeArguments: [string];
307
+ }
308
+ export function depositBalance(options: DepositBalanceOptions) {
309
+ const packageAddress = options.package ?? '@mysten/pas';
310
+ const argumentsTypes = [null, null] satisfies (string | null)[];
311
+ const parameterNames = ['account', 'balance'];
312
+ return (tx: Transaction) =>
313
+ tx.moveCall({
314
+ package: packageAddress,
315
+ module: 'account',
316
+ function: 'deposit_balance',
317
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
318
+ typeArguments: options.typeArguments,
319
+ });
320
+ }
321
+ export interface SyncVersioningArguments {
322
+ account: RawTransactionArgument<string>;
323
+ namespace: RawTransactionArgument<string>;
324
+ }
325
+ export interface SyncVersioningOptions {
326
+ package?: string;
327
+ arguments:
328
+ | SyncVersioningArguments
329
+ | [account: RawTransactionArgument<string>, namespace: RawTransactionArgument<string>];
330
+ }
331
+ /** Permission-less operation to bring versioning up-to-date with the namespace. */
332
+ export function syncVersioning(options: SyncVersioningOptions) {
333
+ const packageAddress = options.package ?? '@mysten/pas';
334
+ const argumentsTypes = [null, null] satisfies (string | null)[];
335
+ const parameterNames = ['account', 'namespace'];
336
+ return (tx: Transaction) =>
337
+ tx.moveCall({
338
+ package: packageAddress,
339
+ module: 'account',
340
+ function: 'sync_versioning',
341
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
342
+ });
343
+ }
@@ -0,0 +1,114 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
6
+ import { type Transaction } from '@mysten/sui/transactions';
7
+ const $moduleName = '@mysten/pas::clawback_funds';
8
+ export function ClawbackFunds<T extends BcsType<any>>(...typeParameters: [T]) {
9
+ return new MoveStruct({
10
+ name: `${$moduleName}::ClawbackFunds<${typeParameters[0].name as T['name']}>`,
11
+ fields: {
12
+ /** `owner` is the wallet OR object address, NOT the account address */
13
+ owner: bcs.Address,
14
+ /** The ID of the account the funds are coming from */
15
+ account_id: bcs.Address,
16
+ /** The balance that is being clawed back. */
17
+ funds: typeParameters[0],
18
+ },
19
+ });
20
+ }
21
+ export interface OwnerArguments {
22
+ request: RawTransactionArgument<string>;
23
+ }
24
+ export interface OwnerOptions {
25
+ package?: string;
26
+ arguments: OwnerArguments | [request: RawTransactionArgument<string>];
27
+ typeArguments: [string];
28
+ }
29
+ export function owner(options: OwnerOptions) {
30
+ const packageAddress = options.package ?? '@mysten/pas';
31
+ const argumentsTypes = [null] satisfies (string | null)[];
32
+ const parameterNames = ['request'];
33
+ return (tx: Transaction) =>
34
+ tx.moveCall({
35
+ package: packageAddress,
36
+ module: 'clawback_funds',
37
+ function: 'owner',
38
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
39
+ typeArguments: options.typeArguments,
40
+ });
41
+ }
42
+ export interface AccountIdArguments {
43
+ request: RawTransactionArgument<string>;
44
+ }
45
+ export interface AccountIdOptions {
46
+ package?: string;
47
+ arguments: AccountIdArguments | [request: RawTransactionArgument<string>];
48
+ typeArguments: [string];
49
+ }
50
+ export function accountId(options: AccountIdOptions) {
51
+ const packageAddress = options.package ?? '@mysten/pas';
52
+ const argumentsTypes = [null] satisfies (string | null)[];
53
+ const parameterNames = ['request'];
54
+ return (tx: Transaction) =>
55
+ tx.moveCall({
56
+ package: packageAddress,
57
+ module: 'clawback_funds',
58
+ function: 'account_id',
59
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
60
+ typeArguments: options.typeArguments,
61
+ });
62
+ }
63
+ export interface FundsArguments {
64
+ request: RawTransactionArgument<string>;
65
+ }
66
+ export interface FundsOptions {
67
+ package?: string;
68
+ arguments: FundsArguments | [request: RawTransactionArgument<string>];
69
+ typeArguments: [string];
70
+ }
71
+ export function funds(options: FundsOptions) {
72
+ const packageAddress = options.package ?? '@mysten/pas';
73
+ const argumentsTypes = [null] satisfies (string | null)[];
74
+ const parameterNames = ['request'];
75
+ return (tx: Transaction) =>
76
+ tx.moveCall({
77
+ package: packageAddress,
78
+ module: 'clawback_funds',
79
+ function: 'funds',
80
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
81
+ typeArguments: options.typeArguments,
82
+ });
83
+ }
84
+ export interface ResolveArguments {
85
+ request: RawTransactionArgument<string>;
86
+ policy: RawTransactionArgument<string>;
87
+ }
88
+ export interface ResolveOptions {
89
+ package?: string;
90
+ arguments:
91
+ | ResolveArguments
92
+ | [request: RawTransactionArgument<string>, policy: RawTransactionArgument<string>];
93
+ typeArguments: [string];
94
+ }
95
+ /**
96
+ * Resolve a clawback funds request by:
97
+ *
98
+ * 1. Verify policy is valid
99
+ * 2. Verify policy has clawback enabled
100
+ * 3. Make sure policy has enabled clawback resolution
101
+ */
102
+ export function resolve(options: ResolveOptions) {
103
+ const packageAddress = options.package ?? '@mysten/pas';
104
+ const argumentsTypes = [null, null] satisfies (string | null)[];
105
+ const parameterNames = ['request', 'policy'];
106
+ return (tx: Transaction) =>
107
+ tx.moveCall({
108
+ package: packageAddress,
109
+ module: 'clawback_funds',
110
+ function: 'resolve',
111
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
112
+ typeArguments: options.typeArguments,
113
+ });
114
+ }
@@ -0,0 +1,24 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /** Functionality for converting Move types into values. Use with care! */
6
+
7
+ import { MoveStruct } from '../../../utils/index.js';
8
+ import { bcs } from '@mysten/sui/bcs';
9
+ const $moduleName = 'std::type_name';
10
+ export const TypeName = new MoveStruct({
11
+ name: `${$moduleName}::TypeName`,
12
+ fields: {
13
+ /**
14
+ * String representation of the type. All types are represented using their source
15
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
16
+ * Struct types are represented as fully qualified type names; e.g.
17
+ * `00000000000000000000000000000001::string::String` or
18
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
19
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
20
+ * 32 depending on the Move platform)
21
+ */
22
+ name: bcs.string(),
23
+ },
24
+ });
@@ -0,0 +1,33 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_map';
7
+ /** An entry in the map */
8
+ export function Entry<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
9
+ return new MoveStruct({
10
+ name: `${$moduleName}::Entry<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
11
+ fields: {
12
+ key: typeParameters[0],
13
+ value: typeParameters[1],
14
+ },
15
+ });
16
+ }
17
+ /**
18
+ * A map data structure backed by a vector. The map is guaranteed not to contain
19
+ * duplicate keys, but entries are _not_ sorted by key--entries are included in
20
+ * insertion order. All operations are O(N) in the size of the map--the intention
21
+ * of this data structure is only to provide the convenience of programming against
22
+ * a map API. Large maps should use handwritten parent/child relationships instead.
23
+ * Maps that need sorted iteration rather than insertion order iteration should
24
+ * also be handwritten.
25
+ */
26
+ export function VecMap<K extends BcsType<any>, V extends BcsType<any>>(...typeParameters: [K, V]) {
27
+ return new MoveStruct({
28
+ name: `${$moduleName}::VecMap<${typeParameters[0].name as K['name']}, ${typeParameters[1].name as V['name']}>`,
29
+ fields: {
30
+ contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
31
+ },
32
+ });
33
+ }
@@ -0,0 +1,22 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { type BcsType, bcs } from '@mysten/sui/bcs';
5
+ import { MoveStruct } from '../../../utils/index.js';
6
+ const $moduleName = '0x2::vec_set';
7
+ /**
8
+ * A set data structure backed by a vector. The set is guaranteed not to contain
9
+ * duplicate keys. All operations are O(N) in the size of the set
10
+ *
11
+ * - the intention of this data structure is only to provide the convenience of
12
+ * programming against a set API. Sets that need sorted iteration rather than
13
+ * insertion order iteration should be handwritten.
14
+ */
15
+ export function VecSet<K extends BcsType<any>>(...typeParameters: [K]) {
16
+ return new MoveStruct({
17
+ name: `${$moduleName}::VecSet<${typeParameters[0].name as K['name']}>`,
18
+ fields: {
19
+ contents: bcs.vector(typeParameters[0]),
20
+ },
21
+ });
22
+ }
@@ -0,0 +1,90 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import { MoveTuple, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
5
+ import { bcs } from '@mysten/sui/bcs';
6
+ import { type Transaction } from '@mysten/sui/transactions';
7
+ const $moduleName = '@mysten/pas::keys';
8
+ export const PolicyKey = new MoveTuple({
9
+ name: `${$moduleName}::PolicyKey<phantom T>`,
10
+ fields: [bcs.bool()],
11
+ });
12
+ export const AccountKey = new MoveTuple({
13
+ name: `${$moduleName}::AccountKey`,
14
+ fields: [bcs.Address],
15
+ });
16
+ export const TemplateKey = new MoveTuple({
17
+ name: `${$moduleName}::TemplateKey`,
18
+ fields: [bcs.bool()],
19
+ });
20
+ export interface SendFundsActionOptions {
21
+ package?: string;
22
+ arguments?: [];
23
+ }
24
+ export function sendFundsAction(options: SendFundsActionOptions = {}) {
25
+ const packageAddress = options.package ?? '@mysten/pas';
26
+ return (tx: Transaction) =>
27
+ tx.moveCall({
28
+ package: packageAddress,
29
+ module: 'keys',
30
+ function: 'send_funds_action',
31
+ });
32
+ }
33
+ export interface UnlockFundsActionOptions {
34
+ package?: string;
35
+ arguments?: [];
36
+ }
37
+ export function unlockFundsAction(options: UnlockFundsActionOptions = {}) {
38
+ const packageAddress = options.package ?? '@mysten/pas';
39
+ return (tx: Transaction) =>
40
+ tx.moveCall({
41
+ package: packageAddress,
42
+ module: 'keys',
43
+ function: 'unlock_funds_action',
44
+ });
45
+ }
46
+ export interface ClawbackFundsActionOptions {
47
+ package?: string;
48
+ arguments?: [];
49
+ }
50
+ export function clawbackFundsAction(options: ClawbackFundsActionOptions = {}) {
51
+ const packageAddress = options.package ?? '@mysten/pas';
52
+ return (tx: Transaction) =>
53
+ tx.moveCall({
54
+ package: packageAddress,
55
+ module: 'keys',
56
+ function: 'clawback_funds_action',
57
+ });
58
+ }
59
+ export interface ActionsOptions {
60
+ package?: string;
61
+ arguments?: [];
62
+ }
63
+ export function actions(options: ActionsOptions = {}) {
64
+ const packageAddress = options.package ?? '@mysten/pas';
65
+ return (tx: Transaction) =>
66
+ tx.moveCall({
67
+ package: packageAddress,
68
+ module: 'keys',
69
+ function: 'actions',
70
+ });
71
+ }
72
+ export interface IsValidActionArguments {
73
+ action: RawTransactionArgument<string>;
74
+ }
75
+ export interface IsValidActionOptions {
76
+ package?: string;
77
+ arguments: IsValidActionArguments | [action: RawTransactionArgument<string>];
78
+ }
79
+ export function isValidAction(options: IsValidActionOptions) {
80
+ const packageAddress = options.package ?? '@mysten/pas';
81
+ const argumentsTypes = ['0x1::string::String'] satisfies (string | null)[];
82
+ const parameterNames = ['action'];
83
+ return (tx: Transaction) =>
84
+ tx.moveCall({
85
+ package: packageAddress,
86
+ module: 'keys',
87
+ function: 'is_valid_action',
88
+ arguments: normalizeMoveArguments(options.arguments, argumentsTypes, parameterNames),
89
+ });
90
+ }