@typemove/sui 1.0.0-rc.19 → 1.0.0-rc.21

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 (61) hide show
  1. package/dist/builtin/0x1.d.ts +211 -10870
  2. package/dist/builtin/0x1.d.ts.map +1 -1
  3. package/dist/builtin/0x1.js +166 -165
  4. package/dist/builtin/0x1.js.map +1 -1
  5. package/dist/builtin/0x2.d.ts +1163 -46532
  6. package/dist/builtin/0x2.d.ts.map +1 -1
  7. package/dist/builtin/0x2.js +700 -699
  8. package/dist/builtin/0x2.js.map +1 -1
  9. package/dist/builtin/0x3.d.ts +476 -13475
  10. package/dist/builtin/0x3.d.ts.map +1 -1
  11. package/dist/builtin/0x3.js +202 -201
  12. package/dist/builtin/0x3.js.map +1 -1
  13. package/dist/codegen/codegen.js +9 -8
  14. package/dist/codegen/codegen.js.map +1 -1
  15. package/dist/models.d.ts +1 -1
  16. package/dist/models.d.ts.map +1 -1
  17. package/dist/models.js.map +1 -1
  18. package/dist/move-coder.d.ts +1 -1
  19. package/dist/move-coder.d.ts.map +1 -1
  20. package/dist/move-coder.js +1 -5
  21. package/dist/move-coder.js.map +1 -1
  22. package/dist/sui-chain-adapter.d.ts +1 -1
  23. package/dist/sui-chain-adapter.d.ts.map +1 -1
  24. package/dist/sui-chain-adapter.js +10 -4
  25. package/dist/sui-chain-adapter.js.map +1 -1
  26. package/dist/tests/move-call.test.d.ts.map +1 -1
  27. package/dist/tests/move-call.test.js.map +1 -1
  28. package/dist/tests/move-coder.test.js.map +1 -1
  29. package/dist/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.d.ts +25 -544
  30. package/dist/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.d.ts.map +1 -1
  31. package/dist/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.js +10 -9
  32. package/dist/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.js.map +1 -1
  33. package/dist/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.d.ts +250 -6489
  34. package/dist/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.d.ts.map +1 -1
  35. package/dist/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.js +98 -97
  36. package/dist/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.js.map +1 -1
  37. package/dist/tests/types/testnet/0xdee9.d.ts +289 -6398
  38. package/dist/tests/types/testnet/0xdee9.d.ts.map +1 -1
  39. package/dist/tests/types/testnet/0xdee9.js +96 -95
  40. package/dist/tests/types/testnet/0xdee9.js.map +1 -1
  41. package/dist/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.d.ts +977 -21126
  42. package/dist/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.d.ts.map +1 -1
  43. package/dist/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.js +312 -311
  44. package/dist/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.js.map +1 -1
  45. package/dist/to-internal.d.ts +1 -1
  46. package/dist/to-internal.d.ts.map +1 -1
  47. package/dist/to-internal.js +2 -8
  48. package/dist/to-internal.js.map +1 -1
  49. package/package.json +5 -12
  50. package/src/builtin/0x1.ts +293 -297
  51. package/src/builtin/0x2.ts +1483 -1490
  52. package/src/builtin/0x3.ts +582 -589
  53. package/src/codegen/codegen.ts +10 -9
  54. package/src/models.ts +8 -14
  55. package/src/move-coder.ts +6 -20
  56. package/src/sui-chain-adapter.ts +13 -15
  57. package/src/tests/types/testnet/0x1e2b124f746a339b3cf99b9f969393a96594519aafb1d06517aacfeeae20e7a5.ts +27 -31
  58. package/src/tests/types/testnet/0x6c4a21e3e7e6b6d51c4604021633e1d97e24e37a696f8c082cd48f37503e602a.ts +276 -280
  59. package/src/tests/types/testnet/0xdee9.ts +303 -307
  60. package/src/tests/types/testnet/0xebaa2ad3eacc230f309cd933958cc52684df0a41ae7ac214d186b80f830867d2.ts +1064 -1068
  61. package/src/to-internal.ts +12 -32
