@sentio/runtime 1.37.4 → 1.37.5-rc.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"service.test.js","sourceRoot":"","sources":["../src/service.test.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAChD,iDAAyD;AAEzD,2CAAwE;AACxE,qCAAgD;AAChD,+BAA6B;AAEhB,QAAA,YAAY,GAA6B,EAAE,CAAA;AAExD,gBAAgB;AAChB,MAAM,UAAW,SAAQ,eAAM;IAC7B,KAAK,CAAC,cAAc,CAAC,OAAoB;QACvC,IAAI,OAAO,CAAC,WAAW,KAAK,oBAAW,CAAC,OAAO,EAAE;YAC/C,IAAA,aAAM,EAAC,OAAO,CAAC,IAAK,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;SACrC;QACD,OAAO,sBAAa,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;IACtC,CAAC;IACD,iBAAiB,GAAG,CAAC,oBAAW,CAAC,OAAO,CAAC,CAAA;CAC1C;AAED,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAC1C,MAAM,WAAW,GAAG,IAAI,8BAAoB,CAAC,GAAG,EAAE;QAChD,sBAAa,CAAC,QAAQ,CAAC,OAAO,GAAG,EAAE,CAAA;QACnC,sBAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,IAAI,uCAAwB,CAAC,WAAW,CAAC,CAAA;IAEzD,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,OAAO,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,EAAE,oBAAY,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACtD,MAAM,QAAQ,GAAgB;YAC5B,IAAI,EAAE;gBACJ,GAAG,EAAE,IAAI,UAAU,EAAE;gBACrB,QAAQ,EAAE;oBACR,KAAK,EAAE;wBACL,MAAM,EAAE,KAAK;qBACd;iBACF;aACF;YACD,WAAW,EAAE,oBAAW,CAAC,OAAO;YAChC,UAAU,EAAE,CAAC,CAAC,CAAC;SAChB,CAAA;QAED,MAAM,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,oBAAY,CAAC,CAAA;IACvE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { ProcessorServiceImpl } from './service'\nimport { FullProcessorServiceImpl } from './full-service'\nimport { CallContext } from 'nice-grpc-common'\nimport { DataBinding, HandlerType, ProcessResult } from '@sentio/protos'\nimport { Plugin, PluginManager } from './plugin'\nimport { assert } from 'chai'\n\nexport const TEST_CONTEXT: CallContext = <CallContext>{}\n\n// TODO use mock\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n if (request.handlerType === HandlerType.UNKNOWN) {\n assert(request.data!.raw.length > 0)\n }\n return ProcessResult.fromPartial({})\n }\n supportedHandlers = [HandlerType.UNKNOWN]\n}\n\ndescribe('Test Service Compatibility', () => {\n const baseService = new ProcessorServiceImpl(() => {\n PluginManager.INSTANCE.plugins = []\n PluginManager.INSTANCE.register(new TestPlugin())\n })\n const service = new FullProcessorServiceImpl(baseService)\n\n beforeAll(async () => {\n await service.start({ templateInstances: [] }, TEST_CONTEXT)\n })\n\n test('Check tictactoe transaction dispatch', async () => {\n const binding1: DataBinding = {\n data: {\n raw: new Uint8Array(),\n ethBlock: {\n block: {\n number: '0x1',\n },\n },\n },\n handlerType: HandlerType.UNKNOWN,\n handlerIds: [0],\n }\n\n await service.processBindings({ bindings: [binding1] }, TEST_CONTEXT)\n })\n})\n"]}
1
+ {"version":3,"file":"service.test.js","sourceRoot":"","sources":["../src/service.test.ts"],"names":[],"mapp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AE,CAAC,CAAC,CAAC;SAChB,CAAA;QAED,MAAM,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,oBAAY,CAAC,CAAA;IACvE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { ProcessorServiceImpl } from './service'\nimport { FullProcessorServiceImpl } from './full-service'\nimport { CallContext } from 'nice-grpc-common'\nimport { DataBinding, HandlerType, ProcessResult } from './gen/processor/protos/processor'\nimport { Plugin, PluginManager } from './plugin'\nimport { assert } from 'chai'\n\nexport const TEST_CONTEXT: CallContext = <CallContext>{}\n\n// TODO use mock\nclass TestPlugin extends Plugin {\n async processBinding(request: DataBinding): Promise<ProcessResult> {\n if (request.handlerType === HandlerType.UNKNOWN) {\n assert(request.data!.raw.length > 0)\n }\n return ProcessResult.fromPartial({})\n }\n supportedHandlers = [HandlerType.UNKNOWN]\n}\n\ndescribe('Test Service Compatibility', () => {\n const baseService = new ProcessorServiceImpl(() => {\n PluginManager.INSTANCE.plugins = []\n PluginManager.INSTANCE.register(new TestPlugin())\n })\n const service = new FullProcessorServiceImpl(baseService)\n\n beforeAll(async () => {\n await service.start({ templateInstances: [] }, TEST_CONTEXT)\n })\n\n test('Check tictactoe transaction dispatch', async () => {\n const binding1: DataBinding = {\n data: {\n raw: new Uint8Array(),\n ethBlock: {\n block: {\n number: '0x1',\n },\n },\n },\n handlerType: HandlerType.UNKNOWN,\n handlerIds: [0],\n }\n\n await service.processBindings({ bindings: [binding1] }, TEST_CONTEXT)\n })\n})\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
3
  "license": "Apache-2.0",
4
- "version": "1.37.4",
4
+ "version": "1.37.5-rc.1",
5
5
  "scripts": {
6
6
  "compile": "tsc -p .",
7
7
  "build": "yarn compile",
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@ethersproject/providers": "~5.7.0",
13
- "@sentio/protos": "^1.37.4",
13
+ "@sentio/protos": "^1.37.5-rc.1",
14
14
  "bignumber.js": "^9.1.0",
15
15
  "command-line-args": "^5.2.1",
16
16
  "command-line-usage": "^6.1.3",
@@ -46,5 +46,5 @@
46
46
  "!{lib,src}/tests",
47
47
  "!**/*.test.{js,ts}"
48
48
  ],
49
- "gitHead": "3eb53f4125983b37e81ea4160eee95c1932ce965"
49
+ "gitHead": "3cb4665cbcfef83951d124ae04f5b50c59b380fd"
50
50
  }
