@zing-protocol/zing-sdk 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 (87) hide show
  1. package/README.md +12 -0
  2. package/package.json +37 -0
  3. package/src/_generated/index.js +6 -0
  4. package/src/_generated/utils/index.ts +181 -0
  5. package/src/_generated/zing_framework/coin_utils.ts +41 -0
  6. package/src/_generated/zing_framework/deps/sui/object.ts +16 -0
  7. package/src/_generated/zing_framework/derived_object_bag.ts +400 -0
  8. package/src/_generated/zing_framework/derived_table.ts +366 -0
  9. package/src/_generated/zing_governance/admin.ts +47 -0
  10. package/src/_generated/zing_governance/deps/sui/object.ts +16 -0
  11. package/src/_generated/zing_governance/treasury.ts +134 -0
  12. package/src/_generated/zing_identity/config.ts +191 -0
  13. package/src/_generated/zing_identity/deps/std/type_name.ts +25 -0
  14. package/src/_generated/zing_identity/deps/sui/object.ts +16 -0
  15. package/src/_generated/zing_identity/deps/sui/object_table.ts +26 -0
  16. package/src/_generated/zing_identity/deps/sui/table.ts +38 -0
  17. package/src/_generated/zing_identity/deps/sui/vec_set.ts +28 -0
  18. package/src/_generated/zing_identity/ecdsa.ts +166 -0
  19. package/src/_generated/zing_identity/identity.ts +661 -0
  20. package/src/_generated/zing_identity/reclaim.ts +803 -0
  21. package/src/_generated/zing_studio/app.ts +855 -0
  22. package/src/_generated/zing_studio/article.ts +598 -0
  23. package/src/_generated/zing_studio/config.ts +475 -0
  24. package/src/_generated/zing_studio/deps/std/type_name.ts +25 -0
  25. package/src/_generated/zing_studio/deps/sui/bag.ts +43 -0
  26. package/src/_generated/zing_studio/deps/sui/balance.ts +20 -0
  27. package/src/_generated/zing_studio/deps/sui/coin.ts +21 -0
  28. package/src/_generated/zing_studio/deps/sui/dynamic_field.ts +272 -0
  29. package/src/_generated/zing_studio/deps/sui/object.ts +16 -0
  30. package/src/_generated/zing_studio/deps/sui/table.ts +38 -0
  31. package/src/_generated/zing_studio/deps/sui/vec_map.ts +39 -0
  32. package/src/_generated/zing_studio/deps/sui/vec_set.ts +28 -0
  33. package/src/_generated/zing_studio/deps/walrus/blob.ts +22 -0
  34. package/src/_generated/zing_studio/deps/walrus/events.ts +124 -0
  35. package/src/_generated/zing_studio/deps/walrus/metadata.ts +137 -0
  36. package/src/_generated/zing_studio/deps/walrus/storage_resource.ts +17 -0
  37. package/src/_generated/zing_studio/deps/zing_framework/derived_object_bag.ts +17 -0
  38. package/src/_generated/zing_studio/deps/zing_framework/derived_table.ts +17 -0
  39. package/src/_generated/zing_studio/donation.ts +18 -0
  40. package/src/_generated/zing_studio/enclave.ts +466 -0
  41. package/src/_generated/zing_studio/nitro_attestation.ts +308 -0
  42. package/src/_generated/zing_studio/referral.ts +447 -0
  43. package/src/_generated/zing_studio/storage.ts +664 -0
  44. package/src/_generated/zing_studio/studio.ts +682 -0
  45. package/src/bcs.ts +139 -0
  46. package/src/client/index.ts +557 -0
  47. package/src/client/types.ts +28 -0
  48. package/src/components/index.ts +3 -0
  49. package/src/components/wallet-provider.tsx +53 -0
  50. package/src/components/walrus-provider.tsx +212 -0
  51. package/src/components/zing-provider.tsx +54 -0
  52. package/src/config/common.ts +82 -0
  53. package/src/config/index.ts +45 -0
  54. package/src/config/mainnet.ts +109 -0
  55. package/src/config/testnet.ts +111 -0
  56. package/src/config/types.ts +69 -0
  57. package/src/const.ts +32 -0
  58. package/src/getters.ts +523 -0
  59. package/src/hooks/index.ts +14 -0
  60. package/src/hooks/useGetStudio.ts +22 -0
  61. package/src/hooks/useGetTierPlan.ts +115 -0
  62. package/src/hooks/useReclaim.ts +165 -0
  63. package/src/hooks/useSignAndExecuteTransaction.ts +57 -0
  64. package/src/hooks/useSignPersonalMessage.ts +28 -0
  65. package/src/hooks/useZingInfiniteQueries.ts +92 -0
  66. package/src/hooks/useZingMutation.ts +66 -0
  67. package/src/hooks/useZingQueries.ts +107 -0
  68. package/src/hooks/useZingQuery.ts +88 -0
  69. package/src/index.ts +15 -0
  70. package/src/lib/utils/colorful-logger.ts +27 -0
  71. package/src/lib/utils/const.ts +25 -0
  72. package/src/lib/utils/helpers.ts +78 -0
  73. package/src/lib/utils/index.ts +5 -0
  74. package/src/lib/utils/init-app-with-shadow.ts +42 -0
  75. package/src/lib/utils/quilt.ts +317 -0
  76. package/src/lib/utils/reclaim.ts +148 -0
  77. package/src/lib/utils/types.ts +14 -0
  78. package/src/mutations/index.ts +3 -0
  79. package/src/mutations/seal.ts +78 -0
  80. package/src/mutations/signer.ts +241 -0
  81. package/src/mutations/walrus.ts +862 -0
  82. package/src/stores/index.ts +3 -0
  83. package/src/stores/walletStore.ts +360 -0
  84. package/src/stores/walrusStore.ts +118 -0
  85. package/src/stores/zkloginStore.ts +53 -0
  86. package/src/types.ts +120 -0
  87. package/tsconfig.json +12 -0
