@mysten/kiosk 1.0.1 → 1.1.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 (101) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/client/kiosk-client.d.mts +4 -4
  3. package/dist/client/kiosk-client.d.mts.map +1 -1
  4. package/dist/client/kiosk-client.mjs.map +1 -1
  5. package/dist/contracts/0x2/bag.mjs.map +1 -1
  6. package/dist/contracts/0x2/balance.mjs +1 -5
  7. package/dist/contracts/0x2/balance.mjs.map +1 -1
  8. package/dist/contracts/0x2/kiosk.mjs +5 -5
  9. package/dist/contracts/0x2/kiosk.mjs.map +1 -1
  10. package/dist/contracts/0x2/kiosk_extension.mjs +1 -1
  11. package/dist/contracts/0x2/kiosk_extension.mjs.map +1 -1
  12. package/dist/contracts/0x2/transfer_policy.mjs +6 -6
  13. package/dist/contracts/0x2/transfer_policy.mjs.map +1 -1
  14. package/dist/contracts/0x2/vec_set.mjs.map +1 -1
  15. package/dist/index.d.mts +4 -4
  16. package/dist/index.mjs +2 -2
  17. package/dist/query/client-utils.mjs +186 -1
  18. package/dist/query/client-utils.mjs.map +1 -1
  19. package/dist/query/kiosk.mjs +2 -1
  20. package/dist/query/kiosk.mjs.map +1 -1
  21. package/dist/query/transfer-policy.mjs +1 -1
  22. package/dist/query/transfer-policy.mjs.map +1 -1
  23. package/dist/types/index.d.mts +7 -4
  24. package/dist/types/index.d.mts.map +1 -1
  25. package/dist/types/kiosk.d.mts +13 -3
  26. package/dist/types/kiosk.d.mts.map +1 -1
  27. package/dist/types/kiosk.mjs.map +1 -1
  28. package/dist/utils.d.mts +3 -9
  29. package/dist/utils.d.mts.map +1 -1
  30. package/dist/utils.mjs +5 -24
  31. package/dist/utils.mjs.map +1 -1
  32. package/package.json +8 -7
  33. package/src/client/kiosk-client.ts +4 -3
  34. package/src/contracts/0x2/bag.ts +2 -181
  35. package/src/contracts/0x2/balance.ts +3 -260
  36. package/src/contracts/0x2/kiosk.ts +4 -4
  37. package/src/contracts/0x2/kiosk_extension.ts +1 -1
  38. package/src/contracts/0x2/transfer_policy.ts +6 -6
  39. package/src/contracts/0x2/vec_set.ts +1 -198
  40. package/src/contracts/kiosk/witness_rule.ts +1 -1
  41. package/src/query/client-utils.ts +253 -2
  42. package/src/query/kiosk.ts +3 -2
  43. package/src/query/transfer-policy.ts +4 -5
  44. package/src/types/index.ts +6 -2
  45. package/src/types/kiosk.ts +15 -3
  46. package/src/utils.ts +8 -38
  47. package/src/contracts/0x2/accumulator.ts +0 -24
  48. package/src/contracts/0x2/accumulator_metadata.ts +0 -38
  49. package/src/contracts/0x2/accumulator_settlement.ts +0 -14
  50. package/src/contracts/0x2/address.ts +0 -145
  51. package/src/contracts/0x2/address_alias.ts +0 -92
  52. package/src/contracts/0x2/authenticator_state.ts +0 -44
  53. package/src/contracts/0x2/bcs.ts +0 -495
  54. package/src/contracts/0x2/bls12381.ts +0 -717
  55. package/src/contracts/0x2/borrow.ts +0 -99
  56. package/src/contracts/0x2/clock.ts +0 -30
  57. package/src/contracts/0x2/coin.ts +0 -977
  58. package/src/contracts/0x2/coin_registry.ts +0 -874
  59. package/src/contracts/0x2/config.ts +0 -30
  60. package/src/contracts/0x2/deny_list.ts +0 -55
  61. package/src/contracts/0x2/derived_object.ts +0 -95
  62. package/src/contracts/0x2/display.ts +0 -258
  63. package/src/contracts/0x2/dynamic_field.ts +0 -171
  64. package/src/contracts/0x2/dynamic_object_field.ts +0 -167
  65. package/src/contracts/0x2/ecdsa_k1.ts +0 -65
  66. package/src/contracts/0x2/ecdsa_r1.ts +0 -49
  67. package/src/contracts/0x2/ecvrf.ts +0 -29
  68. package/src/contracts/0x2/ed25519.ts +0 -25
  69. package/src/contracts/0x2/event.ts +0 -42
  70. package/src/contracts/0x2/funds_accumulator.ts +0 -86
  71. package/src/contracts/0x2/groth16.ts +0 -171
  72. package/src/contracts/0x2/group_ops.ts +0 -49
  73. package/src/contracts/0x2/hash.ts +0 -37
  74. package/src/contracts/0x2/hex.ts +0 -37
  75. package/src/contracts/0x2/hmac.ts +0 -21
  76. package/src/contracts/0x2/linked_table.ts +0 -354
  77. package/src/contracts/0x2/math.ts +0 -117
  78. package/src/contracts/0x2/nitro_attestation.ts +0 -186
  79. package/src/contracts/0x2/object.ts +0 -249
  80. package/src/contracts/0x2/object_bag.ts +0 -210
  81. package/src/contracts/0x2/object_table.ts +0 -200
  82. package/src/contracts/0x2/package.ts +0 -414
  83. package/src/contracts/0x2/party.ts +0 -37
  84. package/src/contracts/0x2/pay.ts +0 -153
  85. package/src/contracts/0x2/poseidon.ts +0 -21
  86. package/src/contracts/0x2/priority_queue.ts +0 -139
  87. package/src/contracts/0x2/random.ts +0 -294
  88. package/src/contracts/0x2/sui.ts +0 -29
  89. package/src/contracts/0x2/table.ts +0 -200
  90. package/src/contracts/0x2/table_vec.ts +0 -232
  91. package/src/contracts/0x2/token.ts +0 -873
  92. package/src/contracts/0x2/transfer.ts +0 -216
  93. package/src/contracts/0x2/tx_context.ts +0 -129
  94. package/src/contracts/0x2/types.ts +0 -24
  95. package/src/contracts/0x2/url.ts +0 -77
  96. package/src/contracts/0x2/vdf.ts +0 -45
  97. package/src/contracts/0x2/vec_map.ts +0 -401
  98. package/src/contracts/0x2/versioned.ts +0 -153
  99. package/src/contracts/0x2/zklogin_verified_id.ts +0 -172
  100. package/src/contracts/0x2/zklogin_verified_issuer.ts +0 -99
  101. package/src/contracts/kiosk/deps/sui/object.ts +0 -15