@@ -1,91 +1,86 @@
1
1
  /* eslint-disable */
2
- import Long from 'long'
3
- import _m0 from 'protobufjs/minimal'
2
+ import Long from "long";
3
+ import _m0 from "protobufjs/minimal";
4
4
 
5
5
  export interface Timestamp {
6
- seconds: bigint
7
- nanos: number
6
+ seconds: bigint;
7
+ nanos: number;
8
8
  }
9
9
 
10
10
  function createBaseTimestamp(): Timestamp {
11
- return { seconds: BigInt('0'), nanos: 0 }
11
+ return { seconds: BigInt("0"), nanos: 0 };
12
12
  }
13
13
 
14
14
  export const Timestamp = {
15
15
  encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
16
- if (message.seconds !== BigInt('0')) {
17
- writer.uint32(8).int64(message.seconds.toString())
16
+ if (message.seconds !== BigInt("0")) {
17
+ writer.uint32(8).int64(message.seconds.toString());
18
18
  }
19
19
  if (message.nanos !== 0) {
20
- writer.uint32(16).int32(message.nanos)
20
+ writer.uint32(16).int32(message.nanos);
21
21
  }
22
- return writer
22
+ return writer;
23
23
  },
24
24
 
25
25
  decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
26
- const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input)
27
- let end = length === undefined ? reader.len : reader.pos + length
28
- const message = createBaseTimestamp()
26
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
27
+ let end = length === undefined ? reader.len : reader.pos + length;
28
+ const message = createBaseTimestamp();
29
29
  while (reader.pos < end) {
30
- const tag = reader.uint32()
30
+ const tag = reader.uint32();
31
31
  switch (tag >>> 3) {
32
32
  case 1:
33
- message.seconds = longToBigint(reader.int64() as Long)
34
- break
33
+ message.seconds = longToBigint(reader.int64() as Long);
34
+ break;
35
35
  case 2:
36
- message.nanos = reader.int32()
37
- break
36
+ message.nanos = reader.int32();
37
+ break;
38
38
  default:
39
- reader.skipType(tag & 7)
40
- break
39
+ reader.skipType(tag & 7);
40
+ break;
41
41
  }
42
42
  }
43
- return message
43
+ return message;
44
44
  },
45
45
 
46
46
  fromJSON(object: any): Timestamp {
47
47
  return {
48
- seconds: isSet(object.seconds) ? BigInt(object.seconds) : BigInt('0'),
48
+ seconds: isSet(object.seconds) ? BigInt(object.seconds) : BigInt("0"),
49
49
  nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
50
- }
50
+ };
51
51
  },
52
52
 
53
53
  toJSON(message: Timestamp): unknown {
54
- const obj: any = {}
55
- message.seconds !== undefined && (obj.seconds = message.seconds.toString())
56
- message.nanos !== undefined && (obj.nanos = Math.round(message.nanos))
57
- return obj
54
+ const obj: any = {};
55
+ message.seconds !== undefined && (obj.seconds = message.seconds.toString());
56
+ message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
57
+ return obj;
58
58
  },
59
59
 
