@sentio/sdk 2.45.3 → 2.46.0-rc.2
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/builtin/0x1.d.ts +65 -65
- package/lib/aptos/builtin/0x1.js +27 -27
- package/lib/aptos/builtin/0x3.d.ts +1 -1
- package/lib/aptos/builtin/0x4.d.ts +34 -34
- package/lib/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC1155__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/ERC1155__factory.js.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC20Bytes__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC20__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC20__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/ERC20__factory.js.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC721__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/ERC721__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/ERC721__factory.js.map +1 -1
- package/lib/eth/builtin/internal/factories/WETH9__factory.d.ts.map +1 -1
- package/lib/eth/builtin/internal/factories/WETH9__factory.js +3 -3
- package/lib/eth/builtin/internal/factories/WETH9__factory.js.map +1 -1
- package/lib/eth/codegen/ethers-sentio.d.ts.map +1 -1
- package/lib/eth/codegen/ethers-sentio.js +4 -1
- package/lib/eth/codegen/ethers-sentio.js.map +1 -1
- package/lib/eth/eth.d.ts +3 -1
- package/lib/eth/eth.d.ts.map +1 -1
- package/lib/eth/eth.js +7 -1
- package/lib/eth/eth.js.map +1 -1
- package/lib/sui/builtin/0x1.d.ts +172 -311
- package/lib/sui/builtin/0x1.d.ts.map +1 -1
- package/lib/sui/builtin/0x1.js +17 -17
- package/lib/sui/builtin/0x1.js.map +1 -1
- package/lib/sui/builtin/0x2.d.ts +673 -1589
- package/lib/sui/builtin/0x2.d.ts.map +1 -1
- package/lib/sui/builtin/0x2.js +106 -106
- package/lib/sui/builtin/0x2.js.map +1 -1
- package/lib/sui/builtin/0x3.d.ts +359 -831
- package/lib/sui/builtin/0x3.d.ts.map +1 -1
- package/lib/sui/builtin/0x3.js +20 -20
- package/lib/sui/builtin/0x3.js.map +1 -1
- package/lib/sui/index.d.ts +1 -1
- package/lib/sui/index.d.ts.map +1 -1
- package/lib/sui/index.js +1 -1
- package/lib/sui/index.js.map +1 -1
- package/lib/sui/sui-object-processor.d.ts +19 -4
- package/lib/sui/sui-object-processor.d.ts.map +1 -1
- package/lib/sui/sui-object-processor.js +38 -4
- package/lib/sui/sui-object-processor.js.map +1 -1
- package/package.json +6 -6
- package/src/aptos/builtin/0x1.ts +78 -78
- package/src/aptos/builtin/0x3.ts +1 -1
- package/src/aptos/builtin/0x4.ts +34 -34
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.ts +3 -2
- package/src/eth/builtin/internal/factories/ERC1155__factory.ts +3 -2
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.ts +3 -2
- package/src/eth/builtin/internal/factories/ERC20__factory.ts +3 -2
- package/src/eth/builtin/internal/factories/ERC721__factory.ts +3 -2
- package/src/eth/builtin/internal/factories/WETH9__factory.ts +3 -2
- package/src/eth/codegen/ethers-sentio.ts +4 -1
- package/src/eth/eth.ts +24 -1
- package/src/sui/builtin/0x1.ts +178 -317
- package/src/sui/builtin/0x2.ts +752 -1668
- package/src/sui/builtin/0x3.ts +374 -846
- package/src/sui/index.ts +3 -1
- package/src/sui/sui-object-processor.ts +61 -9
package/src/sui/index.ts
CHANGED
@@ -2,8 +2,10 @@ export { SuiBaseProcessor, SuiGlobalProcessor, SuiModulesProcessor, type SuiBind
|
|
2
2
|
export {
|
3
3
|
SuiAddressProcessor,
|
4
4
|
SuiObjectProcessor,
|
5
|
+
SuiObjectTypeProcessor,
|
5
6
|
SuiWrappedObjectProcessor,
|
6
|
-
type SuiObjectBindOptions
|
7
|
+
type SuiObjectBindOptions,
|
8
|
+
type SuiObjectTypeBindOptions
|
7
9
|
} from './sui-object-processor.js'
|
8
10
|
|
9
11
|
export {
|
@@ -13,8 +13,10 @@ import { SuiAddressContext, SuiContext, SuiObjectContext } from './context.js'
|
|
13
13
|
import { SuiMoveObject, SuiTransactionBlockResponse } from '@mysten/sui/client'
|
14
14
|
import { PromiseOrVoid } from '../core/index.js'
|
15
15
|
import { configure, DEFAULT_FETCH_CONFIG, IndexConfigure, SuiBindOptions } from './sui-processor.js'
|
16
|
-
import { CallHandler, TransactionFilter } from '../move/index.js'
|
16
|
+
import { CallHandler, TransactionFilter, accountTypeString } from '../move/index.js'
|
17
17
|
import { ServerError, Status } from 'nice-grpc'
|
18
|
+
import { TypeDescriptor } from '@typemove/move'
|
19
|
+
import { TypedSuiMoveObject } from './models.js'
|
18
20
|
|
19
21
|
export interface SuiObjectBindOptions {
|
20
22
|
objectId: string
|
@@ -23,6 +25,13 @@ export interface SuiObjectBindOptions {
|
|
23
25
|
baseLabels?: { [key: string]: string }
|
24
26
|
}
|
25
27
|
|
28
|
+
export interface SuiObjectTypeBindOptions<T> {
|
29
|
+
objectType: TypeDescriptor<T>
|
30
|
+
network?: SuiNetwork
|
31
|
+
startCheckpoint?: bigint
|
32
|
+
baseLabels?: { [key: string]: string }
|
33
|
+
}
|
34
|
+
|
26
35
|
interface ObjectHandler {
|
27
36
|
type?: string
|
28
37
|
checkPointInterval?: HandleInterval
|
@@ -55,7 +64,16 @@ export abstract class SuiBaseObjectOrAddressProcessor<HandlerType> {
|
|
55
64
|
// }
|
56
65
|
|
57
66
|
protected constructor(options: SuiInternalObjectsBindOptions) {
|
58
|
-
|
67
|
+
if (options.ownerType === MoveOwnerType.TYPE) {
|
68
|
+
this.config = {
|
69
|
+
startCheckpoint: options.startCheckpoint || 0n,
|
70
|
+
address: accountTypeString(options.address),
|
71
|
+
network: options.network || SuiNetwork.MAIN_NET,
|
72
|
+
baseLabels: options.baseLabels
|
73
|
+
}
|
74
|
+
} else {
|
75
|
+
this.config = configure(options)
|
76
|
+
}
|
59
77
|
this.ownerType = options.ownerType
|
60
78
|
SuiAccountProcessorState.INSTANCE.addValue(this)
|
61
79
|
}
|
@@ -66,7 +84,7 @@ export abstract class SuiBaseObjectOrAddressProcessor<HandlerType> {
|
|
66
84
|
|
67
85
|
// protected abstract transformObjects(objects: SuiMoveObject[]): SuiMoveObject[]
|
68
86
|
|
69
|
-
protected abstract doHandle(handler: HandlerType, data: Data_SuiObject, ctx: SuiObjectContext):
|
87
|
+
protected abstract doHandle(handler: HandlerType, data: Data_SuiObject, ctx: SuiObjectContext): Promise<any>
|
70
88
|
|
71
89
|
public onInterval(
|
72
90
|
handler: HandlerType, //(resources: SuiMoveObject[], ctx: SuiObjectsContext) => PromiseOrVoid,
|
@@ -141,11 +159,11 @@ export class SuiAddressProcessor extends SuiBaseObjectOrAddressProcessor<
|
|
141
159
|
return new SuiAddressProcessor({ ...options, ownerType: MoveOwnerType.ADDRESS })
|
142
160
|
}
|
143
161
|
|
144
|
-
protected doHandle(
|
162
|
+
protected async doHandle(
|
145
163
|
handler: (objects: SuiMoveObject[], ctx: SuiObjectContext) => PromiseOrVoid,
|
146
164
|
data: Data_SuiObject,
|
147
165
|
ctx: SuiObjectContext
|
148
|
-
)
|
166
|
+
) {
|
149
167
|
return handler(data.objects as SuiMoveObject[], ctx)
|
150
168
|
}
|
151
169
|
|
@@ -207,11 +225,11 @@ export class SuiObjectProcessor extends SuiBaseObjectOrAddressProcessor<
|
|
207
225
|
})
|
208
226
|
}
|
209
227
|
|
210
|
-
protected doHandle(
|
228
|
+
protected async doHandle(
|
211
229
|
handler: (self: SuiMoveObject, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectContext) => PromiseOrVoid,
|
212
230
|
data: Data_SuiObject,
|
213
231
|
ctx: SuiObjectContext
|
214
|
-
)
|
232
|
+
) {
|
215
233
|
if (!data.self) {
|
216
234
|
console.log(`Sui object not existed in ${ctx.checkpoint}, please specific a start time`)
|
217
235
|
return
|
@@ -220,6 +238,40 @@ export class SuiObjectProcessor extends SuiBaseObjectOrAddressProcessor<
|
|
220
238
|
}
|
221
239
|
}
|
222
240
|
|
241
|
+
export class SuiObjectTypeProcessor<T> extends SuiBaseObjectOrAddressProcessor<
|
242
|
+
(self: TypedSuiMoveObject<T>, dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectContext) => PromiseOrVoid
|
243
|
+
> {
|
244
|
+
objectType: TypeDescriptor<T>
|
245
|
+
static bind<T>(options: SuiObjectTypeBindOptions<T>): SuiObjectTypeProcessor<T> {
|
246
|
+
const processor = new SuiObjectTypeProcessor<T>({
|
247
|
+
address: options.objectType.qname,
|
248
|
+
network: options.network,
|
249
|
+
startCheckpoint: options.startCheckpoint,
|
250
|
+
ownerType: MoveOwnerType.TYPE,
|
251
|
+
baseLabels: options.baseLabels
|
252
|
+
})
|
253
|
+
processor.objectType = options.objectType
|
254
|
+
return processor
|
255
|
+
}
|
256
|
+
|
257
|
+
protected async doHandle(
|
258
|
+
handler: (
|
259
|
+
self: TypedSuiMoveObject<T>,
|
260
|
+
dynamicFieldObjects: SuiMoveObject[],
|
261
|
+
ctx: SuiObjectContext
|
262
|
+
) => PromiseOrVoid,
|
263
|
+
data: Data_SuiObject,
|
264
|
+
ctx: SuiObjectContext
|
265
|
+
) {
|
266
|
+
if (!data.self) {
|
267
|
+
console.log(`Sui object not existed in ${ctx.checkpoint}, please specific a start time`)
|
268
|
+
return
|
269
|
+
}
|
270
|
+
const object = await ctx.coder.filterAndDecodeObjects(this.objectType, [data.self as SuiMoveObject])
|
271
|
+
return handler(object[0], data.objects as SuiMoveObject[], ctx)
|
272
|
+
}
|
273
|
+
}
|
274
|
+
|
223
275
|
export class SuiWrappedObjectProcessor extends SuiBaseObjectOrAddressProcessor<
|
224
276
|
(dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectContext) => PromiseOrVoid
|
225
277
|
> {
|
@@ -233,11 +285,11 @@ export class SuiWrappedObjectProcessor extends SuiBaseObjectOrAddressProcessor<
|
|
233
285
|
})
|
234
286
|
}
|
235
287
|
|
236
|
-
protected doHandle(
|
288
|
+
protected async doHandle(
|
237
289
|
handler: (dynamicFieldObjects: SuiMoveObject[], ctx: SuiObjectContext) => PromiseOrVoid,
|
238
290
|
data: Data_SuiObject,
|
239
291
|
ctx: SuiObjectContext
|
240
|
-
)
|
292
|
+
) {
|
241
293
|
return handler(data.objects as SuiMoveObject[], ctx)
|
242
294
|
}
|
243
295
|
}
|