@sentio/runtime 1.37.5-rc.1 → 1.37.5-rc.3

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@sentio/runtime",
3
3
  "license": "Apache-2.0",
4
- "version": "1.37.5-rc.1",
4
+ "version": "1.37.5-rc.3",
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.5-rc.1",
13
+ "@sentio/protos": "^1.37.5-rc.3",
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": "3cb4665cbcfef83951d124ae04f5b50c59b380fd"
49
+ "gitHead": "91efb0c0a1853f1c3158c8abd5d9dcbc152c53c0"
50
50
  }
@@ -4,6 +4,7 @@ import type { CallContext, CallOptions } from "nice-grpc-common";
4
4
  import _m0 from "protobufjs/minimal";
5
5
  import { Empty } from "../../google/protobuf/empty";
6
6
  import { Struct } from "../../google/protobuf/struct";
7
+ import { Timestamp } from "../../google/protobuf/timestamp";
7
8
 
8
9
  export enum MetricType {
9
10
  UNKNOWN_TYPE = 0,
@@ -476,6 +477,7 @@ export interface Data {
476
477
 
477
478
  export interface Data_EthLog {
478
479
  log: { [key: string]: any } | undefined;
480
+ timestamp: Date | undefined;
479
481
  transaction?: { [key: string]: any } | undefined;
480
482
  }
481
483
 
@@ -485,11 +487,13 @@ export interface Data_EthBlock {
485
487
 
486
488
  export interface Data_EthTransaction {
487
489
  transaction: { [key: string]: any } | undefined;
490
+ timestamp: Date | undefined;
488
491
  transactionReceipt?: { [key: string]: any } | undefined;
489
492
  }
490
493
 
491
494
  export interface Data_EthTrace {
492
495
  trace: { [key: string]: any } | undefined;
496
+ timestamp: Date | undefined;
493
497
  transaction?: { [key: string]: any } | undefined;
494
498
  transactionReceipt?: { [key: string]: any } | undefined;
495
499
  }
@@ -503,11 +507,11 @@ export interface Data_SolInstruction {
503
507
  }
504
508
 
505
509
  export interface Data_AptEvent {
506
- event: { [key: string]: any } | undefined;
510
+ transaction: { [key: string]: any } | undefined;
507
511
  }
508
512
 
509
513
  export interface Data_AptCall {
510
- call: { [key: string]: any } | undefined;
514
+ transaction: { [key: string]: any } | undefined;
511
515
  }
512
516
 
513
517
  export interface Data_AptResource {
@@ -2993,7 +2997,7 @@ export const Data = {
2993
2997
  };
2994
2998
 
2995
2999
  function createBaseData_EthLog(): Data_EthLog {
2996
- return { log: undefined, transaction: undefined };
3000
+ return { log: undefined, timestamp: undefined, transaction: undefined };
2997
3001
  }
2998
3002
 
2999
3003
  export const Data_EthLog = {
@@ -3001,6 +3005,9 @@ export const Data_EthLog = {
3001
3005
  if (message.log !== undefined) {
3002
3006
  Struct.encode(Struct.wrap(message.log), writer.uint32(26).fork()).ldelim();
3003
3007
  }
3008
+ if (message.timestamp !== undefined) {
3009
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(34).fork()).ldelim();
3010
+ }
3004
3011
  if (message.transaction !== undefined) {
3005
3012
  Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3006
3013
  }
@@ -3017,6 +3024,9 @@ export const Data_EthLog = {
3017
3024
  case 3:
3018
3025
  message.log = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3019
3026
  break;
3027
+ case 4:
3028
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3029
+ break;
3020
3030
  case 2:
3021
3031
  message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3022
3032
  break;
@@ -3031,6 +3041,7 @@ export const Data_EthLog = {
3031
3041
  fromJSON(object: any): Data_EthLog {
3032
3042
  return {
3033
3043
  log: isObject(object.log) ? object.log : undefined,
3044
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
3034
3045
  transaction: isObject(object.transaction) ? object.transaction : undefined,
3035
3046
  };
3036
3047
  },
@@ -3038,6 +3049,7 @@ export const Data_EthLog = {
3038
3049
  toJSON(message: Data_EthLog): unknown {
3039
3050
  const obj: any = {};
3040
3051
  message.log !== undefined && (obj.log = message.log);
3052
+ message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
3041
3053
  message.transaction !== undefined && (obj.transaction = message.transaction);
3042
3054
  return obj;
3043
3055
  },
@@ -3045,6 +3057,7 @@ export const Data_EthLog = {
3045
3057
  fromPartial(object: DeepPartial<Data_EthLog>): Data_EthLog {
3046
3058
  const message = createBaseData_EthLog();
3047
3059
  message.log = object.log ?? undefined;
3060
+ message.timestamp = object.timestamp ?? undefined;
3048
3061
  message.transaction = object.transaction ?? undefined;
3049
3062
  return message;
3050
3063
  },
@@ -3098,7 +3111,7 @@ export const Data_EthBlock = {
3098
3111
  };
3099
3112
 
3100
3113
  function createBaseData_EthTransaction(): Data_EthTransaction {
3101
- return { transaction: undefined, transactionReceipt: undefined };
3114
+ return { transaction: undefined, timestamp: undefined, transactionReceipt: undefined };
3102
3115
  }
3103
3116
 
3104
3117
  export const Data_EthTransaction = {
@@ -3106,6 +3119,9 @@ export const Data_EthTransaction = {
3106
3119
  if (message.transaction !== undefined) {
3107
3120
  Struct.encode(Struct.wrap(message.transaction), writer.uint32(34).fork()).ldelim();
3108
3121
  }
3122
+ if (message.timestamp !== undefined) {
3123
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim();
3124
+ }
3109
3125
  if (message.transactionReceipt !== undefined) {
3110
3126
  Struct.encode(Struct.wrap(message.transactionReceipt), writer.uint32(26).fork()).ldelim();
3111
3127
  }
@@ -3122,6 +3138,9 @@ export const Data_EthTransaction = {
3122
3138
  case 4:
3123
3139
  message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3124
3140
  break;
3141
+ case 5:
3142
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3143
+ break;
3125
3144
  case 3:
3126
3145
  message.transactionReceipt = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3127
3146
  break;
@@ -3136,6 +3155,7 @@ export const Data_EthTransaction = {
3136
3155
  fromJSON(object: any): Data_EthTransaction {
3137
3156
  return {
3138
3157
  transaction: isObject(object.transaction) ? object.transaction : undefined,
3158
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
3139
3159
  transactionReceipt: isObject(object.transactionReceipt) ? object.transactionReceipt : undefined,
3140
3160
  };
3141
3161
  },
@@ -3143,6 +3163,7 @@ export const Data_EthTransaction = {
3143
3163
  toJSON(message: Data_EthTransaction): unknown {
3144
3164
  const obj: any = {};
3145
3165
  message.transaction !== undefined && (obj.transaction = message.transaction);
3166
+ message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
3146
3167
  message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt);
3147
3168
  return obj;
3148
3169
  },
@@ -3150,13 +3171,14 @@ export const Data_EthTransaction = {
3150
3171
  fromPartial(object: DeepPartial<Data_EthTransaction>): Data_EthTransaction {
3151
3172
  const message = createBaseData_EthTransaction();
3152
3173
  message.transaction = object.transaction ?? undefined;
3174
+ message.timestamp = object.timestamp ?? undefined;
3153
3175
  message.transactionReceipt = object.transactionReceipt ?? undefined;
3154
3176
  return message;
3155
3177
  },
3156
3178
  };
3157
3179
 
3158
3180
  function createBaseData_EthTrace(): Data_EthTrace {
3159
- return { trace: undefined, transaction: undefined, transactionReceipt: undefined };
3181
+ return { trace: undefined, timestamp: undefined, transaction: undefined, transactionReceipt: undefined };
3160
3182
  }
3161
3183
 
3162
3184
  export const Data_EthTrace = {
@@ -3164,6 +3186,9 @@ export const Data_EthTrace = {
3164
3186
  if (message.trace !== undefined) {
3165
3187
  Struct.encode(Struct.wrap(message.trace), writer.uint32(34).fork()).ldelim();
3166
3188
  }
3189
+ if (message.timestamp !== undefined) {
3190
+ Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim();
3191
+ }
3167
3192
  if (message.transaction !== undefined) {
3168
3193
  Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3169
3194
  }
@@ -3183,6 +3208,9 @@ export const Data_EthTrace = {
3183
3208
  case 4:
3184
3209
  message.trace = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3185
3210
  break;
3211
+ case 5:
3212
+ message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
3213
+ break;
3186
3214
  case 2:
3187
3215
  message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3188
3216
  break;
@@ -3200,6 +3228,7 @@ export const Data_EthTrace = {
3200
3228
  fromJSON(object: any): Data_EthTrace {
3201
3229
  return {
3202
3230
  trace: isObject(object.trace) ? object.trace : undefined,
3231
+ timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
3203
3232
  transaction: isObject(object.transaction) ? object.transaction : undefined,
3204
3233
  transactionReceipt: isObject(object.transactionReceipt) ? object.transactionReceipt : undefined,
3205
3234
  };
@@ -3208,6 +3237,7 @@ export const Data_EthTrace = {
3208
3237
  toJSON(message: Data_EthTrace): unknown {
3209
3238
  const obj: any = {};
3210
3239
  message.trace !== undefined && (obj.trace = message.trace);
3240
+ message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
3211
3241
  message.transaction !== undefined && (obj.transaction = message.transaction);
3212
3242
  message.transactionReceipt !== undefined && (obj.transactionReceipt = message.transactionReceipt);
3213
3243
  return obj;
@@ -3216,6 +3246,7 @@ export const Data_EthTrace = {
3216
3246
  fromPartial(object: DeepPartial<Data_EthTrace>): Data_EthTrace {
3217
3247
  const message = createBaseData_EthTrace();
3218
3248
  message.trace = object.trace ?? undefined;
3249
+ message.timestamp = object.timestamp ?? undefined;
3219
3250
  message.transaction = object.transaction ?? undefined;
3220
3251
  message.transactionReceipt = object.transactionReceipt ?? undefined;
3221
3252
  return message;
@@ -3312,13 +3343,13 @@ export const Data_SolInstruction = {
3312
3343
  };
3313
3344
 
3314
3345
  function createBaseData_AptEvent(): Data_AptEvent {
3315
- return { event: undefined };
3346
+ return { transaction: undefined };
3316
3347
  }
3317
3348
 
3318
3349
  export const Data_AptEvent = {
3319
3350
  encode(message: Data_AptEvent, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3320
- if (message.event !== undefined) {
3321
- Struct.encode(Struct.wrap(message.event), writer.uint32(18).fork()).ldelim();
3351
+ if (message.transaction !== undefined) {
3352
+ Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3322
3353
  }
3323
3354
  return writer;
3324
3355
  },
@@ -3331,7 +3362,7 @@ export const Data_AptEvent = {
3331
3362
  const tag = reader.uint32();
3332
3363
  switch (tag >>> 3) {
3333
3364
  case 2:
3334
- message.event = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3365
+ message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3335
3366
  break;
3336
3367
  default:
3337
3368
  reader.skipType(tag & 7);
@@ -3342,30 +3373,30 @@ export const Data_AptEvent = {
3342
3373
  },
3343
3374
 
3344
3375
  fromJSON(object: any): Data_AptEvent {
3345
- return { event: isObject(object.event) ? object.event : undefined };
3376
+ return { transaction: isObject(object.transaction) ? object.transaction : undefined };
3346
3377
  },
3347
3378
 
3348
3379
  toJSON(message: Data_AptEvent): unknown {
3349
3380
  const obj: any = {};
3350
- message.event !== undefined && (obj.event = message.event);
3381
+ message.transaction !== undefined && (obj.transaction = message.transaction);
3351
3382
  return obj;
3352
3383
  },
3353
3384
 
3354
3385
  fromPartial(object: DeepPartial<Data_AptEvent>): Data_AptEvent {
3355
3386
  const message = createBaseData_AptEvent();
3356
- message.event = object.event ?? undefined;
3387
+ message.transaction = object.transaction ?? undefined;
3357
3388
  return message;
3358
3389
  },
3359
3390
  };
3360
3391
 
3361
3392
  function createBaseData_AptCall(): Data_AptCall {
3362
- return { call: undefined };
3393
+ return { transaction: undefined };
3363
3394
  }
3364
3395
 
3365
3396
  export const Data_AptCall = {
3366
3397
  encode(message: Data_AptCall, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
3367
- if (message.call !== undefined) {
3368
- Struct.encode(Struct.wrap(message.call), writer.uint32(18).fork()).ldelim();
3398
+ if (message.transaction !== undefined) {
3399
+ Struct.encode(Struct.wrap(message.transaction), writer.uint32(18).fork()).ldelim();
3369
3400
  }
3370
3401
  return writer;
3371
3402
  },
@@ -3378,7 +3409,7 @@ export const Data_AptCall = {
3378
3409
  const tag = reader.uint32();
3379
3410
  switch (tag >>> 3) {
3380
3411
  case 2:
3381
- message.call = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3412
+ message.transaction = Struct.unwrap(Struct.decode(reader, reader.uint32()));
3382
3413
  break;
3383
3414
  default:
3384
3415
  reader.skipType(tag & 7);
@@ -3389,18 +3420,18 @@ export const Data_AptCall = {
3389
3420
  },
3390
3421
 
3391
3422
  fromJSON(object: any): Data_AptCall {
3392
- return { call: isObject(object.call) ? object.call : undefined };
3423
+ return { transaction: isObject(object.transaction) ? object.transaction : undefined };
3393
3424
  },
3394
3425
 
3395
3426
  toJSON(message: Data_AptCall): unknown {
3396
3427
  const obj: any = {};
3397
- message.call !== undefined && (obj.call = message.call);
3428
+ message.transaction !== undefined && (obj.transaction = message.transaction);
3398
3429
  return obj;
3399
3430
  },
3400
3431
 
3401
3432
  fromPartial(object: DeepPartial<Data_AptCall>): Data_AptCall {
3402
3433
  const message = createBaseData_AptCall();
3403
- message.call = object.call ?? undefined;
3434
+ message.transaction = object.transaction ?? undefined;
3404
3435
  return message;
3405
3436
  },
3406
3437
  };
@@ -4581,6 +4612,28 @@ type DeepPartial<T> = T extends Builtin ? T
4581
4612
  : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
4582
4613
  : Partial<T>;
4583
4614
 
4615
+ function toTimestamp(date: Date): Timestamp {
4616
+ const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
4617
+ const nanos = (date.getTime() % 1_000) * 1_000_000;
4618
+ return { seconds, nanos };
4619
+ }
4620
+
4621
+ function fromTimestamp(t: Timestamp): Date {
4622
+ let millis = Number(t.seconds.toString()) * 1_000;
4623
+ millis += t.nanos / 1_000_000;
4624
+ return new Date(millis);
4625
+ }
4626
+
4627
+ function fromJsonTimestamp(o: any): Date {
4628
+ if (o instanceof Date) {
4629
+ return o;
4630
+ } else if (typeof o === "string") {
4631
+ return new Date(o);
4632
+ } else {
4633
+ return fromTimestamp(Timestamp.fromJSON(o));
4634
+ }
4635
+ }
4636
+
4584
4637
  function longToBigint(long: Long) {
4585
4638
  return BigInt(long.toString());
4586
4639
  }