@sentio/sdk 2.13.0-rc.7 → 2.13.0-rc.9

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 (73) hide show
  1. package/lib/aptos/builtin/0x1.d.ts +1076 -431
  2. package/lib/aptos/builtin/0x1.js +1937 -1457
  3. package/lib/aptos/builtin/0x1.js.map +1 -1
  4. package/lib/aptos/builtin/0x3.d.ts +206 -83
  5. package/lib/aptos/builtin/0x3.js +371 -332
  6. package/lib/aptos/builtin/0x3.js.map +1 -1
  7. package/lib/aptos/codegen/codegen.d.ts +1 -1
  8. package/lib/aptos/codegen/codegen.js +2 -2
  9. package/lib/aptos/codegen/codegen.js.map +1 -1
  10. package/lib/aptos/codegen/run.js +1 -1
  11. package/lib/aptos/codegen/run.js.map +1 -1
  12. package/lib/aptos/ext/aptos-dex.d.ts +2 -1
  13. package/lib/aptos/ext/aptos-dex.js +1 -1
  14. package/lib/aptos/ext/aptos-dex.js.map +1 -1
  15. package/lib/aptos/index.d.ts +1 -0
  16. package/lib/aptos/index.js +1 -0
  17. package/lib/aptos/index.js.map +1 -1
  18. package/lib/aptos/models.d.ts +3 -11
  19. package/lib/aptos/models.js.map +1 -1
  20. package/lib/aptos/move-coder.d.ts +3 -2
  21. package/lib/aptos/move-coder.js +11 -4
  22. package/lib/aptos/move-coder.js.map +1 -1
  23. package/lib/move/abstract-codegen.d.ts +2 -2
  24. package/lib/move/abstract-codegen.js +36 -11
  25. package/lib/move/abstract-codegen.js.map +1 -1
  26. package/lib/move/abstract-move-coder.d.ts +3 -7
  27. package/lib/move/abstract-move-coder.js +3 -3
  28. package/lib/move/abstract-move-coder.js.map +1 -1
  29. package/lib/move/types.d.ts +22 -1
  30. package/lib/move/types.js +46 -17
  31. package/lib/move/types.js.map +1 -1
  32. package/lib/sui/builtin/0x1.d.ts +31 -12
  33. package/lib/sui/builtin/0x1.js +56 -31
  34. package/lib/sui/builtin/0x1.js.map +1 -1
  35. package/lib/sui/builtin/0x2.d.ts +256 -103
  36. package/lib/sui/builtin/0x2.js +461 -316
  37. package/lib/sui/builtin/0x2.js.map +1 -1
  38. package/lib/sui/builtin/0x3.d.ts +126 -51
  39. package/lib/sui/builtin/0x3.js +227 -271
  40. package/lib/sui/builtin/0x3.js.map +1 -1
  41. package/lib/sui/codegen/codegen.d.ts +1 -1
  42. package/lib/sui/codegen/codegen.js +3 -2
  43. package/lib/sui/codegen/codegen.js.map +1 -1
  44. package/lib/sui/codegen/run.js +1 -1
  45. package/lib/sui/codegen/run.js.map +1 -1
  46. package/lib/sui/index.d.ts +1 -0
  47. package/lib/sui/index.js +1 -0
  48. package/lib/sui/index.js.map +1 -1
  49. package/lib/sui/models.d.ts +3 -11
  50. package/lib/sui/models.js.map +1 -1
  51. package/lib/sui/move-coder.d.ts +5 -5
  52. package/lib/sui/move-coder.js +14 -7
  53. package/lib/sui/move-coder.js.map +1 -1
  54. package/package.json +4 -4
  55. package/src/aptos/builtin/0x1.ts +2688 -447
  56. package/src/aptos/builtin/0x3.ts +506 -84
  57. package/src/aptos/codegen/codegen.ts +7 -2
  58. package/src/aptos/codegen/run.ts +1 -1
  59. package/src/aptos/ext/aptos-dex.ts +3 -5
  60. package/src/aptos/index.ts +2 -0
  61. package/src/aptos/models.ts +3 -13
  62. package/src/aptos/move-coder.ts +14 -4
  63. package/src/move/abstract-codegen.ts +39 -13
  64. package/src/move/abstract-move-coder.ts +11 -16
  65. package/src/move/types.ts +63 -18
  66. package/src/sui/builtin/0x1.ts +67 -13
  67. package/src/sui/builtin/0x2.ts +649 -103
  68. package/src/sui/builtin/0x3.ts +315 -51
  69. package/src/sui/codegen/codegen.ts +8 -2
  70. package/src/sui/codegen/run.ts +1 -1
  71. package/src/sui/index.ts +1 -0
  72. package/src/sui/models.ts +3 -13
  73. package/src/sui/move-coder.ts +22 -15
