@sentio/sdk 2.13.0-rc.6 → 2.13.0-rc.8

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 (83) hide show
  1. package/lib/aptos/aptos-processor.js +7 -3
  2. package/lib/aptos/aptos-processor.js.map +1 -1
  3. package/lib/aptos/builtin/0x1.d.ts +1076 -431
  4. package/lib/aptos/builtin/0x1.js +1937 -1457
  5. package/lib/aptos/builtin/0x1.js.map +1 -1
  6. package/lib/aptos/builtin/0x3.d.ts +206 -83
  7. package/lib/aptos/builtin/0x3.js +371 -332
  8. package/lib/aptos/builtin/0x3.js.map +1 -1
  9. package/lib/aptos/codegen/codegen.d.ts +1 -1
  10. package/lib/aptos/codegen/codegen.js +2 -2
  11. package/lib/aptos/codegen/codegen.js.map +1 -1
  12. package/lib/aptos/codegen/run.js +1 -1
  13. package/lib/aptos/codegen/run.js.map +1 -1
  14. package/lib/aptos/index.d.ts +1 -0
  15. package/lib/aptos/index.js +1 -0
  16. package/lib/aptos/index.js.map +1 -1
  17. package/lib/aptos/models.d.ts +3 -11
  18. package/lib/aptos/models.js.map +1 -1
  19. package/lib/aptos/move-coder.d.ts +3 -2
  20. package/lib/aptos/move-coder.js +11 -4
  21. package/lib/aptos/move-coder.js.map +1 -1
  22. package/lib/eth/base-processor.d.ts +8 -8
  23. package/lib/eth/base-processor.js +0 -1
  24. package/lib/eth/base-processor.js.map +1 -1
  25. package/lib/eth/eth.d.ts +7 -2
  26. package/lib/eth/eth.js +8 -1
  27. package/lib/eth/eth.js.map +1 -1
  28. package/lib/move/abstract-codegen.d.ts +2 -2
  29. package/lib/move/abstract-codegen.js +36 -11
  30. package/lib/move/abstract-codegen.js.map +1 -1
  31. package/lib/move/abstract-move-coder.d.ts +3 -7
  32. package/lib/move/abstract-move-coder.js +3 -3
  33. package/lib/move/abstract-move-coder.js.map +1 -1
  34. package/lib/move/types.d.ts +22 -1
  35. package/lib/move/types.js +46 -17
  36. package/lib/move/types.js.map +1 -1
  37. package/lib/sui/builtin/0x1.d.ts +31 -12
  38. package/lib/sui/builtin/0x1.js +56 -31
  39. package/lib/sui/builtin/0x1.js.map +1 -1
  40. package/lib/sui/builtin/0x2.d.ts +256 -103
  41. package/lib/sui/builtin/0x2.js +461 -316
  42. package/lib/sui/builtin/0x2.js.map +1 -1
  43. package/lib/sui/builtin/0x3.d.ts +126 -51
  44. package/lib/sui/builtin/0x3.js +227 -271
  45. package/lib/sui/builtin/0x3.js.map +1 -1
  46. package/lib/sui/codegen/codegen.d.ts +1 -1
  47. package/lib/sui/codegen/codegen.js +3 -2
  48. package/lib/sui/codegen/codegen.js.map +1 -1
  49. package/lib/sui/codegen/run.js +1 -1
  50. package/lib/sui/codegen/run.js.map +1 -1
  51. package/lib/sui/index.d.ts +1 -0
  52. package/lib/sui/index.js +1 -0
  53. package/lib/sui/index.js.map +1 -1
  54. package/lib/sui/models.d.ts +3 -11
  55. package/lib/sui/models.js.map +1 -1
  56. package/lib/sui/move-coder.d.ts +5 -5
  57. package/lib/sui/move-coder.js +14 -7
  58. package/lib/sui/move-coder.js.map +1 -1
  59. package/lib/sui/sui-processor.js +6 -2
  60. package/lib/sui/sui-processor.js.map +1 -1
  61. package/package.json +4 -4
  62. package/src/aptos/aptos-processor.ts +8 -3
  63. package/src/aptos/builtin/0x1.ts +2688 -447
  64. package/src/aptos/builtin/0x3.ts +506 -84
  65. package/src/aptos/codegen/codegen.ts +7 -2
  66. package/src/aptos/codegen/run.ts +1 -1
  67. package/src/aptos/index.ts +2 -0
  68. package/src/aptos/models.ts +3 -13
  69. package/src/aptos/move-coder.ts +14 -4
  70. package/src/eth/base-processor.ts +8 -9
  71. package/src/eth/eth.ts +15 -2
  72. package/src/move/abstract-codegen.ts +39 -13
  73. package/src/move/abstract-move-coder.ts +11 -16
  74. package/src/move/types.ts +63 -18
  75. package/src/sui/builtin/0x1.ts +67 -13
  76. package/src/sui/builtin/0x2.ts +649 -103
  77. package/src/sui/builtin/0x3.ts +315 -51
  78. package/src/sui/codegen/codegen.ts +8 -2
  79. package/src/sui/codegen/run.ts +1 -1
  80. package/src/sui/index.ts +1 -0
  81. package/src/sui/models.ts +3 -13
  82. package/src/sui/move-coder.ts +22 -15
  83. package/src/sui/sui-processor.ts +7 -2
@@ -2,11 +2,11 @@ import { TypedEventInstance, TypedFunctionPayload } from './models.js'
2
2
  import { AbstractMoveCoder } from '../move/abstract-move-coder.js'