@@ -4,7 +4,7 @@ import type {
4
4
  SuiMoveNormalizedModule,
5
5
  SuiMoveNormalizedStruct,
6
6
  SuiMoveNormalizedType,
7
- } from '@mysten/sui.js'
7
+ } from '@mysten/sui.js/client'
8
8
  import {
9
9
  InternalMoveFunction,
10
10
  InternalMoveFunctionVisibility,
@@ -15,25 +15,16 @@ import {
15
15
  TypeDescriptor,
16
16
  } from '@typemove/move'
17
17
 
18
- export function toInternalModule(
19
- module: SuiMoveNormalizedModule
20
- ): InternalMoveModule {
18
+ export function toInternalModule(module: SuiMoveNormalizedModule): InternalMoveModule {
21
19
  return {
22
20
  address: module.address,
23
- exposedFunctions: Object.entries(module.exposedFunctions).map(([n, f]) =>
24
- toInternalFunction(n, f)
25
- ),
21
+ exposedFunctions: Object.entries(module.exposedFunctions).map(([n, f]) => toInternalFunction(n, f)),
26
22
  name: module.name,
27
- structs: Object.entries(module.structs).map(([n, s]) =>
28
- toInternalStruct(n, s)
29
- ),
23
+ structs: Object.entries(module.structs).map(([n, s]) => toInternalStruct(n, s)),
30
24
  }
31
25
  }
32
26
 
33
- function toInternalFunction(
34
- name: string,
35
- func: SuiMoveNormalizedFunction
36
- ): InternalMoveFunction {
27
+ function toInternalFunction(name: string, func: SuiMoveNormalizedFunction): InternalMoveFunction {
37
28
  let visibility
38
29
  switch (func.visibility) {
39
30
  case 'Private':
@@ -60,10 +51,7 @@ function toInternalFunction(
60
51
  }
61
52
  }
62
53
 
63
- function toInternalStruct(
64
- name: string,
65
- struct: SuiMoveNormalizedStruct
66
- ): InternalMoveStruct {
54
+ function toInternalStruct(name: string, struct: SuiMoveNormalizedStruct): InternalMoveStruct {
67
55
  return {
68
56
  abilities: struct.abilities.abilities,
69
57
  fields: struct.fields.map(toInternalField),
@@ -75,28 +63,22 @@ function toInternalStruct(
75
63
  }
76
64
  }
77
65
 
78
- function toInternalField(
79
- module: SuiMoveNormalizedField
80
- ): InternalMoveStructField {
66
+ function toInternalField(module: SuiMoveNormalizedField): InternalMoveStructField {
81
67
  return {
82
68
  name: module.name,
83
69
  type: toTypeDescriptor(module.type),
84
70
  }
85
71
  }
86
72
 
87
- function toTypeDescriptor(
88
- normalizedType: SuiMoveNormalizedType
89
- ): TypeDescriptor {
73
+ function toTypeDescriptor(normalizedType: SuiMoveNormalizedType): TypeDescriptor {
90
74
  if (typeof normalizedType === 'string') {
91
75
  return new TypeDescriptor(normalizedType)
92
76
  }
93
77
 
94
78
  if ('Struct' in normalizedType) {
95
- const qname = [
96
- normalizedType.Struct.address,
97
- normalizedType.Struct.module,
98
- normalizedType.Struct.name,
99
- ].join(SPLITTER)
79
+ const qname = [normalizedType.Struct.address, normalizedType.Struct.module, normalizedType.Struct.name].join(
80
+ SPLITTER
81
+ )
100
82
 
101
83
  const args = normalizedType.Struct.typeArguments.map(toTypeDescriptor)
102
84
 
@@ -104,9 +86,7 @@ function toTypeDescriptor(
104
86
  }
105
87
 
106
88
  if ('Vector' in normalizedType) {
107
- return new TypeDescriptor('Vector', [
108
- toTypeDescriptor(normalizedType.Vector),
109
- ])
89
+ return new TypeDescriptor('Vector', [toTypeDescriptor(normalizedType.Vector)])
110
90
  }
111
91
  if ('TypeParameter' in normalizedType) {
112
92
  return new TypeDescriptor('T' + normalizedType.TypeParameter)