@@ -6,12 +6,17 @@ import { join } from 'path'
6
6
  import { AptosChainAdapter } from '../aptos-chain-adapter.js'
7
7
  import { AbstractCodegen } from '../../move/abstract-codegen.js'
8
8
 
9
- export async function codegen(abisDir: string, outDir = join('src', 'types', 'aptos'), genExample = false) {
9
+ export async function codegen(
10
+ abisDir: string,
11
+ outDir = join('src', 'types', 'aptos'),
12
+ genExample = false,
13
+ builtin = false
14
+ ) {
10
15
  if (!fs.existsSync(abisDir)) {
11
16
  return
12
17
  }
13
18
  const gen = new AptosCodegen()
14
- const numFiles = await gen.generate(abisDir, outDir)
19
+ const numFiles = await gen.generate(abisDir, outDir, builtin)
15
20
  console.log(chalk.green(`Generated ${numFiles} for Aptos`))
16
21
  }
17
22
 
@@ -6,7 +6,7 @@ if (process.argv.length > 3) {
6
6
  const abisDir = process.argv[2]
7
7
  const targetDir = process.argv[3]
8
8
 
9
- await codegen(abisDir, targetDir)
9
+ await codegen(abisDir, targetDir, false, true)
10
10
  } else {
11
11
  console.error('Not enough argument')
12
12
  process.exit(1)
@@ -2,12 +2,13 @@ import { Gauge } from '@sentio/sdk'
2
2
  import { BigDecimal } from '@sentio/bigdecimal'
3
3
  import { calculateValueInUsd, getCoinInfo, whitelistCoins, whiteListed } from './coin.js'
4
4
  import { AptosResourcesContext, TypedMoveResource, MoveResource, AptosContext } from '@sentio/sdk/aptos'
5
+ import { TypeDescriptor } from '../../move/index.js'
5
6
 
6
7
  export interface PoolAdaptor<T> {
7
8
  getXReserve(pool: T): bigint
8
9
  getYReserve(pool: T): bigint
9
10
  getExtraPoolTags(pool: TypedMoveResource<T>): any
10
- poolTypeName: string
11
+ poolType: TypeDescriptor<T>
11
12
  }
12
13
 
13
14
  export class AptosDex<T> {
@@ -98,10 +99,7 @@ export class AptosDex<T> {
98
99
  ctx: AptosResourcesContext,
99
100
  poolsHandler?: (pools: TypedMoveResource<T>[]) => Promise<void> | void
100
101
  ) {
101
- const pools: TypedMoveResource<T>[] = await ctx.coder.filterAndDecodeResources(
102
- this.poolAdaptor.poolTypeName,
103
- resources
104
- )
102
+ const pools = await ctx.coder.filterAndDecodeResources(this.poolAdaptor.poolType, resources)
105
103
 
106
104
  const volumeByCoin = new Map<string, BigDecimal>()
107
105
  const timestamp = ctx.timestampInMicros
@@ -8,3 +8,5 @@ export * from './api.js'
8
8
  export { ModuleClient } from './module-client.js'
9
9
 
10
10
  export { AptosPlugin } from './aptos-plugin.js'
11
+
12
+ export { BUILTIN_TYPES } from '../move/types.js'
@@ -1,17 +1,12 @@
1
1
  import { Event, MoveResource, TransactionPayload_EntryFunctionPayload } from './move-types.js'
2
+ import { DecodedStruct } from '../move/types.js'
2
3
 
3
4
  export type EventInstance = Event & {
4
5
  version: string
5
6
  }
6
7
 
7
- export type TypedEventInstance<T> = EventInstance & {
8
- /**
9
- * decoded data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
10
- */
11
- data_decoded: T
12
-
13
- type_arguments: string[]
14
- }
8
+ export type TypedEventInstance<T> = DecodedStruct<EventInstance, T>
9
+ export type TypedMoveResource<T> = DecodedStruct<MoveResource, T>
15
10
 
16
11
  // Don't use intermediate type to make IDE happier
17
12
  export type TypedFunctionPayload<T extends Array<any>> = TransactionPayload_EntryFunctionPayload & {
@@ -20,8 +15,3 @@ export type TypedFunctionPayload<T extends Array<any>> = TransactionPayload_Entr
20
15
  */
21
16
  arguments_decoded: T
22
17
  }
23
-
24
- export type TypedMoveResource<T> = MoveResource & {
25
- data_decoded: T
26
- type_arguments: string[]
27
- }
@@ -10,6 +10,7 @@ import { TypedEventInstance, TypedFunctionPayload, TypedMoveResource } from './m
10
10
  import { AbstractMoveCoder } from '../move/abstract-move-coder.js'
11
11
  import { AptosNetwork } from './network.js'
12
12
  import { AptosChainAdapter } from './aptos-chain-adapter.js'
13
+ import { parseMoveType, TypeDescriptor } from '../move/index.js'
13
14
 
14
15
  export class MoveCoder extends AbstractMoveCoder<AptosNetwork, MoveModuleBytecode, Event | MoveResource> {
15
16
  constructor(network: AptosNetwork) {
@@ -36,14 +37,23 @@ export class MoveCoder extends AbstractMoveCoder<AptosNetwork, MoveModuleBytecod
36
37
  decodeEvent<T>(event: Event): Promise<TypedEventInstance<T> | undefined> {
37
38
  return this.decodedStruct<T>(event) as any
38
39
  }
39
- filterAndDecodeEvents<T>(typeQname: string, resources: Event[]): Promise<TypedEventInstance<T>[]> {
40
- return this.filterAndDecodeStruct(typeQname, resources) as any
40
+ filterAndDecodeEvents<T>(type: string | TypeDescriptor<T>, resources: Event[]): Promise<TypedEventInstance<T>[]> {
41
+ if (typeof type === 'string') {
42
+ type = parseMoveType(type)
43
+ }
44
+ return this.filterAndDecodeStruct(type, resources) as any
41
45
  }
42
46
  decodeResource<T>(res: MoveResource): Promise<TypedMoveResource<T> | undefined> {
43
47
  return this.decodedStruct<T>(res)
44
48
  }
45
- filterAndDecodeResources<T>(typeQname: string, resources: MoveResource[]): Promise<TypedMoveResource<T>[]> {
46
- return this.filterAndDecodeStruct(typeQname, resources) as any
49
+ filterAndDecodeResources<T>(
50
+ type: string | TypeDescriptor<T>,
51
+ resources: MoveResource[]
52
+ ): Promise<TypedMoveResource<T>[]> {
53
+ if (typeof type === 'string') {
54
+ type = parseMoveType(type)
55
+ }
56
+ return this.filterAndDecodeStruct(type, resources)
47
57
  }
48
58
 
49
59
  async decodeFunctionPayload(
@@ -46,17 +46,18 @@ export abstract class AbstractCodegen<NetworkType, ModuleTypes, StructType> {
46
46
  return JSON.parse(fs.readFileSync(fullPath, 'utf-8'))
47
47
  }
48
48
 
49
- async generate(srcDir: string, outputDir: string): Promise<number> {
50
- const num1 = await this.generateForNetwork(srcDir, outputDir, this.MAIN_NET)
49
+ async generate(srcDir: string, outputDir: string, builtin = false): Promise<number> {
50
+ const num1 = await this.generateForNetwork(srcDir, outputDir, this.MAIN_NET, builtin)
51
51
  const num2 = await this.generateForNetwork(
52
52
  path.join(srcDir, 'testnet'),
53
53
  path.join(outputDir, 'testnet'),
54
- this.TEST_NET
54
+ this.TEST_NET,
55
+ builtin
55
56
  )
56
57
  return num1 + num2
57
58
  }
58
59
 
59
- async generateForNetwork(srcDir: string, outputDir: string, network: NetworkType) {
60
+ async generateForNetwork(srcDir: string, outputDir: string, network: NetworkType, builtin = false) {
60
61
  if (!fs.existsSync(srcDir)) {
61
62
  return 0
62
63
  }
@@ -133,18 +134,19 @@ export abstract class AbstractCodegen<NetworkType, ModuleTypes, StructType> {
133
134
  }
134
135
 
135
136
  const rootFile = path.join(outputDir, 'index.ts')
136
- fs.writeFileSync(
137
- rootFile,
138
- `/* Autogenerated file. Do not edit manually. */
137
+ let rootFileContent = `/* Autogenerated file. Do not edit manually. */
139
138
  /* tslint:disable */
140
139
  /* eslint-disable */
141
140
  `
142
- )
143
141
  for (const output of outputs) {
144
142
  const parsed = path.parse(output.fileName)
145
- const content = `export * as _${parsed.name.replaceAll('-', '_')} from './${parsed.name}.js'\n`
146
- fs.appendFileSync(rootFile, content)
143
+ rootFileContent += `export * as _${parsed.name.replaceAll('-', '_')} from './${parsed.name}.js'\n`
147
144
  }
145
+ // if (builtin) {
146
+ // rootFileContent += `export { BUILTIN_TYPES } from '@sentio/sdk/move'`
147
+ // }
148
+ fs.writeFileSync(rootFile, rootFileContent)
149
+
148
150
  return outputs.length + 1
149
151
  }
150
152
 
@@ -219,6 +221,7 @@ export abstract class AbstractCodegen<NetworkType, ModuleTypes, StructType> {
219
221
  }
220
222
 
221
223
  generateStructs(module: InternalMoveModule, struct: InternalMoveStruct, events: Set<string>) {
224
+ const typeParams = struct.typeParams || []
222
225
  const genericString = this.generateStructTypeParameters(struct)
223
226
  const genericStringAny = this.generateStructTypeParameters(struct, true)
224
227
 
@@ -240,11 +243,34 @@ export abstract class AbstractCodegen<NetworkType, ModuleTypes, StructType> {
240
243
  `
241
244
  }
242
245
 
246
+ const typeParamApplyArg = typeParams
247
+ .map((v, idx) => {
248
+ return `arg${idx}: TypeDescriptor<T${idx}> = ANY_TYPE`
249
+ })
250
+ .join(',')
251
+ const typeParamApply = typeParams
252
+ .map((v, idx) => {
253
+ return `arg${idx}`
254
+ })
255
+ .join(',')
256
+
257
+ const typeWithArg = `
258
+ export function type${genericString}(${typeParamApplyArg}): TypeDescriptor<${structName}${genericString}> {
259
+ return TYPE.apply(${typeParamApply})
260
+ }`
261
+
243
262
  return `
244
- export class ${structName}${genericString} {
245
- static TYPE_QNAME = '${module.address}::${module.name}::${struct.name}'
263
+ export interface ${structName}${genericString} {
246
264
  ${fields.join('\n')}
247
265
  }
266
+
267
+ export namespace ${structName}{
268
+ export const TYPE_QNAME = '${module.address}::${module.name}::${struct.name}'
269
+
270
+ const TYPE = new TypeDescriptor<${structName}${genericStringAny}>(${structName}.TYPE_QNAME)
271
+
272
+ ${typeWithArg}
273
+ }
248
274
 
249
275
  ${eventPayload}
250
276
  `
@@ -484,7 +510,7 @@ export class AccountCodegen<NetworkType, ModuleType, StructType> {
484
510
  }
485
511
 
486
512
  const imports = `
487
- import { CallFilter } from "@sentio/sdk/move"
513
+ import { CallFilter, TypeDescriptor, ANY_TYPE } from "@sentio/sdk/move"
488
514
  import {
489
515
  MoveCoder, defaultMoveCoder, ${this.moduleGen.PREFIX}BindOptions, ${this.moduleGen.PREFIX}BaseProcessor,
490
516
  TypedEventInstance, ${this.moduleGen.PREFIX}Network, TypedFunctionPayload,
@@ -1,14 +1,9 @@
1
1
  import { moduleQname, SPLITTER, VECTOR_STR } from './utils.js'
2
- import { matchType, parseMoveType, TypeDescriptor } from './types.js'
2
+ import { DecodedStruct, matchType, parseMoveType, TypeDescriptor } from './types.js'
3
3
  import { InternalMoveFunction, InternalMoveModule, InternalMoveStruct } from './internal-models.js'
4
4
  import { bytesToBigInt } from '../utils/index.js'
5
5
  import { ChainAdapter } from './chain-adapter.js'
6
6
 
7
- export type DecodedStructWithTag<B, T> = B & {
8
- data_decoded: T
9
- type_arguments: string[]
10
- }
11
-
12
7
  export abstract class AbstractMoveCoder<Network, ModuleType, StructType> {
13
8
  protected moduleMapping = new Map<string, InternalMoveModule>()
14
9
  private typeMapping = new Map<string, InternalMoveStruct>()
@@ -270,32 +265,32 @@ export abstract class AbstractMoveCoder<Network, ModuleType, StructType> {
270
265
  }
271
266
 
272
267
  protected async filterAndDecodeStruct<T>(
273
- typeMatcher: string,
268
+ typeMatcher: TypeDescriptor<T>,
274
269
  structsWithTags: StructType[]
275
- ): Promise<DecodedStructWithTag<StructType, T>[]> {
270
+ ): Promise<DecodedStruct<StructType, T>[]> {
276
271
  if (!structsWithTags) {
277
272
  return [] as any
278
273
  }
279
- const typeMatcherDescriptor = parseMoveType(typeMatcher)
280
- const results: DecodedStructWithTag<StructType, T>[] = []
274
+ // const typeMatcherDescriptor = parseMoveType(typeMatcher)
275
+ const results: DecodedStruct<StructType, T>[] = []
281
276
  for (const resource of structsWithTags) {
282
277
  const resourceType = this.adapter.getType(resource)
283
278
  const resourceTypeDescriptor = parseMoveType(resourceType)
284
- if (!matchType(typeMatcherDescriptor, resourceTypeDescriptor)) {
279
+ if (!matchType(typeMatcher, resourceTypeDescriptor)) {
285
280
  continue
286
281
  }
287
282
 
288
- const result = await this.decodedStruct(resource)
283
+ const result = await this.decodedStruct<T>(resource)
289
284
  if (result) {
290
- results.push(result as DecodedStructWithTag<StructType, T>)
285
+ results.push(result)
291
286
  } else {
292
- console.log('')
287
+ console.error('decoding error')
293
288
  }
294
289
  }
295
290
  return results
296
291
  }
297
292
 
298
- protected async decodedStruct<T>(typeStruct: StructType): Promise<DecodedStructWithTag<StructType, T> | undefined> {
293
+ protected async decodedStruct<T>(typeStruct: StructType): Promise<DecodedStruct<StructType, T> | undefined> {
299
294
  const typeDescriptor = parseMoveType(this.adapter.getType(typeStruct))
300
295
  const typeArguments = typeDescriptor.typeArgs.map((t) => t.getSignature())
301
296
 
@@ -310,6 +305,6 @@ export abstract class AbstractMoveCoder<Network, ModuleType, StructType> {
310
305
  ...typeStruct,
311
306
  data_decoded: dataTyped,
312
307
  type_arguments: typeArguments,
313
- } as DecodedStructWithTag<StructType, T>
308
+ } as DecodedStruct<StructType, T>
314
309
  }
315
310
  }
package/src/move/types.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  import { SPLITTER, VECTOR_STR } from './utils.js'
2
2
 
3
- export class TypeDescriptor {
3
+ export type DecodedStruct<B, T> = B & {
4
+ /**
5
+ * decoded data using ABI, undefined if there is decoding error, usually because the ABI/data mismatch
6
+ */
7
+ data_decoded: T
8
+ type_arguments: string[]
9
+ }
10
+
11
+ export class TypeDescriptor<T = any> {
4
12
  qname: string
5
13
  reference: boolean
6
14
  mutable: boolean
@@ -13,6 +21,32 @@ export class TypeDescriptor {
13
21
  this.typeArgs = typeParams || []
14
22
  }
15
23
 
24
+ apply(...typeArgs: TypeDescriptor[]): TypeDescriptor {
25
+ const newObj = this.clone()
26
+ newObj.typeArgs = typeArgs
27
+ return newObj
28
+ }
29
+
30
+ clone(): this {
31
+ const newObj = new TypeDescriptor(this.qname, this.typeArgs)
32
+ newObj.reference = this.reference
33
+ newObj.mutable = this.mutable
34
+ return newObj as any
35
+ }
36
+
37
+ // compare qname without consider case for system type
38
+ compareQname(t: TypeDescriptor): boolean {
39
+ let t1 = this.qname
40
+ if (BUILTIN_TYPES_SET.has(this.qname.toLowerCase())) {
41
+ t1 = this.qname.toLowerCase()
42
+ }
43
+ let t2 = t.qname
44
+ if (BUILTIN_TYPES_SET.has(t.qname.toLowerCase())) {
45
+ t2 = t.qname
46
+ }
47
+ return t1 === t2
48
+ }
49
+
16
50
  getSignature(): string {
17
51
  if (this.typeArgs.length > 0) {
18
52
  return this.qname + '<' + this.typeArgs.map((t) => t.getSignature()).join(', ') + '>'
@@ -51,25 +85,12 @@ export class TypeDescriptor {
51
85
  if (this.reference) {
52
86
  return []
53
87
  }
88
+ if (BUILTIN_TYPES_SET.has(this.qname.toLowerCase())) {
89
+ return []
90
+ }
54
91
  switch (this.qname) {
55
92
  case 'signer':
56
- case 'address':
57
- case 'Address':
58
93
  case '0x1::string::String':
59
- case 'bool':
60
- case 'Bool':
61
- case 'u8':
62
- case 'U8':
63
- case 'u16':
64
- case 'U16':
65
- case 'u32':
66
- case 'U32':
67
- case 'u64':
68
- case 'U64':
69
- case 'u128':
70
- case 'U128':
71
- case 'u256':
72
- case 'U256':
73
94
  return []
74
95
  }
75
96
 
@@ -155,6 +176,30 @@ function adjustType(type: TypeDescriptor) {
155
176
  }
156
177
  }
157
178
 
179
+ export const ANY_TYPE = new TypeDescriptor<any>('any')
180
+
181
+ export const BUILTIN_TYPES = {
182
+ ADDRESS_TYPE: new TypeDescriptor<string>('address'),
183
+ // export const Address = new TypeDescriptor<string>("Address")
184
+
185
+ BOOL_TYPE: new TypeDescriptor<number>('bool'),
186
+
187
+ U8_TYPE: new TypeDescriptor<number>('u8'),
188
+ // export const U8 = new TypeDescriptor<number>("U8")
189
+ U16_TYPE: new TypeDescriptor<number>('u16'),
190
+ // export const U16 = new TypeDescriptor<number>("U16")
191
+ U32_TYPE: new TypeDescriptor<number>('u32'),
192
+ // export const U32 = new TypeDescriptor<number>("U32")
193
+ U64_TYPE: new TypeDescriptor<number>('u64'),
194
+ // export const U64 = new TypeDescriptor<number>("U64")
195
+ U128_TYPE: new TypeDescriptor<number>('u128'),
196
+ // export const U128 = new TypeDescriptor<number>("U128")
197
+ U256_TYPE: new TypeDescriptor<number>('u256'),
198
+ // export const U256 = new TypeDescriptor<number>("U256")
199
+ }
200
+
201
+ const BUILTIN_TYPES_SET = new Set(Object.values(BUILTIN_TYPES).map((t) => t.qname.toLowerCase()))
202
+
158
203
  /**
159
204
  *
160
205
  * @param matcher
@@ -164,7 +209,7 @@ export function matchType(matcher: TypeDescriptor, type: TypeDescriptor): boolea
164
209
  if (matcher.qname === 'any') {
165
210
  return true
166
211
  }
167
- if (matcher.qname !== type.qname) {
212
+ if (!matcher.compareQname(type)) {
168
213
  return false
169
214
  }
170
215
  for (const [idx, matcherTarg] of matcher.typeArgs.entries()) {
@@ -4,7 +4,7 @@
4
4
 
5
5
  /* Generated modules for account 0x1 */
6
6
 
7
- import { CallFilter } from "@sentio/sdk/move";
7
+ import { CallFilter, TypeDescriptor, ANY_TYPE } from "@sentio/sdk/move";
8
8
  import {
9
9
  MoveCoder,
10
10
  defaultMoveCoder,
@@ -63,21 +63,39 @@ export class ascii extends SuiBaseProcessor {
63
63
  }
64
64
 
65
65
  export namespace ascii {
66
- export class Char {
67
- static TYPE_QNAME = "0x1::ascii::Char";
66
+ export interface Char {
68
67
  byte: number;
69
68
  }
70
69
 
70
+ export namespace Char {
71
+ export const TYPE_QNAME = "0x1::ascii::Char";
72
+
73
+ const TYPE = new TypeDescriptor<Char>(Char.TYPE_QNAME);
74
+
75
+ export function type(): TypeDescriptor<Char> {
76
+ return TYPE.apply();
77
+ }
78
+ }
79
+
71
80
  export interface CharInstance extends TypedEventInstance<Char> {
72
81
  data_decoded: Char;
73
82
  type_arguments: [];
74
83
  }
75
84
 
76
- export class String {
77
- static TYPE_QNAME = "0x1::ascii::String";
85
+ export interface String {
78
86
  bytes: number[];
79
87
  }
80
88
 
89
+ export namespace String {
90
+ export const TYPE_QNAME = "0x1::ascii::String";
91
+
92
+ const TYPE = new TypeDescriptor<String>(String.TYPE_QNAME);
93
+
94
+ export function type(): TypeDescriptor<String> {
95
+ return TYPE.apply();
96
+ }
97
+ }
98
+
81
99
  export interface StringInstance extends TypedEventInstance<String> {
82
100
  data_decoded: String;
83
101
  type_arguments: [];
@@ -115,12 +133,21 @@ export class bit_vector extends SuiBaseProcessor {
115
133
  }
116
134
 
117
135
  export namespace bit_vector {
118
- export class BitVector {
119
- static TYPE_QNAME = "0x1::bit_vector::BitVector";
136
+ export interface BitVector {
120
137
  length: bigint;
121
138
  bit_field: Boolean[];
122
139
  }
123
140
 
141
+ export namespace BitVector {
142
+ export const TYPE_QNAME = "0x1::bit_vector::BitVector";
143
+
144
+ const TYPE = new TypeDescriptor<BitVector>(BitVector.TYPE_QNAME);
145
+
146
+ export function type(): TypeDescriptor<BitVector> {
147
+ return TYPE.apply();
148
+ }
149
+ }
150
+
124
151
  export interface BitVectorInstance extends TypedEventInstance<BitVector> {
125
152
  data_decoded: BitVector;
126
153
  type_arguments: [];
@@ -158,11 +185,20 @@ export class fixed_point32 extends SuiBaseProcessor {
158
185
  }
159
186
 
160
187
  export namespace fixed_point32 {
161
- export class FixedPoint32 {
162
- static TYPE_QNAME = "0x1::fixed_point32::FixedPoint32";
188
+ export interface FixedPoint32 {
163
189
  value: bigint;
164
190
  }
165
191
 
192
+ export namespace FixedPoint32 {
193
+ export const TYPE_QNAME = "0x1::fixed_point32::FixedPoint32";
194
+
195
+ const TYPE = new TypeDescriptor<FixedPoint32>(FixedPoint32.TYPE_QNAME);
196
+
197
+ export function type(): TypeDescriptor<FixedPoint32> {
198
+ return TYPE.apply();
199
+ }
200
+ }
201
+
166
202
  export interface FixedPoint32Instance
167
203
  extends TypedEventInstance<FixedPoint32> {
168
204
  data_decoded: FixedPoint32;
@@ -205,11 +241,20 @@ export class string_ extends SuiBaseProcessor {
205
241
  }
206
242
 
207
243
  export namespace string_ {
208
- export class String {
209
- static TYPE_QNAME = "0x1::string::String";
244
+ export interface String {
210
245
  bytes: number[];
211
246
  }
212
247
 
248
+ export namespace String {
249
+ export const TYPE_QNAME = "0x1::string::String";
250
+
251
+ const TYPE = new TypeDescriptor<String>(String.TYPE_QNAME);
252
+
253
+ export function type(): TypeDescriptor<String> {
254
+ return TYPE.apply();
255
+ }
256
+ }
257
+
213
258
  export interface StringInstance extends TypedEventInstance<String> {
214
259
  data_decoded: String;
215
260
  type_arguments: [];
@@ -245,11 +290,20 @@ export class type_name extends SuiBaseProcessor {
245
290
  }
246
291
 
247
292
  export namespace type_name {
248
- export class TypeName {
249
- static TYPE_QNAME = "0x1::type_name::TypeName";
293
+ export interface TypeName {
250
294
  name: ascii.String;
251
295
  }
252
296
 
297
+ export namespace TypeName {
298
+ export const TYPE_QNAME = "0x1::type_name::TypeName";
299
+
300
+ const TYPE = new TypeDescriptor<TypeName>(TypeName.TYPE_QNAME);
301
+
302
+ export function type(): TypeDescriptor<TypeName> {
303
+ return TYPE.apply();
304
+ }
305
+ }
306
+
253
307
  export interface TypeNameInstance extends TypedEventInstance<TypeName> {
254
308
  data_decoded: TypeName;
255
309
  type_arguments: [];