3
3
  import { MoveCallSuiTransaction, SuiCallArg, SuiEvent, SuiMoveNormalizedModule, SuiMoveObject } from '@mysten/sui.js'
4
4
  import { toInternalModule } from './move-types.js'
5
- import { SPLITTER, TypeDescriptor } from '../move/index.js'
6
- import { dynamic_field } from './builtin/0x2.js'
5
+ import { ANY_TYPE, DecodedStruct, parseMoveType, SPLITTER, TypeDescriptor } from '../move/index.js'
7
6
  import { SuiNetwork } from './network.js'
8
7
  import { SuiChainAdapter } from './sui-chain-adapter.js'
9
8
  import { InternalMoveModule } from '../move/internal-models.js'
9
+ import { dynamic_field } from './builtin/0x2.js'
10
10
 
11
11
  export class MoveCoder extends AbstractMoveCoder<SuiNetwork, SuiMoveNormalizedModule, SuiEvent | SuiMoveObject> {
12
12
  constructor(network: SuiNetwork) {
@@ -43,24 +43,31 @@ export class MoveCoder extends AbstractMoveCoder<SuiNetwork, SuiMoveNormalizedMo
43
43
  decodeEvent<T>(event: SuiEvent): Promise<TypedEventInstance<T> | undefined> {
44
44
  return this.decodedStruct<T>(event) as any
45
45
  }
46
- filterAndDecodeEvents<T>(typeQname: string, resources: SuiEvent[]): Promise<TypedEventInstance<T>[]> {
47
- return this.filterAndDecodeStruct(typeQname, resources) as any
46
+ filterAndDecodeEvents<T>(type: TypeDescriptor<T> | string, resources: SuiEvent[]): Promise<TypedEventInstance<T>[]> {
47
+ if (typeof type === 'string') {
48
+ type = parseMoveType(type)
49
+ }
50
+ return this.filterAndDecodeStruct(type, resources) as any
48
51
  }
49
52
 
50
- async getDynamicFields(
53
+ async getDynamicFields<T1, T2>(
51
54
  objects: SuiMoveObject[],
52
- keyTypeMatcher: string = 'any',
53
- valueTypeMatcher: string = 'any'
54
- ): Promise<dynamic_field.Field<any, any>[]> {
55
- const res = (await this.filterAndDecodeObjects(
56
- `0x2::dynamic_field::Field<${keyTypeMatcher}, ${valueTypeMatcher}>`,
57
- objects
58
- )) as any[]
59
- return res.map((o) => o.data_decoded) as any
55
+ keyType: TypeDescriptor<T1> = ANY_TYPE,
56
+ valueType: TypeDescriptor<T2> = ANY_TYPE
57
+ ): Promise<dynamic_field.Field<T1, T2>[]> {
58
+ // const type = dynamic_field.Field.TYPE
59
+ // Not using the code above to avoid cycle initialize failed
60
+ const type = new TypeDescriptor<dynamic_field.Field<T1, T2>>('0x2::dynamic_field::Field')
61
+ type.typeArgs = [keyType, valueType]
62
+ const res = await this.filterAndDecodeObjects(type, objects)
63
+ return res.map((o) => o.data_decoded)
60
64
  }
61
65
 
62
- filterAndDecodeObjects(typeMatcher: string, objects: SuiMoveObject[]): Promise<any[]> {
63
- return this.filterAndDecodeStruct(typeMatcher, objects) as any
66
+ filterAndDecodeObjects<T>(
67
+ type: TypeDescriptor<T>,
68
+ objects: SuiMoveObject[]
69
+ ): Promise<DecodedStruct<SuiMoveObject, T>[]> {
70
+ return this.filterAndDecodeStruct(type, objects) as any
64
71
  }
65
72
 
66
73
  async decodeFunctionPayload(payload: MoveCallSuiTransaction, inputs: SuiCallArg[]): Promise<MoveCallSuiTransaction> {
@@ -25,6 +25,11 @@ import { defaultMoveCoder, MoveCoder } from './move-coder.js'
25
25
  import { PromiseOrVoid } from '../core/index.js'
26
26
  // import { dynamic_field } from './builtin/0x2.js'
27
27
 
28
+ const DEFAULT_FETCH_CONFIG: MoveFetchConfig = {
29
+ resourceChanges: false,
30
+ allEvents: true,
31
+ }
32
+
28
33
  class IndexConfigure {
29
34
  address: string
30
35
  network: SuiNetwork
@@ -72,7 +77,7 @@ export class SuiBaseProcessor {
72
77
  fetchConfig?: Partial<MoveFetchConfig>
73
78
  ): SuiBaseProcessor {
74
79
  let _filters: EventFilter[] = []
75
- const _fetchConfig = MoveFetchConfig.fromPartial(fetchConfig || {})
80
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
76
81
 
77
82
  if (Array.isArray(filter)) {
78
83
  _filters = filter
@@ -132,7 +137,7 @@ export class SuiBaseProcessor {
132
137
  fetchConfig?: Partial<MoveFetchConfig>
133
138
  ): SuiBaseProcessor {
134
139
  let _filters: FunctionNameAndCallFilter[] = []
135
- const _fetchConfig = MoveFetchConfig.fromPartial(fetchConfig || {})
140
+ const _fetchConfig = MoveFetchConfig.fromPartial({ ...DEFAULT_FETCH_CONFIG, ...fetchConfig })
136
141
 
137
142
  if (Array.isArray(filter)) {
138
143
  _filters = filter