@sentio/runtime 1.0.0-development

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.
@@ -0,0 +1,18 @@
1
+ import Long from "long";
2
+ import _m0 from "protobufjs/minimal";
3
+ export interface Timestamp {
4
+ seconds: Long;
5
+ nanos: number;
6
+ }
7
+ export declare const Timestamp: {
8
+ encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer;
9
+ decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp;
10
+ fromJSON(object: any): Timestamp;
11
+ toJSON(message: Timestamp): unknown;
12
+ fromPartial(object: DeepPartial<Timestamp>): Timestamp;
13
+ };
14
+ declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
15
+ declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
16
+ [K in keyof T]?: DeepPartial<T[K]>;
17
+ } : Partial<T>;
18
+ export {};
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Timestamp = void 0;
7
+ /* eslint-disable */
8
+ const long_1 = __importDefault(require("long"));
9
+ const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
+ function createBaseTimestamp() {
11
+ return { seconds: long_1.default.ZERO, nanos: 0 };
12
+ }
13
+ exports.Timestamp = {
14
+ encode(message, writer = minimal_1.default.Writer.create()) {
15
+ if (!message.seconds.isZero()) {
16
+ writer.uint32(8).int64(message.seconds);
17
+ }
18
+ if (message.nanos !== 0) {
19
+ writer.uint32(16).int32(message.nanos);
20
+ }
21
+ return writer;
22
+ },
23
+ decode(input, length) {
24
+ const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
25
+ let end = length === undefined ? reader.len : reader.pos + length;
26
+ const message = createBaseTimestamp();
27
+ while (reader.pos < end) {
28
+ const tag = reader.uint32();
29
+ switch (tag >>> 3) {
30
+ case 1:
31
+ message.seconds = reader.int64();
32
+ break;
33
+ case 2:
34
+ message.nanos = reader.int32();
35
+ break;
36
+ default:
37
+ reader.skipType(tag & 7);
38
+ break;
39
+ }
40
+ }
41
+ return message;
42
+ },
43
+ fromJSON(object) {
44
+ return {
45
+ seconds: isSet(object.seconds) ? long_1.default.fromValue(object.seconds) : long_1.default.ZERO,
46
+ nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
47
+ };
48
+ },
49
+ toJSON(message) {
50
+ const obj = {};
51
+ message.seconds !== undefined && (obj.seconds = (message.seconds || long_1.default.ZERO).toString());
52
+ message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
53
+ return obj;
54
+ },
55
+ fromPartial(object) {
56
+ const message = createBaseTimestamp();
57
+ message.seconds = (object.seconds !== undefined && object.seconds !== null)
58
+ ? long_1.default.fromValue(object.seconds)
59
+ : long_1.default.ZERO;
60
+ message.nanos = object.nanos ?? 0;
61
+ return message;
62
+ },
63
+ };
64
+ if (minimal_1.default.util.Long !== long_1.default) {
65
+ minimal_1.default.util.Long = long_1.default;
66
+ minimal_1.default.configure();
67
+ }
68
+ function isSet(value) {
69
+ return value !== null && value !== undefined;
70
+ }
71
+ //# sourceMappingURL=timestamp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../../../../src/gen/src/google/protobuf/timestamp.ts"],"names":[],"mappings":";;;;;;AAAA,oBAAoB;AACpB,gDAAwB;AACxB,iEAAqC;AAOrC,SAAS,mBAAmB;IAC1B,OAAO,EAAE,OAAO,EAAE,cAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC1C,CAAC;AAEY,QAAA,SAAS,GAAG;IACvB,MAAM,CAAC,OAAkB,EAAE,SAAqB,iBAAG,CA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AC;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 _m0 from \"protobufjs/minimal\";\n\nexport interface Timestamp {\n seconds: Long;\n nanos: number;\n}\n\nfunction createBaseTimestamp(): Timestamp {\n return { seconds: Long.ZERO, nanos: 0 };\n}\n\nexport const Timestamp = {\n encode(message: Timestamp, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {\n if (!message.seconds.isZero()) {\n writer.uint32(8).int64(message.seconds);\n }\n if (message.nanos !== 0) {\n writer.uint32(16).int32(message.nanos);\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {\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 = createBaseTimestamp();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.seconds = reader.int64() as Long;\n break;\n case 2:\n message.nanos = reader.int32();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): Timestamp {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n },\n\n toJSON(message: Timestamp): unknown {\n const obj: any = {};\n message.seconds !== undefined && (obj.seconds = (message.seconds || Long.ZERO).toString());\n message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));\n return obj;\n },\n\n fromPartial(object: DeepPartial<Timestamp>): Timestamp {\n const message = createBaseTimestamp();\n message.seconds = (object.seconds !== undefined && object.seconds !== null)\n ? Long.fromValue(object.seconds)\n : Long.ZERO;\n message.nanos = object.nanos ?? 0;\n return message;\n },\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\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/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@sentio/runtime",
3
+ "license": "Apache-2.0",
4
+ "version": "1.0.0-development",
5
+ "scripts": {
6
+ "compile": "tsc -p .",
7
+ "build": "yarn compile",
8
+ "test": "jest"
9
+ },
10
+ "dependencies": {
11
+ "@ethersproject/providers": "~5.7.0",
12
+ "bignumber.js": "^9.1.0",
13
+ "command-line-args": "^5.2.1",
14
+ "command-line-usage": "^6.1.3",
15
+ "ethers": "~5.7.1",
16
+ "fs-extra": "^11.0.0",
17
+ "google-protobuf": "^3.15.8",
18
+ "js-yaml": "^4.1.0",
19
+ "nice-grpc": "^2.0.0",
20
+ "nice-grpc-client-middleware-retry": "^2.0.1",
21
+ "nice-grpc-error-details": "^0.1.4",
22
+ "p-queue": "^6.6.2",
23
+ "winston": "^3.8.2"
24
+ },
25
+ "resolutions": {
26
+ "@grpc/grpc-js": "1.7.3"
27
+ },
28
+ "devDependencies": {
29
+ "@types/chai": "^4.3.1",
30
+ "@types/command-line-args": "^5.2.0",
31
+ "@types/command-line-usage": "^5.0.2",
32
+ "@types/expect": "^24.3.0",
33
+ "@types/fs-extra": "^9.0.13",
34
+ "@types/google-protobuf": "^3.15.6",
35
+ "@types/js-yaml": "^4.0.5",
36
+ "@types/node": "^18.0.4"
37
+ },
38
+ "bin": {
39
+ "processor-runner": "./lib/processor-runner.js"
40
+ },
41
+ "main": "./lib/index.js",
42
+ "types": "./lib/index.d.ts",
43
+ "module": "./lib/index.js",
44
+ "files": [
45
+ "{lib,src,templates}",
46
+ "!{lib,src}/tests",
47
+ "!**/*.test.{js,ts}"
48
+ ],
49
+ "engines": {
50
+ "node": ">=16"
51
+ }
52
+ }
@@ -0,0 +1,433 @@
1
+ syntax = "proto3";
2
+
3
+ package processor;
4
+
5
+ import "google/protobuf/empty.proto";
6
+ import "google/protobuf/struct.proto";
7
+
8
+ option go_package = "sentioxyz/sentio/processor/protos";
9
+
10
+ service Processor {
11
+ // Start the processor, need to be called before any other RPC calls
12
+ rpc Start(StartRequest) returns (google.protobuf.Empty);
13
+ // Stop the processor
14
+ rpc Stop(google.protobuf.Empty) returns (google.protobuf.Empty);
15
+ // Get configs of processor, it will be updated automatically if new contracts is added
16
+ // during log processing
17
+ rpc GetConfig(ProcessConfigRequest) returns (ProcessConfigResponse);
18
+
19
+ // Process data binding
20
+ rpc ProcessBindings(ProcessBindingsRequest) returns (ProcessBindingResponse);
21
+
22
+ rpc ProcessBindingsStream(stream DataBinding) returns (stream ProcessBindingResponse);
23
+ }
24
+
25
+ message ProjectConfig {
26
+ string name = 1;
27
+ string version = 3;
28
+ }
29
+
30
+ message ProcessConfigRequest {
31
+ }
32
+
33
+ message ProcessConfigResponse {
34
+ ProjectConfig config = 1;
35
+ repeated ContractConfig contract_configs = 2;
36
+ repeated TemplateInstance template_instances = 3;
37
+
38
+ repeated AccountConfig account_configs = 4;
39
+
40
+ repeated MetricConfig metric_configs = 5;
41
+ repeated EventTrackingConfig event_tracking_configs = 6;
42
+ repeated ExportConfig export_configs = 7;
43
+ }
44
+
45
+ message ContractConfig {
46
+ ContractInfo contract = 1;
47
+ repeated OnIntervalConfig interval_configs = 11;
48
+ repeated LogHandlerConfig log_configs = 3;
49
+ repeated TraceHandlerConfig trace_configs = 2;
50
+ repeated AptosEventHandlerConfig aptos_event_configs = 9;
51
+ repeated AptosCallHandlerConfig aptos_call_configs = 10;
52
+ InstructionHandlerConfig instruction_config = 6;
53
+ uint64 start_block = 4;
54
+ uint64 end_block = 5;
55
+ string processor_type = 8;
56
+ }
57
+
58
+ message TotalPerEntityAggregation {
59
+ enum Type {
60
+ AVG = 0;
61
+ MEDIAN = 1;
62
+ // add more
63
+ }
64
+ }
65
+
66
+ message RetentionConfig {
67
+ string retention_event_name = 2;
68
+ int32 days = 3;
69
+ }
70
+
71
+ message EventTrackingConfig {
72
+ string event_name = 1;
73
+ bool total_by_day = 2;
74
+ bool unique = 3;
75
+ TotalPerEntityAggregation total_per_entity = 4;
76
+ repeated int32 distinct_aggregation_by_days = 5;
77
+ RetentionConfig retention_config = 6;
78
+ }
79
+
80
+ message ExportConfig {
81
+ string name = 1;
82
+ string channel = 2;
83
+ }
84
+
85
+ enum MetricType {
86
+ UNKNOWN_TYPE = 0;
87
+ COUNTER = 1;
88
+ GAUGE = 2;
89
+ HISTOGRAM = 3;
90
+ }
91
+
92
+ message MetricConfig {
93
+ string name = 1;
94
+ string description = 3;
95
+ string unit = 2;
96
+ bool sparse = 4;
97
+
98
+ MetricType type = 7;
99
+ AggregationConfig aggregation_config = 6;
100
+ }
101
+
102
+ /*
103
+ Config to aggregate multiple data points into new data points in a constant time interval.
104
+ e.g. if you have a metric called 'vol', use 1 minutes interval and [SUM, AVG] aggregation type,
105
+ then every minutes there will be a 'vol_sum' and 'vol_avg' metric.
106
+
107
+ Currently this apply to gauge only.
108
+ */
109
+ message AggregationConfig {
110
+ /*
111
+ The interval for data point to be resolved.
112
+ The minimal value is 1, and the max value allowed is 24*60 (1 day)
113
+ */
114
+ repeated int32 interval_in_minutes = 1;
115
+ /*
116
+ What aggregations to be done for the data points.
117
+ */
118
+ repeated AggregationType types = 2;
119
+ /*
120
+ Whether to discard original data points, default to be false.r
121
+ */
122
+ bool discard_origin = 3;
123
+ }
124
+
125
+ enum AggregationType {
126
+ COUNT = 0;
127
+ SUM = 1;
128
+ // AVG = 2;
129
+ // MIN = 3;
130
+ // MAX = 4;
131
+ // P50 = 5;
132
+ // P99 = 6;
133
+ // P99_9 = 7;
134
+ }
135
+
136
+ message AccountConfig {
137
+ // TODO implement account configs
138
+ string chain_id = 1;
139
+ string address = 2;
140
+ uint64 start_block = 3;
141
+
142
+ repeated OnIntervalConfig interval_configs = 4;
143
+ repeated AptosOnIntervalConfig aptos_interval_configs = 5;
144
+ // TODO add tx handler config related to the account
145
+
146
+ repeated LogHandlerConfig log_configs = 6;
147
+ }
148
+
149
+ message HandleInterval {
150
+ int32 recent_interval = 1;
151
+ int32 backfill_interval = 2;
152
+ }
153
+
154
+ message OnIntervalConfig {
155
+ int32 handler_id = 1;
156
+ // num of minutes, there can be either minutes or slot
157
+ int32 minutes = 2;
158
+ optional HandleInterval minutes_interval = 4;
159
+
160
+ // block or version
161
+ int32 slot = 3;
162
+ optional HandleInterval slot_interval = 5;
163
+ }
164
+
165
+ message AptosOnIntervalConfig {
166
+ OnIntervalConfig interval_config = 1;
167
+ string type = 2;
168
+ }
169
+
170
+ message ContractInfo {
171
+ string name = 1;
172
+ // should this be more flexible?
173
+ string chain_id = 2;
174
+ string address = 3;
175
+ string abi = 4;
176
+ }
177
+
178
+ message TemplateInstance {
179
+ ContractInfo contract = 1;
180
+ uint64 start_block = 2;
181
+ uint64 end_block = 3;
182
+ int32 template_id = 4;
183
+ }
184
+
185
+ message StartRequest {
186
+ repeated TemplateInstance template_instances = 1;
187
+ }
188
+
189
+ message BlockHandlerConfig {
190
+ int32 handler_id = 1;
191
+ }
192
+
193
+ message TraceHandlerConfig {
194
+ string signature = 1;
195
+ int32 handler_id = 2;
196
+ }
197
+
198
+ message LogHandlerConfig {
199
+ repeated LogFilter filters = 1;
200
+ int32 handler_id = 2;
201
+ }
202
+
203
+ message LogFilter {
204
+ repeated Topic topics = 1;
205
+ // only used for when in account config
206
+ oneof address_or_type {
207
+ string address = 2;
208
+ AddressType address_type = 3;
209
+ }
210
+ }
211
+
212
+ enum AddressType {
213
+ ERC20 = 0;
214
+ ERC721 = 1;
215
+ ERC1155 = 2;
216
+ }
217
+
218
+ message InstructionHandlerConfig {
219
+ bool inner_instruction = 1;
220
+ bool parsed_instruction = 2;
221
+ bool raw_data_instruction = 3;
222
+ }
223
+
224
+ message AptosEventHandlerConfig {
225
+ repeated AptosEventFilter filters = 1;
226
+ int32 handler_id = 2;
227
+ }
228
+
229
+ message AptosEventFilter {
230
+ string type = 1;
231
+ string account = 2;
232
+ }
233
+
234
+ message AptosCallHandlerConfig {
235
+ repeated AptosCallFilter filters = 1;
236
+ int32 handler_id = 2;
237
+ }
238
+
239
+ message AptosCallFilter {
240
+ string function = 1;
241
+ repeated string type_arguments = 2;
242
+ bool with_type_arguments = 3;
243
+ bool include_failed = 4;
244
+ }
245
+
246
+ message Topic {
247
+ repeated string hashes = 1;
248
+ }
249
+
250
+ message ProcessBindingsRequest {
251
+ repeated DataBinding bindings = 1;
252
+ }
253
+
254
+ message ProcessBindingResponse {
255
+ ProcessResult result = 1;
256
+
257
+ // Whether config update because of dynamic contract processor creation
258
+ // Currently only support log handler in ethereum
259
+ bool config_updated = 4;
260
+ }
261
+
262
+ message RawTransaction {
263
+ bytes raw = 1;
264
+ optional string program_account_id = 2;
265
+ optional uint64 slot = 3;
266
+ }
267
+
268
+ message Data {
269
+ // Every Handler type should have a data type
270
+ message EthLog {
271
+ // bytes data = 1;
272
+ google.protobuf.Struct log = 3;
273
+ optional bytes transaction = 2;
274
+ }
275
+ message EthBlock {
276
+ // bytes data = 1;
277
+ google.protobuf.Struct block = 2;
278
+ }
279
+ message EthTransaction {
280
+ google.protobuf.Struct transaction = 4;
281
+ optional bytes transaction_receipt = 3;
282
+ }
283
+ message EthTrace {
284
+ google.protobuf.Struct trace = 4;
285
+ optional bytes transaction = 2;
286
+ optional bytes transaction_receipt = 3;
287
+ }
288
+ message SolInstruction {
289
+ string instruction_data = 1;
290
+ uint64 slot = 2;
291
+ string program_account_id = 3;
292
+ repeated string accounts = 5;
293
+ optional google.protobuf.Struct parsed = 4;
294
+ }
295
+ message AptEvent {
296
+ google.protobuf.Struct event = 2;
297
+ }
298
+ message AptCall {
299
+ google.protobuf.Struct call = 2;
300
+ }
301
+ message AptResource {
302
+ repeated google.protobuf.Struct resources = 4;
303
+ int64 version = 2;
304
+ int64 timestampMicros = 5;
305
+ }
306
+
307
+ bytes raw = 1;
308
+ oneof value {
309
+ EthLog eth_log = 2;
310
+ EthBlock eth_block = 3;
311
+ EthTransaction eth_transaction = 4;
312
+ EthTrace eth_trace = 5;
313
+ SolInstruction sol_instruction = 6;
314
+ AptEvent apt_event = 7;
315
+ AptCall apt_call = 8;
316
+ AptResource apt_resource = 9;
317
+ }
318
+ }
319
+
320
+ message DataBinding {
321
+ Data data = 1;
322
+ HandlerType handler_type = 3;
323
+ repeated int32 handler_ids = 4;
324
+ }
325
+
326
+ message ProcessResult {
327
+ repeated GaugeResult gauges = 1;
328
+ repeated CounterResult counters = 2;
329
+ repeated LogResult logs = 3;
330
+ repeated EventTrackingResult events = 4;
331
+ repeated ExportResult exports = 5;
332
+ }
333
+
334
+ message RecordMetaData {
335
+ // These are populated by systems.
336
+
337
+ // Contract or Wallet or Account address
338
+ string address = 1;
339
+ // Contract (solidity) or module (move) or programId (solana)
340
+ // it could be empty if this is not record for a contract
341
+ // In some chain (e.g. aptos)
342
+ // one address could have multiple contract/module name
343
+ string contract_name = 9;
344
+ // Block or slot (solana) or version (aptos) number
345
+ uint64 block_number = 2;
346
+ string transaction_hash = 6;
347
+ string chain_id = 5;
348
+
349
+ // optional for ether
350
+ int32 transaction_index = 3;
351
+ int32 log_index = 4;
352
+
353
+ // These are populated by users in meter.
354
+ // The metric name and properties
355
+ string name = 10;
356
+
357
+ // The metric labels provided by users.
358
+ map<string, string> labels = 7;
359
+ }
360
+
361
+ message MetricValue {
362
+ oneof value {
363
+ string big_decimal = 1;
364
+ double double_value = 2;
365
+ BigInteger big_integer = 3;
366
+ }
367
+ }
368
+
369
+ message BigInteger {
370
+ bool negative = 1;
371
+ bytes data = 2;
372
+ }
373
+
374
+ enum HandlerType {
375
+ UNKNOWN = 0;
376
+ ETH_LOG = 1;
377
+ ETH_BLOCK = 2;
378
+ ETH_TRACE = 5;
379
+ SOL_INSTRUCTION = 4;
380
+ APT_EVENT = 6;
381
+ APT_CALL = 7;
382
+ APT_RESOURCE = 8;
383
+ SUI_TRANSACTION = 3;
384
+ }
385
+
386
+ message RuntimeInfo {
387
+ HandlerType from = 1;
388
+ }
389
+
390
+ message GaugeResult {
391
+ RecordMetaData metadata = 1;
392
+ MetricValue metric_value = 2;
393
+ RuntimeInfo runtime_info = 3;
394
+ }
395
+
396
+ message CounterResult {
397
+ RecordMetaData metadata = 1;
398
+ MetricValue metric_value = 2;
399
+ // True to increase or False to decrease
400
+ bool add = 3;
401
+ RuntimeInfo runtime_info = 4;
402
+ }
403
+
404
+ enum LogLevel {
405
+ DEBUG = 0;
406
+ INFO = 1;
407
+ WARNING = 2;
408
+ ERROR = 3;
409
+ CRITICAL = 4;
410
+ }
411
+
412
+ message LogResult {
413
+ RecordMetaData metadata = 1;
414
+ LogLevel level = 2;
415
+ string message = 3;
416
+ // JSON payload
417
+ string attributes = 6;
418
+ RuntimeInfo runtime_info = 4;
419
+ }
420
+
421
+ message EventTrackingResult {
422
+ RecordMetaData metadata = 1;
423
+ string distinct_entity_id = 2;
424
+ // JSON payload
425
+ string attributes = 4;
426
+ RuntimeInfo runtime_info = 5;
427
+ }
428
+
429
+ message ExportResult {
430
+ RecordMetaData metadata = 1;
431
+ string payload = 2;
432
+ RuntimeInfo runtime_info = 3;
433
+ }
@@ -0,0 +1,58 @@
1
+ /* eslint-disable */
2
+ import Long from "long";
3
+ import _m0 from "protobufjs/minimal";
4
+
5
+ export interface Empty {
6
+ }
7
+
8
+ function createBaseEmpty(): Empty {
9
+ return {};
10
+ }
11
+
12
+ export const Empty = {
13
+ encode(_: Empty, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
14
+ return writer;
15
+ },
16
+
17
+ decode(input: _m0.Reader | Uint8Array, length?: number): Empty {
18
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
19
+ let end = length === undefined ? reader.len : reader.pos + length;
20
+ const message = createBaseEmpty();
21
+ while (reader.pos < end) {
22
+ const tag = reader.uint32();
23
+ switch (tag >>> 3) {
24
+ default:
25
+ reader.skipType(tag & 7);
26
+ break;
27
+ }
28
+ }
29
+ return message;
30
+ },
31
+
32
+ fromJSON(_: any): Empty {
33
+ return {};
34
+ },
35
+
36
+ toJSON(_: Empty): unknown {
37
+ const obj: any = {};
38
+ return obj;
39
+ },
40
+
41
+ fromPartial(_: DeepPartial<Empty>): Empty {
42
+ const message = createBaseEmpty();
43
+ return message;
44
+ },
45
+ };
46
+
47
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
48
+
49
+ type DeepPartial<T> = T extends Builtin ? T
50
+ : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>>
51
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
52
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
53
+ : Partial<T>;
54
+
55
+ if (_m0.util.Long !== Long) {
56
+ _m0.util.Long = Long as any;
57
+ _m0.configure();
58
+ }