@sentio/sdk 1.26.0 → 1.26.2
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/aptos-processor.d.ts +1 -0
- package/lib/aptos/aptos-processor.js +2 -1
- package/lib/aptos/aptos-processor.js.map +1 -1
- package/lib/aptos/context.d.ts +2 -1
- package/lib/aptos/context.js +3 -1
- package/lib/aptos/context.js.map +1 -1
- package/lib/aptos/index.d.ts +1 -1
- package/lib/aptos/index.js +2 -1
- package/lib/aptos/index.js.map +1 -1
- package/lib/aptos-codegen/codegen.js +1 -0
- package/lib/aptos-codegen/codegen.js.map +1 -1
- package/lib/builtin/aptos/0x1.d.ts +171 -0
- package/lib/builtin/aptos/0x1.js +171 -0
- package/lib/builtin/aptos/0x1.js.map +1 -1
- package/lib/builtin/aptos/0x3.d.ts +31 -0
- package/lib/builtin/aptos/0x3.js +31 -0
- package/lib/builtin/aptos/0x3.js.map +1 -1
- package/lib/core/context.d.ts +2 -5
- package/lib/core/context.js +8 -11
- package/lib/core/context.js.map +1 -1
- package/lib/core/event-tracker.js +1 -1
- package/lib/core/event-tracker.js.map +1 -1
- package/lib/core/exporter.d.ts +14 -0
- package/lib/core/exporter.js +27 -0
- package/lib/core/exporter.js.map +1 -0
- package/lib/core/logger.js +1 -1
- package/lib/core/logger.js.map +1 -1
- package/lib/core/meter.js +2 -2
- package/lib/core/meter.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +32 -0
- package/lib/gen/processor/protos/processor.js +206 -3
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/processor-state.d.ts +2 -0
- package/lib/processor-state.js +1 -0
- package/lib/processor-state.js.map +1 -1
- package/lib/service.d.ts +1 -0
- package/lib/service.js +19 -16
- package/lib/service.js.map +1 -1
- package/lib/tests/erc20.js +7 -0
- package/lib/tests/erc20.js.map +1 -1
- package/lib/tests/types/aptos/souffle.d.ts +14 -0
- package/lib/tests/types/aptos/souffle.js +14 -0
- package/lib/tests/types/aptos/souffle.js.map +1 -1
- package/package.json +1 -1
- package/src/aptos/aptos-processor.ts +7 -1
- package/src/aptos/context.ts +3 -1
- package/src/aptos/index.ts +1 -1
- package/src/aptos-codegen/codegen.ts +1 -0
- package/src/builtin/aptos/0x1.ts +171 -0
- package/src/builtin/aptos/0x3.ts +31 -0
- package/src/core/context.ts +10 -20
- package/src/core/event-tracker.ts +1 -1
- package/src/core/exporter.ts +33 -0
- package/src/core/logger.ts +1 -1
- package/src/core/meter.ts +2 -2
- package/src/gen/processor/protos/processor.ts +250 -1
- package/src/processor-state.ts +3 -0
- package/src/service.ts +21 -18
- package/src/tests/erc20.ts +7 -0
- package/src/tests/types/aptos/souffle.ts +28 -0
|
@@ -144,6 +144,7 @@ export interface ProcessConfigResponse {
|
|
|
144
144
|
accountConfigs: AccountConfig[];
|
|
145
145
|
metricConfigs: MetricConfig[];
|
|
146
146
|
eventTrackingConfigs: EventTrackingConfig[];
|
|
147
|
+
exportConfigs: ExportConfig[];
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
export interface ContractConfig {
|
|
@@ -212,6 +213,43 @@ export interface EventTrackingConfig {
|
|
|
212
213
|
retentionConfig: RetentionConfig | undefined;
|
|
213
214
|
}
|
|
214
215
|
|
|
216
|
+
export interface ExportConfig {
|
|
217
|
+
exportName: string;
|
|
218
|
+
exportType: ExportConfig_ExportType;
|
|
219
|
+
exportUrl: string;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export enum ExportConfig_ExportType {
|
|
223
|
+
WEBHOOK = 0,
|
|
224
|
+
UNRECOGNIZED = -1,
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function exportConfig_ExportTypeFromJSON(
|
|
228
|
+
object: any
|
|
229
|
+
): ExportConfig_ExportType {
|
|
230
|
+
switch (object) {
|
|
231
|
+
case 0:
|
|
232
|
+
case "WEBHOOK":
|
|
233
|
+
return ExportConfig_ExportType.WEBHOOK;
|
|
234
|
+
case -1:
|
|
235
|
+
case "UNRECOGNIZED":
|
|
236
|
+
default:
|
|
237
|
+
return ExportConfig_ExportType.UNRECOGNIZED;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export function exportConfig_ExportTypeToJSON(
|
|
242
|
+
object: ExportConfig_ExportType
|
|
243
|
+
): string {
|
|
244
|
+
switch (object) {
|
|
245
|
+
case ExportConfig_ExportType.WEBHOOK:
|
|
246
|
+
return "WEBHOOK";
|
|
247
|
+
case ExportConfig_ExportType.UNRECOGNIZED:
|
|
248
|
+
default:
|
|
249
|
+
return "UNRECOGNIZED";
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
215
253
|
export interface MetricConfig {
|
|
216
254
|
name: string;
|
|
217
255
|
description: string;
|
|
@@ -367,6 +405,7 @@ export interface ProcessResult {
|
|
|
367
405
|
counters: CounterResult[];
|
|
368
406
|
logs: LogResult[];
|
|
369
407
|
events: EventTrackingResult[];
|
|
408
|
+
exports: ExportResult[];
|
|
370
409
|
}
|
|
371
410
|
|
|
372
411
|
export interface DataDescriptor {
|
|
@@ -438,6 +477,12 @@ export interface EventTrackingResult {
|
|
|
438
477
|
runtimeInfo: RuntimeInfo | undefined;
|
|
439
478
|
}
|
|
440
479
|
|
|
480
|
+
export interface ExportResult {
|
|
481
|
+
metadata: RecordMetaData | undefined;
|
|
482
|
+
payload: string;
|
|
483
|
+
runtimeInfo: RuntimeInfo | undefined;
|
|
484
|
+
}
|
|
485
|
+
|
|
441
486
|
function createBaseProjectConfig(): ProjectConfig {
|
|
442
487
|
return { name: "", version: "" };
|
|
443
488
|
}
|
|
@@ -552,6 +597,7 @@ function createBaseProcessConfigResponse(): ProcessConfigResponse {
|
|
|
552
597
|
accountConfigs: [],
|
|
553
598
|
metricConfigs: [],
|
|
554
599
|
eventTrackingConfigs: [],
|
|
600
|
+
exportConfigs: [],
|
|
555
601
|
};
|
|
556
602
|
}
|
|
557
603
|
|
|
@@ -578,6 +624,9 @@ export const ProcessConfigResponse = {
|
|
|
578
624
|
for (const v of message.eventTrackingConfigs) {
|
|
579
625
|
EventTrackingConfig.encode(v!, writer.uint32(50).fork()).ldelim();
|
|
580
626
|
}
|
|
627
|
+
for (const v of message.exportConfigs) {
|
|
628
|
+
ExportConfig.encode(v!, writer.uint32(58).fork()).ldelim();
|
|
629
|
+
}
|
|
581
630
|
return writer;
|
|
582
631
|
},
|
|
583
632
|
|
|
@@ -619,6 +668,11 @@ export const ProcessConfigResponse = {
|
|
|
619
668
|
EventTrackingConfig.decode(reader, reader.uint32())
|
|
620
669
|
);
|
|
621
670
|
break;
|
|
671
|
+
case 7:
|
|
672
|
+
message.exportConfigs.push(
|
|
673
|
+
ExportConfig.decode(reader, reader.uint32())
|
|
674
|
+
);
|
|
675
|
+
break;
|
|
622
676
|
default:
|
|
623
677
|
reader.skipType(tag & 7);
|
|
624
678
|
break;
|
|
@@ -649,6 +703,9 @@ export const ProcessConfigResponse = {
|
|
|
649
703
|
EventTrackingConfig.fromJSON(e)
|
|
650
704
|
)
|
|
651
705
|
: [],
|
|
706
|
+
exportConfigs: Array.isArray(object?.exportConfigs)
|
|
707
|
+
? object.exportConfigs.map((e: any) => ExportConfig.fromJSON(e))
|
|
708
|
+
: [],
|
|
652
709
|
};
|
|
653
710
|
},
|
|
654
711
|
|
|
@@ -693,6 +750,13 @@ export const ProcessConfigResponse = {
|
|
|
693
750
|
} else {
|
|
694
751
|
obj.eventTrackingConfigs = [];
|
|
695
752
|
}
|
|
753
|
+
if (message.exportConfigs) {
|
|
754
|
+
obj.exportConfigs = message.exportConfigs.map((e) =>
|
|
755
|
+
e ? ExportConfig.toJSON(e) : undefined
|
|
756
|
+
);
|
|
757
|
+
} else {
|
|
758
|
+
obj.exportConfigs = [];
|
|
759
|
+
}
|
|
696
760
|
return obj;
|
|
697
761
|
},
|
|
698
762
|
|
|
@@ -717,6 +781,8 @@ export const ProcessConfigResponse = {
|
|
|
717
781
|
object.eventTrackingConfigs?.map((e) =>
|
|
718
782
|
EventTrackingConfig.fromPartial(e)
|
|
719
783
|
) || [];
|
|
784
|
+
message.exportConfigs =
|
|
785
|
+
object.exportConfigs?.map((e) => ExportConfig.fromPartial(e)) || [];
|
|
720
786
|
return message;
|
|
721
787
|
},
|
|
722
788
|
};
|
|
@@ -1229,6 +1295,79 @@ export const EventTrackingConfig = {
|
|
|
1229
1295
|
},
|
|
1230
1296
|
};
|
|
1231
1297
|
|
|
1298
|
+
function createBaseExportConfig(): ExportConfig {
|
|
1299
|
+
return { exportName: "", exportType: 0, exportUrl: "" };
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
export const ExportConfig = {
|
|
1303
|
+
encode(
|
|
1304
|
+
message: ExportConfig,
|
|
1305
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1306
|
+
): _m0.Writer {
|
|
1307
|
+
if (message.exportName !== "") {
|
|
1308
|
+
writer.uint32(10).string(message.exportName);
|
|
1309
|
+
}
|
|
1310
|
+
if (message.exportType !== 0) {
|
|
1311
|
+
writer.uint32(16).int32(message.exportType);
|
|
1312
|
+
}
|
|
1313
|
+
if (message.exportUrl !== "") {
|
|
1314
|
+
writer.uint32(26).string(message.exportUrl);
|
|
1315
|
+
}
|
|
1316
|
+
return writer;
|
|
1317
|
+
},
|
|
1318
|
+
|
|
1319
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ExportConfig {
|
|
1320
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1321
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1322
|
+
const message = createBaseExportConfig();
|
|
1323
|
+
while (reader.pos < end) {
|
|
1324
|
+
const tag = reader.uint32();
|
|
1325
|
+
switch (tag >>> 3) {
|
|
1326
|
+
case 1:
|
|
1327
|
+
message.exportName = reader.string();
|
|
1328
|
+
break;
|
|
1329
|
+
case 2:
|
|
1330
|
+
message.exportType = reader.int32() as any;
|
|
1331
|
+
break;
|
|
1332
|
+
case 3:
|
|
1333
|
+
message.exportUrl = reader.string();
|
|
1334
|
+
break;
|
|
1335
|
+
default:
|
|
1336
|
+
reader.skipType(tag & 7);
|
|
1337
|
+
break;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
return message;
|
|
1341
|
+
},
|
|
1342
|
+
|
|
1343
|
+
fromJSON(object: any): ExportConfig {
|
|
1344
|
+
return {
|
|
1345
|
+
exportName: isSet(object.exportName) ? String(object.exportName) : "",
|
|
1346
|
+
exportType: isSet(object.exportType)
|
|
1347
|
+
? exportConfig_ExportTypeFromJSON(object.exportType)
|
|
1348
|
+
: 0,
|
|
1349
|
+
exportUrl: isSet(object.exportUrl) ? String(object.exportUrl) : "",
|
|
1350
|
+
};
|
|
1351
|
+
},
|
|
1352
|
+
|
|
1353
|
+
toJSON(message: ExportConfig): unknown {
|
|
1354
|
+
const obj: any = {};
|
|
1355
|
+
message.exportName !== undefined && (obj.exportName = message.exportName);
|
|
1356
|
+
message.exportType !== undefined &&
|
|
1357
|
+
(obj.exportType = exportConfig_ExportTypeToJSON(message.exportType));
|
|
1358
|
+
message.exportUrl !== undefined && (obj.exportUrl = message.exportUrl);
|
|
1359
|
+
return obj;
|
|
1360
|
+
},
|
|
1361
|
+
|
|
1362
|
+
fromPartial(object: DeepPartial<ExportConfig>): ExportConfig {
|
|
1363
|
+
const message = createBaseExportConfig();
|
|
1364
|
+
message.exportName = object.exportName ?? "";
|
|
1365
|
+
message.exportType = object.exportType ?? 0;
|
|
1366
|
+
message.exportUrl = object.exportUrl ?? "";
|
|
1367
|
+
return message;
|
|
1368
|
+
},
|
|
1369
|
+
};
|
|
1370
|
+
|
|
1232
1371
|
function createBaseMetricConfig(): MetricConfig {
|
|
1233
1372
|
return {
|
|
1234
1373
|
name: "",
|
|
@@ -3370,7 +3509,7 @@ export const RawBlock = {
|
|
|
3370
3509
|
};
|
|
3371
3510
|
|
|
3372
3511
|
function createBaseProcessResult(): ProcessResult {
|
|
3373
|
-
return { gauges: [], counters: [], logs: [], events: [] };
|
|
3512
|
+
return { gauges: [], counters: [], logs: [], events: [], exports: [] };
|
|
3374
3513
|
}
|
|
3375
3514
|
|
|
3376
3515
|
export const ProcessResult = {
|
|
@@ -3390,6 +3529,9 @@ export const ProcessResult = {
|
|
|
3390
3529
|
for (const v of message.events) {
|
|
3391
3530
|
EventTrackingResult.encode(v!, writer.uint32(34).fork()).ldelim();
|
|
3392
3531
|
}
|
|
3532
|
+
for (const v of message.exports) {
|
|
3533
|
+
ExportResult.encode(v!, writer.uint32(42).fork()).ldelim();
|
|
3534
|
+
}
|
|
3393
3535
|
return writer;
|
|
3394
3536
|
},
|
|
3395
3537
|
|
|
@@ -3414,6 +3556,9 @@ export const ProcessResult = {
|
|
|
3414
3556
|
EventTrackingResult.decode(reader, reader.uint32())
|
|
3415
3557
|
);
|
|
3416
3558
|
break;
|
|
3559
|
+
case 5:
|
|
3560
|
+
message.exports.push(ExportResult.decode(reader, reader.uint32()));
|
|
3561
|
+
break;
|
|
3417
3562
|
default:
|
|
3418
3563
|
reader.skipType(tag & 7);
|
|
3419
3564
|
break;
|
|
@@ -3436,6 +3581,9 @@ export const ProcessResult = {
|
|
|
3436
3581
|
events: Array.isArray(object?.events)
|
|
3437
3582
|
? object.events.map((e: any) => EventTrackingResult.fromJSON(e))
|
|
3438
3583
|
: [],
|
|
3584
|
+
exports: Array.isArray(object?.exports)
|
|
3585
|
+
? object.exports.map((e: any) => ExportResult.fromJSON(e))
|
|
3586
|
+
: [],
|
|
3439
3587
|
};
|
|
3440
3588
|
},
|
|
3441
3589
|
|
|
@@ -3467,6 +3615,13 @@ export const ProcessResult = {
|
|
|
3467
3615
|
} else {
|
|
3468
3616
|
obj.events = [];
|
|
3469
3617
|
}
|
|
3618
|
+
if (message.exports) {
|
|
3619
|
+
obj.exports = message.exports.map((e) =>
|
|
3620
|
+
e ? ExportResult.toJSON(e) : undefined
|
|
3621
|
+
);
|
|
3622
|
+
} else {
|
|
3623
|
+
obj.exports = [];
|
|
3624
|
+
}
|
|
3470
3625
|
return obj;
|
|
3471
3626
|
},
|
|
3472
3627
|
|
|
@@ -3479,6 +3634,8 @@ export const ProcessResult = {
|
|
|
3479
3634
|
message.logs = object.logs?.map((e) => LogResult.fromPartial(e)) || [];
|
|
3480
3635
|
message.events =
|
|
3481
3636
|
object.events?.map((e) => EventTrackingResult.fromPartial(e)) || [];
|
|
3637
|
+
message.exports =
|
|
3638
|
+
object.exports?.map((e) => ExportResult.fromPartial(e)) || [];
|
|
3482
3639
|
return message;
|
|
3483
3640
|
},
|
|
3484
3641
|
};
|
|
@@ -4504,6 +4661,98 @@ export const EventTrackingResult = {
|
|
|
4504
4661
|
},
|
|
4505
4662
|
};
|
|
4506
4663
|
|
|
4664
|
+
function createBaseExportResult(): ExportResult {
|
|
4665
|
+
return { metadata: undefined, payload: "", runtimeInfo: undefined };
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
export const ExportResult = {
|
|
4669
|
+
encode(
|
|
4670
|
+
message: ExportResult,
|
|
4671
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
4672
|
+
): _m0.Writer {
|
|
4673
|
+
if (message.metadata !== undefined) {
|
|
4674
|
+
RecordMetaData.encode(
|
|
4675
|
+
message.metadata,
|
|
4676
|
+
writer.uint32(10).fork()
|
|
4677
|
+
).ldelim();
|
|
4678
|
+
}
|
|
4679
|
+
if (message.payload !== "") {
|
|
4680
|
+
writer.uint32(18).string(message.payload);
|
|
4681
|
+
}
|
|
4682
|
+
if (message.runtimeInfo !== undefined) {
|
|
4683
|
+
RuntimeInfo.encode(
|
|
4684
|
+
message.runtimeInfo,
|
|
4685
|
+
writer.uint32(26).fork()
|
|
4686
|
+
).ldelim();
|
|
4687
|
+
}
|
|
4688
|
+
return writer;
|
|
4689
|
+
},
|
|
4690
|
+
|
|
4691
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ExportResult {
|
|
4692
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
4693
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
4694
|
+
const message = createBaseExportResult();
|
|
4695
|
+
while (reader.pos < end) {
|
|
4696
|
+
const tag = reader.uint32();
|
|
4697
|
+
switch (tag >>> 3) {
|
|
4698
|
+
case 1:
|
|
4699
|
+
message.metadata = RecordMetaData.decode(reader, reader.uint32());
|
|
4700
|
+
break;
|
|
4701
|
+
case 2:
|
|
4702
|
+
message.payload = reader.string();
|
|
4703
|
+
break;
|
|
4704
|
+
case 3:
|
|
4705
|
+
message.runtimeInfo = RuntimeInfo.decode(reader, reader.uint32());
|
|
4706
|
+
break;
|
|
4707
|
+
default:
|
|
4708
|
+
reader.skipType(tag & 7);
|
|
4709
|
+
break;
|
|
4710
|
+
}
|
|
4711
|
+
}
|
|
4712
|
+
return message;
|
|
4713
|
+
},
|
|
4714
|
+
|
|
4715
|
+
fromJSON(object: any): ExportResult {
|
|
4716
|
+
return {
|
|
4717
|
+
metadata: isSet(object.metadata)
|
|
4718
|
+
? RecordMetaData.fromJSON(object.metadata)
|
|
4719
|
+
: undefined,
|
|
4720
|
+
payload: isSet(object.payload) ? String(object.payload) : "",
|
|
4721
|
+
runtimeInfo: isSet(object.runtimeInfo)
|
|
4722
|
+
? RuntimeInfo.fromJSON(object.runtimeInfo)
|
|
4723
|
+
: undefined,
|
|
4724
|
+
};
|
|
4725
|
+
},
|
|
4726
|
+
|
|
4727
|
+
toJSON(message: ExportResult): unknown {
|
|
4728
|
+
const obj: any = {};
|
|
4729
|
+
message.metadata !== undefined &&
|
|
4730
|
+
(obj.metadata = message.metadata
|
|
4731
|
+
? RecordMetaData.toJSON(message.metadata)
|
|
4732
|
+
: undefined);
|
|
4733
|
+
message.payload !== undefined && (obj.payload = message.payload);
|
|
4734
|
+
message.runtimeInfo !== undefined &&
|
|
4735
|
+
(obj.runtimeInfo = message.runtimeInfo
|
|
4736
|
+
? RuntimeInfo.toJSON(message.runtimeInfo)
|
|
4737
|
+
: undefined);
|
|
4738
|
+
return obj;
|
|
4739
|
+
},
|
|
4740
|
+
|
|
4741
|
+
fromPartial(object: DeepPartial<ExportResult>): ExportResult {
|
|
4742
|
+
const message = createBaseExportResult();
|
|
4743
|
+
message.metadata =
|
|
4744
|
+
object.metadata !== undefined && object.metadata !== null
|
|
4745
|
+
? RecordMetaData.fromPartial(object.metadata)
|
|
4746
|
+
: undefined;
|
|
4747
|
+
message.payload = object.payload ?? "";
|
|
4748
|
+
message.runtimeInfo =
|
|
4749
|
+
object.runtimeInfo !== undefined && object.runtimeInfo !== null
|
|
4750
|
+
? RuntimeInfo.fromPartial(object.runtimeInfo)
|
|
4751
|
+
: undefined;
|
|
4752
|
+
return message;
|
|
4753
|
+
},
|
|
4754
|
+
};
|
|
4755
|
+
|
|
4507
4756
|
export type ProcessorDefinition = typeof ProcessorDefinition;
|
|
4508
4757
|
export const ProcessorDefinition = {
|
|
4509
4758
|
name: "Processor",
|
package/src/processor-state.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { Provider } from '@ethersproject/providers'
|
|
|
15
15
|
import { EventTracker } from './core'
|
|
16
16
|
import { Metric } from './core/meter'
|
|
17
17
|
import { AptosAccountProcessor } from './aptos/aptos-processor'
|
|
18
|
+
import { Exporter } from './core/exporter'
|
|
18
19
|
|
|
19
20
|
export class ProcessorState {
|
|
20
21
|
// from abiName_address_chainId => contract wrapper
|
|
@@ -39,5 +40,7 @@ export class ProcessorState {
|
|
|
39
40
|
|
|
40
41
|
eventTrackers: EventTracker[] = []
|
|
41
42
|
|
|
43
|
+
exporters: Exporter[] = []
|
|
44
|
+
|
|
42
45
|
metrics: Metric[] = []
|
|
43
46
|
}
|
package/src/service.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ContractConfig,
|
|
11
11
|
DataBinding,
|
|
12
12
|
EventTrackingConfig,
|
|
13
|
+
ExportConfig,
|
|
13
14
|
HandlerType,
|
|
14
15
|
LogFilter,
|
|
15
16
|
LogHandlerConfig,
|
|
@@ -57,6 +58,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
57
58
|
private templateInstances: TemplateInstance[]
|
|
58
59
|
private metricConfigs: MetricConfig[]
|
|
59
60
|
private eventTrackingConfigs: EventTrackingConfig[]
|
|
61
|
+
private exportConfigs: ExportConfig[]
|
|
60
62
|
private readonly loader: () => void
|
|
61
63
|
|
|
62
64
|
private readonly shutdownHandler?: () => void
|
|
@@ -74,10 +76,11 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
74
76
|
// TODO project setting
|
|
75
77
|
config: undefined,
|
|
76
78
|
contractConfigs: this.contractConfigs,
|
|
79
|
+
accountConfigs: this.accountConfigs,
|
|
77
80
|
templateInstances: this.templateInstances,
|
|
78
81
|
eventTrackingConfigs: this.eventTrackingConfigs,
|
|
79
82
|
metricConfigs: this.metricConfigs,
|
|
80
|
-
|
|
83
|
+
exportConfigs: this.exportConfigs,
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
86
|
|
|
@@ -91,6 +94,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
91
94
|
this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances]
|
|
92
95
|
this.eventTrackingConfigs = []
|
|
93
96
|
this.metricConfigs = []
|
|
97
|
+
this.exportConfigs = []
|
|
94
98
|
|
|
95
99
|
// part 0, prepare metrics and event tracking configs
|
|
96
100
|
for (const metric of global.PROCESSOR_STATE.metrics) {
|
|
@@ -110,6 +114,14 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
110
114
|
})
|
|
111
115
|
}
|
|
112
116
|
|
|
117
|
+
for (const exporter of global.PROCESSOR_STATE.exporters) {
|
|
118
|
+
this.exportConfigs.push({
|
|
119
|
+
exportName: exporter.exportName,
|
|
120
|
+
exportType: exporter.options.exportType,
|
|
121
|
+
exportUrl: exporter.options.exportUrl,
|
|
122
|
+
})
|
|
123
|
+
}
|
|
124
|
+
|
|
113
125
|
// Part 1, prepare EVM processors
|
|
114
126
|
for (const processor of global.PROCESSOR_STATE.processors) {
|
|
115
127
|
// If server favor incremental update this need to change
|
|
@@ -720,28 +732,19 @@ function mergeProcessResults(results: ProcessResult[]): ProcessResult {
|
|
|
720
732
|
res.gauges = res.gauges.concat(r.gauges)
|
|
721
733
|
res.logs = res.logs.concat(r.logs)
|
|
722
734
|
res.events = res.events.concat(r.events)
|
|
735
|
+
res.exports = res.exports.concat(r.exports)
|
|
723
736
|
}
|
|
724
737
|
return res
|
|
725
738
|
}
|
|
726
739
|
|
|
727
740
|
function recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType) {
|
|
728
|
-
results.gauges.
|
|
729
|
-
e
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
e.runtimeInfo = {
|
|
736
|
-
from: handlerType,
|
|
737
|
-
}
|
|
738
|
-
})
|
|
739
|
-
|
|
740
|
-
results.logs.forEach((e) => {
|
|
741
|
-
e.runtimeInfo = {
|
|
742
|
-
from: handlerType,
|
|
743
|
-
}
|
|
744
|
-
})
|
|
741
|
+
for (const list of [results.gauges, results.counters, results.logs, results.events, results.exports]) {
|
|
742
|
+
list.forEach((e) => {
|
|
743
|
+
e.runtimeInfo = {
|
|
744
|
+
from: handlerType,
|
|
745
|
+
}
|
|
746
|
+
})
|
|
747
|
+
}
|
|
745
748
|
}
|
|
746
749
|
|
|
747
750
|
function errorString(e: Error): string {
|
package/src/tests/erc20.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ERC20Processor, ERC20ProcessorTemplate } from '../builtin/erc20'
|
|
2
2
|
import { EventTracker } from '../core/event-tracker'
|
|
3
|
+
import { Exporter } from '../core/exporter'
|
|
4
|
+
import { ExportConfig_ExportType } from '@sentio/sdk'
|
|
3
5
|
|
|
4
6
|
export const filter = ERC20Processor.filters.Transfer(
|
|
5
7
|
'0x0000000000000000000000000000000000000000',
|
|
@@ -7,6 +9,10 @@ export const filter = ERC20Processor.filters.Transfer(
|
|
|
7
9
|
)
|
|
8
10
|
|
|
9
11
|
const tracker = EventTracker.register('sdf')
|
|
12
|
+
const exporter = Exporter.register('transfer', {
|
|
13
|
+
exportType: ExportConfig_ExportType.WEBHOOK,
|
|
14
|
+
exportUrl: 'http://localhost',
|
|
15
|
+
})
|
|
10
16
|
|
|
11
17
|
const processorTemplate = new ERC20ProcessorTemplate().onEventTransfer(async function (event, ctx) {
|
|
12
18
|
console.log('')
|
|
@@ -34,6 +40,7 @@ ERC20Processor.bind({ address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', net
|
|
|
34
40
|
.onEventTransfer(async function (event, ctx) {
|
|
35
41
|
ctx.meter.Counter('c2').add(2)
|
|
36
42
|
tracker.trackEvent(ctx, { distinctId: event.args.from })
|
|
43
|
+
exporter.emit(ctx, event)
|
|
37
44
|
}, filter)
|
|
38
45
|
.onBlock(async function (block, ctx) {
|
|
39
46
|
ctx.meter.Gauge('g2').record(20, { k: 'v' })
|
|
@@ -98,14 +98,20 @@ export class CandyMachine extends aptos.AptosBaseProcessor {
|
|
|
98
98
|
|
|
99
99
|
export namespace CandyMachine {
|
|
100
100
|
export class ACLBox<T0> {
|
|
101
|
+
static TYPE_NAME =
|
|
102
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::CandyMachine::ACLBox";
|
|
101
103
|
box: acl.ACL;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
export class Counter<T0> {
|
|
107
|
+
static TYPE_NAME =
|
|
108
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::CandyMachine::Counter";
|
|
105
109
|
counter: bigint;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
export class Property<T0> {
|
|
113
|
+
static TYPE_NAME =
|
|
114
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::CandyMachine::Property";
|
|
109
115
|
payee: Address;
|
|
110
116
|
collection: string;
|
|
111
117
|
token_base_name: string;
|
|
@@ -127,6 +133,8 @@ export namespace CandyMachine {
|
|
|
127
133
|
}
|
|
128
134
|
|
|
129
135
|
export class ResourceAccountCap<T0> {
|
|
136
|
+
static TYPE_NAME =
|
|
137
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::CandyMachine::ResourceAccountCap";
|
|
130
138
|
cap: account.SignerCapability;
|
|
131
139
|
}
|
|
132
140
|
|
|
@@ -434,10 +442,14 @@ export class SouffleChefCampaign extends aptos.AptosBaseProcessor {
|
|
|
434
442
|
|
|
435
443
|
export namespace SouffleChefCampaign {
|
|
436
444
|
export class ACLBox<T0> {
|
|
445
|
+
static TYPE_NAME =
|
|
446
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::ACLBox";
|
|
437
447
|
box: acl.ACL;
|
|
438
448
|
}
|
|
439
449
|
|
|
440
450
|
export class BurnEnjoyEvent {
|
|
451
|
+
static TYPE_NAME =
|
|
452
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::BurnEnjoyEvent";
|
|
441
453
|
owner: Address;
|
|
442
454
|
}
|
|
443
455
|
|
|
@@ -448,6 +460,8 @@ export namespace SouffleChefCampaign {
|
|
|
448
460
|
}
|
|
449
461
|
|
|
450
462
|
export class BurnRule {
|
|
463
|
+
static TYPE_NAME =
|
|
464
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::BurnRule";
|
|
451
465
|
token_ids: SouffleChefCampaign.CollectionId[];
|
|
452
466
|
burn_amount: table.Table<SouffleChefCampaign.CollectionId, bigint>;
|
|
453
467
|
total_burn_amount: bigint;
|
|
@@ -456,19 +470,27 @@ export namespace SouffleChefCampaign {
|
|
|
456
470
|
}
|
|
457
471
|
|
|
458
472
|
export class CollectionId {
|
|
473
|
+
static TYPE_NAME =
|
|
474
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::CollectionId";
|
|
459
475
|
creator: Address;
|
|
460
476
|
collection_name: string;
|
|
461
477
|
}
|
|
462
478
|
|
|
463
479
|
export class Counter<T0> {
|
|
480
|
+
static TYPE_NAME =
|
|
481
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::Counter";
|
|
464
482
|
counter: bigint;
|
|
465
483
|
}
|
|
466
484
|
|
|
467
485
|
export class OfferRecords {
|
|
486
|
+
static TYPE_NAME =
|
|
487
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::OfferRecords";
|
|
468
488
|
records: table.Table<Address, token.TokenId[]>;
|
|
469
489
|
}
|
|
470
490
|
|
|
471
491
|
export class Property<T0> {
|
|
492
|
+
static TYPE_NAME =
|
|
493
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::Property";
|
|
472
494
|
payee: Address;
|
|
473
495
|
collection: string;
|
|
474
496
|
token_base_name: string;
|
|
@@ -491,6 +513,8 @@ export namespace SouffleChefCampaign {
|
|
|
491
513
|
}
|
|
492
514
|
|
|
493
515
|
export class PropertyContainer<T0> {
|
|
516
|
+
static TYPE_NAME =
|
|
517
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::PropertyContainer";
|
|
494
518
|
container: table.Table<
|
|
495
519
|
SouffleChefCampaign.CollectionId,
|
|
496
520
|
SouffleChefCampaign.Property<T0>
|
|
@@ -498,6 +522,8 @@ export namespace SouffleChefCampaign {
|
|
|
498
522
|
}
|
|
499
523
|
|
|
500
524
|
export class PullTokenEvent {
|
|
525
|
+
static TYPE_NAME =
|
|
526
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::PullTokenEvent";
|
|
501
527
|
receiver: Address;
|
|
502
528
|
}
|
|
503
529
|
|
|
@@ -508,6 +534,8 @@ export namespace SouffleChefCampaign {
|
|
|
508
534
|
}
|
|
509
535
|
|
|
510
536
|
export class ResourceAccountCap<T0> {
|
|
537
|
+
static TYPE_NAME =
|
|
538
|
+
"0x4188c8694687e844677c2aa87171019e23d61cac60de5082a278a8aa47e9d807::SouffleChefCampaign::ResourceAccountCap";
|
|
511
539
|
cap: account.SignerCapability;
|
|
512
540
|
}
|
|
513
541
|
|