@sentio/sdk 1.34.0 → 1.34.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.
- package/lib/gen/chainquery/protos/chainquery.d.ts +1 -1
- package/lib/gen/chainquery/protos/chainquery.js +108 -211
- package/lib/gen/chainquery/protos/chainquery.js.map +1 -1
- package/lib/gen/google/protobuf/empty.js.map +1 -1
- package/lib/gen/google/protobuf/timestamp.js +5 -9
- package/lib/gen/google/protobuf/timestamp.js.map +1 -1
- package/lib/gen/processor/protos/processor.d.ts +127 -27
- package/lib/gen/processor/protos/processor.js +789 -701
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/gen/service/price/protos/price.d.ts +4 -4
- package/lib/gen/service/price/protos/price.js +15 -27
- package/lib/gen/service/price/protos/price.js.map +1 -1
- package/lib/release.config.js +2 -2
- package/lib/service.d.ts +6 -2
- package/lib/service.js +27 -19
- package/lib/service.js.map +1 -1
- package/lib/testing/test-processor-server.d.ts +6 -2
- package/lib/testing/test-processor-server.js +15 -5
- package/lib/testing/test-processor-server.js.map +1 -1
- package/lib/utils/token.d.ts +1 -1
- package/lib/utils/token.js.map +1 -1
- package/package.json +1 -1
- package/src/gen/chainquery/protos/chainquery.ts +171 -379
- package/src/gen/google/protobuf/empty.ts +7 -19
- package/src/gen/google/protobuf/timestamp.ts +11 -31
- package/src/gen/processor/protos/processor.ts +1064 -1286
- package/src/gen/service/price/protos/price.ts +38 -103
- package/src/service.ts +33 -22
- package/src/testing/test-processor-server.ts +18 -9
- package/src/utils/token.ts +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CallContext, CallOptions } from "nice-grpc-common";
|
|
2
1
|
import Long from "long";
|
|
2
|
+
import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
3
3
|
import _m0 from "protobufjs/minimal";
|
|
4
4
|
export interface CoinID {
|
|
5
|
-
symbol
|
|
6
|
-
address
|
|
5
|
+
symbol?: string | undefined;
|
|
6
|
+
address?: CoinID_AddressIdentifier | undefined;
|
|
7
7
|
}
|
|
8
8
|
export interface CoinID_AddressIdentifier {
|
|
9
9
|
address: string;
|
|
@@ -72,7 +72,7 @@ export declare const PriceServiceDefinition: {
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
};
|
|
75
|
-
export interface
|
|
75
|
+
export interface PriceServiceImplementation<CallContextExt = {}> {
|
|
76
76
|
getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;
|
|
77
77
|
}
|
|
78
78
|
export interface PriceServiceClient<CallOptionsExt = {}> {
|
|
@@ -4,9 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PriceServiceDefinition = exports.GetPriceResponse = exports.GetPriceRequest = exports.CoinID_AddressIdentifier = exports.CoinID = void 0;
|
|
7
|
-
|
|
7
|
+
/* eslint-disable */
|
|
8
8
|
const long_1 = __importDefault(require("long"));
|
|
9
9
|
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
const timestamp_1 = require("../../../google/protobuf/timestamp");
|
|
10
11
|
function createBaseCoinID() {
|
|
11
12
|
return { symbol: undefined, address: undefined };
|
|
12
13
|
}
|
|
@@ -43,27 +44,22 @@ exports.CoinID = {
|
|
|
43
44
|
fromJSON(object) {
|
|
44
45
|
return {
|
|
45
46
|
symbol: isSet(object.symbol) ? String(object.symbol) : undefined,
|
|
46
|
-
address: isSet(object.address)
|
|
47
|
-
? exports.CoinID_AddressIdentifier.fromJSON(object.address)
|
|
48
|
-
: undefined,
|
|
47
|
+
address: isSet(object.address) ? exports.CoinID_AddressIdentifier.fromJSON(object.address) : undefined,
|
|
49
48
|
};
|
|
50
49
|
},
|
|
51
50
|
toJSON(message) {
|
|
52
51
|
const obj = {};
|
|
53
52
|
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
54
53
|
message.address !== undefined &&
|
|
55
|
-
(obj.address = message.address
|
|
56
|
-
? exports.CoinID_AddressIdentifier.toJSON(message.address)
|
|
57
|
-
: undefined);
|
|
54
|
+
(obj.address = message.address ? exports.CoinID_AddressIdentifier.toJSON(message.address) : undefined);
|
|
58
55
|
return obj;
|
|
59
56
|
},
|
|
60
57
|
fromPartial(object) {
|
|
61
58
|
const message = createBaseCoinID();
|
|
62
59
|
message.symbol = object.symbol ?? undefined;
|
|
63
|
-
message.address =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: undefined;
|
|
60
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
61
|
+
? exports.CoinID_AddressIdentifier.fromPartial(object.address)
|
|
62
|
+
: undefined;
|
|
67
63
|
return message;
|
|
68
64
|
},
|
|
69
65
|
};
|
|
@@ -154,27 +150,22 @@ exports.GetPriceRequest = {
|
|
|
154
150
|
},
|
|
155
151
|
fromJSON(object) {
|
|
156
152
|
return {
|
|
157
|
-
timestamp: isSet(object.timestamp)
|
|
158
|
-
? fromJsonTimestamp(object.timestamp)
|
|
159
|
-
: undefined,
|
|
153
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
160
154
|
coinId: isSet(object.coinId) ? exports.CoinID.fromJSON(object.coinId) : undefined,
|
|
161
155
|
};
|
|
162
156
|
},
|
|
163
157
|
toJSON(message) {
|
|
164
158
|
const obj = {};
|
|
165
|
-
message.timestamp !== undefined &&
|
|
166
|
-
|
|
167
|
-
message.coinId !== undefined &&
|
|
168
|
-
(obj.coinId = message.coinId ? exports.CoinID.toJSON(message.coinId) : undefined);
|
|
159
|
+
message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
|
|
160
|
+
message.coinId !== undefined && (obj.coinId = message.coinId ? exports.CoinID.toJSON(message.coinId) : undefined);
|
|
169
161
|
return obj;
|
|
170
162
|
},
|
|
171
163
|
fromPartial(object) {
|
|
172
164
|
const message = createBaseGetPriceRequest();
|
|
173
165
|
message.timestamp = object.timestamp ?? undefined;
|
|
174
|
-
message.coinId =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
: undefined;
|
|
166
|
+
message.coinId = (object.coinId !== undefined && object.coinId !== null)
|
|
167
|
+
? exports.CoinID.fromPartial(object.coinId)
|
|
168
|
+
: undefined;
|
|
178
169
|
return message;
|
|
179
170
|
},
|
|
180
171
|
};
|
|
@@ -214,16 +205,13 @@ exports.GetPriceResponse = {
|
|
|
214
205
|
fromJSON(object) {
|
|
215
206
|
return {
|
|
216
207
|
price: isSet(object.price) ? Number(object.price) : 0,
|
|
217
|
-
timestamp: isSet(object.timestamp)
|
|
218
|
-
? fromJsonTimestamp(object.timestamp)
|
|
219
|
-
: undefined,
|
|
208
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
220
209
|
};
|
|
221
210
|
},
|
|
222
211
|
toJSON(message) {
|
|
223
212
|
const obj = {};
|
|
224
213
|
message.price !== undefined && (obj.price = message.price);
|
|
225
|
-
message.timestamp !== undefined &&
|
|
226
|
-
(obj.timestamp = message.timestamp.toISOString());
|
|
214
|
+
message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
|
|
227
215
|
return obj;
|
|
228
216
|
},
|
|
229
217
|
fromPartial(object) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../../../src/gen/service/price/protos/price.ts"],"names":[],"mappings":";;;;;;AAEA,kEAA+D;AAC/D,gDAAwB;AACxB,iEAAqC;AAsBrC,SAAS,gBAAgB;IACvB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,MAAM,CACJ,OAAe,EACf,SAAqB,iBAAG,CAAC,MAAM,CAAC,MAAM,EAAE;QAExC,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAChC,MAAM,CAAC,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,CAAC;AAqCX,SAAS,WAAW,CAAC,IAAU;IAC7B,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;IACrD,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,CAAY;IACjC,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAM;IAC/B,IAAI,CAAC,YAAY,IAAI,EAAE;QACrB,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QAChC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;KACpB;SAAM;QACL,OAAO,aAAa,CAAC,qBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,cAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,iBAAG,CAAC,IAAI,CAAC,IAAI,KAAK,cAAI,EAAE;IAC1B,iBAAG,CAAC,IAAI,CAAC,IAAI,GAAG,cAAW,CAAC;IAC5B,iBAAG,CAAC,SAAS,EAAE,CAAC;CACjB;AAED,SAAS,KAAK,CAAC,KAAU;IACvB,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC","sourcesContent":["/* eslint-disable */\nimport { CallContext, CallOptions } from \"nice-grpc-common\";\nimport { Timestamp } from \"../../../google/protobuf/timestamp\";\nimport Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\n\nexport interface CoinID {\n symbol: string | undefined;\n address: CoinID_AddressIdentifier | undefined;\n}\n\nexport interface CoinID_AddressIdentifier {\n address: string;\n chain: string;\n}\n\nexport interface GetPriceRequest {\n timestamp: Date | undefined;\n coinId: CoinID | undefined;\n}\n\nexport interface GetPriceResponse {\n price: number;\n timestamp: Date | undefined;\n}\n\nfunction createBaseCoinID(): CoinID {\n return { symbol: undefined, address: undefined };\n}\n\nexport const CoinID = {\n encode(\n message: CoinID,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.symbol !== undefined) {\n writer.uint32(18).string(message.symbol);\n }\n if (message.address !== undefined) {\n CoinID_AddressIdentifier.encode(\n message.address,\n writer.uint32(26).fork()\n ).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n message.symbol = reader.string();\n break;\n case 3:\n message.address = CoinID_AddressIdentifier.decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID {\n return {\n symbol: isSet(object.symbol) ? String(object.symbol) : undefined,\n address: isSet(object.address)\n ? CoinID_AddressIdentifier.fromJSON(object.address)\n : undefined,\n };\n },\n\n toJSON(message: CoinID): unknown {\n const obj: any = {};\n message.symbol !== undefined && (obj.symbol = message.symbol);\n message.address !== undefined &&\n (obj.address = message.address\n ? CoinID_AddressIdentifier.toJSON(message.address)\n : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<CoinID>): CoinID {\n const message = createBaseCoinID();\n message.symbol = object.symbol ?? undefined;\n message.address =\n object.address !== undefined && object.address !== null\n ? CoinID_AddressIdentifier.fromPartial(object.address)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {\n return { address: \"\", chain: \"\" };\n}\n\nexport const CoinID_AddressIdentifier = {\n encode(\n message: CoinID_AddressIdentifier,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.address !== \"\") {\n writer.uint32(10).string(message.address);\n }\n if (message.chain !== \"\") {\n writer.uint32(18).string(message.chain);\n }\n return writer;\n },\n\n decode(\n input: _m0.Reader | Uint8Array,\n length?: number\n ): CoinID_AddressIdentifier {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID_AddressIdentifier();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.address = reader.string();\n break;\n case 2:\n message.chain = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID_AddressIdentifier {\n return {\n address: isSet(object.address) ? String(object.address) : \"\",\n chain: isSet(object.chain) ? String(object.chain) : \"\",\n };\n },\n\n toJSON(message: CoinID_AddressIdentifier): unknown {\n const obj: any = {};\n message.address !== undefined && (obj.address = message.address);\n message.chain !== undefined && (obj.chain = message.chain);\n return obj;\n },\n\n fromPartial(\n object: DeepPartial<CoinID_AddressIdentifier>\n ): CoinID_AddressIdentifier {\n const message = createBaseCoinID_AddressIdentifier();\n message.address = object.address ?? \"\";\n message.chain = object.chain ?? \"\";\n return message;\n },\n};\n\nfunction createBaseGetPriceRequest(): GetPriceRequest {\n return { timestamp: undefined, coinId: undefined };\n}\n\nexport const GetPriceRequest = {\n encode(\n message: GetPriceRequest,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.timestamp !== undefined) {\n Timestamp.encode(\n toTimestamp(message.timestamp),\n writer.uint32(10).fork()\n ).ldelim();\n }\n if (message.coinId !== undefined) {\n CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceRequest();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.timestamp = fromTimestamp(\n Timestamp.decode(reader, reader.uint32())\n );\n break;\n case 2:\n message.coinId = CoinID.decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceRequest {\n return {\n timestamp: isSet(object.timestamp)\n ? fromJsonTimestamp(object.timestamp)\n : undefined,\n coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,\n };\n },\n\n toJSON(message: GetPriceRequest): unknown {\n const obj: any = {};\n message.timestamp !== undefined &&\n (obj.timestamp = message.timestamp.toISOString());\n message.coinId !== undefined &&\n (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {\n const message = createBaseGetPriceRequest();\n message.timestamp = object.timestamp ?? undefined;\n message.coinId =\n object.coinId !== undefined && object.coinId !== null\n ? CoinID.fromPartial(object.coinId)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseGetPriceResponse(): GetPriceResponse {\n return { price: 0, timestamp: undefined };\n}\n\nexport const GetPriceResponse = {\n encode(\n message: GetPriceResponse,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.price !== 0) {\n writer.uint32(9).double(message.price);\n }\n if (message.timestamp !== undefined) {\n Timestamp.encode(\n toTimestamp(message.timestamp),\n writer.uint32(18).fork()\n ).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.price = reader.double();\n break;\n case 2:\n message.timestamp = fromTimestamp(\n Timestamp.decode(reader, reader.uint32())\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceResponse {\n return {\n price: isSet(object.price) ? Number(object.price) : 0,\n timestamp: isSet(object.timestamp)\n ? fromJsonTimestamp(object.timestamp)\n : undefined,\n };\n },\n\n toJSON(message: GetPriceResponse): unknown {\n const obj: any = {};\n message.price !== undefined && (obj.price = message.price);\n message.timestamp !== undefined &&\n (obj.timestamp = message.timestamp.toISOString());\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {\n const message = createBaseGetPriceResponse();\n message.price = object.price ?? 0;\n message.timestamp = object.timestamp ?? undefined;\n return message;\n },\n};\n\nexport type PriceServiceDefinition = typeof PriceServiceDefinition;\nexport const PriceServiceDefinition = {\n name: \"PriceService\",\n fullName: \"price_service.PriceService\",\n methods: {\n getPrice: {\n name: \"GetPrice\",\n requestType: GetPriceRequest,\n requestStream: false,\n responseType: GetPriceResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\nexport interface PriceServiceServiceImplementation<CallContextExt = {}> {\n getPrice(\n request: GetPriceRequest,\n context: CallContext & CallContextExt\n ): Promise<DeepPartial<GetPriceResponse>>;\n}\n\nexport interface PriceServiceClient<CallOptionsExt = {}> {\n getPrice(\n request: DeepPartial<GetPriceRequest>,\n options?: CallOptions & CallOptionsExt\n ): Promise<GetPriceResponse>;\n}\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | boolean\n | undefined;\n\ntype DeepPartial<T> = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1_000;\n millis += t.nanos / 1_000_000;\n return new Date(millis);\n}\n\nfunction fromJsonTimestamp(o: any): Date {\n if (o instanceof Date) {\n return o;\n } else if (typeof o === \"string\") {\n return new Date(o);\n } else {\n return fromTimestamp(Timestamp.fromJSON(o));\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../../../src/gen/service/price/protos/price.ts"],"names":[],"mappings":";;;;;;AAAA,oBAAoB;AACpB,gDAAwB;AAExB,iEAAqC;AACrC,kEAA+D;AAsB/D,SAAS,gBAAgB;IACvB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,MAAM,CAAC,OAAe,EAAE,SAAqB,iBAAG,CAAC,MAAM,CAAC,MAAM,EAAE;QAC9D,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAChC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SAC1C;QACD,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS,EAAE;YACjC,gCAAwB,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAA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KAAK,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,CAAY;IACjC,IAAI,MAAM,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC1C,MAAM,IAAI,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAM;IAC/B,IAAI,CAAC,YAAY,IAAI,EAAE;QACrB,OAAO,CAAC,CAAC;KACV;SAAM,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE;QAChC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;KACpB;SAAM;QACL,OAAO,aAAa,CAAC,qBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC7C;AACH,CAAC;AAED,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,cAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAED,IAAI,iBAAG,CAAC,IAAI,CAAC,IAAI,KAAK,cAAI,EAAE;IAC1B,iBAAG,CAAC,IAAI,CAAC,IAAI,GAAG,cAAW,CAAC;IAC5B,iBAAG,CAAC,SAAS,EAAE,CAAC;CACjB;AAED,SAAS,KAAK,CAAC,KAAU;IACvB,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;AAC/C,CAAC","sourcesContent":["/* eslint-disable */\nimport Long from \"long\";\nimport type { CallContext, CallOptions } from \"nice-grpc-common\";\nimport _m0 from \"protobufjs/minimal\";\nimport { Timestamp } from \"../../../google/protobuf/timestamp\";\n\nexport interface CoinID {\n symbol?: string | undefined;\n address?: CoinID_AddressIdentifier | undefined;\n}\n\nexport interface CoinID_AddressIdentifier {\n address: string;\n chain: string;\n}\n\nexport interface GetPriceRequest {\n timestamp: Date | undefined;\n coinId: CoinID | undefined;\n}\n\nexport interface GetPriceResponse {\n price: number;\n timestamp: Date | undefined;\n}\n\nfunction createBaseCoinID(): CoinID {\n return { symbol: undefined, address: undefined };\n}\n\nexport const CoinID = {\n encode(message: CoinID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (message.symbol !== undefined) {\n writer.uint32(18).string(message.symbol);\n }\n if (message.address !== undefined) {\n CoinID_AddressIdentifier.encode(message.address, writer.uint32(26).fork()).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n message.symbol = reader.string();\n break;\n case 3:\n message.address = CoinID_AddressIdentifier.decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID {\n return {\n symbol: isSet(object.symbol) ? String(object.symbol) : undefined,\n address: isSet(object.address) ? CoinID_AddressIdentifier.fromJSON(object.address) : undefined,\n };\n },\n\n toJSON(message: CoinID): unknown {\n const obj: any = {};\n message.symbol !== undefined && (obj.symbol = message.symbol);\n message.address !== undefined &&\n (obj.address = message.address ? CoinID_AddressIdentifier.toJSON(message.address) : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<CoinID>): CoinID {\n const message = createBaseCoinID();\n message.symbol = object.symbol ?? undefined;\n message.address = (object.address !== undefined && object.address !== null)\n ? CoinID_AddressIdentifier.fromPartial(object.address)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {\n return { address: \"\", chain: \"\" };\n}\n\nexport const CoinID_AddressIdentifier = {\n encode(message: CoinID_AddressIdentifier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (message.address !== \"\") {\n writer.uint32(10).string(message.address);\n }\n if (message.chain !== \"\") {\n writer.uint32(18).string(message.chain);\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): CoinID_AddressIdentifier {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID_AddressIdentifier();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.address = reader.string();\n break;\n case 2:\n message.chain = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID_AddressIdentifier {\n return {\n address: isSet(object.address) ? String(object.address) : \"\",\n chain: isSet(object.chain) ? String(object.chain) : \"\",\n };\n },\n\n toJSON(message: CoinID_AddressIdentifier): unknown {\n const obj: any = {};\n message.address !== undefined && (obj.address = message.address);\n message.chain !== undefined && (obj.chain = message.chain);\n return obj;\n },\n\n fromPartial(object: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier {\n const message = createBaseCoinID_AddressIdentifier();\n message.address = object.address ?? \"\";\n message.chain = object.chain ?? \"\";\n return message;\n },\n};\n\nfunction createBaseGetPriceRequest(): GetPriceRequest {\n return { timestamp: undefined, coinId: undefined };\n}\n\nexport const GetPriceRequest = {\n encode(message: GetPriceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (message.timestamp !== undefined) {\n Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim();\n }\n if (message.coinId !== undefined) {\n CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceRequest();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n break;\n case 2:\n message.coinId = CoinID.decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceRequest {\n return {\n timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,\n coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,\n };\n },\n\n toJSON(message: GetPriceRequest): unknown {\n const obj: any = {};\n message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());\n message.coinId !== undefined && (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {\n const message = createBaseGetPriceRequest();\n message.timestamp = object.timestamp ?? undefined;\n message.coinId = (object.coinId !== undefined && object.coinId !== null)\n ? CoinID.fromPartial(object.coinId)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseGetPriceResponse(): GetPriceResponse {\n return { price: 0, timestamp: undefined };\n}\n\nexport const GetPriceResponse = {\n encode(message: GetPriceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (message.price !== 0) {\n writer.uint32(9).double(message.price);\n }\n if (message.timestamp !== undefined) {\n Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.price = reader.double();\n break;\n case 2:\n message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceResponse {\n return {\n price: isSet(object.price) ? Number(object.price) : 0,\n timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,\n };\n },\n\n toJSON(message: GetPriceResponse): unknown {\n const obj: any = {};\n message.price !== undefined && (obj.price = message.price);\n message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {\n const message = createBaseGetPriceResponse();\n message.price = object.price ?? 0;\n message.timestamp = object.timestamp ?? undefined;\n return message;\n },\n};\n\nexport type PriceServiceDefinition = typeof PriceServiceDefinition;\nexport const PriceServiceDefinition = {\n name: \"PriceService\",\n fullName: \"price_service.PriceService\",\n methods: {\n getPrice: {\n name: \"GetPrice\",\n requestType: GetPriceRequest,\n requestStream: false,\n responseType: GetPriceResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\nexport interface PriceServiceImplementation<CallContextExt = {}> {\n getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;\n}\n\nexport interface PriceServiceClient<CallOptionsExt = {}> {\n getPrice(request: DeepPartial<GetPriceRequest>, options?: CallOptions & CallOptionsExt): Promise<GetPriceResponse>;\n}\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\ntype DeepPartial<T> = T extends Builtin ? T\n : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>\n : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1_000;\n millis += t.nanos / 1_000_000;\n return new Date(millis);\n}\n\nfunction fromJsonTimestamp(o: any): Date {\n if (o instanceof Date) {\n return o;\n } else if (typeof o === \"string\") {\n return new Date(o);\n } else {\n return fromTimestamp(Timestamp.fromJSON(o));\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
|
package/lib/release.config.js
CHANGED
package/lib/service.d.ts
CHANGED
|
@@ -24,9 +24,13 @@ export declare class ProcessorServiceImpl implements ProcessorServiceImplementat
|
|
|
24
24
|
stop(request: Empty, context: CallContext): Promise<Empty>;
|
|
25
25
|
processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse>;
|
|
26
26
|
processBinding(request: DataBinding, options?: CallContext): Promise<ProcessResult>;
|
|
27
|
+
processBindingsStream(requests: AsyncIterable<DataBinding>, context: CallContext): AsyncGenerator<{
|
|
28
|
+
result: ProcessResult;
|
|
29
|
+
configUpdated: boolean;
|
|
30
|
+
}, void, unknown>;
|
|
27
31
|
processLogs(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse>;
|
|
28
|
-
processLog(
|
|
29
|
-
|
|
32
|
+
processLog(request: DataBinding): Promise<ProcessResult>;
|
|
33
|
+
procecessSolInstructions(request: DataBinding): Promise<ProcessResult>;
|
|
30
34
|
processBlock(binding: DataBinding): Promise<ProcessResult>;
|
|
31
35
|
processTraces(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse>;
|
|
32
36
|
processTrace(binding: DataBinding): Promise<ProcessResult>;
|
package/lib/service.js
CHANGED
|
@@ -414,7 +414,7 @@ class ProcessorServiceImpl {
|
|
|
414
414
|
case gen_1.HandlerType.ETH_BLOCK:
|
|
415
415
|
return this.processBlock(request);
|
|
416
416
|
case gen_1.HandlerType.SOL_INSTRUCTION:
|
|
417
|
-
return this.
|
|
417
|
+
return this.procecessSolInstructions(request);
|
|
418
418
|
// TODO migrate SUI cases
|
|
419
419
|
// case HandlerType.INSTRUCTION:
|
|
420
420
|
// return this.processInstruction(request)
|
|
@@ -426,6 +426,21 @@ class ProcessorServiceImpl {
|
|
|
426
426
|
recordRuntimeInfo(result, request.handlerType);
|
|
427
427
|
return result;
|
|
428
428
|
}
|
|
429
|
+
async *processBindingsStream(requests, context) {
|
|
430
|
+
for await (const request of requests) {
|
|
431
|
+
const result = await this.processBinding(request);
|
|
432
|
+
let updated = false;
|
|
433
|
+
if (global.PROCESSOR_STATE.templatesInstances &&
|
|
434
|
+
this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length) {
|
|
435
|
+
await this.configure();
|
|
436
|
+
updated = true;
|
|
437
|
+
}
|
|
438
|
+
yield {
|
|
439
|
+
result,
|
|
440
|
+
configUpdated: updated,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
}
|
|
429
444
|
async processLogs(request, context) {
|
|
430
445
|
if (!this.started) {
|
|
431
446
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.UNAVAILABLE, 'Service Not started.');
|
|
@@ -447,14 +462,14 @@ class ProcessorServiceImpl {
|
|
|
447
462
|
configUpdated: updated,
|
|
448
463
|
};
|
|
449
464
|
}
|
|
450
|
-
async processLog(
|
|
451
|
-
if (!
|
|
465
|
+
async processLog(request) {
|
|
466
|
+
if (!request.data) {
|
|
452
467
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Log can't be null");
|
|
453
468
|
}
|
|
454
469
|
const promises = [];
|
|
455
|
-
const jsonString = Utf8ArrayToStr(
|
|
470
|
+
const jsonString = Utf8ArrayToStr(request.data.ethLog?.data || request.data.raw);
|
|
456
471
|
const log = JSON.parse(jsonString);
|
|
457
|
-
for (const handlerId of
|
|
472
|
+
for (const handlerId of request.handlerIds) {
|
|
458
473
|
const handler = this.eventHandlers[handlerId];
|
|
459
474
|
promises.push(handler(log).catch((e) => {
|
|
460
475
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INTERNAL, 'error processing log: ' + jsonString + '\n' + errorString(e));
|
|
@@ -462,24 +477,17 @@ class ProcessorServiceImpl {
|
|
|
462
477
|
}
|
|
463
478
|
return mergeProcessResults(await Promise.all(promises));
|
|
464
479
|
}
|
|
465
|
-
async
|
|
480
|
+
async procecessSolInstructions(request) {
|
|
466
481
|
if (!request.data) {
|
|
467
482
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, 'instruction data cannot be empty');
|
|
468
483
|
}
|
|
469
|
-
|
|
470
|
-
const instruction = gen_1.Instruction.decode(request.data.raw); // JSON.parse(jsonString)
|
|
484
|
+
const instruction = request.data.solInstruction || gen_1.Data_SolInstruction.decode(request.data.raw); // JSON.parse(jsonString)
|
|
471
485
|
const promises = [];
|
|
472
486
|
// Only have instruction handlers for solana processors
|
|
473
487
|
for (const processor of solana_processor_1.SolanaProcessorState.INSTANCE.getValues()) {
|
|
474
488
|
if (processor.address === instruction.programAccountId) {
|
|
475
489
|
let parsedInstruction = null;
|
|
476
490
|
if (instruction.parsed) {
|
|
477
|
-
// const decoded = new TextDecoder().decode(instruction.parsed)
|
|
478
|
-
if (!(instruction.parsed instanceof Uint8Array)) {
|
|
479
|
-
// const parsed = instruction.parsed as Uint8Array
|
|
480
|
-
const values = Object.entries(instruction.parsed).map(([key, value]) => value);
|
|
481
|
-
instruction.parsed = Uint8Array.from(values);
|
|
482
|
-
}
|
|
483
491
|
const a1 = JSON.parse(new util_1.TextDecoder().decode(instruction.parsed));
|
|
484
492
|
parsedInstruction = processor.getParsedInstruction(a1);
|
|
485
493
|
}
|
|
@@ -503,7 +511,7 @@ class ProcessorServiceImpl {
|
|
|
503
511
|
if (!binding.data) {
|
|
504
512
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Block can't be empty");
|
|
505
513
|
}
|
|
506
|
-
const jsonString = Utf8ArrayToStr(binding.data.raw);
|
|
514
|
+
const jsonString = Utf8ArrayToStr(binding.data.ethBlock?.data || binding.data.raw);
|
|
507
515
|
const block = JSON.parse(jsonString);
|
|
508
516
|
const promises = [];
|
|
509
517
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -529,7 +537,7 @@ class ProcessorServiceImpl {
|
|
|
529
537
|
if (!binding.data) {
|
|
530
538
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Trace can't be empty");
|
|
531
539
|
}
|
|
532
|
-
const jsonString = Utf8ArrayToStr(binding.data.raw);
|
|
540
|
+
const jsonString = Utf8ArrayToStr(binding.data.ethTrace?.data || binding.data.raw);
|
|
533
541
|
const trace = JSON.parse(jsonString);
|
|
534
542
|
const promises = [];
|
|
535
543
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -544,7 +552,7 @@ class ProcessorServiceImpl {
|
|
|
544
552
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Event can't be empty");
|
|
545
553
|
}
|
|
546
554
|
const promises = [];
|
|
547
|
-
const jsonString = Utf8ArrayToStr(binding.data.raw);
|
|
555
|
+
const jsonString = Utf8ArrayToStr(binding.data.aptEvent?.data || binding.data.raw);
|
|
548
556
|
const event = JSON.parse(jsonString);
|
|
549
557
|
for (const handlerId of binding.handlerIds) {
|
|
550
558
|
// only support aptos event for now
|
|
@@ -558,7 +566,7 @@ class ProcessorServiceImpl {
|
|
|
558
566
|
if (!binding.data) {
|
|
559
567
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Event can't be empty");
|
|
560
568
|
}
|
|
561
|
-
const jsonString = Utf8ArrayToStr(binding.data.raw);
|
|
569
|
+
const jsonString = Utf8ArrayToStr(binding.data.aptResource?.data || binding.data.raw);
|
|
562
570
|
const json = JSON.parse(jsonString);
|
|
563
571
|
const promises = [];
|
|
564
572
|
for (const handlerId of binding.handlerIds) {
|
|
@@ -572,7 +580,7 @@ class ProcessorServiceImpl {
|
|
|
572
580
|
if (!binding.data) {
|
|
573
581
|
throw new nice_grpc_1.ServerError(nice_grpc_1.Status.INVALID_ARGUMENT, "Event can't be empty");
|
|
574
582
|
}
|
|
575
|
-
const jsonString = Utf8ArrayToStr(binding.data.raw);
|
|
583
|
+
const jsonString = Utf8ArrayToStr(binding.data.aptCall?.data || binding.data.raw);
|
|
576
584
|
const call = JSON.parse(jsonString);
|
|
577
585
|
const promises = [];
|
|
578
586
|
for (const handlerId of binding.handlerIds) {
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;;;;;AACA,yCAA4D;AAC5D,yCAA6D;AAE7D,+BAqBc;AAGd,gDAAuB;AACvB,+BAAkC;AAGlC,wCAA0C;AAC1C,8CAA+C;AAC/C,wDAAwD;AACxD,6DAIgC;AAChC,gEAAgE;AAChE,wDAAwD;AACxD,8DAA8D;AAC9D,mCACC;AAAC,MAAM,CAAC,SAAiB,CAAC,MAAM,GAAG;IAClC,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAA;AAEnC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAEvC,MAAa,oBAAoB;IAC/B,eAAe;IACP,aAAa,GAA+C,EAAE,CAAA;IAC9D,aAAa,GAAiD,EAAE,CAAA;IAChE,aAAa,GAAiD,EAAE,CAAA;IAExE,iBAAiB;IACT,kBAAkB,GAA+C,EAAE,CAAA;IACnE,iBAAiB,GAA8C,EAAE,CAAA;IACjE,qBAAqB,GAC3B,EAAE,CAAA;IAEJ,0CAA0C;IAC1C,0FAA0F;IAC1F,qHAAqH;IAE7G,OAAO,GAAG,KAAK,CAAA;IACf,eAAe,CAAkB;IACjC,cAAc,CAAiB;IAC/B,iBAAiB,CAAoB;IACrC,aAAa,CAAgB;IAC7B,oBAAoB,CAAuB;IAC3C,aAAa,CAAgB;IACpB,MAAM,CAAY;IAElB,eAAe,CAAa;IAE7C,YAAY,MAAkB,EAAE,eAA4B;QAC1D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,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,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAClC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACxC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;KAC5C;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAsB,EAAE,WAAwB;IACzE,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;QACpG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACjB,CAAC,CAAC,WAAW,GAAG;gBACd,IAAI,EAAE,WAAW;aAClB,CAAA;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC;AAED,SAAS,WAAW,CAAC,CAAQ;IAC3B,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAA;AAC7B,CAAC","sourcesContent":["import { Block, Log } from '@ethersproject/abstract-provider'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { SOL_MAINMET_ID, SUI_DEVNET_ID } from './utils/chain'\n\nimport {\n AccountConfig,\n AptosCallHandlerConfig,\n AptosEventHandlerConfig,\n ContractConfig,\n DataBinding,\n EventTrackingConfig,\n ExportConfig,\n HandlerType,\n Instruction,\n LogFilter,\n LogHandlerConfig,\n MetricConfig,\n ProcessBindingResponse,\n ProcessBindingsRequest,\n ProcessConfigRequest,\n ProcessConfigResponse,\n ProcessorServiceImplementation,\n ProcessResult,\n StartRequest,\n TemplateInstance,\n} from './gen'\n\nimport { Empty } from './gen/google/protobuf/empty'\nimport Long from 'long'\nimport { TextDecoder } from 'util'\nimport { Trace } from './core'\nimport { Instruction as SolInstruction } from '@project-serum/anchor'\nimport { MetricState } from './core/meter'\nimport { ExporterState } from './core/exporter'\nimport { EventTrackerState } from './core/event-tracker'\nimport {\n AptosAccountProcessorState,\n AptosProcessorState,\n MoveResourcesWithVersionPayload,\n} from './aptos/aptos-processor'\nimport { AccountProcessorState } from './core/account-processor'\nimport { SuiProcessorState } from './core/sui-processor'\nimport { SolanaProcessorState } from './core/solana-processor'\nimport { ProcessorState } from './binds'\n;(BigInt.prototype as any).toJSON = function () {\n return this.toString()\n}\n\nconst DEFAULT_MAX_BLOCK = Long.ZERO\n\nconst USER_PROCESSOR = 'user_processor'\n\nexport class ProcessorServiceImpl implements ProcessorServiceImplementation {\n // eth handlers\n private eventHandlers: ((event: Log) => Promise<ProcessResult>)[] = []\n private traceHandlers: ((trace: Trace) => Promise<ProcessResult>)[] = []\n private blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []\n\n // aptos handlers\n private aptosEventHandlers: ((event: any) => Promise<ProcessResult>)[] = []\n private aptosCallHandlers: ((func: any) => Promise<ProcessResult>)[] = []\n private aptosResourceHandlers: ((resourceWithVersion: MoveResourcesWithVersionPayload) => Promise<ProcessResult>)[] =\n []\n\n // map from chain id to list of processors\n // private blockHandlers = new Map<string, ((block: Block) => Promise<ProcessResult>)[]>()\n // private processorsByChainId = new Map<string, BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>>()\n\n private started = false\n private contractConfigs: ContractConfig[]\n private accountConfigs: AccountConfig[]\n private templateInstances: TemplateInstance[]\n private metricConfigs: MetricConfig[]\n private eventTrackingConfigs: EventTrackingConfig[]\n private exportConfigs: ExportConfig[]\n private readonly loader: () => void\n\n private readonly shutdownHandler?: () => void\n\n constructor(loader: () => void, shutdownHandler?: () => void) {\n this.loader = loader\n this.shutdownHandler = shutdownHandler\n }\n\n async getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n return {\n // TODO project setting\n config: undefined,\n contractConfigs: this.contractConfigs,\n accountConfigs: this.accountConfigs,\n templateInstances: this.templateInstances,\n eventTrackingConfigs: this.eventTrackingConfigs,\n metricConfigs: this.metricConfigs,\n exportConfigs: this.exportConfigs,\n }\n }\n\n async configure() {\n this.eventHandlers = []\n this.templateInstances = []\n // this.processorsByChainId.clear()\n this.contractConfigs = []\n this.accountConfigs = []\n\n this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances]\n this.eventTrackingConfigs = []\n this.metricConfigs = []\n this.exportConfigs = []\n\n // part 0, prepare metrics and event tracking configs\n for (const metric of MetricState.INSTANCE.getValues()) {\n this.metricConfigs.push({\n ...metric.config,\n })\n }\n\n for (const eventTracker of EventTrackerState.INSTANCE.getValues()) {\n this.eventTrackingConfigs.push({\n distinctAggregationByDays: eventTracker.options.distinctByDays || [],\n eventName: eventTracker.name,\n retentionConfig: undefined,\n totalByDay: eventTracker.options.totalByDay || false,\n totalPerEntity: undefined,\n unique: eventTracker.options.unique || false,\n })\n }\n\n for (const exporter of ExporterState.INSTANCE.getValues()) {\n this.exportConfigs.push({\n name: exporter.name,\n channel: exporter.channel,\n })\n }\n\n // Part 1.a, prepare EVM processors\n for (const processor of ProcessorState.INSTANCE.getValues()) {\n // If server favor incremental update this need to change\n // Start basic config for contract\n const chainId = processor.getChainId()\n // this.processorsByChainId.set(chainId, processor)\n\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: processor.config.name,\n chainId: chainId.toString(),\n address: processor.config.address,\n abi: '',\n },\n intervalConfigs: [],\n logConfigs: [],\n traceConfigs: [],\n startBlock: processor.config.startBlock,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n if (processor.config.endBlock) {\n contractConfig.endBlock = processor.config.endBlock\n }\n\n // Step 1. Prepare all the block handlers\n for (const blockHandler of processor.blockHandlers) {\n const handlerId = this.blockHandlers.push(blockHandler.handler) - 1\n // TODO wrap the block handler into one\n\n contractConfig.intervalConfigs.push({\n slot: 0,\n slotInterval: blockHandler.blockInterval,\n minutes: 0,\n minutesInterval: blockHandler.timeIntervalInMinutes,\n handlerId: handlerId,\n })\n }\n\n // Step 2. Prepare all trace handlers\n for (const traceHandler of processor.traceHandlers) {\n const handlerId = this.traceHandlers.push(traceHandler.handler) - 1\n contractConfig.traceConfigs.push({\n signature: traceHandler.signature,\n handlerId: handlerId,\n })\n }\n\n // Step 3. Prepare all the event handlers\n for (const eventsHandler of processor.eventHandlers) {\n // associate id with filter\n const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1\n const logConfig: LogHandlerConfig = {\n handlerId: handlerId,\n filters: [],\n }\n\n for (const filter of eventsHandler.filters) {\n if (!filter.topics) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')\n }\n const logFilter: LogFilter = {\n addressType: undefined,\n address: contractConfig.contract?.address,\n topics: [],\n }\n\n for (const ts of filter.topics) {\n let hashes: string[] = []\n if (Array.isArray(ts)) {\n hashes = hashes.concat(ts)\n } else if (ts) {\n hashes.push(ts)\n }\n logFilter.topics.push({ hashes: hashes })\n }\n logConfig.filters.push(logFilter)\n }\n contractConfig.logConfigs.push(logConfig)\n }\n\n // Finish up a contract\n this.contractConfigs.push(contractConfig)\n }\n\n // part 1.b prepare EVM account processors\n for (const processor of AccountProcessorState.INSTANCE.getValues()) {\n const accountConfig: AccountConfig = {\n address: processor.config.address,\n chainId: processor.getChainId().toString(),\n startBlock: processor.config.startBlock ? Long.fromValue(processor.config.startBlock) : Long.ZERO,\n aptosIntervalConfigs: [],\n intervalConfigs: [],\n logConfigs: [],\n }\n // TODO add interval\n for (const eventsHandler of processor.eventHandlers) {\n // associate id with filter\n const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1\n const logConfig: LogHandlerConfig = {\n handlerId: handlerId,\n filters: [],\n }\n\n for (const filter of eventsHandler.filters) {\n if (!filter.topics) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')\n }\n const logFilter: LogFilter = {\n addressType: filter.addressType,\n address: filter.address,\n topics: [],\n }\n\n for (const ts of filter.topics) {\n let hashes: string[] = []\n if (Array.isArray(ts)) {\n hashes = hashes.concat(ts)\n } else if (ts) {\n hashes.push(ts)\n }\n logFilter.topics.push({ hashes: hashes })\n }\n logConfig.filters.push(logFilter)\n }\n accountConfig.logConfigs.push(logConfig)\n }\n\n this.accountConfigs.push(accountConfig)\n }\n\n // Part 2, prepare solana constractors\n for (const solanaProcessor of SolanaProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: solanaProcessor.contractName,\n chainId: SOL_MAINMET_ID,\n address: solanaProcessor.address,\n abi: '',\n },\n logConfigs: [],\n traceConfigs: [],\n intervalConfigs: [],\n startBlock: solanaProcessor.config.startSlot,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: {\n innerInstruction: solanaProcessor.processInnerInstruction,\n parsedInstruction: solanaProcessor.fromParsedInstruction !== null,\n rawDataInstruction: solanaProcessor.decodeInstruction !== null,\n },\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n this.contractConfigs.push(contractConfig)\n }\n\n // Part 3, prepare sui constractors\n for (const suiProcessor of SuiProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: 'sui contract',\n chainId: SUI_DEVNET_ID,\n address: suiProcessor.address,\n abi: '',\n },\n logConfigs: [],\n intervalConfigs: [],\n traceConfigs: [],\n startBlock: suiProcessor.config.startSeqNumber,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n this.contractConfigs.push(contractConfig)\n }\n\n // Part 4, prepare aptos constractors\n for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: aptosProcessor.moduleName,\n chainId: aptosProcessor.getChainId(),\n address: aptosProcessor.config.address,\n abi: '',\n },\n intervalConfigs: [],\n logConfigs: [],\n traceConfigs: [],\n startBlock: Long.fromString(aptosProcessor.config.startVersion.toString()),\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n // 1. Prepare event handlers\n for (const handler of aptosProcessor.eventHandlers) {\n const handlerId = this.aptosEventHandlers.push(handler.handler) - 1\n const eventHandlerConfig: AptosEventHandlerConfig = {\n filters: handler.filters.map((f) => {\n return {\n type: f.type,\n account: f.account || '',\n }\n }),\n handlerId,\n }\n contractConfig.aptosEventConfigs.push(eventHandlerConfig)\n }\n\n // 2. Prepare function handlers\n for (const handler of aptosProcessor.callHandlers) {\n const handlerId = this.aptosCallHandlers.push(handler.handler) - 1\n const functionHandlerConfig: AptosCallHandlerConfig = {\n filters: handler.filters.map((filter) => {\n return {\n function: filter.function,\n typeArguments: filter.typeArguments || [],\n withTypeArguments: filter.typeArguments ? true : false,\n includeFailed: filter.includeFailed || false,\n }\n }),\n handlerId,\n }\n contractConfig.aptosCallConfigs.push(functionHandlerConfig)\n }\n this.contractConfigs.push(contractConfig)\n }\n\n for (const aptosProcessor of AptosAccountProcessorState.INSTANCE.getValues()) {\n const accountConfig: AccountConfig = {\n address: aptosProcessor.config.address,\n chainId: aptosProcessor.getChainId(),\n startBlock: Long.fromValue(aptosProcessor.config.startVersion.toString()),\n aptosIntervalConfigs: [],\n intervalConfigs: [],\n logConfigs: [],\n }\n for (const handler of aptosProcessor.resourcesHandlers) {\n const handlerId = this.aptosResourceHandlers.push(handler.handler) - 1\n accountConfig.aptosIntervalConfigs.push({\n intervalConfig: {\n handlerId: handlerId,\n minutes: 0,\n minutesInterval: handler.timeIntervalInMinutes,\n slot: 0,\n slotInterval: handler.versionInterval,\n },\n type: handler.type || '',\n })\n }\n this.accountConfigs.push(accountConfig)\n }\n }\n\n async start(request: StartRequest, context: CallContext): Promise<Empty> {\n if (this.started) {\n return {}\n }\n\n try {\n this.loader()\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n for (const instance of request.templateInstances) {\n const template = global.PROCESSOR_STATE.templates[instance.templateId]\n if (!template) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance)\n }\n if (!instance.contract) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Contract Empty from:' + instance)\n }\n template.bind({\n name: instance.contract.name,\n address: instance.contract.address,\n network: Number(instance.contract.chainId),\n startBlock: instance.startBlock,\n endBlock: instance.endBlock,\n })\n }\n try {\n await this.configure()\n } catch (e) {\n throw new ServerError(Status.INTERNAL, 'Failed to start processor : ' + errorString(e))\n }\n this.started = true\n return {}\n }\n\n async stop(request: Empty, context: CallContext): Promise<Empty> {\n console.log('Server Shutting down in 5 seconds')\n if (this.shutdownHandler) {\n setTimeout(this.shutdownHandler, 5000)\n }\n return {}\n }\n\n async processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises = request.bindings.map((binding) => this.processBinding(binding))\n const result = mergeProcessResults(await Promise.all(promises))\n\n let updated = false\n if (\n global.PROCESSOR_STATE.templatesInstances &&\n this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length\n ) {\n await this.configure()\n updated = true\n }\n\n return {\n result,\n configUpdated: updated,\n }\n }\n\n async processBinding(request: DataBinding, options?: CallContext): Promise<ProcessResult> {\n const processBindingInternal = (request: DataBinding) => {\n switch (request.handlerType) {\n case HandlerType.APT_CALL:\n return this.processAptosFunctionCall(request)\n case HandlerType.APT_EVENT:\n return this.processAptosEvent(request)\n case HandlerType.APT_RESOURCE:\n return this.processAptosResource(request)\n case HandlerType.ETH_LOG:\n return this.processLog(request)\n case HandlerType.ETH_TRACE:\n return this.processTrace(request)\n case HandlerType.ETH_BLOCK:\n return this.processBlock(request)\n case HandlerType.SOL_INSTRUCTION:\n return this.procecessSolInstruSolctions(request)\n // TODO migrate SUI cases\n // case HandlerType.INSTRUCTION:\n // return this.processInstruction(request)\n default:\n throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)\n }\n }\n\n const result = await processBindingInternal(request)\n recordRuntimeInfo(result, request.handlerType)\n return result\n }\n\n async processLogs(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises: Promise<ProcessResult>[] = []\n for (const l of request.bindings) {\n promises.push(this.processLog(l))\n }\n\n const result = mergeProcessResults(await Promise.all(promises))\n\n let updated = false\n if (\n global.PROCESSOR_STATE.templatesInstances &&\n this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length\n ) {\n await this.configure()\n updated = true\n }\n\n recordRuntimeInfo(result, HandlerType.ETH_LOG)\n return {\n result,\n configUpdated: updated,\n }\n }\n\n async processLog(l: DataBinding): Promise<ProcessResult> {\n if (!l.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Log can't be null\")\n }\n\n const promises: Promise<ProcessResult>[] = []\n const jsonString = Utf8ArrayToStr(l.data.raw)\n const log: Log = JSON.parse(jsonString)\n\n for (const handlerId of l.handlerIds) {\n const handler = this.eventHandlers[handlerId]\n promises.push(\n handler(log).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing log: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async procecessSolInstruSolctions(request: DataBinding): Promise<ProcessResult> {\n if (!request.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'instruction data cannot be empty')\n }\n\n // const jsonString = new TextDecoder().decode(request.data.raw) // Utf8ArrayToStr(request.data.raw)\n\n const instruction: Instruction = Instruction.decode(request.data.raw) // JSON.parse(jsonString)\n const promises: Promise<ProcessResult>[] = []\n\n // Only have instruction handlers for solana processors\n for (const processor of SolanaProcessorState.INSTANCE.getValues()) {\n if (processor.address === instruction.programAccountId) {\n let parsedInstruction: SolInstruction | null = null\n if (instruction.parsed) {\n // const decoded = new TextDecoder().decode(instruction.parsed)\n if (!(instruction.parsed instanceof Uint8Array)) {\n // const parsed = instruction.parsed as Uint8Array\n const values = Object.entries(instruction.parsed).map(([key, value]) => value) as number[]\n instruction.parsed = Uint8Array.from(values)\n }\n\n const a1 = JSON.parse(new TextDecoder().decode(instruction.parsed))\n parsedInstruction = processor.getParsedInstruction(a1)\n } else if (instruction.instructionData) {\n parsedInstruction = processor.getParsedInstruction(instruction.instructionData)\n }\n if (parsedInstruction == null) {\n continue\n }\n const insHandler = processor.getInstructionHandler(parsedInstruction)\n if (insHandler == null) {\n continue\n }\n const res = await processor.handleInstruction(\n parsedInstruction,\n instruction.accounts,\n insHandler,\n instruction.slot\n )\n\n promises.push(Promise.resolve(res))\n }\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processBlock(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Block can't be empty\")\n }\n\n const jsonString = Utf8ArrayToStr(binding.data.raw)\n\n const block: Block = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.blockHandlers[handlerId](block).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing block: ' + block.number + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processTraces(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises = request.bindings.map((binding) => this.processTrace(binding))\n const result = mergeProcessResults(await Promise.all(promises))\n\n recordRuntimeInfo(result, HandlerType.ETH_TRACE)\n return {\n result,\n configUpdated: false,\n }\n }\n\n async processTrace(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Trace can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.raw)\n const trace: Trace = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.traceHandlers[handlerId](trace).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing trace: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosEvent(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const promises: Promise<ProcessResult>[] = []\n const jsonString = Utf8ArrayToStr(binding.data.raw)\n const event = JSON.parse(jsonString)\n\n for (const handlerId of binding.handlerIds) {\n // only support aptos event for now\n promises.push(\n this.aptosEventHandlers[handlerId](event).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing event: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosResource(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.raw)\n const json = JSON.parse(jsonString) as MoveResourcesWithVersionPayload\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.aptosResourceHandlers[handlerId](json).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing event: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosFunctionCall(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.raw)\n const call = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n // only support aptos call for now\n const promise = this.aptosCallHandlers[handlerId](call).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing call: ' + jsonString + '\\n' + errorString(e))\n })\n promises.push(promise)\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n}\n\n// https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript\n/* eslint-disable */\nfunction Utf8ArrayToStr(array: Uint8Array) {\n let out, i, len, c\n let char2, char3\n\n out = ''\n len = array.length\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n }\n }\n\n return out\n}\n\nfunction mergeProcessResults(results: ProcessResult[]): ProcessResult {\n const res = ProcessResult.fromPartial({})\n\n for (const r of results) {\n res.counters = res.counters.concat(r.counters)\n res.gauges = res.gauges.concat(r.gauges)\n res.logs = res.logs.concat(r.logs)\n res.events = res.events.concat(r.events)\n res.exports = res.exports.concat(r.exports)\n }\n return res\n}\n\nfunction recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType) {\n for (const list of [results.gauges, results.counters, results.logs, results.events, results.exports]) {\n list.forEach((e) => {\n e.runtimeInfo = {\n from: handlerType,\n }\n })\n }\n}\n\nfunction errorString(e: Error): string {\n return e.stack || e.message\n}\n"]}
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],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AAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;QAC9C,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACxC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;QAClC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;QACxC,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;KAC5C;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,iBAAiB,CAAC,OAAsB,EAAE,WAAwB;IACzE,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE;QACpG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACjB,CAAC,CAAC,WAAW,GAAG;gBACd,IAAI,EAAE,WAAW;aAClB,CAAA;QACH,CAAC,CAAC,CAAA;KACH;AACH,CAAC;AAED,SAAS,WAAW,CAAC,CAAQ;IAC3B,OAAO,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,CAAA;AAC7B,CAAC","sourcesContent":["import { Block, Log } from '@ethersproject/abstract-provider'\nimport { CallContext, ServerError, Status } from 'nice-grpc'\nimport { SOL_MAINMET_ID, SUI_DEVNET_ID } from './utils/chain'\n\nimport {\n AccountConfig,\n AptosCallHandlerConfig,\n AptosEventHandlerConfig,\n ContractConfig,\n Data,\n Data_SolInstruction,\n DataBinding,\n EventTrackingConfig,\n ExportConfig,\n HandlerType,\n LogFilter,\n LogHandlerConfig,\n MetricConfig,\n ProcessBindingResponse,\n ProcessBindingsRequest,\n ProcessConfigRequest,\n ProcessConfigResponse,\n ProcessorServiceImplementation,\n ProcessResult,\n ServerStreamingMethodResult,\n StartRequest,\n TemplateInstance,\n} from './gen'\n\nimport { Empty } from './gen/google/protobuf/empty'\nimport Long from 'long'\nimport { TextDecoder } from 'util'\nimport { Trace } from './core'\nimport { Instruction as SolInstruction } from '@project-serum/anchor'\nimport { MetricState } from './core/meter'\nimport { ExporterState } from './core/exporter'\nimport { EventTrackerState } from './core/event-tracker'\nimport {\n AptosAccountProcessorState,\n AptosProcessorState,\n MoveResourcesWithVersionPayload,\n} from './aptos/aptos-processor'\nimport { AccountProcessorState } from './core/account-processor'\nimport { SuiProcessorState } from './core/sui-processor'\nimport { SolanaProcessorState } from './core/solana-processor'\nimport { ProcessorState } from './binds'\n;(BigInt.prototype as any).toJSON = function () {\n return this.toString()\n}\n\nconst DEFAULT_MAX_BLOCK = Long.ZERO\n\nconst USER_PROCESSOR = 'user_processor'\n\nexport class ProcessorServiceImpl implements ProcessorServiceImplementation {\n // eth handlers\n private eventHandlers: ((event: Log) => Promise<ProcessResult>)[] = []\n private traceHandlers: ((trace: Trace) => Promise<ProcessResult>)[] = []\n private blockHandlers: ((block: Block) => Promise<ProcessResult>)[] = []\n\n // aptos handlers\n private aptosEventHandlers: ((event: any) => Promise<ProcessResult>)[] = []\n private aptosCallHandlers: ((func: any) => Promise<ProcessResult>)[] = []\n private aptosResourceHandlers: ((resourceWithVersion: MoveResourcesWithVersionPayload) => Promise<ProcessResult>)[] =\n []\n\n // map from chain id to list of processors\n // private blockHandlers = new Map<string, ((block: Block) => Promise<ProcessResult>)[]>()\n // private processorsByChainId = new Map<string, BaseProcessor<BaseContract, BoundContractView<BaseContract, any>>>()\n\n private started = false\n private contractConfigs: ContractConfig[]\n private accountConfigs: AccountConfig[]\n private templateInstances: TemplateInstance[]\n private metricConfigs: MetricConfig[]\n private eventTrackingConfigs: EventTrackingConfig[]\n private exportConfigs: ExportConfig[]\n private readonly loader: () => void\n\n private readonly shutdownHandler?: () => void\n\n constructor(loader: () => void, shutdownHandler?: () => void) {\n this.loader = loader\n this.shutdownHandler = shutdownHandler\n }\n\n async getConfig(request: ProcessConfigRequest, context: CallContext): Promise<ProcessConfigResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n return {\n // TODO project setting\n config: undefined,\n contractConfigs: this.contractConfigs,\n accountConfigs: this.accountConfigs,\n templateInstances: this.templateInstances,\n eventTrackingConfigs: this.eventTrackingConfigs,\n metricConfigs: this.metricConfigs,\n exportConfigs: this.exportConfigs,\n }\n }\n\n async configure() {\n this.eventHandlers = []\n this.templateInstances = []\n // this.processorsByChainId.clear()\n this.contractConfigs = []\n this.accountConfigs = []\n\n this.templateInstances = [...global.PROCESSOR_STATE.templatesInstances]\n this.eventTrackingConfigs = []\n this.metricConfigs = []\n this.exportConfigs = []\n\n // part 0, prepare metrics and event tracking configs\n for (const metric of MetricState.INSTANCE.getValues()) {\n this.metricConfigs.push({\n ...metric.config,\n })\n }\n\n for (const eventTracker of EventTrackerState.INSTANCE.getValues()) {\n this.eventTrackingConfigs.push({\n distinctAggregationByDays: eventTracker.options.distinctByDays || [],\n eventName: eventTracker.name,\n retentionConfig: undefined,\n totalByDay: eventTracker.options.totalByDay || false,\n totalPerEntity: undefined,\n unique: eventTracker.options.unique || false,\n })\n }\n\n for (const exporter of ExporterState.INSTANCE.getValues()) {\n this.exportConfigs.push({\n name: exporter.name,\n channel: exporter.channel,\n })\n }\n\n // Part 1.a, prepare EVM processors\n for (const processor of ProcessorState.INSTANCE.getValues()) {\n // If server favor incremental update this need to change\n // Start basic config for contract\n const chainId = processor.getChainId()\n // this.processorsByChainId.set(chainId, processor)\n\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: processor.config.name,\n chainId: chainId.toString(),\n address: processor.config.address,\n abi: '',\n },\n intervalConfigs: [],\n logConfigs: [],\n traceConfigs: [],\n startBlock: processor.config.startBlock,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n if (processor.config.endBlock) {\n contractConfig.endBlock = processor.config.endBlock\n }\n\n // Step 1. Prepare all the block handlers\n for (const blockHandler of processor.blockHandlers) {\n const handlerId = this.blockHandlers.push(blockHandler.handler) - 1\n // TODO wrap the block handler into one\n\n contractConfig.intervalConfigs.push({\n slot: 0,\n slotInterval: blockHandler.blockInterval,\n minutes: 0,\n minutesInterval: blockHandler.timeIntervalInMinutes,\n handlerId: handlerId,\n })\n }\n\n // Step 2. Prepare all trace handlers\n for (const traceHandler of processor.traceHandlers) {\n const handlerId = this.traceHandlers.push(traceHandler.handler) - 1\n contractConfig.traceConfigs.push({\n signature: traceHandler.signature,\n handlerId: handlerId,\n })\n }\n\n // Step 3. Prepare all the event handlers\n for (const eventsHandler of processor.eventHandlers) {\n // associate id with filter\n const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1\n const logConfig: LogHandlerConfig = {\n handlerId: handlerId,\n filters: [],\n }\n\n for (const filter of eventsHandler.filters) {\n if (!filter.topics) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')\n }\n const logFilter: LogFilter = {\n addressType: undefined,\n address: contractConfig.contract?.address,\n topics: [],\n }\n\n for (const ts of filter.topics) {\n let hashes: string[] = []\n if (Array.isArray(ts)) {\n hashes = hashes.concat(ts)\n } else if (ts) {\n hashes.push(ts)\n }\n logFilter.topics.push({ hashes: hashes })\n }\n logConfig.filters.push(logFilter)\n }\n contractConfig.logConfigs.push(logConfig)\n }\n\n // Finish up a contract\n this.contractConfigs.push(contractConfig)\n }\n\n // part 1.b prepare EVM account processors\n for (const processor of AccountProcessorState.INSTANCE.getValues()) {\n const accountConfig: AccountConfig = {\n address: processor.config.address,\n chainId: processor.getChainId().toString(),\n startBlock: processor.config.startBlock ? Long.fromValue(processor.config.startBlock) : Long.ZERO,\n aptosIntervalConfigs: [],\n intervalConfigs: [],\n logConfigs: [],\n }\n // TODO add interval\n for (const eventsHandler of processor.eventHandlers) {\n // associate id with filter\n const handlerId = this.eventHandlers.push(eventsHandler.handler) - 1\n const logConfig: LogHandlerConfig = {\n handlerId: handlerId,\n filters: [],\n }\n\n for (const filter of eventsHandler.filters) {\n if (!filter.topics) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Topic should not be null')\n }\n const logFilter: LogFilter = {\n addressType: filter.addressType,\n address: filter.address,\n topics: [],\n }\n\n for (const ts of filter.topics) {\n let hashes: string[] = []\n if (Array.isArray(ts)) {\n hashes = hashes.concat(ts)\n } else if (ts) {\n hashes.push(ts)\n }\n logFilter.topics.push({ hashes: hashes })\n }\n logConfig.filters.push(logFilter)\n }\n accountConfig.logConfigs.push(logConfig)\n }\n\n this.accountConfigs.push(accountConfig)\n }\n\n // Part 2, prepare solana constractors\n for (const solanaProcessor of SolanaProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: solanaProcessor.contractName,\n chainId: SOL_MAINMET_ID,\n address: solanaProcessor.address,\n abi: '',\n },\n logConfigs: [],\n traceConfigs: [],\n intervalConfigs: [],\n startBlock: solanaProcessor.config.startSlot,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: {\n innerInstruction: solanaProcessor.processInnerInstruction,\n parsedInstruction: solanaProcessor.fromParsedInstruction !== null,\n rawDataInstruction: solanaProcessor.decodeInstruction !== null,\n },\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n this.contractConfigs.push(contractConfig)\n }\n\n // Part 3, prepare sui constractors\n for (const suiProcessor of SuiProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: 'sui contract',\n chainId: SUI_DEVNET_ID,\n address: suiProcessor.address,\n abi: '',\n },\n logConfigs: [],\n intervalConfigs: [],\n traceConfigs: [],\n startBlock: suiProcessor.config.startSeqNumber,\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n this.contractConfigs.push(contractConfig)\n }\n\n // Part 4, prepare aptos constractors\n for (const aptosProcessor of AptosProcessorState.INSTANCE.getValues()) {\n const contractConfig: ContractConfig = {\n processorType: USER_PROCESSOR,\n contract: {\n name: aptosProcessor.moduleName,\n chainId: aptosProcessor.getChainId(),\n address: aptosProcessor.config.address,\n abi: '',\n },\n intervalConfigs: [],\n logConfigs: [],\n traceConfigs: [],\n startBlock: Long.fromString(aptosProcessor.config.startVersion.toString()),\n endBlock: DEFAULT_MAX_BLOCK,\n instructionConfig: undefined,\n aptosEventConfigs: [],\n aptosCallConfigs: [],\n }\n // 1. Prepare event handlers\n for (const handler of aptosProcessor.eventHandlers) {\n const handlerId = this.aptosEventHandlers.push(handler.handler) - 1\n const eventHandlerConfig: AptosEventHandlerConfig = {\n filters: handler.filters.map((f) => {\n return {\n type: f.type,\n account: f.account || '',\n }\n }),\n handlerId,\n }\n contractConfig.aptosEventConfigs.push(eventHandlerConfig)\n }\n\n // 2. Prepare function handlers\n for (const handler of aptosProcessor.callHandlers) {\n const handlerId = this.aptosCallHandlers.push(handler.handler) - 1\n const functionHandlerConfig: AptosCallHandlerConfig = {\n filters: handler.filters.map((filter) => {\n return {\n function: filter.function,\n typeArguments: filter.typeArguments || [],\n withTypeArguments: filter.typeArguments ? true : false,\n includeFailed: filter.includeFailed || false,\n }\n }),\n handlerId,\n }\n contractConfig.aptosCallConfigs.push(functionHandlerConfig)\n }\n this.contractConfigs.push(contractConfig)\n }\n\n for (const aptosProcessor of AptosAccountProcessorState.INSTANCE.getValues()) {\n const accountConfig: AccountConfig = {\n address: aptosProcessor.config.address,\n chainId: aptosProcessor.getChainId(),\n startBlock: Long.fromValue(aptosProcessor.config.startVersion.toString()),\n aptosIntervalConfigs: [],\n intervalConfigs: [],\n logConfigs: [],\n }\n for (const handler of aptosProcessor.resourcesHandlers) {\n const handlerId = this.aptosResourceHandlers.push(handler.handler) - 1\n accountConfig.aptosIntervalConfigs.push({\n intervalConfig: {\n handlerId: handlerId,\n minutes: 0,\n minutesInterval: handler.timeIntervalInMinutes,\n slot: 0,\n slotInterval: handler.versionInterval,\n },\n type: handler.type || '',\n })\n }\n this.accountConfigs.push(accountConfig)\n }\n }\n\n async start(request: StartRequest, context: CallContext): Promise<Empty> {\n if (this.started) {\n return {}\n }\n\n try {\n this.loader()\n } catch (e) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Failed to load processor: ' + errorString(e))\n }\n\n for (const instance of request.templateInstances) {\n const template = global.PROCESSOR_STATE.templates[instance.templateId]\n if (!template) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Invalid template contract:' + instance)\n }\n if (!instance.contract) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Contract Empty from:' + instance)\n }\n template.bind({\n name: instance.contract.name,\n address: instance.contract.address,\n network: Number(instance.contract.chainId),\n startBlock: instance.startBlock,\n endBlock: instance.endBlock,\n })\n }\n try {\n await this.configure()\n } catch (e) {\n throw new ServerError(Status.INTERNAL, 'Failed to start processor : ' + errorString(e))\n }\n this.started = true\n return {}\n }\n\n async stop(request: Empty, context: CallContext): Promise<Empty> {\n console.log('Server Shutting down in 5 seconds')\n if (this.shutdownHandler) {\n setTimeout(this.shutdownHandler, 5000)\n }\n return {}\n }\n\n async processBindings(request: ProcessBindingsRequest, options?: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises = request.bindings.map((binding) => this.processBinding(binding))\n const result = mergeProcessResults(await Promise.all(promises))\n\n let updated = false\n if (\n global.PROCESSOR_STATE.templatesInstances &&\n this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length\n ) {\n await this.configure()\n updated = true\n }\n\n return {\n result,\n configUpdated: updated,\n }\n }\n\n async processBinding(request: DataBinding, options?: CallContext): Promise<ProcessResult> {\n const processBindingInternal = (request: DataBinding) => {\n switch (request.handlerType) {\n case HandlerType.APT_CALL:\n return this.processAptosFunctionCall(request)\n case HandlerType.APT_EVENT:\n return this.processAptosEvent(request)\n case HandlerType.APT_RESOURCE:\n return this.processAptosResource(request)\n case HandlerType.ETH_LOG:\n return this.processLog(request)\n case HandlerType.ETH_TRACE:\n return this.processTrace(request)\n case HandlerType.ETH_BLOCK:\n return this.processBlock(request)\n case HandlerType.SOL_INSTRUCTION:\n return this.procecessSolInstructions(request)\n // TODO migrate SUI cases\n // case HandlerType.INSTRUCTION:\n // return this.processInstruction(request)\n default:\n throw new ServerError(Status.INVALID_ARGUMENT, 'No handle type registered ' + request.handlerType)\n }\n }\n\n const result = await processBindingInternal(request)\n recordRuntimeInfo(result, request.handlerType)\n return result\n }\n\n async *processBindingsStream(requests: AsyncIterable<DataBinding>, context: CallContext) {\n for await (const request of requests) {\n const result = await this.processBinding(request)\n let updated = false\n if (\n global.PROCESSOR_STATE.templatesInstances &&\n this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length\n ) {\n await this.configure()\n updated = true\n }\n yield {\n result,\n configUpdated: updated,\n }\n }\n }\n\n async processLogs(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises: Promise<ProcessResult>[] = []\n for (const l of request.bindings) {\n promises.push(this.processLog(l))\n }\n\n const result = mergeProcessResults(await Promise.all(promises))\n\n let updated = false\n if (\n global.PROCESSOR_STATE.templatesInstances &&\n this.templateInstances.length != global.PROCESSOR_STATE.templatesInstances.length\n ) {\n await this.configure()\n updated = true\n }\n\n recordRuntimeInfo(result, HandlerType.ETH_LOG)\n return {\n result,\n configUpdated: updated,\n }\n }\n\n async processLog(request: DataBinding): Promise<ProcessResult> {\n if (!request.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Log can't be null\")\n }\n\n const promises: Promise<ProcessResult>[] = []\n const jsonString = Utf8ArrayToStr(request.data.ethLog?.data || request.data.raw)\n const log: Log = JSON.parse(jsonString)\n\n for (const handlerId of request.handlerIds) {\n const handler = this.eventHandlers[handlerId]\n promises.push(\n handler(log).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing log: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async procecessSolInstructions(request: DataBinding): Promise<ProcessResult> {\n if (!request.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'instruction data cannot be empty')\n }\n\n const instruction = request.data.solInstruction || Data_SolInstruction.decode(request.data.raw) // JSON.parse(jsonString)\n const promises: Promise<ProcessResult>[] = []\n\n // Only have instruction handlers for solana processors\n for (const processor of SolanaProcessorState.INSTANCE.getValues()) {\n if (processor.address === instruction.programAccountId) {\n let parsedInstruction: SolInstruction | null = null\n if (instruction.parsed) {\n const a1 = JSON.parse(new TextDecoder().decode(instruction.parsed))\n parsedInstruction = processor.getParsedInstruction(a1)\n } else if (instruction.instructionData) {\n parsedInstruction = processor.getParsedInstruction(instruction.instructionData)\n }\n if (parsedInstruction == null) {\n continue\n }\n const insHandler = processor.getInstructionHandler(parsedInstruction)\n if (insHandler == null) {\n continue\n }\n const res = await processor.handleInstruction(\n parsedInstruction,\n instruction.accounts,\n insHandler,\n instruction.slot\n )\n\n promises.push(Promise.resolve(res))\n }\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processBlock(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Block can't be empty\")\n }\n\n const jsonString = Utf8ArrayToStr(binding.data.ethBlock?.data || binding.data.raw)\n\n const block: Block = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.blockHandlers[handlerId](block).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing block: ' + block.number + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processTraces(request: ProcessBindingsRequest, context: CallContext): Promise<ProcessBindingResponse> {\n if (!this.started) {\n throw new ServerError(Status.UNAVAILABLE, 'Service Not started.')\n }\n\n const promises = request.bindings.map((binding) => this.processTrace(binding))\n const result = mergeProcessResults(await Promise.all(promises))\n\n recordRuntimeInfo(result, HandlerType.ETH_TRACE)\n return {\n result,\n configUpdated: false,\n }\n }\n\n async processTrace(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Trace can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.ethTrace?.data || binding.data.raw)\n const trace: Trace = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.traceHandlers[handlerId](trace).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing trace: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosEvent(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const promises: Promise<ProcessResult>[] = []\n const jsonString = Utf8ArrayToStr(binding.data.aptEvent?.data || binding.data.raw)\n const event = JSON.parse(jsonString)\n\n for (const handlerId of binding.handlerIds) {\n // only support aptos event for now\n promises.push(\n this.aptosEventHandlers[handlerId](event).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing event: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosResource(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.aptResource?.data || binding.data.raw)\n const json = JSON.parse(jsonString) as MoveResourcesWithVersionPayload\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n promises.push(\n this.aptosResourceHandlers[handlerId](json).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing event: ' + jsonString + '\\n' + errorString(e))\n })\n )\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n\n async processAptosFunctionCall(binding: DataBinding): Promise<ProcessResult> {\n if (!binding.data) {\n throw new ServerError(Status.INVALID_ARGUMENT, \"Event can't be empty\")\n }\n const jsonString = Utf8ArrayToStr(binding.data.aptCall?.data || binding.data.raw)\n const call = JSON.parse(jsonString)\n\n const promises: Promise<ProcessResult>[] = []\n for (const handlerId of binding.handlerIds) {\n // only support aptos call for now\n const promise = this.aptosCallHandlers[handlerId](call).catch((e) => {\n throw new ServerError(Status.INTERNAL, 'error processing call: ' + jsonString + '\\n' + errorString(e))\n })\n promises.push(promise)\n }\n return mergeProcessResults(await Promise.all(promises))\n }\n}\n\n// https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript\n/* eslint-disable */\nfunction Utf8ArrayToStr(array: Uint8Array) {\n let out, i, len, c\n let char2, char3\n\n out = ''\n len = array.length\n i = 0\n while (i < len) {\n c = array[i++]\n switch (c >> 4) {\n case 0:\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n case 6:\n case 7:\n // 0xxxxxxx\n out += String.fromCharCode(c)\n break\n case 12:\n case 13:\n // 110x xxxx 10xx xxxx\n char2 = array[i++]\n out += String.fromCharCode(((c & 0x1f) << 6) | (char2 & 0x3f))\n break\n case 14:\n // 1110 xxxx 10xx xxxx 10xx xxxx\n char2 = array[i++]\n char3 = array[i++]\n out += String.fromCharCode(((c & 0x0f) << 12) | ((char2 & 0x3f) << 6) | ((char3 & 0x3f) << 0))\n break\n }\n }\n\n return out\n}\n\nfunction mergeProcessResults(results: ProcessResult[]): ProcessResult {\n const res = ProcessResult.fromPartial({})\n\n for (const r of results) {\n res.counters = res.counters.concat(r.counters)\n res.gauges = res.gauges.concat(r.gauges)\n res.logs = res.logs.concat(r.logs)\n res.events = res.events.concat(r.events)\n res.exports = res.exports.concat(r.exports)\n }\n return res\n}\n\nfunction recordRuntimeInfo(results: ProcessResult, handlerType: HandlerType) {\n for (const list of [results.gauges, results.counters, results.logs, results.events, results.exports]) {\n list.forEach((e) => {\n e.runtimeInfo = {\n from: handlerType,\n }\n })\n }\n}\n\nfunction errorString(e: Error): string {\n return e.stack || e.message\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountConfig, ContractConfig, DataBinding,
|
|
1
|
+
import { AccountConfig, ContractConfig, DataBinding, Data_SolInstruction, ProcessBindingResponse, ProcessBindingsRequest, ProcessConfigRequest, ProcessConfigResponse, ProcessorServiceImplementation, StartRequest } from '../gen';
|
|
2
2
|
import { CallContext } from 'nice-grpc-common';
|
|
3
3
|
import { Empty } from '../gen/google/protobuf/empty';
|
|
4
4
|
import { Block, Log } from '@ethersproject/abstract-provider';
|
|
@@ -35,6 +35,10 @@ export declare class TestProcessorServer implements ProcessorServiceImplementati
|
|
|
35
35
|
buildBlockBinding(block: Partial<Block> & {
|
|
36
36
|
number: number;
|
|
37
37
|
}, network?: Networkish): DataBinding;
|
|
38
|
-
testInstructions(instructions:
|
|
38
|
+
testInstructions(instructions: Data_SolInstruction[]): Promise<ProcessBindingResponse>;
|
|
39
39
|
processBindings(request: ProcessBindingsRequest, context?: CallContext): Promise<ProcessBindingResponse>;
|
|
40
|
+
processBindingsStream(request: AsyncIterable<DataBinding>, context: CallContext): AsyncGenerator<{
|
|
41
|
+
result: import("../gen").ProcessResult;
|
|
42
|
+
configUpdated: boolean;
|
|
43
|
+
}, void, unknown>;
|
|
40
44
|
}
|