@sentio/runtime 2.54.0-rc.1 → 2.54.0-rc.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
- "version": "2.54.0-rc.1",
3
+ "version": "2.54.0-rc.11",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,19 +1,17 @@
1
1
  import { CallContext } from 'nice-grpc'
2
2
  import { createRequire } from 'module'
3
- const require = createRequire(import.meta.url)
4
-
5
3
  // Different than the simple one which
6
4
  import {
7
5
  DataBinding,
6
+ ExecutionConfig,
8
7
  HandlerType,
9
8
  PreprocessStreamRequest,
10
9
  ProcessBindingsRequest,
11
- ProcessStreamRequest,
12
10
  ProcessConfigRequest,
13
11
  ProcessorServiceImplementation,
14
- StartRequest,
15
12
  ProcessResult,
16
- ExecutionConfig
13
+ ProcessStreamRequest,
14
+ StartRequest
17
15
  } from './gen/processor/protos/processor.js'
18
16
 
19
17
  import { Empty } from '@sentio/protos'
@@ -21,6 +19,9 @@ import fs from 'fs-extra'
21
19
  import path from 'path'
22
20
  import os from 'os'
23
21
  import { GLOBAL_CONFIG } from './global-config.js'
22
+ import { compareSemver } from './utils.js'
23
+
24
+ const require = createRequire(import.meta.url)
24
25
 
25
26
  function locatePackageJson(pkgId: string) {
26
27
  const m = require.resolve(pkgId)
@@ -34,6 +35,7 @@ function locatePackageJson(pkgId: string) {
34
35
  }
35
36
 
36
37
  export class FullProcessorServiceImpl implements ProcessorServiceImplementation {
38
+ private sdkVersion: string
37
39
  constructor(instance: ProcessorServiceImplementation) {
38
40
  this.instance = instance
39
41
  const sdkPackageJson = locatePackageJson('@sentio/sdk')
@@ -43,10 +45,12 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
43
45
 
44
46
  const version = sdkPackageJson.version.split('.')
45
47
  this.sdkMinorVersion = parseInt(version[1])
48
+ this.sdkVersion = sdkPackageJson.version
46
49
  }
47
50
 
48
51
  instance: ProcessorServiceImplementation
49
52
  sdkMinorVersion: number
53
+ semver: string
50
54
 
51
55
  async getConfig(request: ProcessConfigRequest, context: CallContext) {
52
56
  const config = await this.instance.getConfig(request, context)
@@ -129,6 +133,23 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
129
133
  return
130
134
  }
131
135
  switch (dataBinding.handlerType) {
136
+ case HandlerType.FUEL_TRANSACTION:
137
+ if (compareSemver(this.sdkVersion, '2.54.0-rc.7') < 0) {
138
+ dataBinding.handlerType = HandlerType.FUEL_CALL
139
+ if (dataBinding.data) {
140
+ dataBinding.data.fuelCall = dataBinding.data?.fuelTransaction
141
+ }
142
+ }
143
+ break
144
+ case HandlerType.FUEL_RECEIPT:
145
+ if (compareSemver(this.sdkVersion, '2.54.0-rc.7') < 0) {
146
+ dataBinding.handlerType = HandlerType.FUEL_CALL
147
+ if (dataBinding.data) {
148
+ dataBinding.data.fuelCall = dataBinding.data?.fuelLog
149
+ }
150
+ }
151
+
152
+ break
132
153
  case HandlerType.APT_EVENT:
133
154
  if (dataBinding.data?.aptEvent) {
134
155
  if (dataBinding.data.aptEvent.rawTransaction && !dataBinding.data.aptEvent.transaction) {