@sentio/sdk 1.7.22 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gen/processor/protos/processor.d.ts +80 -16
- package/lib/gen/processor/protos/processor.js +236 -19
- package/lib/gen/processor/protos/processor.js.map +1 -1
- package/lib/meter.js +1 -1
- package/lib/meter.js.map +1 -1
- package/lib/service.d.ts +2 -1
- package/lib/service.js +6 -1
- package/lib/service.js.map +1 -1
- package/lib/test/index.d.ts +1 -0
- package/lib/test/index.js +3 -1
- package/lib/test/index.js.map +1 -1
- package/lib/test/test-processor-server.d.ts +2 -1
- package/lib/test/test-processor-server.js +3 -0
- package/lib/test/test-processor-server.js.map +1 -1
- package/lib/test/test-provider.d.ts +1 -0
- package/lib/test/test-provider.js +25 -0
- package/lib/test/test-provider.js.map +1 -0
- package/lib/utils/chainmap.js +3 -3
- package/lib/utils/chainmap.js.map +1 -1
- package/lib/utils/erc20.test.js +6 -11
- package/lib/utils/erc20.test.js.map +1 -1
- package/package.json +1 -1
- package/src/gen/processor/protos/processor.ts +327 -32
- package/src/meter.ts +1 -1
- package/src/service.ts +9 -1
- package/src/test/index.ts +1 -0
- package/src/test/test-processor-server.ts +6 -0
- package/src/test/test-provider.ts +25 -0
- package/src/utils/chainmap.ts +3 -3
- package/src/utils/erc20.test.ts +7 -12
|
@@ -10,6 +10,7 @@ export enum HandlerType {
|
|
|
10
10
|
BLOCK = 2,
|
|
11
11
|
TRANSACTION = 3,
|
|
12
12
|
INSTRUCTION = 4,
|
|
13
|
+
TRACE = 5,
|
|
13
14
|
UNRECOGNIZED = -1,
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -30,6 +31,9 @@ export function handlerTypeFromJSON(object: any): HandlerType {
|
|
|
30
31
|
case 4:
|
|
31
32
|
case "INSTRUCTION":
|
|
32
33
|
return HandlerType.INSTRUCTION;
|
|
34
|
+
case 5:
|
|
35
|
+
case "TRACE":
|
|
36
|
+
return HandlerType.TRACE;
|
|
33
37
|
case -1:
|
|
34
38
|
case "UNRECOGNIZED":
|
|
35
39
|
default:
|
|
@@ -49,6 +53,8 @@ export function handlerTypeToJSON(object: HandlerType): string {
|
|
|
49
53
|
return "TRANSACTION";
|
|
50
54
|
case HandlerType.INSTRUCTION:
|
|
51
55
|
return "INSTRUCTION";
|
|
56
|
+
case HandlerType.TRACE:
|
|
57
|
+
return "TRACE";
|
|
52
58
|
case HandlerType.UNRECOGNIZED:
|
|
53
59
|
default:
|
|
54
60
|
return "UNRECOGNIZED";
|
|
@@ -128,6 +134,14 @@ export interface ProcessLogsResponse {
|
|
|
128
134
|
configUpdated: boolean;
|
|
129
135
|
}
|
|
130
136
|
|
|
137
|
+
export interface ProcessTracesRequest {
|
|
138
|
+
logBindings: LogBinding[];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface ProcessTracesResponse {
|
|
142
|
+
result: O11yResult | undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
131
145
|
export interface ProcessTransactionsRequest {
|
|
132
146
|
transaction: Transaction | undefined;
|
|
133
147
|
}
|
|
@@ -153,11 +167,20 @@ export interface ProcessBlocksResponse {
|
|
|
153
167
|
}
|
|
154
168
|
|
|
155
169
|
export interface LogBinding {
|
|
156
|
-
log:
|
|
170
|
+
log: RawLog | undefined;
|
|
157
171
|
handlerId: number;
|
|
158
172
|
}
|
|
159
173
|
|
|
160
|
-
export interface
|
|
174
|
+
export interface RawLog {
|
|
175
|
+
raw: Uint8Array;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface TraceBinding {
|
|
179
|
+
trace: RawTrace | undefined;
|
|
180
|
+
handlerId: number;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface RawTrace {
|
|
161
184
|
raw: Uint8Array;
|
|
162
185
|
}
|
|
163
186
|
|
|
@@ -175,11 +198,11 @@ export interface Instruction {
|
|
|
175
198
|
}
|
|
176
199
|
|
|
177
200
|
export interface BlockBinding {
|
|
178
|
-
block:
|
|
201
|
+
block: RawBlock | undefined;
|
|
179
202
|
handlerIds: number[];
|
|
180
203
|
}
|
|
181
204
|
|
|
182
|
-
export interface
|
|
205
|
+
export interface RawBlock {
|
|
183
206
|
raw: Uint8Array;
|
|
184
207
|
}
|
|
185
208
|
|
|
@@ -1323,6 +1346,135 @@ export const ProcessLogsResponse = {
|
|
|
1323
1346
|
},
|
|
1324
1347
|
};
|
|
1325
1348
|
|
|
1349
|
+
function createBaseProcessTracesRequest(): ProcessTracesRequest {
|
|
1350
|
+
return { logBindings: [] };
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
export const ProcessTracesRequest = {
|
|
1354
|
+
encode(
|
|
1355
|
+
message: ProcessTracesRequest,
|
|
1356
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1357
|
+
): _m0.Writer {
|
|
1358
|
+
for (const v of message.logBindings) {
|
|
1359
|
+
LogBinding.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
1360
|
+
}
|
|
1361
|
+
return writer;
|
|
1362
|
+
},
|
|
1363
|
+
|
|
1364
|
+
decode(
|
|
1365
|
+
input: _m0.Reader | Uint8Array,
|
|
1366
|
+
length?: number
|
|
1367
|
+
): ProcessTracesRequest {
|
|
1368
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1369
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1370
|
+
const message = createBaseProcessTracesRequest();
|
|
1371
|
+
while (reader.pos < end) {
|
|
1372
|
+
const tag = reader.uint32();
|
|
1373
|
+
switch (tag >>> 3) {
|
|
1374
|
+
case 1:
|
|
1375
|
+
message.logBindings.push(LogBinding.decode(reader, reader.uint32()));
|
|
1376
|
+
break;
|
|
1377
|
+
default:
|
|
1378
|
+
reader.skipType(tag & 7);
|
|
1379
|
+
break;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
return message;
|
|
1383
|
+
},
|
|
1384
|
+
|
|
1385
|
+
fromJSON(object: any): ProcessTracesRequest {
|
|
1386
|
+
return {
|
|
1387
|
+
logBindings: Array.isArray(object?.logBindings)
|
|
1388
|
+
? object.logBindings.map((e: any) => LogBinding.fromJSON(e))
|
|
1389
|
+
: [],
|
|
1390
|
+
};
|
|
1391
|
+
},
|
|
1392
|
+
|
|
1393
|
+
toJSON(message: ProcessTracesRequest): unknown {
|
|
1394
|
+
const obj: any = {};
|
|
1395
|
+
if (message.logBindings) {
|
|
1396
|
+
obj.logBindings = message.logBindings.map((e) =>
|
|
1397
|
+
e ? LogBinding.toJSON(e) : undefined
|
|
1398
|
+
);
|
|
1399
|
+
} else {
|
|
1400
|
+
obj.logBindings = [];
|
|
1401
|
+
}
|
|
1402
|
+
return obj;
|
|
1403
|
+
},
|
|
1404
|
+
|
|
1405
|
+
fromPartial(object: DeepPartial<ProcessTracesRequest>): ProcessTracesRequest {
|
|
1406
|
+
const message = createBaseProcessTracesRequest();
|
|
1407
|
+
message.logBindings =
|
|
1408
|
+
object.logBindings?.map((e) => LogBinding.fromPartial(e)) || [];
|
|
1409
|
+
return message;
|
|
1410
|
+
},
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
function createBaseProcessTracesResponse(): ProcessTracesResponse {
|
|
1414
|
+
return { result: undefined };
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
export const ProcessTracesResponse = {
|
|
1418
|
+
encode(
|
|
1419
|
+
message: ProcessTracesResponse,
|
|
1420
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1421
|
+
): _m0.Writer {
|
|
1422
|
+
if (message.result !== undefined) {
|
|
1423
|
+
O11yResult.encode(message.result, writer.uint32(10).fork()).ldelim();
|
|
1424
|
+
}
|
|
1425
|
+
return writer;
|
|
1426
|
+
},
|
|
1427
|
+
|
|
1428
|
+
decode(
|
|
1429
|
+
input: _m0.Reader | Uint8Array,
|
|
1430
|
+
length?: number
|
|
1431
|
+
): ProcessTracesResponse {
|
|
1432
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1433
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1434
|
+
const message = createBaseProcessTracesResponse();
|
|
1435
|
+
while (reader.pos < end) {
|
|
1436
|
+
const tag = reader.uint32();
|
|
1437
|
+
switch (tag >>> 3) {
|
|
1438
|
+
case 1:
|
|
1439
|
+
message.result = O11yResult.decode(reader, reader.uint32());
|
|
1440
|
+
break;
|
|
1441
|
+
default:
|
|
1442
|
+
reader.skipType(tag & 7);
|
|
1443
|
+
break;
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
return message;
|
|
1447
|
+
},
|
|
1448
|
+
|
|
1449
|
+
fromJSON(object: any): ProcessTracesResponse {
|
|
1450
|
+
return {
|
|
1451
|
+
result: isSet(object.result)
|
|
1452
|
+
? O11yResult.fromJSON(object.result)
|
|
1453
|
+
: undefined,
|
|
1454
|
+
};
|
|
1455
|
+
},
|
|
1456
|
+
|
|
1457
|
+
toJSON(message: ProcessTracesResponse): unknown {
|
|
1458
|
+
const obj: any = {};
|
|
1459
|
+
message.result !== undefined &&
|
|
1460
|
+
(obj.result = message.result
|
|
1461
|
+
? O11yResult.toJSON(message.result)
|
|
1462
|
+
: undefined);
|
|
1463
|
+
return obj;
|
|
1464
|
+
},
|
|
1465
|
+
|
|
1466
|
+
fromPartial(
|
|
1467
|
+
object: DeepPartial<ProcessTracesResponse>
|
|
1468
|
+
): ProcessTracesResponse {
|
|
1469
|
+
const message = createBaseProcessTracesResponse();
|
|
1470
|
+
message.result =
|
|
1471
|
+
object.result !== undefined && object.result !== null
|
|
1472
|
+
? O11yResult.fromPartial(object.result)
|
|
1473
|
+
: undefined;
|
|
1474
|
+
return message;
|
|
1475
|
+
},
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1326
1478
|
function createBaseProcessTransactionsRequest(): ProcessTransactionsRequest {
|
|
1327
1479
|
return { transaction: undefined };
|
|
1328
1480
|
}
|
|
@@ -1730,7 +1882,7 @@ export const LogBinding = {
|
|
|
1730
1882
|
writer: _m0.Writer = _m0.Writer.create()
|
|
1731
1883
|
): _m0.Writer {
|
|
1732
1884
|
if (message.log !== undefined) {
|
|
1733
|
-
|
|
1885
|
+
RawLog.encode(message.log, writer.uint32(10).fork()).ldelim();
|
|
1734
1886
|
}
|
|
1735
1887
|
if (message.handlerId !== 0) {
|
|
1736
1888
|
writer.uint32(16).int32(message.handlerId);
|
|
@@ -1746,7 +1898,7 @@ export const LogBinding = {
|
|
|
1746
1898
|
const tag = reader.uint32();
|
|
1747
1899
|
switch (tag >>> 3) {
|
|
1748
1900
|
case 1:
|
|
1749
|
-
message.log =
|
|
1901
|
+
message.log = RawLog.decode(reader, reader.uint32());
|
|
1750
1902
|
break;
|
|
1751
1903
|
case 2:
|
|
1752
1904
|
message.handlerId = reader.int32();
|
|
@@ -1761,7 +1913,7 @@ export const LogBinding = {
|
|
|
1761
1913
|
|
|
1762
1914
|
fromJSON(object: any): LogBinding {
|
|
1763
1915
|
return {
|
|
1764
|
-
log: isSet(object.log) ?
|
|
1916
|
+
log: isSet(object.log) ? RawLog.fromJSON(object.log) : undefined,
|
|
1765
1917
|
handlerId: isSet(object.handlerId) ? Number(object.handlerId) : 0,
|
|
1766
1918
|
};
|
|
1767
1919
|
},
|
|
@@ -1769,7 +1921,7 @@ export const LogBinding = {
|
|
|
1769
1921
|
toJSON(message: LogBinding): unknown {
|
|
1770
1922
|
const obj: any = {};
|
|
1771
1923
|
message.log !== undefined &&
|
|
1772
|
-
(obj.log = message.log ?
|
|
1924
|
+
(obj.log = message.log ? RawLog.toJSON(message.log) : undefined);
|
|
1773
1925
|
message.handlerId !== undefined &&
|
|
1774
1926
|
(obj.handlerId = Math.round(message.handlerId));
|
|
1775
1927
|
return obj;
|
|
@@ -1779,29 +1931,32 @@ export const LogBinding = {
|
|
|
1779
1931
|
const message = createBaseLogBinding();
|
|
1780
1932
|
message.log =
|
|
1781
1933
|
object.log !== undefined && object.log !== null
|
|
1782
|
-
?
|
|
1934
|
+
? RawLog.fromPartial(object.log)
|
|
1783
1935
|
: undefined;
|
|
1784
1936
|
message.handlerId = object.handlerId ?? 0;
|
|
1785
1937
|
return message;
|
|
1786
1938
|
},
|
|
1787
1939
|
};
|
|
1788
1940
|
|
|
1789
|
-
function
|
|
1941
|
+
function createBaseRawLog(): RawLog {
|
|
1790
1942
|
return { raw: new Uint8Array() };
|
|
1791
1943
|
}
|
|
1792
1944
|
|
|
1793
|
-
export const
|
|
1794
|
-
encode(
|
|
1945
|
+
export const RawLog = {
|
|
1946
|
+
encode(
|
|
1947
|
+
message: RawLog,
|
|
1948
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
1949
|
+
): _m0.Writer {
|
|
1795
1950
|
if (message.raw.length !== 0) {
|
|
1796
1951
|
writer.uint32(10).bytes(message.raw);
|
|
1797
1952
|
}
|
|
1798
1953
|
return writer;
|
|
1799
1954
|
},
|
|
1800
1955
|
|
|
1801
|
-
decode(input: _m0.Reader | Uint8Array, length?: number):
|
|
1956
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): RawLog {
|
|
1802
1957
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
1803
1958
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
1804
|
-
const message =
|
|
1959
|
+
const message = createBaseRawLog();
|
|
1805
1960
|
while (reader.pos < end) {
|
|
1806
1961
|
const tag = reader.uint32();
|
|
1807
1962
|
switch (tag >>> 3) {
|
|
@@ -1816,13 +1971,13 @@ export const Log = {
|
|
|
1816
1971
|
return message;
|
|
1817
1972
|
},
|
|
1818
1973
|
|
|
1819
|
-
fromJSON(object: any):
|
|
1974
|
+
fromJSON(object: any): RawLog {
|
|
1820
1975
|
return {
|
|
1821
1976
|
raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
|
|
1822
1977
|
};
|
|
1823
1978
|
},
|
|
1824
1979
|
|
|
1825
|
-
toJSON(message:
|
|
1980
|
+
toJSON(message: RawLog): unknown {
|
|
1826
1981
|
const obj: any = {};
|
|
1827
1982
|
message.raw !== undefined &&
|
|
1828
1983
|
(obj.raw = base64FromBytes(
|
|
@@ -1831,8 +1986,129 @@ export const Log = {
|
|
|
1831
1986
|
return obj;
|
|
1832
1987
|
},
|
|
1833
1988
|
|
|
1834
|
-
fromPartial(object: DeepPartial<
|
|
1835
|
-
const message =
|
|
1989
|
+
fromPartial(object: DeepPartial<RawLog>): RawLog {
|
|
1990
|
+
const message = createBaseRawLog();
|
|
1991
|
+
message.raw = object.raw ?? new Uint8Array();
|
|
1992
|
+
return message;
|
|
1993
|
+
},
|
|
1994
|
+
};
|
|
1995
|
+
|
|
1996
|
+
function createBaseTraceBinding(): TraceBinding {
|
|
1997
|
+
return { trace: undefined, handlerId: 0 };
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
export const TraceBinding = {
|
|
2001
|
+
encode(
|
|
2002
|
+
message: TraceBinding,
|
|
2003
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
2004
|
+
): _m0.Writer {
|
|
2005
|
+
if (message.trace !== undefined) {
|
|
2006
|
+
RawTrace.encode(message.trace, writer.uint32(10).fork()).ldelim();
|
|
2007
|
+
}
|
|
2008
|
+
if (message.handlerId !== 0) {
|
|
2009
|
+
writer.uint32(16).int32(message.handlerId);
|
|
2010
|
+
}
|
|
2011
|
+
return writer;
|
|
2012
|
+
},
|
|
2013
|
+
|
|
2014
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): TraceBinding {
|
|
2015
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
2016
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2017
|
+
const message = createBaseTraceBinding();
|
|
2018
|
+
while (reader.pos < end) {
|
|
2019
|
+
const tag = reader.uint32();
|
|
2020
|
+
switch (tag >>> 3) {
|
|
2021
|
+
case 1:
|
|
2022
|
+
message.trace = RawTrace.decode(reader, reader.uint32());
|
|
2023
|
+
break;
|
|
2024
|
+
case 2:
|
|
2025
|
+
message.handlerId = reader.int32();
|
|
2026
|
+
break;
|
|
2027
|
+
default:
|
|
2028
|
+
reader.skipType(tag & 7);
|
|
2029
|
+
break;
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
return message;
|
|
2033
|
+
},
|
|
2034
|
+
|
|
2035
|
+
fromJSON(object: any): TraceBinding {
|
|
2036
|
+
return {
|
|
2037
|
+
trace: isSet(object.trace) ? RawTrace.fromJSON(object.trace) : undefined,
|
|
2038
|
+
handlerId: isSet(object.handlerId) ? Number(object.handlerId) : 0,
|
|
2039
|
+
};
|
|
2040
|
+
},
|
|
2041
|
+
|
|
2042
|
+
toJSON(message: TraceBinding): unknown {
|
|
2043
|
+
const obj: any = {};
|
|
2044
|
+
message.trace !== undefined &&
|
|
2045
|
+
(obj.trace = message.trace ? RawTrace.toJSON(message.trace) : undefined);
|
|
2046
|
+
message.handlerId !== undefined &&
|
|
2047
|
+
(obj.handlerId = Math.round(message.handlerId));
|
|
2048
|
+
return obj;
|
|
2049
|
+
},
|
|
2050
|
+
|
|
2051
|
+
fromPartial(object: DeepPartial<TraceBinding>): TraceBinding {
|
|
2052
|
+
const message = createBaseTraceBinding();
|
|
2053
|
+
message.trace =
|
|
2054
|
+
object.trace !== undefined && object.trace !== null
|
|
2055
|
+
? RawTrace.fromPartial(object.trace)
|
|
2056
|
+
: undefined;
|
|
2057
|
+
message.handlerId = object.handlerId ?? 0;
|
|
2058
|
+
return message;
|
|
2059
|
+
},
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
function createBaseRawTrace(): RawTrace {
|
|
2063
|
+
return { raw: new Uint8Array() };
|
|
2064
|
+
}
|
|
2065
|
+
|
|
2066
|
+
export const RawTrace = {
|
|
2067
|
+
encode(
|
|
2068
|
+
message: RawTrace,
|
|
2069
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
2070
|
+
): _m0.Writer {
|
|
2071
|
+
if (message.raw.length !== 0) {
|
|
2072
|
+
writer.uint32(10).bytes(message.raw);
|
|
2073
|
+
}
|
|
2074
|
+
return writer;
|
|
2075
|
+
},
|
|
2076
|
+
|
|
2077
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): RawTrace {
|
|
2078
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
2079
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2080
|
+
const message = createBaseRawTrace();
|
|
2081
|
+
while (reader.pos < end) {
|
|
2082
|
+
const tag = reader.uint32();
|
|
2083
|
+
switch (tag >>> 3) {
|
|
2084
|
+
case 1:
|
|
2085
|
+
message.raw = reader.bytes();
|
|
2086
|
+
break;
|
|
2087
|
+
default:
|
|
2088
|
+
reader.skipType(tag & 7);
|
|
2089
|
+
break;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
return message;
|
|
2093
|
+
},
|
|
2094
|
+
|
|
2095
|
+
fromJSON(object: any): RawTrace {
|
|
2096
|
+
return {
|
|
2097
|
+
raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
|
|
2098
|
+
};
|
|
2099
|
+
},
|
|
2100
|
+
|
|
2101
|
+
toJSON(message: RawTrace): unknown {
|
|
2102
|
+
const obj: any = {};
|
|
2103
|
+
message.raw !== undefined &&
|
|
2104
|
+
(obj.raw = base64FromBytes(
|
|
2105
|
+
message.raw !== undefined ? message.raw : new Uint8Array()
|
|
2106
|
+
));
|
|
2107
|
+
return obj;
|
|
2108
|
+
},
|
|
2109
|
+
|
|
2110
|
+
fromPartial(object: DeepPartial<RawTrace>): RawTrace {
|
|
2111
|
+
const message = createBaseRawTrace();
|
|
1836
2112
|
message.raw = object.raw ?? new Uint8Array();
|
|
1837
2113
|
return message;
|
|
1838
2114
|
},
|
|
@@ -2022,7 +2298,7 @@ export const BlockBinding = {
|
|
|
2022
2298
|
writer: _m0.Writer = _m0.Writer.create()
|
|
2023
2299
|
): _m0.Writer {
|
|
2024
2300
|
if (message.block !== undefined) {
|
|
2025
|
-
|
|
2301
|
+
RawBlock.encode(message.block, writer.uint32(10).fork()).ldelim();
|
|
2026
2302
|
}
|
|
2027
2303
|
writer.uint32(18).fork();
|
|
2028
2304
|
for (const v of message.handlerIds) {
|
|
@@ -2040,7 +2316,7 @@ export const BlockBinding = {
|
|
|
2040
2316
|
const tag = reader.uint32();
|
|
2041
2317
|
switch (tag >>> 3) {
|
|
2042
2318
|
case 1:
|
|
2043
|
-
message.block =
|
|
2319
|
+
message.block = RawBlock.decode(reader, reader.uint32());
|
|
2044
2320
|
break;
|
|
2045
2321
|
case 2:
|
|
2046
2322
|
if ((tag & 7) === 2) {
|
|
@@ -2062,7 +2338,7 @@ export const BlockBinding = {
|
|
|
2062
2338
|
|
|
2063
2339
|
fromJSON(object: any): BlockBinding {
|
|
2064
2340
|
return {
|
|
2065
|
-
block: isSet(object.block) ?
|
|
2341
|
+
block: isSet(object.block) ? RawBlock.fromJSON(object.block) : undefined,
|
|
2066
2342
|
handlerIds: Array.isArray(object?.handlerIds)
|
|
2067
2343
|
? object.handlerIds.map((e: any) => Number(e))
|
|
2068
2344
|
: [],
|
|
@@ -2072,7 +2348,7 @@ export const BlockBinding = {
|
|
|
2072
2348
|
toJSON(message: BlockBinding): unknown {
|
|
2073
2349
|
const obj: any = {};
|
|
2074
2350
|
message.block !== undefined &&
|
|
2075
|
-
(obj.block = message.block ?
|
|
2351
|
+
(obj.block = message.block ? RawBlock.toJSON(message.block) : undefined);
|
|
2076
2352
|
if (message.handlerIds) {
|
|
2077
2353
|
obj.handlerIds = message.handlerIds.map((e) => Math.round(e));
|
|
2078
2354
|
} else {
|
|
@@ -2085,29 +2361,32 @@ export const BlockBinding = {
|
|
|
2085
2361
|
const message = createBaseBlockBinding();
|
|
2086
2362
|
message.block =
|
|
2087
2363
|
object.block !== undefined && object.block !== null
|
|
2088
|
-
?
|
|
2364
|
+
? RawBlock.fromPartial(object.block)
|
|
2089
2365
|
: undefined;
|
|
2090
2366
|
message.handlerIds = object.handlerIds?.map((e) => e) || [];
|
|
2091
2367
|
return message;
|
|
2092
2368
|
},
|
|
2093
2369
|
};
|
|
2094
2370
|
|
|
2095
|
-
function
|
|
2371
|
+
function createBaseRawBlock(): RawBlock {
|
|
2096
2372
|
return { raw: new Uint8Array() };
|
|
2097
2373
|
}
|
|
2098
2374
|
|
|
2099
|
-
export const
|
|
2100
|
-
encode(
|
|
2375
|
+
export const RawBlock = {
|
|
2376
|
+
encode(
|
|
2377
|
+
message: RawBlock,
|
|
2378
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
2379
|
+
): _m0.Writer {
|
|
2101
2380
|
if (message.raw.length !== 0) {
|
|
2102
2381
|
writer.uint32(10).bytes(message.raw);
|
|
2103
2382
|
}
|
|
2104
2383
|
return writer;
|
|
2105
2384
|
},
|
|
2106
2385
|
|
|
2107
|
-
decode(input: _m0.Reader | Uint8Array, length?: number):
|
|
2386
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): RawBlock {
|
|
2108
2387
|
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
2109
2388
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
2110
|
-
const message =
|
|
2389
|
+
const message = createBaseRawBlock();
|
|
2111
2390
|
while (reader.pos < end) {
|
|
2112
2391
|
const tag = reader.uint32();
|
|
2113
2392
|
switch (tag >>> 3) {
|
|
@@ -2122,13 +2401,13 @@ export const Block = {
|
|
|
2122
2401
|
return message;
|
|
2123
2402
|
},
|
|
2124
2403
|
|
|
2125
|
-
fromJSON(object: any):
|
|
2404
|
+
fromJSON(object: any): RawBlock {
|
|
2126
2405
|
return {
|
|
2127
2406
|
raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(),
|
|
2128
2407
|
};
|
|
2129
2408
|
},
|
|
2130
2409
|
|
|
2131
|
-
toJSON(message:
|
|
2410
|
+
toJSON(message: RawBlock): unknown {
|
|
2132
2411
|
const obj: any = {};
|
|
2133
2412
|
message.raw !== undefined &&
|
|
2134
2413
|
(obj.raw = base64FromBytes(
|
|
@@ -2137,8 +2416,8 @@ export const Block = {
|
|
|
2137
2416
|
return obj;
|
|
2138
2417
|
},
|
|
2139
2418
|
|
|
2140
|
-
fromPartial(object: DeepPartial<
|
|
2141
|
-
const message =
|
|
2419
|
+
fromPartial(object: DeepPartial<RawBlock>): RawBlock {
|
|
2420
|
+
const message = createBaseRawBlock();
|
|
2142
2421
|
message.raw = object.raw ?? new Uint8Array();
|
|
2143
2422
|
return message;
|
|
2144
2423
|
},
|
|
@@ -2911,6 +3190,14 @@ export const ProcessorDefinition = {
|
|
|
2911
3190
|
responseStream: false,
|
|
2912
3191
|
options: {},
|
|
2913
3192
|
},
|
|
3193
|
+
processTraces: {
|
|
3194
|
+
name: "ProcessTraces",
|
|
3195
|
+
requestType: ProcessTracesRequest,
|
|
3196
|
+
requestStream: false,
|
|
3197
|
+
responseType: ProcessTracesResponse,
|
|
3198
|
+
responseStream: false,
|
|
3199
|
+
options: {},
|
|
3200
|
+
},
|
|
2914
3201
|
processTransactions: {
|
|
2915
3202
|
name: "ProcessTransactions",
|
|
2916
3203
|
requestType: ProcessTransactionsRequest,
|
|
@@ -2955,6 +3242,10 @@ export interface ProcessorServiceImplementation<CallContextExt = {}> {
|
|
|
2955
3242
|
request: ProcessLogsRequest,
|
|
2956
3243
|
context: CallContext & CallContextExt
|
|
2957
3244
|
): Promise<DeepPartial<ProcessLogsResponse>>;
|
|
3245
|
+
processTraces(
|
|
3246
|
+
request: ProcessTracesRequest,
|
|
3247
|
+
context: CallContext & CallContextExt
|
|
3248
|
+
): Promise<DeepPartial<ProcessTracesResponse>>;
|
|
2958
3249
|
processTransactions(
|
|
2959
3250
|
request: ProcessTransactionsRequest,
|
|
2960
3251
|
context: CallContext & CallContextExt
|
|
@@ -2986,6 +3277,10 @@ export interface ProcessorClient<CallOptionsExt = {}> {
|
|
|
2986
3277
|
request: DeepPartial<ProcessLogsRequest>,
|
|
2987
3278
|
options?: CallOptions & CallOptionsExt
|
|
2988
3279
|
): Promise<ProcessLogsResponse>;
|
|
3280
|
+
processTraces(
|
|
3281
|
+
request: DeepPartial<ProcessTracesRequest>,
|
|
3282
|
+
options?: CallOptions & CallOptionsExt
|
|
3283
|
+
): Promise<ProcessTracesResponse>;
|
|
2989
3284
|
processTransactions(
|
|
2990
3285
|
request: DeepPartial<ProcessTransactionsRequest>,
|
|
2991
3286
|
options?: CallOptions & CallOptionsExt
|
package/src/meter.ts
CHANGED
|
@@ -40,7 +40,7 @@ function GetRecordMetaData(ctx: EthContext | SolanaContext, name: string, labels
|
|
|
40
40
|
blockNumber: Long.ZERO, // TODO need number type to be long
|
|
41
41
|
transactionIndex: 0,
|
|
42
42
|
logIndex: 0,
|
|
43
|
-
chainId: '
|
|
43
|
+
chainId: 'SOL_mainnet', // TODO set in context
|
|
44
44
|
name: name,
|
|
45
45
|
labels: labels,
|
|
46
46
|
}
|
package/src/service.ts
CHANGED
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
ProcessLogsRequest,
|
|
18
18
|
ProcessLogsResponse,
|
|
19
19
|
ProcessorServiceImplementation,
|
|
20
|
+
ProcessTracesRequest,
|
|
21
|
+
ProcessTracesResponse,
|
|
20
22
|
ProcessTransactionsRequest,
|
|
21
23
|
ProcessTransactionsResponse,
|
|
22
24
|
StartRequest,
|
|
@@ -143,7 +145,7 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
143
145
|
processorType: 'user_processor',
|
|
144
146
|
contract: {
|
|
145
147
|
name: solanaProcessor.contractName,
|
|
146
|
-
chainId: '
|
|
148
|
+
chainId: 'SOL_mainnet', // TODO set in processor
|
|
147
149
|
address: solanaProcessor.address,
|
|
148
150
|
abi: '',
|
|
149
151
|
},
|
|
@@ -381,6 +383,12 @@ export class ProcessorServiceImpl implements ProcessorServiceImplementation {
|
|
|
381
383
|
}
|
|
382
384
|
return resp
|
|
383
385
|
}
|
|
386
|
+
|
|
387
|
+
async processTraces(request: ProcessTracesRequest, context: CallContext): Promise<ProcessTracesResponse> {
|
|
388
|
+
return {
|
|
389
|
+
result: undefined,
|
|
390
|
+
}
|
|
391
|
+
}
|
|
384
392
|
}
|
|
385
393
|
|
|
386
394
|
// https://ourcodeworld.com/articles/read/164/how-to-convert-an-uint8array-to-string-in-javascript
|
package/src/test/index.ts
CHANGED
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
ProcessorServiceImpl,
|
|
14
14
|
ProcessorServiceImplementation,
|
|
15
15
|
ProcessorState,
|
|
16
|
+
ProcessTracesRequest,
|
|
17
|
+
ProcessTracesResponse,
|
|
16
18
|
ProcessTransactionsRequest,
|
|
17
19
|
ProcessTransactionsResponse,
|
|
18
20
|
setProvider,
|
|
@@ -82,6 +84,10 @@ export class TestProcessorServer implements ProcessorServiceImplementation {
|
|
|
82
84
|
return this.service.processLogs(request, context)
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
processTraces(request: ProcessTracesRequest, context: CallContext = TEST_CONTEXT): Promise<ProcessTracesResponse> {
|
|
88
|
+
return this.service.processTraces(request, context)
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
processTransactions(
|
|
86
92
|
request: ProcessTransactionsRequest,
|
|
87
93
|
context = TEST_CONTEXT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChainConfig } from '../chain-config'
|
|
2
|
+
import { setProvider } from '@sentio/sdk'
|
|
3
|
+
|
|
4
|
+
export function loadTestProvidersFromEnv(ids: string[] | string): boolean {
|
|
5
|
+
const dummyConfig: Record<string, ChainConfig> = {}
|
|
6
|
+
|
|
7
|
+
if (!Array.isArray(ids)) {
|
|
8
|
+
ids = [ids]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
for (const k of ids) {
|
|
12
|
+
const envKey = 'TEST_ENDPOINT_' + k
|
|
13
|
+
const http = process.env[envKey]
|
|
14
|
+
if (!http) {
|
|
15
|
+
return false
|
|
16
|
+
}
|
|
17
|
+
dummyConfig[k] = {
|
|
18
|
+
ChainID: k,
|
|
19
|
+
Https: [http],
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
setProvider(dummyConfig)
|
|
24
|
+
return true
|
|
25
|
+
}
|
package/src/utils/chainmap.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// and https://besu.hyperledger.org/en/stable/Concepts/NetworkID-And-ChainID/
|
|
3
3
|
|
|
4
4
|
export const CHAIN_MAP: Record<string, string> = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
SOL_mainnet: 'solana',
|
|
6
|
+
SOL_devnet: 'solana-dev',
|
|
7
|
+
SOL_testnet: 'solana-test',
|
|
8
8
|
0: 'kardia',
|
|
9
9
|
1: 'ethereum',
|
|
10
10
|
2: 'expanse',
|