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

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.11",
3
+ "version": "2.54.0-rc.12",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -19,7 +19,7 @@ import fs from 'fs-extra'
19
19
  import path from 'path'
20
20
  import os from 'os'
21
21
  import { GLOBAL_CONFIG } from './global-config.js'
22
- import { compareSemver } from './utils.js'
22
+ import { compareSemver, parseSemver, Semver } from './utils.js'
23
23
 
24
24
  const require = createRequire(import.meta.url)
25
25
 
@@ -35,7 +35,6 @@ function locatePackageJson(pkgId: string) {
35
35
  }
36
36
 
37
37
  export class FullProcessorServiceImpl implements ProcessorServiceImplementation {
38
- private sdkVersion: string
39
38
  constructor(instance: ProcessorServiceImplementation) {
40
39
  this.instance = instance
41
40
  const sdkPackageJson = locatePackageJson('@sentio/sdk')
@@ -43,14 +42,11 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
43
42
 
44
43
  console.log('Runtime version:', runtimePackageJson.version, 'SDK version:', sdkPackageJson.version)
45
44
 
46
- const version = sdkPackageJson.version.split('.')
47
- this.sdkMinorVersion = parseInt(version[1])
48
- this.sdkVersion = sdkPackageJson.version
45
+ this.sdkVersion = parseSemver(sdkPackageJson.version)
49
46
  }
50
47
 
51
48
  instance: ProcessorServiceImplementation
52
- sdkMinorVersion: number
53
- semver: string
49
+ sdkVersion: Semver
54
50
 
55
51
  async getConfig(request: ProcessConfigRequest, context: CallContext) {
56
52
  const config = await this.instance.getConfig(request, context)
@@ -97,7 +93,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
97
93
  }
98
94
  return result
99
95
  } catch (e) {
100
- if (this.sdkMinorVersion <= 16) {
96
+ if (this.sdkVersion.minor <= 16) {
101
97
  // Old sdk doesn't handle this well
102
98
  if (
103
99
  e.code === os.constants.errno.ECONNRESET ||
@@ -134,7 +130,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
134
130
  }
135
131
  switch (dataBinding.handlerType) {
136
132
  case HandlerType.FUEL_TRANSACTION:
137
- if (compareSemver(this.sdkVersion, '2.54.0-rc.7') < 0) {
133
+ if (compareSemver(this.sdkVersion, fuelProtoUpdateVersion) < 0) {
138
134
  dataBinding.handlerType = HandlerType.FUEL_CALL
139
135
  if (dataBinding.data) {
140
136
  dataBinding.data.fuelCall = dataBinding.data?.fuelTransaction
@@ -142,7 +138,7 @@ export class FullProcessorServiceImpl implements ProcessorServiceImplementation
142
138
  }
143
139
  break
144
140
  case HandlerType.FUEL_RECEIPT:
145
- if (compareSemver(this.sdkVersion, '2.54.0-rc.7') < 0) {
141
+ if (compareSemver(this.sdkVersion, fuelProtoUpdateVersion) < 0) {
146
142
  dataBinding.handlerType = HandlerType.FUEL_CALL
147
143
  if (dataBinding.data) {
148
144
  dataBinding.data.fuelCall = dataBinding.data?.fuelLog
@@ -218,3 +214,5 @@ function getSecondary(d: DataBinding) {
218
214
  d.data?.ethTrace?.trace?.transactionPosition
219
215
  )
220
216
  }
217
+
218
+ const fuelProtoUpdateVersion = parseSemver('2.54.0-rc.7')
package/src/utils.ts CHANGED
@@ -61,9 +61,9 @@ export function parseSemver(version: string): Semver {
61
61
  }
62
62
  }
63
63
 
64
- export function compareSemver(a: string, b: string) {
65
- const { major: ma, minor: mia, patch: pa, prerelease: pra } = parseSemver(a)
66
- const { major: mb, minor: mib, patch: pb, prerelease: prb } = parseSemver(b)
64
+ export function compareSemver(a: Semver, b: Semver) {
65
+ const { major: ma, minor: mia, patch: pa, prerelease: pra } = a
66
+ const { major: mb, minor: mib, patch: pb, prerelease: prb } = b
67
67
 
68
68
  if (ma !== mb) {
69
69
  return ma - mb