60
60
  fromPartial(object: DeepPartial<Timestamp>): Timestamp {
61
- const message = createBaseTimestamp()
62
- message.seconds = object.seconds ?? BigInt('0')
63
- message.nanos = object.nanos ?? 0
64
- return message
61
+ const message = createBaseTimestamp();
62
+ message.seconds = object.seconds ?? BigInt("0");
63
+ message.nanos = object.nanos ?? 0;
64
+ return message;
65
65
  },
66
- }
66
+ };
67
67
 
68
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined
68
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
69
69
 
70
- type DeepPartial<T> = T extends Builtin
71
- ? T
72
- : T extends Array<infer U>
73
- ? Array<DeepPartial<U>>
74
- : T extends ReadonlyArray<infer U>
75
- ? ReadonlyArray<DeepPartial<U>>
76
- : T extends {}
77
- ? { [K in keyof T]?: DeepPartial<T[K]> }
78
- : Partial<T>
70
+ type DeepPartial<T> = T extends Builtin ? T
71
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
72
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
73
+ : Partial<T>;
79
74
 
80
75
  function longToBigint(long: Long) {
81
- return BigInt(long.toString())
76
+ return BigInt(long.toString());
82
77
  }
83
78
 
84
79
  if (_m0.util.Long !== Long) {
85
- _m0.util.Long = Long as any
86
- _m0.configure()
80
+ _m0.util.Long = Long as any;
81
+ _m0.configure();
87
82
  }
88
83
 
89
84
  function isSet(value: any): boolean {
90
- return value !== null && value !== undefined
85
+ return value !== null && value !== undefined;
91
86
  }
@@ -462,6 +462,7 @@ export interface RawTransaction {
462
462
  }
463
463
 
