@sentio/runtime 2.54.3-rc.1 → 2.55.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/chunk-YNTRONGV.js +131 -0
- package/lib/{chunk-KVJ2GUGQ.js.map → chunk-YNTRONGV.js.map} +1 -1
- package/lib/index.js +1 -1
- package/lib/processor-runner.js +38 -38
- package/lib/processor-runner.js.map +1 -1
- package/package.json +1 -1
- package/src/full-service.ts +103 -54
- package/src/gen/processor/protos/processor.ts +246 -47
- package/lib/chunk-KVJ2GUGQ.js +0 -131
package/package.json
CHANGED
package/src/full-service.ts
CHANGED
@@ -23,6 +23,9 @@ import { compareSemver, parseSemver, Semver } from './utils.js'
|
|
23
23
|
|
24
24
|
const require = createRequire(import.meta.url)
|
25
25
|
|
26
|
+
const FUEL_PROTO_UPDATE_VERSION = parseSemver('2.54.0-rc.7')
|
27
|
+
const MOVE_USE_RAW_VERSION = parseSemver('2.55.0-rc.1')
|
28
|
+
|
26
29
|
function locatePackageJson(pkgId: string) {
|
27
30
|
const m = require.resolve(pkgId)
|
28
31
|
|
@@ -78,9 +81,9 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
78
81
|
}
|
79
82
|
|
80
83
|
async processBindings(request: ProcessBindingsRequest, options: CallContext) {
|
81
|
-
if (GLOBAL_CONFIG.execution.sequential) {
|
82
|
-
|
83
|
-
}
|
84
|
+
// if (GLOBAL_CONFIG.execution.sequential) {
|
85
|
+
// request.bindings = request.bindings.sort(dataCompare)
|
86
|
+
// }
|
84
87
|
|
85
88
|
for (const binding of request.bindings) {
|
86
89
|
this.adjustDataBinding(binding)
|
@@ -125,12 +128,14 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
125
128
|
private adjustResult(res: ProcessResult): void {}
|
126
129
|
|
127
130
|
private adjustDataBinding(dataBinding?: DataBinding): void {
|
131
|
+
const isBeforeMoveUseRawVersion = compareSemver(this.sdkVersion, MOVE_USE_RAW_VERSION) < 0
|
132
|
+
|
128
133
|
if (!dataBinding) {
|
129
134
|
return
|
130
135
|
}
|
131
136
|
switch (dataBinding.handlerType) {
|
132
137
|
case HandlerType.FUEL_TRANSACTION:
|
133
|
-
if (compareSemver(this.sdkVersion,
|
138
|
+
if (compareSemver(this.sdkVersion, FUEL_PROTO_UPDATE_VERSION) < 0) {
|
134
139
|
dataBinding.handlerType = HandlerType.FUEL_CALL
|
135
140
|
if (dataBinding.data) {
|
136
141
|
dataBinding.data.fuelCall = dataBinding.data?.fuelTransaction
|
@@ -138,7 +143,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
138
143
|
}
|
139
144
|
break
|
140
145
|
case HandlerType.FUEL_RECEIPT:
|
141
|
-
if (compareSemver(this.sdkVersion,
|
146
|
+
if (compareSemver(this.sdkVersion, FUEL_PROTO_UPDATE_VERSION) < 0) {
|
142
147
|
dataBinding.handlerType = HandlerType.FUEL_CALL
|
143
148
|
if (dataBinding.data) {
|
144
149
|
dataBinding.data.fuelCall = dataBinding.data?.fuelLog
|
@@ -147,72 +152,116 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
|
|
147
152
|
|
148
153
|
break
|
149
154
|
case HandlerType.APT_EVENT:
|
150
|
-
|
151
|
-
|
152
|
-
|
155
|
+
const aptEvent = dataBinding.data?.aptEvent
|
156
|
+
if (aptEvent) {
|
157
|
+
if (isBeforeMoveUseRawVersion) {
|
158
|
+
aptEvent.transaction = JSON.parse(aptEvent.rawTransaction)
|
159
|
+
if (!aptEvent.transaction?.events?.length) {
|
160
|
+
// when fetch all is not true, then events is empty, we need to fill it to old format
|
161
|
+
aptEvent.transaction!.events = [JSON.parse(aptEvent.rawEvent)]
|
162
|
+
}
|
153
163
|
}
|
154
164
|
}
|
155
165
|
break
|
156
166
|
case HandlerType.APT_CALL:
|
157
|
-
|
158
|
-
|
159
|
-
|
167
|
+
const aptCall = dataBinding.data?.aptCall
|
168
|
+
if (aptCall) {
|
169
|
+
if (isBeforeMoveUseRawVersion) {
|
170
|
+
aptCall.transaction = JSON.parse(aptCall.rawTransaction)
|
160
171
|
}
|
161
172
|
}
|
162
173
|
break
|
163
174
|
case HandlerType.APT_RESOURCE:
|
164
|
-
|
165
|
-
|
166
|
-
|
175
|
+
const aptResource = dataBinding.data?.aptResource
|
176
|
+
if (aptResource) {
|
177
|
+
if (isBeforeMoveUseRawVersion) {
|
178
|
+
aptResource.resources = aptResource.rawResources.map((e) => JSON.parse(e))
|
167
179
|
}
|
168
180
|
}
|
169
181
|
break
|
170
|
-
case HandlerType.
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
182
|
+
case HandlerType.SUI_EVENT:
|
183
|
+
const suiEvent = dataBinding.data?.suiEvent
|
184
|
+
if (suiEvent) {
|
185
|
+
if (isBeforeMoveUseRawVersion) {
|
186
|
+
suiEvent.transaction = JSON.parse(suiEvent.rawTransaction)
|
187
|
+
if (!suiEvent.transaction?.events?.length) {
|
188
|
+
// when fetch all is not true, then events is empty, we need to fill it to old format
|
189
|
+
suiEvent.transaction!.events = [JSON.parse(suiEvent.rawEvent)]
|
190
|
+
}
|
191
|
+
}
|
192
|
+
}
|
193
|
+
break
|
194
|
+
case HandlerType.SUI_CALL:
|
195
|
+
const suiCall = dataBinding.data?.suiCall
|
196
|
+
if (suiCall) {
|
197
|
+
if (isBeforeMoveUseRawVersion) {
|
198
|
+
suiCall.transaction = JSON.parse(suiCall.rawTransaction)
|
199
|
+
}
|
200
|
+
}
|
201
|
+
break
|
202
|
+
case HandlerType.SUI_OBJECT:
|
203
|
+
const suiObject = dataBinding.data?.suiObject
|
204
|
+
if (suiObject) {
|
205
|
+
if (isBeforeMoveUseRawVersion) {
|
206
|
+
if (suiObject.rawSelf) {
|
207
|
+
suiObject.self = JSON.parse(suiObject.rawSelf)
|
208
|
+
}
|
209
|
+
suiObject.objects = suiObject.rawObjects.map((e) => JSON.parse(e))
|
210
|
+
}
|
211
|
+
}
|
212
|
+
break
|
213
|
+
case HandlerType.SUI_OBJECT_CHANGE:
|
214
|
+
const suiObjectChange = dataBinding.data?.suiObjectChange
|
215
|
+
if (suiObjectChange) {
|
216
|
+
if (isBeforeMoveUseRawVersion) {
|
217
|
+
suiObjectChange.changes = suiObjectChange.rawChanges.map((e) => JSON.parse(e))
|
176
218
|
}
|
177
219
|
}
|
178
220
|
break
|
221
|
+
case HandlerType.UNKNOWN:
|
222
|
+
// if (dataBinding.data?.ethBlock) {
|
223
|
+
// if (dataBinding.data.raw.length === 0) {
|
224
|
+
// // This is actually not needed in current system, just as initla test propose, move to test only
|
225
|
+
// // when this is stable
|
226
|
+
// dataBinding.data.raw = new TextEncoder().encode(JSON.stringify(dataBinding.data.ethBlock.block))
|
227
|
+
// }
|
228
|
+
// }
|
229
|
+
break
|
179
230
|
default:
|
180
231
|
break
|
181
232
|
}
|
182
233
|
}
|
183
234
|
}
|
184
235
|
|
185
|
-
//
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
const fuelProtoUpdateVersion = parseSemver('2.54.0-rc.7')
|
236
|
+
// function dataCompare(a: DataBinding, b: DataBinding): number {
|
237
|
+
// const timeA = getTimestamp(a) || new Date(0)
|
238
|
+
// const timeB = getTimestamp(b) || new Date(0)
|
239
|
+
// const timeCmp = timeA.getTime() - timeB.getTime()
|
240
|
+
// if (timeCmp !== 0) {
|
241
|
+
// return timeCmp
|
242
|
+
// }
|
243
|
+
// return getSecondary(a) - getSecondary(b)
|
244
|
+
// }
|
245
|
+
//
|
246
|
+
// function getTimestamp(d: DataBinding): Date | undefined {
|
247
|
+
// return (
|
248
|
+
// d.data?.ethLog?.timestamp ||
|
249
|
+
// d.data?.ethTransaction?.timestamp ||
|
250
|
+
// (d.data?.ethBlock?.block?.timestamp ? new Date(Number(d.data.ethBlock.block.timestamp) * 1000) : undefined) ||
|
251
|
+
// d.data?.ethTrace?.timestamp ||
|
252
|
+
// (d.data?.aptCall?.transaction ? new Date(Number(d.data.aptCall.transaction.timestamp) / 1000) : undefined) ||
|
253
|
+
// (d.data?.aptEvent?.transaction ? new Date(Number(d.data.aptEvent.transaction.timestamp) / 1000) : undefined) ||
|
254
|
+
// (d.data?.aptResource?.timestampMicros ? new Date(Number(d.data.aptResource.timestampMicros) / 1000) : undefined) ||
|
255
|
+
// d.data?.fuelCall?.timestamp
|
256
|
+
// )
|
257
|
+
// }
|
258
|
+
//
|
259
|
+
// function getSecondary(d: DataBinding) {
|
260
|
+
// return (
|
261
|
+
// d.data?.ethLog?.log?.logIndex ||
|
262
|
+
// d.data?.ethTransaction?.transaction?.transactionIndex ||
|
263
|
+
// d.data?.ethBlock?.block?.number ||
|
264
|
+
// d.data?.ethTrace?.trace?.transactionPosition
|
265
|
+
// )
|
266
|
+
// }
|
267
|
+
//
|