@@ -1,401 +0,0 @@
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 = '0x2::vec_map';
8
- export function Entry<T0 extends BcsType<any>, T1 extends BcsType<any>>(
9
- ...typeParameters: [T0, T1]
10
- ) {
11
- return new MoveStruct({
12
- name: `${$moduleName}::Entry<${typeParameters[0].name as T0['name']}, ${typeParameters[1].name as T1['name']}>`,
13
- fields: {
14
- key: typeParameters[0],
15
- value: typeParameters[1],
16
- },
17
- });
18
- }
19
- export function VecMap<T0 extends BcsType<any>, T1 extends BcsType<any>>(
20
- ...typeParameters: [T0, T1]
21
- ) {
22
- return new MoveStruct({
23
- name: `${$moduleName}::VecMap<${typeParameters[0].name as T0['name']}, ${typeParameters[1].name as T1['name']}>`,
24
- fields: {
25
- contents: bcs.vector(Entry(typeParameters[0], typeParameters[1])),
26
- },
27
- });
28
- }
29
- export interface EmptyOptions {
30
- package?: string;
31
- arguments?: [];
32
- typeArguments: [string, string];
33
- }
34
- export function empty(options: EmptyOptions) {
35
- const packageAddress =
36
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
37
- return (tx: Transaction) =>
38
- tx.moveCall({
39
- package: packageAddress,
40
- module: 'vec_map',
41
- function: 'empty',
42
- typeArguments: options.typeArguments,
43
- });
44
- }
45
- export interface InsertOptions<T0 extends BcsType<any>, T1 extends BcsType<any>> {
46
- package?: string;
47
- arguments: [
48
- RawTransactionArgument<string>,
49
- RawTransactionArgument<T0>,
50
- RawTransactionArgument<T1>,
51
- ];
52
- typeArguments: [string, string];
53
- }
54
- export function insert<T0 extends BcsType<any>, T1 extends BcsType<any>>(
55
- options: InsertOptions<T0, T1>,
56
- ) {
57
- const packageAddress =
58
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
59
- const argumentsTypes = [
60
- null,
61
- `${options.typeArguments[0]}`,
62
- `${options.typeArguments[1]}`,
63
- ] satisfies (string | null)[];
64
- return (tx: Transaction) =>
65
- tx.moveCall({
66
- package: packageAddress,
67
- module: 'vec_map',
68
- function: 'insert',
69
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
70
- typeArguments: options.typeArguments,
71
- });
72
- }
73
- export interface RemoveOptions<T0 extends BcsType<any>> {
74
- package?: string;
75
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
76
- typeArguments: [string, string];
77
- }
78
- export function remove<T0 extends BcsType<any>>(options: RemoveOptions<T0>) {
79
- const packageAddress =
80
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
81
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
82
- return (tx: Transaction) =>
83
- tx.moveCall({
84
- package: packageAddress,
85
- module: 'vec_map',
86
- function: 'remove',
87
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
88
- typeArguments: options.typeArguments,
89
- });
90
- }
91
- export interface PopOptions {
92
- package?: string;
93
- arguments: [RawTransactionArgument<string>];
94
- typeArguments: [string, string];
95
- }
96
- export function pop(options: PopOptions) {
97
- const packageAddress =
98
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
99
- const argumentsTypes = [null] satisfies (string | null)[];
100
- return (tx: Transaction) =>
101
- tx.moveCall({
102
- package: packageAddress,
103
- module: 'vec_map',
104
- function: 'pop',
105
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
106
- typeArguments: options.typeArguments,
107
- });
108
- }
109
- export interface GetMutOptions<T0 extends BcsType<any>> {
110
- package?: string;
111
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
112
- typeArguments: [string, string];
113
- }
114
- export function getMut<T0 extends BcsType<any>>(options: GetMutOptions<T0>) {
115
- const packageAddress =
116
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
117
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
118
- return (tx: Transaction) =>
119
- tx.moveCall({
120
- package: packageAddress,
121
- module: 'vec_map',
122
- function: 'get_mut',
123
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
124
- typeArguments: options.typeArguments,
125
- });
126
- }
127
- export interface GetOptions<T0 extends BcsType<any>> {
128
- package?: string;
129
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
130
- typeArguments: [string, string];
131
- }
132
- export function get<T0 extends BcsType<any>>(options: GetOptions<T0>) {
133
- const packageAddress =
134
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
135
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
136
- return (tx: Transaction) =>
137
- tx.moveCall({
138
- package: packageAddress,
139
- module: 'vec_map',
140
- function: 'get',
141
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
142
- typeArguments: options.typeArguments,
143
- });
144
- }
145
- export interface TryGetOptions<T0 extends BcsType<any>> {
146
- package?: string;
147
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
148
- typeArguments: [string, string];
149
- }
150
- export function tryGet<T0 extends BcsType<any>>(options: TryGetOptions<T0>) {
151
- const packageAddress =
152
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
153
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
154
- return (tx: Transaction) =>
155
- tx.moveCall({
156
- package: packageAddress,
157
- module: 'vec_map',
158
- function: 'try_get',
159
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
160
- typeArguments: options.typeArguments,
161
- });
162
- }
163
- export interface ContainsOptions<T0 extends BcsType<any>> {
164
- package?: string;
165
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
166
- typeArguments: [string, string];
167
- }
168
- export function contains<T0 extends BcsType<any>>(options: ContainsOptions<T0>) {
169
- const packageAddress =
170
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
171
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
172
- return (tx: Transaction) =>
173
- tx.moveCall({
174
- package: packageAddress,
175
- module: 'vec_map',
176
- function: 'contains',
177
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
178
- typeArguments: options.typeArguments,
179
- });
180
- }
181
- export interface LengthOptions {
182
- package?: string;
183
- arguments: [RawTransactionArgument<string>];
184
- typeArguments: [string, string];
185
- }
186
- export function length(options: LengthOptions) {
187
- const packageAddress =
188
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
189
- const argumentsTypes = [null] satisfies (string | null)[];
190
- return (tx: Transaction) =>
191
- tx.moveCall({
192
- package: packageAddress,
193
- module: 'vec_map',
194
- function: 'length',
195
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
196
- typeArguments: options.typeArguments,
197
- });
198
- }
199
- export interface IsEmptyOptions {
200
- package?: string;
201
- arguments: [RawTransactionArgument<string>];
202
- typeArguments: [string, string];
203
- }
204
- export function isEmpty(options: IsEmptyOptions) {
205
- const packageAddress =
206
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
207
- const argumentsTypes = [null] satisfies (string | null)[];
208
- return (tx: Transaction) =>
209
- tx.moveCall({
210
- package: packageAddress,
211
- module: 'vec_map',
212
- function: 'is_empty',
213
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
214
- typeArguments: options.typeArguments,
215
- });
216
- }
217
- export interface DestroyEmptyOptions {
218
- package?: string;
219
- arguments: [RawTransactionArgument<string>];
220
- typeArguments: [string, string];
221
- }
222
- export function destroyEmpty(options: DestroyEmptyOptions) {
223
- const packageAddress =
224
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
225
- const argumentsTypes = [null] satisfies (string | null)[];
226
- return (tx: Transaction) =>
227
- tx.moveCall({
228
- package: packageAddress,
229
- module: 'vec_map',
230
- function: 'destroy_empty',
231
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
232
- typeArguments: options.typeArguments,
233
- });
234
- }
235
- export interface IntoKeysValuesOptions {
236
- package?: string;
237
- arguments: [RawTransactionArgument<string>];
238
- typeArguments: [string, string];
239
- }
240
- export function intoKeysValues(options: IntoKeysValuesOptions) {
241
- const packageAddress =
242
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
243
- const argumentsTypes = [null] satisfies (string | null)[];
244
- return (tx: Transaction) =>
245
- tx.moveCall({
246
- package: packageAddress,
247
- module: 'vec_map',
248
- function: 'into_keys_values',
249
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
250
- typeArguments: options.typeArguments,
251
- });
252
- }
253
- export interface FromKeysValuesOptions<T0 extends BcsType<any>, T1 extends BcsType<any>> {
254
- package?: string;
255
- arguments: [RawTransactionArgument<T0[]>, RawTransactionArgument<T1[]>];
256
- typeArguments: [string, string];
257
- }
258
- export function fromKeysValues<T0 extends BcsType<any>, T1 extends BcsType<any>>(
259
- options: FromKeysValuesOptions<T0, T1>,
260
- ) {
261
- const packageAddress =
262
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
263
- const argumentsTypes = [
264
- `vector<${options.typeArguments[0]}>`,
265
- `vector<${options.typeArguments[1]}>`,
266
- ] satisfies (string | null)[];
267
- return (tx: Transaction) =>
268
- tx.moveCall({
269
- package: packageAddress,
270
- module: 'vec_map',
271
- function: 'from_keys_values',
272
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
273
- typeArguments: options.typeArguments,
274
- });
275
- }
276
- export interface KeysOptions {
277
- package?: string;
278
- arguments: [RawTransactionArgument<string>];
279
- typeArguments: [string, string];
280
- }
281
- export function keys(options: KeysOptions) {
282
- const packageAddress =
283
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
284
- const argumentsTypes = [null] satisfies (string | null)[];
285
- return (tx: Transaction) =>
286
- tx.moveCall({
287
- package: packageAddress,
288
- module: 'vec_map',
289
- function: 'keys',
290
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
291
- typeArguments: options.typeArguments,
292
- });
293
- }
294
- export interface GetIdxOptOptions<T0 extends BcsType<any>> {
295
- package?: string;
296
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
297
- typeArguments: [string, string];
298
- }
299
- export function getIdxOpt<T0 extends BcsType<any>>(options: GetIdxOptOptions<T0>) {
300
- const packageAddress =
301
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
302
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
303
- return (tx: Transaction) =>
304
- tx.moveCall({
305
- package: packageAddress,
306
- module: 'vec_map',
307
- function: 'get_idx_opt',
308
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
309
- typeArguments: options.typeArguments,
310
- });
311
- }
312
- export interface GetIdxOptions<T0 extends BcsType<any>> {
313
- package?: string;
314
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<T0>];
315
- typeArguments: [string, string];
316
- }
317
- export function getIdx<T0 extends BcsType<any>>(options: GetIdxOptions<T0>) {
318
- const packageAddress =
319
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
320
- const argumentsTypes = [null, `${options.typeArguments[0]}`] satisfies (string | null)[];
321
- return (tx: Transaction) =>
322
- tx.moveCall({
323
- package: packageAddress,
324
- module: 'vec_map',
325
- function: 'get_idx',
326
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
327
- typeArguments: options.typeArguments,
328
- });
329
- }
330
- export interface GetEntryByIdxOptions {
331
- package?: string;
332
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<number | bigint>];
333
- typeArguments: [string, string];
334
- }
335
- export function getEntryByIdx(options: GetEntryByIdxOptions) {
336
- const packageAddress =
337
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
338
- const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
339
- return (tx: Transaction) =>
340
- tx.moveCall({
341
- package: packageAddress,
342
- module: 'vec_map',
343
- function: 'get_entry_by_idx',
344
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
345
- typeArguments: options.typeArguments,
346
- });
347
- }
348
- export interface GetEntryByIdxMutOptions {
349
- package?: string;
350
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<number | bigint>];
351
- typeArguments: [string, string];
352
- }
353
- export function getEntryByIdxMut(options: GetEntryByIdxMutOptions) {
354
- const packageAddress =
355
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
356
- const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
357
- return (tx: Transaction) =>
358
- tx.moveCall({
359
- package: packageAddress,
360
- module: 'vec_map',
361
- function: 'get_entry_by_idx_mut',
362
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
363
- typeArguments: options.typeArguments,
364
- });
365
- }
366
- export interface RemoveEntryByIdxOptions {
367
- package?: string;
368
- arguments: [RawTransactionArgument<string>, RawTransactionArgument<number | bigint>];
369
- typeArguments: [string, string];
370
- }
371
- export function removeEntryByIdx(options: RemoveEntryByIdxOptions) {
372
- const packageAddress =
373
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
374
- const argumentsTypes = [null, 'u64'] satisfies (string | null)[];
375
- return (tx: Transaction) =>
376
- tx.moveCall({
377
- package: packageAddress,
378
- module: 'vec_map',
379
- function: 'remove_entry_by_idx',
380
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
381
- typeArguments: options.typeArguments,
382
- });
383
- }
384
- export interface SizeOptions {
385
- package?: string;
386
- arguments: [RawTransactionArgument<string>];
387
- typeArguments: [string, string];
388
- }
389
- export function size(options: SizeOptions) {
390
- const packageAddress =
391
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
392
- const argumentsTypes = [null] satisfies (string | null)[];
393
- return (tx: Transaction) =>
394
- tx.moveCall({
395
- package: packageAddress,
396
- module: 'vec_map',
397
- function: 'size',
398
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
399
- typeArguments: options.typeArguments,
400
- });
401
- }
@@ -1,153 +0,0 @@
1
- /**************************************************************
2
- * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
- **************************************************************/
4
- import { MoveStruct, normalizeMoveArguments, type RawTransactionArgument } from '../utils/index.js';
5
- import { bcs, type BcsType } from '@mysten/sui/bcs';
6
- import { type Transaction } from '@mysten/sui/transactions';
7
- const $moduleName = '0x2::versioned';
8
- export const Versioned = new MoveStruct({
9
- name: `${$moduleName}::Versioned`,
10
- fields: {
11
- id: bcs.Address,
12
- version: bcs.u64(),
13
- },
14
- });
15
- export const VersionChangeCap = new MoveStruct({
16
- name: `${$moduleName}::VersionChangeCap`,
17
- fields: {
18
- versioned_id: bcs.Address,
19
- old_version: bcs.u64(),
20
- },
21
- });
22
- export interface CreateOptions<T0 extends BcsType<any>> {
23
- package?: string;
24
- arguments: [RawTransactionArgument<number | bigint>, RawTransactionArgument<T0>];
25
- typeArguments: [string];
26
- }
27
- export function create<T0 extends BcsType<any>>(options: CreateOptions<T0>) {
28
- const packageAddress =
29
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
30
- const argumentsTypes = ['u64', `${options.typeArguments[0]}`] satisfies (string | null)[];
31
- return (tx: Transaction) =>
32
- tx.moveCall({
33
- package: packageAddress,
34
- module: 'versioned',
35
- function: 'create',
36
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
37
- typeArguments: options.typeArguments,
38
- });
39
- }
40
- export interface VersionOptions {
41
- package?: string;
42
- arguments: [RawTransactionArgument<string>];
43
- }
44
- export function version(options: VersionOptions) {
45
- const packageAddress =
46
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
47
- const argumentsTypes = [null] satisfies (string | null)[];
48
- return (tx: Transaction) =>
49
- tx.moveCall({
50
- package: packageAddress,
51
- module: 'versioned',
52
- function: 'version',
53
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
54
- });
55
- }
56
- export interface LoadValueOptions {
57
- package?: string;
58
- arguments: [RawTransactionArgument<string>];
59
- typeArguments: [string];
60
- }
61
- export function loadValue(options: LoadValueOptions) {
62
- const packageAddress =
63
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
64
- const argumentsTypes = [null] satisfies (string | null)[];
65
- return (tx: Transaction) =>
66
- tx.moveCall({
67
- package: packageAddress,
68
- module: 'versioned',
69
- function: 'load_value',
70
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
71
- typeArguments: options.typeArguments,
72
- });
73
- }
74
- export interface LoadValueMutOptions {
75
- package?: string;
76
- arguments: [RawTransactionArgument<string>];
77
- typeArguments: [string];
78
- }
79
- export function loadValueMut(options: LoadValueMutOptions) {
80
- const packageAddress =
81
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
82
- const argumentsTypes = [null] satisfies (string | null)[];
83
- return (tx: Transaction) =>
84
- tx.moveCall({
85
- package: packageAddress,
86
- module: 'versioned',
87
- function: 'load_value_mut',
88
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
89
- typeArguments: options.typeArguments,
90
- });
91
- }
92
- export interface RemoveValueForUpgradeOptions {
93
- package?: string;
94
- arguments: [RawTransactionArgument<string>];
95
- typeArguments: [string];
96
- }
97
- export function removeValueForUpgrade(options: RemoveValueForUpgradeOptions) {
98
- const packageAddress =
99
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
100
- const argumentsTypes = [null] satisfies (string | null)[];
101
- return (tx: Transaction) =>
102
- tx.moveCall({
103
- package: packageAddress,
104
- module: 'versioned',
105
- function: 'remove_value_for_upgrade',
106
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
107
- typeArguments: options.typeArguments,
108
- });
109
- }
110
- export interface UpgradeOptions<T0 extends BcsType<any>> {
111
- package?: string;
112
- arguments: [
113
- RawTransactionArgument<string>,
114
- RawTransactionArgument<number | bigint>,
115
- RawTransactionArgument<T0>,
116
- RawTransactionArgument<string>,
117
- ];
118
- typeArguments: [string];
119
- }
120
- export function upgrade<T0 extends BcsType<any>>(options: UpgradeOptions<T0>) {
121
- const packageAddress =
122
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
123
- const argumentsTypes = [null, 'u64', `${options.typeArguments[0]}`, null] satisfies (
124
- | string
125
- | null
126
- )[];
127
- return (tx: Transaction) =>
128
- tx.moveCall({
129
- package: packageAddress,
130
- module: 'versioned',
131
- function: 'upgrade',
132
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
133
- typeArguments: options.typeArguments,
134
- });
135
- }
136
- export interface DestroyOptions {
137
- package?: string;
138
- arguments: [RawTransactionArgument<string>];
139
- typeArguments: [string];
140
- }
141
- export function destroy(options: DestroyOptions) {
142
- const packageAddress =
143
- options.package ?? '0x0000000000000000000000000000000000000000000000000000000000000002';
144
- const argumentsTypes = [null] satisfies (string | null)[];
145
- return (tx: Transaction) =>
146
- tx.moveCall({
147
- package: packageAddress,
148
- module: 'versioned',
149
- function: 'destroy',
150
- arguments: normalizeMoveArguments(options.arguments, argumentsTypes),
151
- typeArguments: options.typeArguments,
152
- });
153
- }