464
464
  export interface Data {
465
+ /** @deprecated */
465
466
  raw: Uint8Array;
466
467
  ethLog?: Data_EthLog | undefined;
467
468
  ethBlock?: Data_EthBlock | undefined;
@@ -475,7 +476,7 @@ export interface Data {
475
476
 
476
477
  export interface Data_EthLog {
477
478
  log: { [key: string]: any } | undefined;
478
- transaction?: Uint8Array | undefined;
479
+ transaction?: { [key: string]: any } | undefined;
479
480
  }
480
481
 
481
482
  export interface Data_EthBlock {
@@ -484,13 +485,13 @@ export interface Data_EthBlock {
484
485
 
485
486
  export interface Data_EthTransaction {
486
487
  transaction: { [key: string]: any } | undefined;
487
- transactionReceipt?: Uint8Array | undefined;
488
+ transactionReceipt?: { [key: string]: any } | undefined;
488
489
  }
489
490
 
490
491
  export interface Data_EthTrace {
491
492
  trace: { [key: string]: any } | undefined;
492
- transaction?: Uint8Array | undefined;
493
- transactionReceipt?: Uint8Array | undefined;
493
+ transaction?: { [key: string]: any } | undefined;
494
+ transactionReceipt?: { [key: string]: any } | undefined;
494
495
  }
495
496
 
496
497
  export interface Data_SolInstruction {
@@ -3001,7 +3002,7 @@ export const Data_EthLog = {
3001
3002
  Struct.encode(Struct.wrap(message.log), writer.uint32(26).fork()).ldelim();
3002
3003
  }
3003
3004
  if (message.transaction !== undefined) {
3004
- writer.uint32(18).bytes(message.transaction);
3005
+ Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3005
3006
  }
3006
3007
  return writer;
3007
3008
  },
@@ -3017,7 +3018,7 @@ export const Data_EthLog = {
3017
3018
  message.log = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3018
3019
  break;
3019
3020
  case 2:
3020
- message.transaction = reader.bytes();
3021
+ message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3021
3022
  break;
3022
3023
  default:
3023
3024
  reader.skipType(tag & 7);
@@ -3030,15 +3031,14 @@ export const Data_EthLog = {
3030
3031
  fromJSON(object: any): Data_EthLog {
3031
3032
  return {
3032
3033
  log: isObject(object.log) ? object.log : undefined,
3033
- transaction: isSet(object.transaction) ? bytesFromBase64(object.transaction) : undefined,
3034
+ transaction: isObject(object.transaction) ? object.transaction : undefined,
3034
3035
  };
3035
3036
  },
3036
3037
 
3037
3038
  toJSON(message: Data_EthLog): unknown {
3038
3039
  const obj: any = {};
3039
3040
  message.log !== undefined && (obj.log = message.log);
3040
- message.transaction !== undefined &&
3041
- (obj.transaction = message.transaction !== undefined ? base64FromBytes(message.transaction) : undefined);
3041
+ message.transaction !== undefined && (obj.transaction = message.transaction);
3042
3042
  return obj;
3043
3043
  },
3044
3044
 
@@ -3107,7 +3107,7 @@ export const Data_EthTransaction = {
3107
3107
  Struct.encode(Struct.wrap(message.transaction), writer.uint32(34).fork()).ldelim();
3108
3108
  }
3109
3109
  if (message.transactionReceipt !== undefined) {
3110
- writer.uint32(26).bytes(message.transactionReceipt);
3110
+ Struct.encode(Struct.wrap(message.transactionReceipt), writer.uint32(26).fork()).ldelim();
3111
3111
  }
3112
3112
  return writer;
3113
3113
  },
@@ -3123,7 +3123,7 @@ export const Data_EthTransaction = {
3123
3123
  message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3124
3124
  break;
3125
3125
  case 3:
3126
- message.transactionReceipt = reader.bytes();
3126
+ message.transactionReceipt = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3127
3127
  break;
3128
3128
  default:
3129
3129
  reader.skipType(tag & 7);
@@ -3136,16 +3136,14 @@ export const Data_EthTransaction = {
3136
3136
  fromJSON(object: any): Data_EthTransaction {
3137
3137
  return {
3138
3138
  transaction: isObject(object.transaction) ? object.transaction : undefined,
3139
- transactionReceipt: isSet(object.transactionReceipt) ? bytesFromBase64(object.transactionReceipt) : undefined,
3139
+ transactionReceipt: isObject(object.transactionReceipt) ? object.transactionReceipt : undefined,
3140
3140
  };
3141
3141
  },
3142
3142
 
3143
3143
  toJSON(message: Data_EthTransaction): unknown {
3144
3144
  const obj: any = {};
3145
3145
  message.transaction !== undefined && (obj.transaction = message.transaction);
3146
- message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt !== undefined
3147
- ? base64FromBytes(message.transactionReceipt)
3148
- : undefined);
3146
+ message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt);
3149
3147
  return obj;
3150
3148
  },
3151
3149
 
@@ -3167,10 +3165,10 @@ export const Data_EthTrace = {
3167
3165
  Struct.encode(Struct.wrap(message.trace), writer.uint32(34).fork()).ldelim();
3168
3166
  }
3169
3167
  if (message.transaction !== undefined) {
3170
- writer.uint32(18).bytes(message.transaction);
3168
+ Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3171
3169
  }
3172
3170
  if (message.transactionReceipt !== undefined) {
3173
- writer.uint32(26).bytes(message.transactionReceipt);
3171
+ Struct.encode(Struct.wrap(message.transactionReceipt), writer.uint32(26).fork()).ldelim();
3174
3172
  }
3175
3173
  return writer;
3176
3174
  },
@@ -3186,10 +3184,10 @@ export const Data_EthTrace = {
3186
3184
  message.trace = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3187
3185
  break;
3188
3186
  case 2:
3189
- message.transaction = reader.bytes();
3187
+ message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3190
3188
  break;
3191
3189
  case 3:
3192
- message.transactionReceipt = reader.bytes();
3190
+ message.transactionReceipt = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3193
3191
  break;
3194
3192
  default:
3195
3193
  reader.skipType(tag & 7);
@@ -3202,19 +3200,16 @@ export const Data_EthTrace = {
3202
3200
  fromJSON(object: any): Data_EthTrace {
3203
3201
  return {
3204
3202
  trace: isObject(object.trace) ? object.trace : undefined,
3205
- transaction: isSet(object.transaction) ? bytesFromBase64(object.transaction) : undefined,
3206
- transactionReceipt: isSet(object.transactionReceipt) ? bytesFromBase64(object.transactionReceipt) : undefined,
3203
+ transaction: isObject(object.transaction) ? object.transaction : undefined,
3204
+ transactionReceipt: isObject(object.transactionReceipt) ? object.transactionReceipt : undefined,
3207
3205
  };
3208
3206
  },
3209
3207
 
3210
3208
  toJSON(message: Data_EthTrace): unknown {
3211
3209
  const obj: any = {};
3212
3210
  message.trace !== undefined && (obj.trace = message.trace);
3213
- message.transaction !== undefined &&
3214
- (obj.transaction = message.transaction !== undefined ? base64FromBytes(message.transaction) : undefined);
3215
- message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt !== undefined
3216
- ? base64FromBytes(message.transactionReceipt)
3217
- : undefined);
3211
+ message.transaction !== undefined && (obj.transaction = message.transaction);
3212
+ message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt);
3218
3213
  return obj;
3219
3214
  },
3220
3215
 
@@ -4456,7 +4451,7 @@ export const ExportResult = {
4456
4451
  export type ProcessorDefinition = typeof ProcessorDefinition;
4457
4452
  export const ProcessorDefinition = {
4458
4453
  name: "Processor",
4459
- fullName: "processor.Processor",
4454
+ fullName: "processor_full.Processor",
4460
4455
  methods: {
4461
4456
  start: {
4462
4457
  name: "Start",