@@ -0,0 +1,475 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+ import * as type_name from "./deps/std/type_name.js";
5
+ import * as object from "./deps/sui/object.js";
6
+ import * as vec_set from "./deps/sui/vec_set.js";
7
+ import { MoveStruct, normalizeMoveArguments } from "../utils/index.js";
8
+ import { bcs } from "@mysten/sui/bcs";
9
+ import type { RawTransactionArgument } from "../utils/index.js";
10
+ import type { Transaction } from "@mysten/sui/transactions";
11
+
12
+ const $moduleName = "@local-pkg/zing_studio::config";
13
+ export const Config = new MoveStruct({
14
+ name: `${$moduleName}::Config`,
15
+ fields: {
16
+ id: object.UID,
17
+ versions: vec_set.VecSet(bcs.u64()),
18
+ managers: vec_set.VecSet(bcs.Address),
19
+ allowed_works: vec_set.VecSet(type_name.TypeName),
20
+ platform_fee_bps: bcs.u64(),
21
+ allowed_stablecoins: vec_set.VecSet(type_name.TypeName),
22
+ max_num_of_subscription_level: bcs.u8(),
23
+ },
24
+ });
25
+ export interface PackageVersionOptions {
26
+ package?: string;
27
+ arguments?: [];
28
+ }
29
+ export function packageVersion(options: PackageVersionOptions = {}) {
30
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
31
+ return (tx: Transaction) =>
32
+ tx.moveCall({
33
+ package: packageAddress,
34
+ module: "config",
35
+ function: "package_version",
36
+ });
37
+ }
38
+ export interface FeeScalingOptions {
39
+ package?: string;
40
+ arguments?: [];
41
+ }
42
+ export function feeScaling(options: FeeScalingOptions = {}) {
43
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
44
+ return (tx: Transaction) =>
45
+ tx.moveCall({
46
+ package: packageAddress,
47
+ module: "config",
48
+ function: "fee_scaling",
49
+ });
50
+ }
51
+ export interface MonthDurationInWalrusEpochOptions {
52
+ package?: string;
53
+ arguments?: [];
54
+ }
55
+ export function monthDurationInWalrusEpoch(
56
+ options: MonthDurationInWalrusEpochOptions = {},
57
+ ) {
58
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
59
+ return (tx: Transaction) =>
60
+ tx.moveCall({
61
+ package: packageAddress,
62
+ module: "config",
63
+ function: "month_duration_in_walrus_epoch",
64
+ });
65
+ }
66
+ export interface DayInMilliesecondOptions {
67
+ package?: string;
68
+ arguments?: [];
69
+ }
70
+ export function dayInMilliesecond(options: DayInMilliesecondOptions = {}) {
71
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
72
+ return (tx: Transaction) =>
73
+ tx.moveCall({
74
+ package: packageAddress,
75
+ module: "config",
76
+ function: "day_in_milliesecond",
77
+ });
78
+ }
79
+ export interface BlobExtendedDurationOptions {
80
+ package?: string;
81
+ arguments?: [];
82
+ }
83
+ export function blobExtendedDuration(
84
+ options: BlobExtendedDurationOptions = {},
85
+ ) {
86
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
87
+ return (tx: Transaction) =>
88
+ tx.moveCall({
89
+ package: packageAddress,
90
+ module: "config",
91
+ function: "blob_extended_duration",
92
+ });
93
+ }
94
+ export interface ManagersArguments {
95
+ self: RawTransactionArgument<string>;
96
+ }
97
+ export interface ManagersOptions {
98
+ package?: string;
99
+ arguments: ManagersArguments | [self: RawTransactionArgument<string>];
100
+ }
101
+ export function managers(options: ManagersOptions) {
102
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
103
+ const argumentsTypes = [
104
+ `${packageAddress}::config::Config`,
105
+ ] satisfies string[];
106
+ const parameterNames = ["self"];
107
+ return (tx: Transaction) =>
108
+ tx.moveCall({
109
+ package: packageAddress,
110
+ module: "config",
111
+ function: "managers",
112
+ arguments: normalizeMoveArguments(
113
+ options.arguments,
114
+ argumentsTypes,
115
+ parameterNames,
116
+ ),
117
+ });
118
+ }
119
+ export interface AllowedWorksArguments {
120
+ self: RawTransactionArgument<string>;
121
+ }
122
+ export interface AllowedWorksOptions {
123
+ package?: string;
124
+ arguments: AllowedWorksArguments | [self: RawTransactionArgument<string>];
125
+ }
126
+ export function allowedWorks(options: AllowedWorksOptions) {
127
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
128
+ const argumentsTypes = [
129
+ `${packageAddress}::config::Config`,
130
+ ] satisfies string[];
131
+ const parameterNames = ["self"];
132
+ return (tx: Transaction) =>
133
+ tx.moveCall({
134
+ package: packageAddress,
135
+ module: "config",
136
+ function: "allowed_works",
137
+ arguments: normalizeMoveArguments(
138
+ options.arguments,
139
+ argumentsTypes,
140
+ parameterNames,
141
+ ),
142
+ });
143
+ }
144
+ export interface PlatformFeeBpsArguments {
145
+ self: RawTransactionArgument<string>;
146
+ }
147
+ export interface PlatformFeeBpsOptions {
148
+ package?: string;
149
+ arguments: PlatformFeeBpsArguments | [self: RawTransactionArgument<string>];
150
+ }
151
+ export function platformFeeBps(options: PlatformFeeBpsOptions) {
152
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
153
+ const argumentsTypes = [
154
+ `${packageAddress}::config::Config`,
155
+ ] satisfies string[];
156
+ const parameterNames = ["self"];
157
+ return (tx: Transaction) =>
158
+ tx.moveCall({
159
+ package: packageAddress,
160
+ module: "config",
161
+ function: "platform_fee_bps",
162
+ arguments: normalizeMoveArguments(
163
+ options.arguments,
164
+ argumentsTypes,
165
+ parameterNames,
166
+ ),
167
+ });
168
+ }
169
+ export interface AllowedStablecoinsArguments {
170
+ self: RawTransactionArgument<string>;
171
+ }
172
+ export interface AllowedStablecoinsOptions {
173
+ package?: string;
174
+ arguments:
175
+ | AllowedStablecoinsArguments
176
+ | [self: RawTransactionArgument<string>];
177
+ }
178
+ export function allowedStablecoins(options: AllowedStablecoinsOptions) {
179
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
180
+ const argumentsTypes = [
181
+ `${packageAddress}::config::Config`,
182
+ ] satisfies string[];
183
+ const parameterNames = ["self"];
184
+ return (tx: Transaction) =>
185
+ tx.moveCall({
186
+ package: packageAddress,
187
+ module: "config",
188
+ function: "allowed_stablecoins",
189
+ arguments: normalizeMoveArguments(
190
+ options.arguments,
191
+ argumentsTypes,
192
+ parameterNames,
193
+ ),
194
+ });
195
+ }
196
+ export interface AddVersionArguments {
197
+ self: RawTransactionArgument<string>;
198
+ Cap: RawTransactionArgument<string>;
199
+ version: RawTransactionArgument<number | bigint>;
200
+ }
201
+ export interface AddVersionOptions {
202
+ package?: string;
203
+ arguments:
204
+ | AddVersionArguments
205
+ | [
206
+ self: RawTransactionArgument<string>,
207
+ Cap: RawTransactionArgument<string>,
208
+ version: RawTransactionArgument<number | bigint>,
209
+ ];
210
+ }
211
+ export function addVersion(options: AddVersionOptions) {
212
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
213
+ const argumentsTypes = [
214
+ `${packageAddress}::config::Config`,
215
+ `${packageAddress}::admin::AdminCap`,
216
+ "u64",
217
+ ] satisfies string[];
218
+ const parameterNames = ["self", "Cap", "version"];
219
+ return (tx: Transaction) =>
220
+ tx.moveCall({
221
+ package: packageAddress,
222
+ module: "config",
223
+ function: "add_version",
224
+ arguments: normalizeMoveArguments(
225
+ options.arguments,
226
+ argumentsTypes,
227
+ parameterNames,
228
+ ),
229
+ });
230
+ }
231
+ export interface RemoveVersionArguments {
232
+ self: RawTransactionArgument<string>;
233
+ Cap: RawTransactionArgument<string>;
234
+ version: RawTransactionArgument<number | bigint>;
235
+ }
236
+ export interface RemoveVersionOptions {
237
+ package?: string;
238
+ arguments:
239
+ | RemoveVersionArguments
240
+ | [
241
+ self: RawTransactionArgument<string>,
242
+ Cap: RawTransactionArgument<string>,
243
+ version: RawTransactionArgument<number | bigint>,
244
+ ];
245
+ }
246
+ export function removeVersion(options: RemoveVersionOptions) {
247
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
248
+ const argumentsTypes = [
249
+ `${packageAddress}::config::Config`,
250
+ `${packageAddress}::admin::AdminCap`,
251
+ "u64",
252
+ ] satisfies string[];
253
+ const parameterNames = ["self", "Cap", "version"];
254
+ return (tx: Transaction) =>
255
+ tx.moveCall({
256
+ package: packageAddress,
257
+ module: "config",
258
+ function: "remove_version",
259
+ arguments: normalizeMoveArguments(
260
+ options.arguments,
261
+ argumentsTypes,
262
+ parameterNames,
263
+ ),
264
+ });
265
+ }
266
+ export interface AddAllowedWorksArguments {
267
+ self: RawTransactionArgument<string>;
268
+ Cap: RawTransactionArgument<string>;
269
+ }
270
+ export interface AddAllowedWorksOptions {
271
+ package?: string;
272
+ arguments:
273
+ | AddAllowedWorksArguments
274
+ | [
275
+ self: RawTransactionArgument<string>,
276
+ Cap: RawTransactionArgument<string>,
277
+ ];
278
+ typeArguments: [string];
279
+ }
280
+ export function addAllowedWorks(options: AddAllowedWorksOptions) {
281
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
282
+ const argumentsTypes = [
283
+ `${packageAddress}::config::Config`,
284
+ `${packageAddress}::admin::AdminCap`,
285
+ ] satisfies string[];
286
+ const parameterNames = ["self", "Cap"];
287
+ return (tx: Transaction) =>
288
+ tx.moveCall({
289
+ package: packageAddress,
290
+ module: "config",
291
+ function: "add_allowed_works",
292
+ arguments: normalizeMoveArguments(
293
+ options.arguments,
294
+ argumentsTypes,
295
+ parameterNames,
296
+ ),
297
+ typeArguments: options.typeArguments,
298
+ });
299
+ }
300
+ export interface RemoveAllowedWorksArguments {
301
+ self: RawTransactionArgument<string>;
302
+ Cap: RawTransactionArgument<string>;
303
+ }
304
+ export interface RemoveAllowedWorksOptions {
305
+ package?: string;
306
+ arguments:
307
+ | RemoveAllowedWorksArguments
308
+ | [
309
+ self: RawTransactionArgument<string>,
310
+ Cap: RawTransactionArgument<string>,
311
+ ];
312
+ typeArguments: [string];
313
+ }
314
+ export function removeAllowedWorks(options: RemoveAllowedWorksOptions) {
315
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
316
+ const argumentsTypes = [
317
+ `${packageAddress}::config::Config`,
318
+ `${packageAddress}::admin::AdminCap`,
319
+ ] satisfies string[];
320
+ const parameterNames = ["self", "Cap"];
321
+ return (tx: Transaction) =>
322
+ tx.moveCall({
323
+ package: packageAddress,
324
+ module: "config",
325
+ function: "remove_allowed_works",
326
+ arguments: normalizeMoveArguments(
327
+ options.arguments,
328
+ argumentsTypes,
329
+ parameterNames,
330
+ ),
331
+ typeArguments: options.typeArguments,
332
+ });
333
+ }
334
+ export interface UpdatePlatformFeeBpsArguments {
335
+ self: RawTransactionArgument<string>;
336
+ Cap: RawTransactionArgument<string>;
337
+ platformFeeBps: RawTransactionArgument<number | bigint>;
338
+ }
339
+ export interface UpdatePlatformFeeBpsOptions {
340
+ package?: string;
341
+ arguments:
342
+ | UpdatePlatformFeeBpsArguments
343
+ | [
344
+ self: RawTransactionArgument<string>,
345
+ Cap: RawTransactionArgument<string>,
346
+ platformFeeBps: RawTransactionArgument<number | bigint>,
347
+ ];
348
+ }
349
+ export function updatePlatformFeeBps(options: UpdatePlatformFeeBpsOptions) {
350
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
351
+ const argumentsTypes = [
352
+ `${packageAddress}::config::Config`,
353
+ `${packageAddress}::admin::AdminCap`,
354
+ "u64",
355
+ ] satisfies string[];
356
+ const parameterNames = ["self", "Cap", "platformFeeBps"];
357
+ return (tx: Transaction) =>
358
+ tx.moveCall({
359
+ package: packageAddress,
360
+ module: "config",
361
+ function: "update_platform_fee_bps",
362
+ arguments: normalizeMoveArguments(
363
+ options.arguments,
364
+ argumentsTypes,
365
+ parameterNames,
366
+ ),
367
+ });
368
+ }
369
+ export interface AddAllowedStablecoinsArguments {
370
+ self: RawTransactionArgument<string>;
371
+ Cap: RawTransactionArgument<string>;
372
+ }
373
+ export interface AddAllowedStablecoinsOptions {
374
+ package?: string;
375
+ arguments:
376
+ | AddAllowedStablecoinsArguments
377
+ | [
378
+ self: RawTransactionArgument<string>,
379
+ Cap: RawTransactionArgument<string>,
380
+ ];
381
+ typeArguments: [string];
382
+ }
383
+ export function addAllowedStablecoins(options: AddAllowedStablecoinsOptions) {
384
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
385
+ const argumentsTypes = [
386
+ `${packageAddress}::config::Config`,
387
+ `${packageAddress}::admin::AdminCap`,
388
+ ] satisfies string[];
389
+ const parameterNames = ["self", "Cap"];
390
+ return (tx: Transaction) =>
391
+ tx.moveCall({
392
+ package: packageAddress,
393
+ module: "config",
394
+ function: "add_allowed_stablecoins",
395
+ arguments: normalizeMoveArguments(
396
+ options.arguments,
397
+ argumentsTypes,
398
+ parameterNames,
399
+ ),
400
+ typeArguments: options.typeArguments,
401
+ });
402
+ }
403
+ export interface RemoveAllowedStablecoinsArguments {
404
+ self: RawTransactionArgument<string>;
405
+ Cap: RawTransactionArgument<string>;
406
+ }
407
+ export interface RemoveAllowedStablecoinsOptions {
408
+ package?: string;
409
+ arguments:
410
+ | RemoveAllowedStablecoinsArguments
411
+ | [
412
+ self: RawTransactionArgument<string>,
413
+ Cap: RawTransactionArgument<string>,
414
+ ];
415
+ typeArguments: [string];
416
+ }
417
+ export function removeAllowedStablecoins(
418
+ options: RemoveAllowedStablecoinsOptions,
419
+ ) {
420
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
421
+ const argumentsTypes = [
422
+ `${packageAddress}::config::Config`,
423
+ `${packageAddress}::admin::AdminCap`,
424
+ ] satisfies string[];
425
+ const parameterNames = ["self", "Cap"];
426
+ return (tx: Transaction) =>
427
+ tx.moveCall({
428
+ package: packageAddress,
429
+ module: "config",
430
+ function: "remove_allowed_stablecoins",
431
+ arguments: normalizeMoveArguments(
432
+ options.arguments,
433
+ argumentsTypes,
434
+ parameterNames,
435
+ ),
436
+ typeArguments: options.typeArguments,
437
+ });
438
+ }
439
+ export interface UpdaqteMaxNumOfSubscriptionLevelArguments {
440
+ self: RawTransactionArgument<string>;
441
+ Cap: RawTransactionArgument<string>;
442
+ num: RawTransactionArgument<number>;
443
+ }
444
+ export interface UpdaqteMaxNumOfSubscriptionLevelOptions {
445
+ package?: string;
446
+ arguments:
447
+ | UpdaqteMaxNumOfSubscriptionLevelArguments
448
+ | [
449
+ self: RawTransactionArgument<string>,
450
+ Cap: RawTransactionArgument<string>,
451
+ num: RawTransactionArgument<number>,
452
+ ];
453
+ }
454
+ export function updaqteMaxNumOfSubscriptionLevel(
455
+ options: UpdaqteMaxNumOfSubscriptionLevelOptions,
456
+ ) {
457
+ const packageAddress = options.package ?? "@local-pkg/zing_studio";
458
+ const argumentsTypes = [
459
+ `${packageAddress}::config::Config`,
460
+ `${packageAddress}::admin::AdminCap`,
461
+ "u8",
462
+ ] satisfies string[];
463
+ const parameterNames = ["self", "Cap", "num"];
464
+ return (tx: Transaction) =>
465
+ tx.moveCall({
466
+ package: packageAddress,
467
+ module: "config",
468
+ function: "updaqte_max_num_of_subscription_level",
469
+ arguments: normalizeMoveArguments(
470
+ options.arguments,
471
+ argumentsTypes,
472
+ parameterNames,
473
+ ),
474
+ });
475
+ }
@@ -0,0 +1,25 @@
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
+
10
+ const $moduleName = "std::type_name";
11
+ export const TypeName = new MoveStruct({
12
+ name: `${$moduleName}::TypeName`,
13
+ fields: {
14
+ /**
15
+ * String representation of the type. All types are represented using their source
16
+ * syntax: "u8", "u64", "bool", "address", "vector", and so on for primitive types.
17
+ * Struct types are represented as fully qualified type names; e.g.
18
+ * `00000000000000000000000000000001::string::String` or
19
+ * `0000000000000000000000000000000a::module_name1::type_name1<0000000000000000000000000000000a::module_name2::type_name2<u64>>`
20
+ * Addresses are hex-encoded lowercase values of length ADDRESS_LENGTH (16, 20, or
21
+ * 32 depending on the Move platform)
22
+ */
23
+ name: bcs.string(),
24
+ },
25
+ });
@@ -0,0 +1,43 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * A bag is a heterogeneous map-like collection. The collection is similar to
7
+ * `sui::table` in that its keys and values are not stored within the `Bag` value,
8
+ * but instead are stored using Sui's object system. The `Bag` struct acts only as
9
+ * a handle into the object system to retrieve those keys and values. Note that
10
+ * this means that `Bag` values with exactly the same key-value mapping will not be
11
+ * equal, with `==`, at runtime. For example
12
+ *
13
+ * ```
14
+ * let bag1 = bag::new();
15
+ * let bag2 = bag::new();
16
+ * bag::add(&mut bag1, 0, false);
17
+ * bag::add(&mut bag1, 1, true);
18
+ * bag::add(&mut bag2, 0, false);
19
+ * bag::add(&mut bag2, 1, true);
20
+ * // bag1 does not equal bag2, despite having the same entries
21
+ * assert!(&bag1 != &bag2);
22
+ * ```
23
+ *
24
+ * At it's core, `sui::bag` is a wrapper around `UID` that allows for access to
25
+ * `sui::dynamic_field` while preventing accidentally stranding field values. A
26
+ * `UID` can be deleted, even if it has dynamic fields associated with it, but a
27
+ * bag, on the other hand, must be empty to be destroyed.
28
+ */
29
+
30
+ import * as object from "./object.js";
31
+ import { MoveStruct } from "../../../utils/index.js";
32
+ import { bcs } from "@mysten/sui/bcs";
33
+
34
+ const $moduleName = "0x2::bag";
35
+ export const Bag = new MoveStruct({
36
+ name: `${$moduleName}::Bag`,
37
+ fields: {
38
+ /** the ID of this bag */
39
+ id: object.UID,
40
+ /** the number of key-value pairs in the bag */
41
+ size: bcs.u64(),
42
+ },
43
+ });
@@ -0,0 +1,20 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * A storable handler for Balances in general. Is used in the `Coin` module to
7
+ * allow balance operations and can be used to implement custom coins with `Supply`
8
+ * and `Balance`s.
9
+ */
10
+
11
+ import { MoveStruct } from "../../../utils/index.js";
12
+ import { bcs } from "@mysten/sui/bcs";
13
+
14
+ const $moduleName = "0x2::balance";
15
+ export const Balance = new MoveStruct({
16
+ name: `${$moduleName}::Balance`,
17
+ fields: {
18
+ value: bcs.u64(),
19
+ },
20
+ });
@@ -0,0 +1,21 @@
1
+ /**************************************************************
2
+ * THIS FILE IS GENERATED AND SHOULD NOT BE MANUALLY MODIFIED *
3
+ **************************************************************/
4
+
5
+ /**
6
+ * Defines the `Coin` type - platform wide representation of fungible tokens and
7
+ * coins. `Coin` can be described as a secure wrapper around `Balance` type.
8
+ */
9
+
10
+ import * as balance from "./balance.js";
11
+ import * as object from "./object.js";
12
+ import { MoveStruct } from "../../../utils/index.js";
13
+
14
+ const $moduleName = "0x2::coin";
15
+ export const Coin = new MoveStruct({
16
+ name: `${$moduleName}::Coin`,
17
+ fields: {
18
+ id: object.UID,
19
+ balance: balance.Balance,
20
+ },
21
+ });