@sentio/protos 2.6.2-rc.2 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,6 +23,25 @@ export interface GetPriceResponse {
23
23
  timestamp: Date | undefined;
24
24
  }
25
25
 
26
+ export interface BatchGetPricesRequest {
27
+ timestamps: Date[];
28
+ coinIds: CoinID[];
29
+ }
30
+
31
+ export interface BatchGetPricesResponse {
32
+ prices: BatchGetPricesResponse_CoinPrice[];
33
+ }
34
+
35
+ export interface BatchGetPricesResponse_CoinPrice {
36
+ coinId: CoinID | undefined;
37
+ price?: BatchGetPricesResponse_CoinPrice_Price | undefined;
38
+ error?: string | undefined;
39
+ }
40
+
41
+ export interface BatchGetPricesResponse_CoinPrice_Price {
42
+ results: GetPriceResponse[];
43
+ }
44
+
26
45
  function createBaseCoinID(): CoinID {
27
46
  return { symbol: undefined, address: undefined };
28
47
  }
@@ -276,6 +295,268 @@ export const GetPriceResponse = {
276
295
  },
277
296
  };
278
297
 
298
+ function createBaseBatchGetPricesRequest(): BatchGetPricesRequest {
299
+ return { timestamps: [], coinIds: [] };
300
+ }
301
+
302
+ export const BatchGetPricesRequest = {
303
+ encode(message: BatchGetPricesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
304
+ for (const v of message.timestamps) {
305
+ Timestamp.encode(toTimestamp(v!), writer.uint32(10).fork()).ldelim();
306
+ }
307
+ for (const v of message.coinIds) {
308
+ CoinID.encode(v!, writer.uint32(18).fork()).ldelim();
309
+ }
310
+ return writer;
311
+ },
312
+
313
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesRequest {
314
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
315
+ let end = length === undefined ? reader.len : reader.pos + length;
316
+ const message = createBaseBatchGetPricesRequest();
317
+ while (reader.pos < end) {
318
+ const tag = reader.uint32();
319
+ switch (tag >>> 3) {
320
+ case 1:
321
+ message.timestamps.push(fromTimestamp(Timestamp.decode(reader, reader.uint32())));
322
+ break;
323
+ case 2:
324
+ message.coinIds.push(CoinID.decode(reader, reader.uint32()));
325
+ break;
326
+ default:
327
+ reader.skipType(tag & 7);
328
+ break;
329
+ }
330
+ }
331
+ return message;
332
+ },
333
+
334
+ fromJSON(object: any): BatchGetPricesRequest {
335
+ return {
336
+ timestamps: Array.isArray(object?.timestamps) ? object.timestamps.map((e: any) => fromJsonTimestamp(e)) : [],
337
+ coinIds: Array.isArray(object?.coinIds) ? object.coinIds.map((e: any) => CoinID.fromJSON(e)) : [],
338
+ };
339
+ },
340
+
341
+ toJSON(message: BatchGetPricesRequest): unknown {
342
+ const obj: any = {};
343
+ if (message.timestamps) {
344
+ obj.timestamps = message.timestamps.map((e) => e.toISOString());
345
+ } else {
346
+ obj.timestamps = [];
347
+ }
348
+ if (message.coinIds) {
349
+ obj.coinIds = message.coinIds.map((e) => e ? CoinID.toJSON(e) : undefined);
350
+ } else {
351
+ obj.coinIds = [];
352
+ }
353
+ return obj;
354
+ },
355
+
356
+ create(base?: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
357
+ return BatchGetPricesRequest.fromPartial(base ?? {});
358
+ },
359
+
360
+ fromPartial(object: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
361
+ const message = createBaseBatchGetPricesRequest();
362
+ message.timestamps = object.timestamps?.map((e) => e) || [];
363
+ message.coinIds = object.coinIds?.map((e) => CoinID.fromPartial(e)) || [];
364
+ return message;
365
+ },
366
+ };
367
+
368
+ function createBaseBatchGetPricesResponse(): BatchGetPricesResponse {
369
+ return { prices: [] };
370
+ }
371
+
372
+ export const BatchGetPricesResponse = {
373
+ encode(message: BatchGetPricesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
374
+ for (const v of message.prices) {
375
+ BatchGetPricesResponse_CoinPrice.encode(v!, writer.uint32(10).fork()).ldelim();
376
+ }
377
+ return writer;
378
+ },
379
+
380
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse {
381
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
382
+ let end = length === undefined ? reader.len : reader.pos + length;
383
+ const message = createBaseBatchGetPricesResponse();
384
+ while (reader.pos < end) {
385
+ const tag = reader.uint32();
386
+ switch (tag >>> 3) {
387
+ case 1:
388
+ message.prices.push(BatchGetPricesResponse_CoinPrice.decode(reader, reader.uint32()));
389
+ break;
390
+ default:
391
+ reader.skipType(tag & 7);
392
+ break;
393
+ }
394
+ }
395
+ return message;
396
+ },
397
+
398
+ fromJSON(object: any): BatchGetPricesResponse {
399
+ return {
400
+ prices: Array.isArray(object?.prices)
401
+ ? object.prices.map((e: any) => BatchGetPricesResponse_CoinPrice.fromJSON(e))
402
+ : [],
403
+ };
404
+ },
405
+
406
+ toJSON(message: BatchGetPricesResponse): unknown {
407
+ const obj: any = {};
408
+ if (message.prices) {
409
+ obj.prices = message.prices.map((e) => e ? BatchGetPricesResponse_CoinPrice.toJSON(e) : undefined);
410
+ } else {
411
+ obj.prices = [];
412
+ }
413
+ return obj;
414
+ },
415
+
416
+ create(base?: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
417
+ return BatchGetPricesResponse.fromPartial(base ?? {});
418
+ },
419
+
420
+ fromPartial(object: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
421
+ const message = createBaseBatchGetPricesResponse();
422
+ message.prices = object.prices?.map((e) => BatchGetPricesResponse_CoinPrice.fromPartial(e)) || [];
423
+ return message;
424
+ },
425
+ };
426
+
427
+ function createBaseBatchGetPricesResponse_CoinPrice(): BatchGetPricesResponse_CoinPrice {
428
+ return { coinId: undefined, price: undefined, error: undefined };
429
+ }
430
+
431
+ export const BatchGetPricesResponse_CoinPrice = {
432
+ encode(message: BatchGetPricesResponse_CoinPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
433
+ if (message.coinId !== undefined) {
434
+ CoinID.encode(message.coinId, writer.uint32(10).fork()).ldelim();
435
+ }
436
+ if (message.price !== undefined) {
437
+ BatchGetPricesResponse_CoinPrice_Price.encode(message.price, writer.uint32(18).fork()).ldelim();
438
+ }
439
+ if (message.error !== undefined) {
440
+ writer.uint32(26).string(message.error);
441
+ }
442
+ return writer;
443
+ },
444
+
445
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice {
446
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
447
+ let end = length === undefined ? reader.len : reader.pos + length;
448
+ const message = createBaseBatchGetPricesResponse_CoinPrice();
449
+ while (reader.pos < end) {
450
+ const tag = reader.uint32();
451
+ switch (tag >>> 3) {
452
+ case 1:
453
+ message.coinId = CoinID.decode(reader, reader.uint32());
454
+ break;
455
+ case 2:
456
+ message.price = BatchGetPricesResponse_CoinPrice_Price.decode(reader, reader.uint32());
457
+ break;
458
+ case 3:
459
+ message.error = reader.string();
460
+ break;
461
+ default:
462
+ reader.skipType(tag & 7);
463
+ break;
464
+ }
465
+ }
466
+ return message;
467
+ },
468
+
469
+ fromJSON(object: any): BatchGetPricesResponse_CoinPrice {
470
+ return {
471
+ coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
472
+ price: isSet(object.price) ? BatchGetPricesResponse_CoinPrice_Price.fromJSON(object.price) : undefined,
473
+ error: isSet(object.error) ? String(object.error) : undefined,
474
+ };
475
+ },
476
+
477
+ toJSON(message: BatchGetPricesResponse_CoinPrice): unknown {
478
+ const obj: any = {};
479
+ message.coinId !== undefined && (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);
480
+ message.price !== undefined &&
481
+ (obj.price = message.price ? BatchGetPricesResponse_CoinPrice_Price.toJSON(message.price) : undefined);
482
+ message.error !== undefined && (obj.error = message.error);
483
+ return obj;
484
+ },
485
+
486
+ create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
487
+ return BatchGetPricesResponse_CoinPrice.fromPartial(base ?? {});
488
+ },
489
+
490
+ fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
491
+ const message = createBaseBatchGetPricesResponse_CoinPrice();
492
+ message.coinId = (object.coinId !== undefined && object.coinId !== null)
493
+ ? CoinID.fromPartial(object.coinId)
494
+ : undefined;
495
+ message.price = (object.price !== undefined && object.price !== null)
496
+ ? BatchGetPricesResponse_CoinPrice_Price.fromPartial(object.price)
497
+ : undefined;
498
+ message.error = object.error ?? undefined;
499
+ return message;
500
+ },
501
+ };
502
+
503
+ function createBaseBatchGetPricesResponse_CoinPrice_Price(): BatchGetPricesResponse_CoinPrice_Price {
504
+ return { results: [] };
505
+ }
506
+
507
+ export const BatchGetPricesResponse_CoinPrice_Price = {
508
+ encode(message: BatchGetPricesResponse_CoinPrice_Price, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
509
+ for (const v of message.results) {
510
+ GetPriceResponse.encode(v!, writer.uint32(10).fork()).ldelim();
511
+ }
512
+ return writer;
513
+ },
514
+
515
+ decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice_Price {
516
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
517
+ let end = length === undefined ? reader.len : reader.pos + length;
518
+ const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
519
+ while (reader.pos < end) {
520
+ const tag = reader.uint32();
521
+ switch (tag >>> 3) {
522
+ case 1:
523
+ message.results.push(GetPriceResponse.decode(reader, reader.uint32()));
524
+ break;
525
+ default:
526
+ reader.skipType(tag & 7);
527
+ break;
528
+ }
529
+ }
530
+ return message;
531
+ },
532
+
533
+ fromJSON(object: any): BatchGetPricesResponse_CoinPrice_Price {
534
+ return {
535
+ results: Array.isArray(object?.results) ? object.results.map((e: any) => GetPriceResponse.fromJSON(e)) : [],
536
+ };
537
+ },
538
+
539
+ toJSON(message: BatchGetPricesResponse_CoinPrice_Price): unknown {
540
+ const obj: any = {};
541
+ if (message.results) {
542
+ obj.results = message.results.map((e) => e ? GetPriceResponse.toJSON(e) : undefined);
543
+ } else {
544
+ obj.results = [];
545
+ }
546
+ return obj;
547
+ },
548
+
549
+ create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
550
+ return BatchGetPricesResponse_CoinPrice_Price.fromPartial(base ?? {});
551
+ },
552
+
553
+ fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
554
+ const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
555
+ message.results = object.results?.map((e) => GetPriceResponse.fromPartial(e)) || [];
556
+ return message;
557
+ },
558
+ };
559
+
279
560
  export type PriceServiceDefinition = typeof PriceServiceDefinition;
