@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.
- package/lib/aptos/aptos-processor.js +7 -3
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/builtin/0x1.d.ts +1076 -431
- package/lib/aptos/builtin/0x1.js +1937 -1457
- package/lib/aptos/builtin/0x1.js.map +1 -1
- package/lib/aptos/builtin/0x3.d.ts +206 -83
- package/lib/aptos/builtin/0x3.js +371 -332
- package/lib/aptos/builtin/0x3.js.map +1 -1
- package/lib/aptos/codegen/codegen.d.ts +1 -1
- package/lib/aptos/codegen/codegen.js +2 -2
- package/lib/aptos/codegen/codegen.js.map +1 -1
- package/lib/aptos/codegen/run.js +1 -1
- package/lib/aptos/codegen/run.js.map +1 -1
- package/lib/aptos/index.d.ts +1 -0
- package/lib/aptos/index.js +1 -0
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos/models.d.ts +3 -11
- package/lib/aptos/models.js.map +1 -1
- package/lib/aptos/move-coder.d.ts +3 -2
- package/lib/aptos/move-coder.js +11 -4
- package/lib/aptos/move-coder.js.map +1 -1
- package/lib/eth/base-processor.d.ts +8 -8
- package/lib/eth/base-processor.js +0 -1
- package/lib/eth/base-processor.js.map +1 -1
- package/lib/eth/eth.d.ts +7 -2
- package/lib/eth/eth.js +8 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/move/abstract-codegen.d.ts +2 -2
- package/lib/move/abstract-codegen.js +36 -11
- package/lib/move/abstract-codegen.js.map +1 -1
- package/lib/move/abstract-move-coder.d.ts +3 -7
- package/lib/move/abstract-move-coder.js +3 -3
- package/lib/move/abstract-move-coder.js.map +1 -1
- package/lib/move/types.d.ts +22 -1
- package/lib/move/types.js +46 -17
- package/lib/move/types.js.map +1 -1
- package/lib/sui/builtin/0x1.d.ts +31 -12
- package/lib/sui/builtin/0x1.js +56 -31
- package/lib/sui/builtin/0x1.js.map +1 -1
- package/lib/sui/builtin/0x2.d.ts +256 -103
- package/lib/sui/builtin/0x2.js +461 -316
- package/lib/sui/builtin/0x2.js.map +1 -1
- package/lib/sui/builtin/0x3.d.ts +126 -51
- package/lib/sui/builtin/0x3.js +227 -271
- package/lib/sui/builtin/0x3.js.map +1 -1
- package/lib/sui/codegen/codegen.d.ts +1 -1
- package/lib/sui/codegen/codegen.js +3 -2
- package/lib/sui/codegen/codegen.js.map +1 -1
- package/lib/sui/codegen/run.js +1 -1
- package/lib/sui/codegen/run.js.map +1 -1
- package/lib/sui/index.d.ts +1 -0
- package/lib/sui/index.js +1 -0
- package/lib/sui/index.js.map +1 -1
- package/lib/sui/models.d.ts +3 -11
- package/lib/sui/models.js.map +1 -1
- package/lib/sui/move-coder.d.ts +5 -5
- package/lib/sui/move-coder.js +14 -7
- package/lib/sui/move-coder.js.map +1 -1
- package/lib/sui/sui-processor.js +6 -2
- package/lib/sui/sui-processor.js.map +1 -1
- package/package.json +4 -4
- package/src/aptos/aptos-processor.ts +8 -3
- package/src/aptos/builtin/0x1.ts +2688 -447
- package/src/aptos/builtin/0x3.ts +506 -84
- package/src/aptos/codegen/codegen.ts +7 -2
- package/src/aptos/codegen/run.ts +1 -1
- package/src/aptos/index.ts +2 -0
- package/src/aptos/models.ts +3 -13
- package/src/aptos/move-coder.ts +14 -4
- package/src/eth/base-processor.ts +8 -9
- package/src/eth/eth.ts +15 -2
- package/src/move/abstract-codegen.ts +39 -13
- package/src/move/abstract-move-coder.ts +11 -16
- package/src/move/types.ts +63 -18
- package/src/sui/builtin/0x1.ts +67 -13
- package/src/sui/builtin/0x2.ts +649 -103
- package/src/sui/builtin/0x3.ts +315 -51
- package/src/sui/codegen/codegen.ts +8 -2
- package/src/sui/codegen/run.ts +1 -1
- package/src/sui/index.ts +1 -0
- package/src/sui/models.ts +3 -13
- package/src/sui/move-coder.ts +22 -15
- package/src/sui/sui-processor.ts +7 -2
package/src/sui/move-coder.ts
CHANGED
@@ -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>(
|
47
|
-
|
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
|
-
|
53
|
-
|
54
|
-
): Promise<dynamic_field.Field<
|
55
|
-
const
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
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
|
63
|
-
|
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> {
|
package/src/sui/sui-processor.ts
CHANGED
@@ -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
|