@sentio/sdk 1.29.1 → 1.30.0
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/aptos/context.d.ts +3 -3
- package/lib/aptos/context.js +7 -6
- package/lib/aptos/context.js.map +1 -1
- package/lib/core/base-context.d.ts +2 -2
- package/lib/core/base-context.js.map +1 -1
- package/lib/core/context.d.ts +4 -4
- package/lib/core/context.js +14 -13
- package/lib/core/context.js.map +1 -1
- package/lib/core/event-tracker.d.ts +2 -2
- package/lib/core/event-tracker.js +4 -5
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +2 -2
- package/lib/core/exporter.js +4 -5
- package/lib/core/exporter.js.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +2 -2
- package/lib/core/index.js.map +1 -1
- package/lib/core/logger.d.ts +2 -2
- package/lib/core/logger.js +3 -4
- package/lib/core/logger.js.map +1 -1
- package/lib/core/metadata.d.ts +3 -6
- package/lib/core/metadata.js +6 -16
- package/lib/core/metadata.js.map +1 -1
- package/lib/core/meter.d.ts +14 -7
- package/lib/core/meter.js +16 -25
- package/lib/core/meter.js.map +1 -1
- package/lib/gen/chainquery/protos/chainquery.d.ts +48 -1
- package/lib/gen/chainquery/protos/chainquery.js +16 -0
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +20 -0
- package/lib/gen/processor/protos/processor.js +138 -2
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/service.js +1 -1
- package/lib/service.js.map +1 -1
- package/lib/testing/metric-utils.d.ts +1 -2
- package/lib/testing/metric-utils.js +2 -2
- package/lib/testing/metric-utils.js.map +1 -1
- package/package.json +1 -1
- package/src/aptos/context.ts +6 -6
- package/src/core/base-context.ts +2 -2
- package/src/core/context.ts +13 -13
- package/src/core/event-tracker.ts +4 -4
- package/src/core/exporter.ts +5 -5
- package/src/core/index.ts +1 -1
- package/src/core/logger.ts +4 -5
- package/src/core/metadata.ts +4 -15
- package/src/core/meter.ts +19 -28
- package/src/gen/chainquery/protos/chainquery.ts +37 -1
- package/src/gen/processor/protos/processor.ts +156 -0
- package/src/service.ts +1 -2
- package/src/testing/metric-utils.ts +3 -4
- package/templates/evm/src/processor.ts +1 -1
package/src/core/meter.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseContext } from './base-context'
|
|
2
2
|
import { toMetricValue, Numberish } from './numberish'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Labels, NamedResultDescriptor } from './metadata'
|
|
4
|
+
import { AggregationConfig, MetricConfig } from '../gen'
|
|
5
5
|
|
|
6
6
|
export function normalizeName(name: string): string {
|
|
7
7
|
const regex = new RegExp('![_.a-zA-Z0-9]')
|
|
@@ -27,36 +27,29 @@ export function normalizeLabels(labels: Labels): Labels {
|
|
|
27
27
|
return normLabels
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export class
|
|
30
|
+
export class MetricOptions {
|
|
31
31
|
unit?: string
|
|
32
32
|
description?: string
|
|
33
33
|
sparse?: boolean
|
|
34
|
-
|
|
34
|
+
aggregationConfig?: Partial<AggregationConfig>
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export class
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
descriptor.sparse = option.sparse
|
|
49
|
-
}
|
|
50
|
-
if (option.resolutionInSeconds) {
|
|
51
|
-
descriptor.resolutionInSeconds = option.resolutionInSeconds
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
super(descriptor)
|
|
37
|
+
export class CounterOptions {
|
|
38
|
+
unit?: string
|
|
39
|
+
description?: string
|
|
40
|
+
sparse?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class Metric extends NamedResultDescriptor {
|
|
44
|
+
descriptor: MetricConfig
|
|
45
|
+
constructor(name: string, option?: MetricOptions) {
|
|
46
|
+
super(name)
|
|
47
|
+
this.descriptor = MetricConfig.fromPartial({ name: this.name, ...option })
|
|
55
48
|
}
|
|
56
49
|
}
|
|
57
50
|
|
|
58
51
|
export class Counter extends Metric {
|
|
59
|
-
static register(name: string, option?:
|
|
52
|
+
static register(name: string, option?: CounterOptions): Counter {
|
|
60
53
|
// TODO also dedup
|
|
61
54
|
const metric = new Counter(name, option)
|
|
62
55
|
global.PROCESSOR_STATE.metrics.push(metric)
|
|
@@ -73,12 +66,11 @@ export class Counter extends Metric {
|
|
|
73
66
|
|
|
74
67
|
private record(ctx: BaseContext, value: Numberish, labels: Labels, add: boolean) {
|
|
75
68
|
ctx.res.counters.push({
|
|
76
|
-
metadata: ctx.getMetaData(this.
|
|
69
|
+
metadata: ctx.getMetaData(this.name, labels),
|
|
77
70
|
metricValue: toMetricValue(value),
|
|
78
71
|
add: add,
|
|
79
72
|
runtimeInfo: undefined,
|
|
80
73
|
})
|
|
81
|
-
this.usage++
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
|
|
@@ -101,7 +93,7 @@ export class CounterBinding {
|
|
|
101
93
|
}
|
|
102
94
|
|
|
103
95
|
export class Gauge extends Metric {
|
|
104
|
-
static register(name: string, option?:
|
|
96
|
+
static register(name: string, option?: MetricOptions): Gauge {
|
|
105
97
|
// TODO also dedup
|
|
106
98
|
const metric = new Gauge(name, option)
|
|
107
99
|
global.PROCESSOR_STATE.metrics.push(metric)
|
|
@@ -110,11 +102,10 @@ export class Gauge extends Metric {
|
|
|
110
102
|
|
|
111
103
|
record(ctx: BaseContext, value: Numberish, labels: Labels = {}) {
|
|
112
104
|
ctx.res.gauges.push({
|
|
113
|
-
metadata: ctx.getMetaData(this.
|
|
105
|
+
metadata: ctx.getMetaData(this.descriptor.name, labels),
|
|
114
106
|
metricValue: toMetricValue(value),
|
|
115
107
|
runtimeInfo: undefined,
|
|
116
108
|
})
|
|
117
|
-
this.usage++
|
|
118
109
|
}
|
|
119
110
|
}
|
|
120
111
|
|
|
@@ -40,7 +40,7 @@ export interface QueryExecutionSummary {
|
|
|
40
40
|
|
|
41
41
|
export interface AptosGetTxnsResponse {
|
|
42
42
|
documents: string[];
|
|
43
|
-
executionSummary
|
|
43
|
+
executionSummary?: QueryExecutionSummary | undefined;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export interface AptosRefreshRequest {}
|
|
@@ -728,6 +728,14 @@ export const AptosQueryDefinition = {
|
|
|
728
728
|
responseStream: false,
|
|
729
729
|
options: {},
|
|
730
730
|
},
|
|
731
|
+
aptosGetTxnsByFunctionStream: {
|
|
732
|
+
name: "AptosGetTxnsByFunctionStream",
|
|
733
|
+
requestType: AptosGetTxnsByFunctionRequest,
|
|
734
|
+
requestStream: false,
|
|
735
|
+
responseType: AptosGetTxnsResponse,
|
|
736
|
+
responseStream: true,
|
|
737
|
+
options: {},
|
|
738
|
+
},
|
|
731
739
|
aptosGetTxnsByVersion: {
|
|
732
740
|
name: "AptosGetTxnsByVersion",
|
|
733
741
|
requestType: AptosGetTxnsByVersionRequest,
|
|
@@ -744,6 +752,14 @@ export const AptosQueryDefinition = {
|
|
|
744
752
|
responseStream: false,
|
|
745
753
|
options: {},
|
|
746
754
|
},
|
|
755
|
+
aptosGetTxnsByEventStream: {
|
|
756
|
+
name: "AptosGetTxnsByEventStream",
|
|
757
|
+
requestType: AptosGetTxnsByEventRequest,
|
|
758
|
+
requestStream: false,
|
|
759
|
+
responseType: AptosGetTxnsResponse,
|
|
760
|
+
responseStream: true,
|
|
761
|
+
options: {},
|
|
762
|
+
},
|
|
747
763
|
aptosRefresh: {
|
|
748
764
|
name: "AptosRefresh",
|
|
749
765
|
requestType: AptosRefreshRequest,
|
|
@@ -768,6 +784,10 @@ export interface AptosQueryServiceImplementation<CallContextExt = {}> {
|
|
|
768
784
|
request: AptosGetTxnsByFunctionRequest,
|
|
769
785
|
context: CallContext & CallContextExt
|
|
770
786
|
): Promise<DeepPartial<AptosGetTxnsResponse>>;
|
|
787
|
+
aptosGetTxnsByFunctionStream(
|
|
788
|
+
request: AptosGetTxnsByFunctionRequest,
|
|
789
|
+
context: CallContext & CallContextExt
|
|
790
|
+
): ServerStreamingMethodResult<DeepPartial<AptosGetTxnsResponse>>;
|
|
771
791
|
aptosGetTxnsByVersion(
|
|
772
792
|
request: AptosGetTxnsByVersionRequest,
|
|
773
793
|
context: CallContext & CallContextExt
|
|
@@ -776,6 +796,10 @@ export interface AptosQueryServiceImplementation<CallContextExt = {}> {
|
|
|
776
796
|
request: AptosGetTxnsByEventRequest,
|
|
777
797
|
context: CallContext & CallContextExt
|
|
778
798
|
): Promise<DeepPartial<AptosGetTxnsResponse>>;
|
|
799
|
+
aptosGetTxnsByEventStream(
|
|
800
|
+
request: AptosGetTxnsByEventRequest,
|
|
801
|
+
context: CallContext & CallContextExt
|
|
802
|
+
): ServerStreamingMethodResult<DeepPartial<AptosGetTxnsResponse>>;
|
|
779
803
|
aptosRefresh(
|
|
780
804
|
request: AptosRefreshRequest,
|
|
781
805
|
context: CallContext & CallContextExt
|
|
@@ -791,6 +815,10 @@ export interface AptosQueryClient<CallOptionsExt = {}> {
|
|
|
791
815
|
request: DeepPartial<AptosGetTxnsByFunctionRequest>,
|
|
792
816
|
options?: CallOptions & CallOptionsExt
|
|
793
817
|
): Promise<AptosGetTxnsResponse>;
|
|
818
|
+
aptosGetTxnsByFunctionStream(
|
|
819
|
+
request: DeepPartial<AptosGetTxnsByFunctionRequest>,
|
|
820
|
+
options?: CallOptions & CallOptionsExt
|
|
821
|
+
): AsyncIterable<AptosGetTxnsResponse>;
|
|
794
822
|
aptosGetTxnsByVersion(
|
|
795
823
|
request: DeepPartial<AptosGetTxnsByVersionRequest>,
|
|
796
824
|
options?: CallOptions & CallOptionsExt
|
|
@@ -799,6 +827,10 @@ export interface AptosQueryClient<CallOptionsExt = {}> {
|
|
|
799
827
|
request: DeepPartial<AptosGetTxnsByEventRequest>,
|
|
800
828
|
options?: CallOptions & CallOptionsExt
|
|
801
829
|
): Promise<AptosGetTxnsResponse>;
|
|
830
|
+
aptosGetTxnsByEventStream(
|
|
831
|
+
request: DeepPartial<AptosGetTxnsByEventRequest>,
|
|
832
|
+
options?: CallOptions & CallOptionsExt
|
|
833
|
+
): AsyncIterable<AptosGetTxnsResponse>;
|
|
802
834
|
aptosRefresh(
|
|
803
835
|
request: DeepPartial<AptosRefreshRequest>,
|
|
804
836
|
options?: CallOptions & CallOptionsExt
|
|
@@ -838,3 +870,7 @@ if (_m0.util.Long !== Long) {
|
|
|
838
870
|
function isSet(value: any): boolean {
|
|
839
871
|
return value !== null && value !== undefined;
|
|
840
872
|
}
|
|
873
|
+
|
|
874
|
+
export type ServerStreamingMethodResult<Response> = {
|
|
875
|
+
[Symbol.asyncIterator](): AsyncIterator<Response, void>;
|
|
876
|
+
};
|
|
@@ -4,6 +4,39 @@ import Long from "long";
|
|
|
4
4
|
import { Empty } from "../../google/protobuf/empty";
|
|
5
5
|
import _m0 from "protobufjs/minimal";
|
|
6
6
|
|
|
7
|
+
export enum AggregationType {
|
|
8
|
+
COUNT = 0,
|
|
9
|
+
SUM = 1,
|
|
10
|
+
UNRECOGNIZED = -1,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function aggregationTypeFromJSON(object: any): AggregationType {
|
|
14
|
+
switch (object) {
|
|
15
|
+
case 0:
|
|
16
|
+
case "COUNT":
|
|
17
|
+
return AggregationType.COUNT;
|
|
18
|
+
case 1:
|
|
19
|
+
case "SUM":
|
|
20
|
+
return AggregationType.SUM;
|
|
21
|
+
case -1:
|
|
22
|
+
case "UNRECOGNIZED":
|
|
23
|
+
default:
|
|
24
|
+
return AggregationType.UNRECOGNIZED;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function aggregationTypeToJSON(object: AggregationType): string {
|
|
29
|
+
switch (object) {
|
|
30
|
+
case AggregationType.COUNT:
|
|
31
|
+
return "COUNT";
|
|
32
|
+
case AggregationType.SUM:
|
|
33
|
+
return "SUM";
|
|
34
|
+
case AggregationType.UNRECOGNIZED:
|
|
35
|
+
default:
|
|
36
|
+
return "UNRECOGNIZED";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
7
40
|
export enum HandlerType {
|
|
8
41
|
UNKNOWN = 0,
|
|
9
42
|
ETH_LOG = 1,
|
|
@@ -225,6 +258,13 @@ export interface MetricConfig {
|
|
|
225
258
|
unit: string;
|
|
226
259
|
sparse: boolean;
|
|
227
260
|
resolutionInSeconds: number;
|
|
261
|
+
aggregationConfig: AggregationConfig | undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface AggregationConfig {
|
|
265
|
+
intervalInMinutes: number;
|
|
266
|
+
types: AggregationType[];
|
|
267
|
+
discardOrigin: boolean;
|
|
228
268
|
}
|
|
229
269
|
|
|
230
270
|
export interface AccountConfig {
|
|
@@ -1353,6 +1393,7 @@ function createBaseMetricConfig(): MetricConfig {
|
|
|
1353
1393
|
unit: "",
|
|
1354
1394
|
sparse: false,
|
|
1355
1395
|
resolutionInSeconds: 0,
|
|
1396
|
+
aggregationConfig: undefined,
|
|
1356
1397
|
};
|
|
1357
1398
|
}
|
|
1358
1399
|
|
|
@@ -1376,6 +1417,12 @@ export const MetricConfig = {
|
|
|
1376
1417
|
if (message.resolutionInSeconds !== 0) {
|
|
1377
1418
|
writer.uint32(40).int32(message.resolutionInSeconds);
|
|
1378
1419
|
}
|
|
1420
|
+
if (message.aggregationConfig !== undefined) {
|
|
1421
|
+
AggregationConfig.encode(
|
|
1422
|
+
message.aggregationConfig,
|
|
1423
|
+
writer.uint32(50).fork()
|
|
1424
|
+
).ldelim();
|
|
1425
|
+
}
|
|
1379
1426
|
return writer;
|
|
1380
1427
|
},
|
|
1381
1428
|
|
|
@@ -1401,6 +1448,12 @@ export const MetricConfig = {
|
|
|
1401
1448
|
case 5:
|
|
1402
1449
|
message.resolutionInSeconds = reader.int32();
|
|
1403
1450
|
break;
|
|
1451
|
+
case 6:
|
|
1452
|
+
message.aggregationConfig = AggregationConfig.decode(
|
|
1453
|
+
reader,
|
|
1454
|
+
reader.uint32()
|
|
1455
|
+
);
|
|
1456
|
+
break;
|
|
1404
1457
|
default:
|
|
1405
1458
|
reader.skipType(tag & 7);
|
|
1406
1459
|
break;
|
|
@@ -1418,6 +1471,9 @@ export const MetricConfig = {
|
|
|
1418
1471
|
resolutionInSeconds: isSet(object.resolutionInSeconds)
|
|
1419
1472
|
? Number(object.resolutionInSeconds)
|
|
1420
1473
|
: 0,
|
|
1474
|
+
aggregationConfig: isSet(object.aggregationConfig)
|
|
1475
|
+
? AggregationConfig.fromJSON(object.aggregationConfig)
|
|
1476
|
+
: undefined,
|
|
1421
1477
|
};
|
|
1422
1478
|
},
|
|
1423
1479
|
|
|
@@ -1430,6 +1486,10 @@ export const MetricConfig = {
|
|
|
1430
1486
|
message.sparse !== undefined && (obj.sparse = message.sparse);
|
|
1431
1487
|
message.resolutionInSeconds !== undefined &&
|
|
1432
1488
|
(obj.resolutionInSeconds = Math.round(message.resolutionInSeconds));
|
|
1489
|
+
message.aggregationConfig !== undefined &&
|
|
1490
|
+
(obj.aggregationConfig = message.aggregationConfig
|
|
1491
|
+
? AggregationConfig.toJSON(message.aggregationConfig)
|
|
1492
|
+
: undefined);
|
|
1433
1493
|
return obj;
|
|
1434
1494
|
},
|
|
1435
1495
|
|
|
@@ -1440,6 +1500,102 @@ export const MetricConfig = {
|
|
|
1440
1500
|
message.unit = object.unit ?? "";
|
|
1441
1501
|
message.sparse = object.sparse ?? false;
|
|
1442
1502
|
message.resolutionInSeconds = object.resolutionInSeconds ?? 0;
|
|
1503
|
+
message.aggregationConfig =
|
|
1504
|
+
object.aggregationConfig !== undefined &&
|
|
1505
|
+
object.aggregationConfig !== null
|
|
1506
|
+
? AggregationConfig.fromPartial(object.aggregationConfig)
|
|
1507
|
+
: undefined;
|
|
1508
|
+
return message;
|
|
1509
|
+
},
|
|
1510
|
+
};
|
|
1511
|
+
|
|
1512
|
+
function createBaseAggregationConfig(): AggregationConfig {
|
|
1513
|
+
return { intervalInMinutes: 0, types: [], discardOrigin: false };
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
export const AggregationConfig = {
|
|
1517
|
+
encode(
|
|
1518
|
+
message: AggregationConfig,
|
|
1519
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1520
|
+
): _m0.Writer {
|
|
1521
|
+
if (message.intervalInMinutes !== 0) {
|
|
1522
|
+
writer.uint32(8).int32(message.intervalInMinutes);
|
|
1523
|
+
}
|
|
1524
|
+
writer.uint32(18).fork();
|
|
1525
|
+
for (const v of message.types) {
|
|
1526
|
+
writer.int32(v);
|
|
1527
|
+
}
|
|
1528
|
+
writer.ldelim();
|
|
1529
|
+
if (message.discardOrigin === true) {
|
|
1530
|
+
writer.uint32(24).bool(message.discardOrigin);
|
|
1531
|
+
}
|
|
1532
|
+
return writer;
|
|
1533
|
+
},
|
|
1534
|
+
|
|
1535
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): AggregationConfig {
|
|
1536
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1537
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1538
|
+
const message = createBaseAggregationConfig();
|
|
1539
|
+
while (reader.pos < end) {
|
|
1540
|
+
const tag = reader.uint32();
|
|
1541
|
+
switch (tag >>> 3) {
|
|
1542
|
+
case 1:
|
|
1543
|
+
message.intervalInMinutes = reader.int32();
|
|
1544
|
+
break;
|
|
1545
|
+
case 2:
|
|
1546
|
+
if ((tag & 7) === 2) {
|
|
1547
|
+
const end2 = reader.uint32() + reader.pos;
|
|
1548
|
+
while (reader.pos < end2) {
|
|
1549
|
+
message.types.push(reader.int32() as any);
|
|
1550
|
+
}
|
|
1551
|
+
} else {
|
|
1552
|
+
message.types.push(reader.int32() as any);
|
|
1553
|
+
}
|
|
1554
|
+
break;
|
|
1555
|
+
case 3:
|
|
1556
|
+
message.discardOrigin = reader.bool();
|
|
1557
|
+
break;
|
|
1558
|
+
default:
|
|
1559
|
+
reader.skipType(tag & 7);
|
|
1560
|
+
break;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
return message;
|
|
1564
|
+
},
|
|
1565
|
+
|
|
1566
|
+
fromJSON(object: any): AggregationConfig {
|
|
1567
|
+
return {
|
|
1568
|
+
intervalInMinutes: isSet(object.intervalInMinutes)
|
|
1569
|
+
? Number(object.intervalInMinutes)
|
|
1570
|
+
: 0,
|
|
1571
|
+
types: Array.isArray(object?.types)
|
|
1572
|
+
? object.types.map((e: any) => aggregationTypeFromJSON(e))
|
|
1573
|
+
: [],
|
|
1574
|
+
discardOrigin: isSet(object.discardOrigin)
|
|
1575
|
+
? Boolean(object.discardOrigin)
|
|
1576
|
+
: false,
|
|
1577
|
+
};
|
|
1578
|
+
},
|
|
1579
|
+
|
|
1580
|
+
toJSON(message: AggregationConfig): unknown {
|
|
1581
|
+
const obj: any = {};
|
|
1582
|
+
message.intervalInMinutes !== undefined &&
|
|
1583
|
+
(obj.intervalInMinutes = Math.round(message.intervalInMinutes));
|
|
1584
|
+
if (message.types) {
|
|
1585
|
+
obj.types = message.types.map((e) => aggregationTypeToJSON(e));
|
|
1586
|
+
} else {
|
|
1587
|
+
obj.types = [];
|
|
1588
|
+
}
|
|
1589
|
+
message.discardOrigin !== undefined &&
|
|
1590
|
+
(obj.discardOrigin = message.discardOrigin);
|
|
1591
|
+
return obj;
|
|
1592
|
+
},
|
|
1593
|
+
|
|
1594
|
+
fromPartial(object: DeepPartial<AggregationConfig>): AggregationConfig {
|
|
1595
|
+
const message = createBaseAggregationConfig();
|
|
1596
|
+
message.intervalInMinutes = object.intervalInMinutes ?? 0;
|
|
1597
|
+
message.types = object.types?.map((e) => e) || [];
|
|
1598
|
+
message.discardOrigin = object.discardOrigin ?? false;
|
|
1443
1599
|
return message;
|
|
1444
1600
|
},
|
|
1445
1601
|
};
|
package/src/service.ts
CHANGED
|
@@ -34,7 +34,6 @@ import { TextDecoder } from 'util'
|
|
|
34
34
|
import { Trace } from './core'
|
|
35
35
|
import { Instruction } from '@project-serum/anchor'
|
|
36
36
|
import { MoveResourcesWithVersionPayload } from './aptos/aptos-processor'
|
|
37
|
-
|
|
38
37
|
;(BigInt.prototype as any).toJSON = function () {
|
|
39
38
|
return this.toString()
|
|
40
39
|
}
|
|
@@ -110,7 +109,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
110
109
|
for (const eventTracker of global.PROCESSOR_STATE.eventTrackers) {
|
|
111
110
|
this.eventTrackingConfigs.push({
|
|
112
111
|
distinctAggregationByDays: eventTracker.options.distinctByDays || [],
|
|
113
|
-
eventName: eventTracker.
|
|
112
|
+
eventName: eventTracker.name,
|
|
114
113
|
retentionConfig: undefined,
|
|
115
114
|
totalByDay: eventTracker.options.totalByDay || false,
|
|
116
115
|
totalPerEntity: undefined,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { DeepPartial } from '../gen/builtin'
|
|
2
1
|
import { MetricValue, ProcessResult } from '../gen'
|
|
3
2
|
import { Numberish, BigDecimal } from '../core'
|
|
4
3
|
import { BigNumber } from 'ethers'
|
|
5
4
|
|
|
6
|
-
export function MetricValueToNumber(v:
|
|
5
|
+
export function MetricValueToNumber(v: Partial<MetricValue> | undefined): Numberish | undefined {
|
|
7
6
|
if (v === undefined) {
|
|
8
7
|
return undefined
|
|
9
8
|
}
|
|
@@ -29,7 +28,7 @@ export function firstCounterValue(result: ProcessResult | undefined, name: strin
|
|
|
29
28
|
return undefined
|
|
30
29
|
}
|
|
31
30
|
for (const counter of result.counters) {
|
|
32
|
-
if (counter.metadata?.
|
|
31
|
+
if (counter.metadata?.name === name) {
|
|
33
32
|
return MetricValueToNumber(counter.metricValue)
|
|
34
33
|
}
|
|
35
34
|
}
|
|
@@ -41,7 +40,7 @@ export function firstGaugeValue(result: ProcessResult | undefined, name: string)
|
|
|
41
40
|
return undefined
|
|
42
41
|
}
|
|
43
42
|
for (const gauge of result.gauges) {
|
|
44
|
-
if (gauge.metadata?.
|
|
43
|
+
if (gauge.metadata?.name === name) {
|
|
45
44
|
return MetricValueToNumber(gauge.metricValue)
|
|
46
45
|
}
|
|
47
46
|
}
|
|
@@ -3,7 +3,7 @@ import { token } from '@sentio/sdk/lib/utils'
|
|
|
3
3
|
import { ERC20Processor } from '@sentio/sdk/lib/builtin/erc20'
|
|
4
4
|
import { X2y2Processor } from './types/x2y2'
|
|
5
5
|
|
|
6
|
-
const rewardPerBlock =
|
|
6
|
+
const rewardPerBlock = Gauge.register('reward_per_block', {
|
|
7
7
|
description: 'rewards for each block grouped by phase',
|
|
8
8
|
unit: 'x2y2',
|
|
9
9
|
})
|