280
561
  export const PriceServiceDefinition = {
281
562
  name: "PriceService",
@@ -289,15 +570,31 @@ export const PriceServiceDefinition = {
289
570
  responseStream: false,
290
571
  options: {},
291
572
  },
573
+ batchGetPrices: {
574
+ name: "BatchGetPrices",
575
+ requestType: BatchGetPricesRequest,
576
+ requestStream: false,
577
+ responseType: BatchGetPricesResponse,
578
+ responseStream: false,
579
+ options: {},
580
+ },
292
581
  },
293
582
  } as const;
294
583
 
295
584
  export interface PriceServiceImplementation<CallContextExt = {}> {
296
585
  getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;
586
+ batchGetPrices(
587
+ request: BatchGetPricesRequest,
588
+ context: CallContext & CallContextExt,
589
+ ): Promise<DeepPartial<BatchGetPricesResponse>>;
297
590
  }
298
591
 
299
592
  export interface PriceServiceClient<CallOptionsExt = {}> {
300
593
  getPrice(request: DeepPartial<GetPriceRequest>, options?: CallOptions & CallOptionsExt): Promise<GetPriceResponse>;
594
+ batchGetPrices(
595
+ request: DeepPartial<BatchGetPricesRequest>,
596
+ options?: CallOptions & CallOptionsExt,
597
+ ): Promise<BatchGetPricesResponse>;
301
598
  }
302
599
 
303
600
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;