@sentio/protos 2.54.2 → 2.54.3-rc.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.
@@ -1,1707 +0,0 @@
1
- /* eslint-disable */
2
- import type { CallContext, CallOptions } from "nice-grpc-common";
3
- import _m0 from "protobufjs/minimal.js";
4
- import { Empty } from "../../../google/protobuf/empty.js";
5
- import { Timestamp } from "../../../google/protobuf/timestamp.js";
6
-
7
- export interface CoinID {
8
- symbol?: string | undefined;
9
- address?: CoinID_AddressIdentifier | undefined;
10
- }
11
-
12
- export interface CoinID_AddressIdentifier {
13
- address: string;
14
- chain: string;
15
- }
16
-
17
- export interface GetPriceRequest {
18
- timestamp: Date | undefined;
19
- coinId: CoinID | undefined;
20
- source: string;
21
- }
22
-
23
- export interface GetPriceResponse {
24
- price: number;
25
- timestamp: Date | undefined;
26
- }
27
-
28
- export interface BatchGetPricesRequest {
29
- timestamps: Date[];
30
- coinIds: CoinID[];
31
- }
32
-
33
- export interface BatchGetPricesResponse {
34
- prices: BatchGetPricesResponse_CoinPrice[];
35
- }
36
-
37
- export interface BatchGetPricesResponse_CoinPrice {
38
- coinId: CoinID | undefined;
39
- price?: BatchGetPricesResponse_CoinPrice_Price | undefined;
40
- error?: string | undefined;
41
- }
42
-
43
- export interface BatchGetPricesResponse_CoinPrice_Price {
44
- results: GetPriceResponse[];
45
- }
46
-
47
- export interface ListCoinsRequest {
48
- limit: number;
49
- offset: number;
50
- searchQuery: string;
51
- chain: string;
52
- }
53
-
54
- export interface ListCoinsResponse {
55
- coins: CoinID[];
56
- coinAddressesInChain: { [key: string]: CoinID };
57
- }
58
-
59
- export interface ListCoinsResponse_CoinAddressesInChainEntry {
60
- key: string;
61
- value: CoinID | undefined;
62
- }
63
-
64
- export interface CheckLatestPriceResponse {
65
- prices: CheckLatestPriceResponse_CoinPrice[];
66
- latestPrice: CheckLatestPriceResponse_CoinPrice | undefined;
67
- }
68
-
69
- export interface CheckLatestPriceResponse_CoinPrice {
70
- coinId: CoinID | undefined;
71
- price: number;
72
- timestamp: Date | undefined;
73
- }
74
-
75
- export interface BackfillCoinRequest {
76
- name: string;
77
- symbol: string;
78
- chain: string;
79
- address: string;
80
- coingeckoId: string;
81
- decimals: number;
82
- logoUrl: string;
83
- projectUrl: string;
84
- accountAddress: string;
85
- moduleName: string;
86
- structName: string;
87
- }
88
-
89
- export interface BackfillCoinResponse {
90
- symbol: string;
91
- message: string;
92
- }
93
-
94
- function createBaseCoinID(): CoinID {
95
- return { symbol: undefined, address: undefined };
96
- }
97
-
98
- export const CoinID = {
99
- encode(message: CoinID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
100
- if (message.symbol !== undefined) {
101
- writer.uint32(18).string(message.symbol);
102
- }
103
- if (message.address !== undefined) {
104
- CoinID_AddressIdentifier.encode(message.address, writer.uint32(26).fork()).ldelim();
105
- }
106
- return writer;
107
- },
108
-
109
- decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {
110
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
111
- let end = length === undefined ? reader.len : reader.pos + length;
112
- const message = createBaseCoinID();
113
- while (reader.pos < end) {
114
- const tag = reader.uint32();
115
- switch (tag >>> 3) {
116
- case 2:
117
- if (tag !== 18) {
118
- break;
119
- }
120
-
121
- message.symbol = reader.string();
122
- continue;
123
- case 3:
124
- if (tag !== 26) {
125
- break;
126
- }
127
-
128
- message.address = CoinID_AddressIdentifier.decode(reader, reader.uint32());
129
- continue;
130
- }
131
- if ((tag & 7) === 4 || tag === 0) {
132
- break;
133
- }
134
- reader.skipType(tag & 7);
135
- }
136
- return message;
137
- },
138
-
139
- fromJSON(object: any): CoinID {
140
- return {
141
- symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : undefined,
142
- address: isSet(object.address) ? CoinID_AddressIdentifier.fromJSON(object.address) : undefined,
143
- };
144
- },
145
-
146
- toJSON(message: CoinID): unknown {
147
- const obj: any = {};
148
- if (message.symbol !== undefined) {
149
- obj.symbol = message.symbol;
150
- }
151
- if (message.address !== undefined) {
152
- obj.address = CoinID_AddressIdentifier.toJSON(message.address);
153
- }
154
- return obj;
155
- },
156
-
157
- create(base?: DeepPartial<CoinID>): CoinID {
158
- return CoinID.fromPartial(base ?? {});
159
- },
160
- fromPartial(object: DeepPartial<CoinID>): CoinID {
161
- const message = createBaseCoinID();
162
- message.symbol = object.symbol ?? undefined;
163
- message.address = (object.address !== undefined && object.address !== null)
164
- ? CoinID_AddressIdentifier.fromPartial(object.address)
165
- : undefined;
166
- return message;
167
- },
168
- };
169
-
170
- function createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {
171
- return { address: "", chain: "" };
172
- }
173
-
174
- export const CoinID_AddressIdentifier = {
175
- encode(message: CoinID_AddressIdentifier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
176
- if (message.address !== "") {
177
- writer.uint32(10).string(message.address);
178
- }
179
- if (message.chain !== "") {
180
- writer.uint32(18).string(message.chain);
181
- }
182
- return writer;
183
- },
184
-
185
- decode(input: _m0.Reader | Uint8Array, length?: number): CoinID_AddressIdentifier {
186
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
187
- let end = length === undefined ? reader.len : reader.pos + length;
188
- const message = createBaseCoinID_AddressIdentifier();
189
- while (reader.pos < end) {
190
- const tag = reader.uint32();
191
- switch (tag >>> 3) {
192
- case 1:
193
- if (tag !== 10) {
194
- break;
195
- }
196
-
197
- message.address = reader.string();
198
- continue;
199
- case 2:
200
- if (tag !== 18) {
201
- break;
202
- }
203
-
204
- message.chain = reader.string();
205
- continue;
206
- }
207
- if ((tag & 7) === 4 || tag === 0) {
208
- break;
209
- }
210
- reader.skipType(tag & 7);
211
- }
212
- return message;
213
- },
214
-
215
- fromJSON(object: any): CoinID_AddressIdentifier {
216
- return {
217
- address: isSet(object.address) ? globalThis.String(object.address) : "",
218
- chain: isSet(object.chain) ? globalThis.String(object.chain) : "",
219
- };
220
- },
221
-
222
- toJSON(message: CoinID_AddressIdentifier): unknown {
223
- const obj: any = {};
224
- if (message.address !== "") {
225
- obj.address = message.address;
226
- }
227
- if (message.chain !== "") {
228
- obj.chain = message.chain;
229
- }
230
- return obj;
231
- },
232
-
233
- create(base?: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier {
234
- return CoinID_AddressIdentifier.fromPartial(base ?? {});
235
- },
236
- fromPartial(object: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier {
237
- const message = createBaseCoinID_AddressIdentifier();
238
- message.address = object.address ?? "";
239
- message.chain = object.chain ?? "";
240
- return message;
241
- },
242
- };
243
-
244
- function createBaseGetPriceRequest(): GetPriceRequest {
245
- return { timestamp: undefined, coinId: undefined, source: "" };
246
- }
247
-
248
- export const GetPriceRequest = {
249
- encode(message: GetPriceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
250
- if (message.timestamp !== undefined) {
251
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim();
252
- }
253
- if (message.coinId !== undefined) {
254
- CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();
255
- }
256
- if (message.source !== "") {
257
- writer.uint32(26).string(message.source);
258
- }
259
- return writer;
260
- },
261
-
262
- decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {
263
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
264
- let end = length === undefined ? reader.len : reader.pos + length;
265
- const message = createBaseGetPriceRequest();
266
- while (reader.pos < end) {
267
- const tag = reader.uint32();
268
- switch (tag >>> 3) {
269
- case 1:
270
- if (tag !== 10) {
271
- break;
272
- }
273
-
274
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
275
- continue;
276
- case 2:
277
- if (tag !== 18) {
278
- break;
279
- }
280
-
281
- message.coinId = CoinID.decode(reader, reader.uint32());
282
- continue;
283
- case 3:
284
- if (tag !== 26) {
285
- break;
286
- }
287
-
288
- message.source = reader.string();
289
- continue;
290
- }
291
- if ((tag & 7) === 4 || tag === 0) {
292
- break;
293
- }
294
- reader.skipType(tag & 7);
295
- }
296
- return message;
297
- },
298
-
299
- fromJSON(object: any): GetPriceRequest {
300
- return {
301
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
302
- coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
303
- source: isSet(object.source) ? globalThis.String(object.source) : "",
304
- };
305
- },
306
-
307
- toJSON(message: GetPriceRequest): unknown {
308
- const obj: any = {};
309
- if (message.timestamp !== undefined) {
310
- obj.timestamp = message.timestamp.toISOString();
311
- }
312
- if (message.coinId !== undefined) {
313
- obj.coinId = CoinID.toJSON(message.coinId);
314
- }
315
- if (message.source !== "") {
316
- obj.source = message.source;
317
- }
318
- return obj;
319
- },
320
-
321
- create(base?: DeepPartial<GetPriceRequest>): GetPriceRequest {
322
- return GetPriceRequest.fromPartial(base ?? {});
323
- },
324
- fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {
325
- const message = createBaseGetPriceRequest();
326
- message.timestamp = object.timestamp ?? undefined;
327
- message.coinId = (object.coinId !== undefined && object.coinId !== null)
328
- ? CoinID.fromPartial(object.coinId)
329
- : undefined;
330
- message.source = object.source ?? "";
331
- return message;
332
- },
333
- };
334
-
335
- function createBaseGetPriceResponse(): GetPriceResponse {
336
- return { price: 0, timestamp: undefined };
337
- }
338
-
339
- export const GetPriceResponse = {
340
- encode(message: GetPriceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
341
- if (message.price !== 0) {
342
- writer.uint32(9).double(message.price);
343
- }
344
- if (message.timestamp !== undefined) {
345
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim();
346
- }
347
- return writer;
348
- },
349
-
350
- decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {
351
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
352
- let end = length === undefined ? reader.len : reader.pos + length;
353
- const message = createBaseGetPriceResponse();
354
- while (reader.pos < end) {
355
- const tag = reader.uint32();
356
- switch (tag >>> 3) {
357
- case 1:
358
- if (tag !== 9) {
359
- break;
360
- }
361
-
362
- message.price = reader.double();
363
- continue;
364
- case 2:
365
- if (tag !== 18) {
366
- break;
367
- }
368
-
369
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
370
- continue;
371
- }
372
- if ((tag & 7) === 4 || tag === 0) {
373
- break;
374
- }
375
- reader.skipType(tag & 7);
376
- }
377
- return message;
378
- },
379
-
380
- fromJSON(object: any): GetPriceResponse {
381
- return {
382
- price: isSet(object.price) ? globalThis.Number(object.price) : 0,
383
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
384
- };
385
- },
386
-
387
- toJSON(message: GetPriceResponse): unknown {
388
- const obj: any = {};
389
- if (message.price !== 0) {
390
- obj.price = message.price;
391
- }
392
- if (message.timestamp !== undefined) {
393
- obj.timestamp = message.timestamp.toISOString();
394
- }
395
- return obj;
396
- },
397
-
398
- create(base?: DeepPartial<GetPriceResponse>): GetPriceResponse {
399
- return GetPriceResponse.fromPartial(base ?? {});
400
- },
401
- fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {
402
- const message = createBaseGetPriceResponse();
403
- message.price = object.price ?? 0;
404
- message.timestamp = object.timestamp ?? undefined;
405
- return message;
406
- },
407
- };
408
-
409
- function createBaseBatchGetPricesRequest(): BatchGetPricesRequest {
410
- return { timestamps: [], coinIds: [] };
411
- }
412
-
413
- export const BatchGetPricesRequest = {
414
- encode(message: BatchGetPricesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
415
- for (const v of message.timestamps) {
416
- Timestamp.encode(toTimestamp(v!), writer.uint32(10).fork()).ldelim();
417
- }
418
- for (const v of message.coinIds) {
419
- CoinID.encode(v!, writer.uint32(18).fork()).ldelim();
420
- }
421
- return writer;
422
- },
423
-
424
- decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesRequest {
425
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
426
- let end = length === undefined ? reader.len : reader.pos + length;
427
- const message = createBaseBatchGetPricesRequest();
428
- while (reader.pos < end) {
429
- const tag = reader.uint32();
430
- switch (tag >>> 3) {
431
- case 1:
432
- if (tag !== 10) {
433
- break;
434
- }
435
-
436
- message.timestamps.push(fromTimestamp(Timestamp.decode(reader, reader.uint32())));
437
- continue;
438
- case 2:
439
- if (tag !== 18) {
440
- break;
441
- }
442
-
443
- message.coinIds.push(CoinID.decode(reader, reader.uint32()));
444
- continue;
445
- }
446
- if ((tag & 7) === 4 || tag === 0) {
447
- break;
448
- }
449
- reader.skipType(tag & 7);
450
- }
451
- return message;
452
- },
453
-
454
- fromJSON(object: any): BatchGetPricesRequest {
455
- return {
456
- timestamps: globalThis.Array.isArray(object?.timestamps)
457
- ? object.timestamps.map((e: any) => fromJsonTimestamp(e))
458
- : [],
459
- coinIds: globalThis.Array.isArray(object?.coinIds) ? object.coinIds.map((e: any) => CoinID.fromJSON(e)) : [],
460
- };
461
- },
462
-
463
- toJSON(message: BatchGetPricesRequest): unknown {
464
- const obj: any = {};
465
- if (message.timestamps?.length) {
466
- obj.timestamps = message.timestamps.map((e) => e.toISOString());
467
- }
468
- if (message.coinIds?.length) {
469
- obj.coinIds = message.coinIds.map((e) => CoinID.toJSON(e));
470
- }
471
- return obj;
472
- },
473
-
474
- create(base?: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
475
- return BatchGetPricesRequest.fromPartial(base ?? {});
476
- },
477
- fromPartial(object: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
478
- const message = createBaseBatchGetPricesRequest();
479
- message.timestamps = object.timestamps?.map((e) => e) || [];
480
- message.coinIds = object.coinIds?.map((e) => CoinID.fromPartial(e)) || [];
481
- return message;
482
- },
483
- };
484
-
485
- function createBaseBatchGetPricesResponse(): BatchGetPricesResponse {
486
- return { prices: [] };
487
- }
488
-
489
- export const BatchGetPricesResponse = {
490
- encode(message: BatchGetPricesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
491
- for (const v of message.prices) {
492
- BatchGetPricesResponse_CoinPrice.encode(v!, writer.uint32(10).fork()).ldelim();
493
- }
494
- return writer;
495
- },
496
-
497
- decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse {
498
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
499
- let end = length === undefined ? reader.len : reader.pos + length;
500
- const message = createBaseBatchGetPricesResponse();
501
- while (reader.pos < end) {
502
- const tag = reader.uint32();
503
- switch (tag >>> 3) {
504
- case 1:
505
- if (tag !== 10) {
506
- break;
507
- }
508
-
509
- message.prices.push(BatchGetPricesResponse_CoinPrice.decode(reader, reader.uint32()));
510
- continue;
511
- }
512
- if ((tag & 7) === 4 || tag === 0) {
513
- break;
514
- }
515
- reader.skipType(tag & 7);
516
- }
517
- return message;
518
- },
519
-
520
- fromJSON(object: any): BatchGetPricesResponse {
521
- return {
522
- prices: globalThis.Array.isArray(object?.prices)
523
- ? object.prices.map((e: any) => BatchGetPricesResponse_CoinPrice.fromJSON(e))
524
- : [],
525
- };
526
- },
527
-
528
- toJSON(message: BatchGetPricesResponse): unknown {
529
- const obj: any = {};
530
- if (message.prices?.length) {
531
- obj.prices = message.prices.map((e) => BatchGetPricesResponse_CoinPrice.toJSON(e));
532
- }
533
- return obj;
534
- },
535
-
536
- create(base?: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
537
- return BatchGetPricesResponse.fromPartial(base ?? {});
538
- },
539
- fromPartial(object: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
540
- const message = createBaseBatchGetPricesResponse();
541
- message.prices = object.prices?.map((e) => BatchGetPricesResponse_CoinPrice.fromPartial(e)) || [];
542
- return message;
543
- },
544
- };
545
-
546
- function createBaseBatchGetPricesResponse_CoinPrice(): BatchGetPricesResponse_CoinPrice {
547
- return { coinId: undefined, price: undefined, error: undefined };
548
- }
549
-
550
- export const BatchGetPricesResponse_CoinPrice = {
551
- encode(message: BatchGetPricesResponse_CoinPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
552
- if (message.coinId !== undefined) {
553
- CoinID.encode(message.coinId, writer.uint32(10).fork()).ldelim();
554
- }
555
- if (message.price !== undefined) {
556
- BatchGetPricesResponse_CoinPrice_Price.encode(message.price, writer.uint32(18).fork()).ldelim();
557
- }
558
- if (message.error !== undefined) {
559
- writer.uint32(26).string(message.error);
560
- }
561
- return writer;
562
- },
563
-
564
- decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice {
565
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
566
- let end = length === undefined ? reader.len : reader.pos + length;
567
- const message = createBaseBatchGetPricesResponse_CoinPrice();
568
- while (reader.pos < end) {
569
- const tag = reader.uint32();
570
- switch (tag >>> 3) {
571
- case 1:
572
- if (tag !== 10) {
573
- break;
574
- }
575
-
576
- message.coinId = CoinID.decode(reader, reader.uint32());
577
- continue;
578
- case 2:
579
- if (tag !== 18) {
580
- break;
581
- }
582
-
583
- message.price = BatchGetPricesResponse_CoinPrice_Price.decode(reader, reader.uint32());
584
- continue;
585
- case 3:
586
- if (tag !== 26) {
587
- break;
588
- }
589
-
590
- message.error = reader.string();
591
- continue;
592
- }
593
- if ((tag & 7) === 4 || tag === 0) {
594
- break;
595
- }
596
- reader.skipType(tag & 7);
597
- }
598
- return message;
599
- },
600
-
601
- fromJSON(object: any): BatchGetPricesResponse_CoinPrice {
602
- return {
603
- coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
604
- price: isSet(object.price) ? BatchGetPricesResponse_CoinPrice_Price.fromJSON(object.price) : undefined,
605
- error: isSet(object.error) ? globalThis.String(object.error) : undefined,
606
- };
607
- },
608
-
609
- toJSON(message: BatchGetPricesResponse_CoinPrice): unknown {
610
- const obj: any = {};
611
- if (message.coinId !== undefined) {
612
- obj.coinId = CoinID.toJSON(message.coinId);
613
- }
614
- if (message.price !== undefined) {
615
- obj.price = BatchGetPricesResponse_CoinPrice_Price.toJSON(message.price);
616
- }
617
- if (message.error !== undefined) {
618
- obj.error = message.error;
619
- }
620
- return obj;
621
- },
622
-
623
- create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
624
- return BatchGetPricesResponse_CoinPrice.fromPartial(base ?? {});
625
- },
626
- fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
627
- const message = createBaseBatchGetPricesResponse_CoinPrice();
628
- message.coinId = (object.coinId !== undefined && object.coinId !== null)
629
- ? CoinID.fromPartial(object.coinId)
630
- : undefined;
631
- message.price = (object.price !== undefined && object.price !== null)
632
- ? BatchGetPricesResponse_CoinPrice_Price.fromPartial(object.price)
633
- : undefined;
634
- message.error = object.error ?? undefined;
635
- return message;
636
- },
637
- };
638
-
639
- function createBaseBatchGetPricesResponse_CoinPrice_Price(): BatchGetPricesResponse_CoinPrice_Price {
640
- return { results: [] };
641
- }
642
-
643
- export const BatchGetPricesResponse_CoinPrice_Price = {
644
- encode(message: BatchGetPricesResponse_CoinPrice_Price, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
645
- for (const v of message.results) {
646
- GetPriceResponse.encode(v!, writer.uint32(10).fork()).ldelim();
647
- }
648
- return writer;
649
- },
650
-
651
- decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice_Price {
652
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
653
- let end = length === undefined ? reader.len : reader.pos + length;
654
- const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
655
- while (reader.pos < end) {
656
- const tag = reader.uint32();
657
- switch (tag >>> 3) {
658
- case 1:
659
- if (tag !== 10) {
660
- break;
661
- }
662
-
663
- message.results.push(GetPriceResponse.decode(reader, reader.uint32()));
664
- continue;
665
- }
666
- if ((tag & 7) === 4 || tag === 0) {
667
- break;
668
- }
669
- reader.skipType(tag & 7);
670
- }
671
- return message;
672
- },
673
-
674
- fromJSON(object: any): BatchGetPricesResponse_CoinPrice_Price {
675
- return {
676
- results: globalThis.Array.isArray(object?.results)
677
- ? object.results.map((e: any) => GetPriceResponse.fromJSON(e))
678
- : [],
679
- };
680
- },
681
-
682
- toJSON(message: BatchGetPricesResponse_CoinPrice_Price): unknown {
683
- const obj: any = {};
684
- if (message.results?.length) {
685
- obj.results = message.results.map((e) => GetPriceResponse.toJSON(e));
686
- }
687
- return obj;
688
- },
689
-
690
- create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
691
- return BatchGetPricesResponse_CoinPrice_Price.fromPartial(base ?? {});
692
- },
693
- fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
694
- const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
695
- message.results = object.results?.map((e) => GetPriceResponse.fromPartial(e)) || [];
696
- return message;
697
- },
698
- };
699
-
700
- function createBaseListCoinsRequest(): ListCoinsRequest {
701
- return { limit: 0, offset: 0, searchQuery: "", chain: "" };
702
- }
703
-
704
- export const ListCoinsRequest = {
705
- encode(message: ListCoinsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
706
- if (message.limit !== 0) {
707
- writer.uint32(8).int32(message.limit);
708
- }
709
- if (message.offset !== 0) {
710
- writer.uint32(16).int32(message.offset);
711
- }
712
- if (message.searchQuery !== "") {
713
- writer.uint32(26).string(message.searchQuery);
714
- }
715
- if (message.chain !== "") {
716
- writer.uint32(34).string(message.chain);
717
- }
718
- return writer;
719
- },
720
-
721
- decode(input: _m0.Reader | Uint8Array, length?: number): ListCoinsRequest {
722
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
723
- let end = length === undefined ? reader.len : reader.pos + length;
724
- const message = createBaseListCoinsRequest();
725
- while (reader.pos < end) {
726
- const tag = reader.uint32();
727
- switch (tag >>> 3) {
728
- case 1:
729
- if (tag !== 8) {
730
- break;
731
- }
732
-
733
- message.limit = reader.int32();
734
- continue;
735
- case 2:
736
- if (tag !== 16) {
737
- break;
738
- }
739
-
740
- message.offset = reader.int32();
741
- continue;
742
- case 3:
743
- if (tag !== 26) {
744
- break;
745
- }
746
-
747
- message.searchQuery = reader.string();
748
- continue;
749
- case 4:
750
- if (tag !== 34) {
751
- break;
752
- }
753
-
754
- message.chain = reader.string();
755
- continue;
756
- }
757
- if ((tag & 7) === 4 || tag === 0) {
758
- break;
759
- }
760
- reader.skipType(tag & 7);
761
- }
762
- return message;
763
- },
764
-
765
- fromJSON(object: any): ListCoinsRequest {
766
- return {
767
- limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
768
- offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
769
- searchQuery: isSet(object.searchQuery) ? globalThis.String(object.searchQuery) : "",
770
- chain: isSet(object.chain) ? globalThis.String(object.chain) : "",
771
- };
772
- },
773
-
774
- toJSON(message: ListCoinsRequest): unknown {
775
- const obj: any = {};
776
- if (message.limit !== 0) {
777
- obj.limit = Math.round(message.limit);
778
- }
779
- if (message.offset !== 0) {
780
- obj.offset = Math.round(message.offset);
781
- }
782
- if (message.searchQuery !== "") {
783
- obj.searchQuery = message.searchQuery;
784
- }
785
- if (message.chain !== "") {
786
- obj.chain = message.chain;
787
- }
788
- return obj;
789
- },
790
-
791
- create(base?: DeepPartial<ListCoinsRequest>): ListCoinsRequest {
792
- return ListCoinsRequest.fromPartial(base ?? {});
793
- },
794
- fromPartial(object: DeepPartial<ListCoinsRequest>): ListCoinsRequest {
795
- const message = createBaseListCoinsRequest();
796
- message.limit = object.limit ?? 0;
797
- message.offset = object.offset ?? 0;
798
- message.searchQuery = object.searchQuery ?? "";
799
- message.chain = object.chain ?? "";
800
- return message;
801
- },
802
- };
803
-
804
- function createBaseListCoinsResponse(): ListCoinsResponse {
805
- return { coins: [], coinAddressesInChain: {} };
806
- }
807
-
808
- export const ListCoinsResponse = {
809
- encode(message: ListCoinsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
810
- for (const v of message.coins) {
811
- CoinID.encode(v!, writer.uint32(10).fork()).ldelim();
812
- }
813
- Object.entries(message.coinAddressesInChain).forEach(([key, value]) => {
814
- ListCoinsResponse_CoinAddressesInChainEntry.encode({ key: key as any, value }, writer.uint32(18).fork()).ldelim();
815
- });
816
- return writer;
817
- },
818
-
819
- decode(input: _m0.Reader | Uint8Array, length?: number): ListCoinsResponse {
820
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
821
- let end = length === undefined ? reader.len : reader.pos + length;
822
- const message = createBaseListCoinsResponse();
823
- while (reader.pos < end) {
824
- const tag = reader.uint32();
825
- switch (tag >>> 3) {
826
- case 1:
827
- if (tag !== 10) {
828
- break;
829
- }
830
-
831
- message.coins.push(CoinID.decode(reader, reader.uint32()));
832
- continue;
833
- case 2:
834
- if (tag !== 18) {
835
- break;
836
- }
837
-
838
- const entry2 = ListCoinsResponse_CoinAddressesInChainEntry.decode(reader, reader.uint32());
839
- if (entry2.value !== undefined) {
840
- message.coinAddressesInChain[entry2.key] = entry2.value;
841
- }
842
- continue;
843
- }
844
- if ((tag & 7) === 4 || tag === 0) {
845
- break;
846
- }
847
- reader.skipType(tag & 7);
848
- }
849
- return message;
850
- },
851
-
852
- fromJSON(object: any): ListCoinsResponse {
853
- return {
854
- coins: globalThis.Array.isArray(object?.coins) ? object.coins.map((e: any) => CoinID.fromJSON(e)) : [],
855
- coinAddressesInChain: isObject(object.coinAddressesInChain)
856
- ? Object.entries(object.coinAddressesInChain).reduce<{ [key: string]: CoinID }>((acc, [key, value]) => {
857
- acc[key] = CoinID.fromJSON(value);
858
- return acc;
859
- }, {})
860
- : {},
861
- };
862
- },
863
-
864
- toJSON(message: ListCoinsResponse): unknown {
865
- const obj: any = {};
866
- if (message.coins?.length) {
867
- obj.coins = message.coins.map((e) => CoinID.toJSON(e));
868
- }
869
- if (message.coinAddressesInChain) {
870
- const entries = Object.entries(message.coinAddressesInChain);
871
- if (entries.length > 0) {
872
- obj.coinAddressesInChain = {};
873
- entries.forEach(([k, v]) => {
874
- obj.coinAddressesInChain[k] = CoinID.toJSON(v);
875
- });
876
- }
877
- }
878
- return obj;
879
- },
880
-
881
- create(base?: DeepPartial<ListCoinsResponse>): ListCoinsResponse {
882
- return ListCoinsResponse.fromPartial(base ?? {});
883
- },
884
- fromPartial(object: DeepPartial<ListCoinsResponse>): ListCoinsResponse {
885
- const message = createBaseListCoinsResponse();
886
- message.coins = object.coins?.map((e) => CoinID.fromPartial(e)) || [];
887
- message.coinAddressesInChain = Object.entries(object.coinAddressesInChain ?? {}).reduce<{ [key: string]: CoinID }>(
888
- (acc, [key, value]) => {
889
- if (value !== undefined) {
890
- acc[key] = CoinID.fromPartial(value);
891
- }
892
- return acc;
893
- },
894
- {},
895
- );
896
- return message;
897
- },
898
- };
899
-
900
- function createBaseListCoinsResponse_CoinAddressesInChainEntry(): ListCoinsResponse_CoinAddressesInChainEntry {
901
- return { key: "", value: undefined };
902
- }
903
-
904
- export const ListCoinsResponse_CoinAddressesInChainEntry = {
905
- encode(message: ListCoinsResponse_CoinAddressesInChainEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
906
- if (message.key !== "") {
907
- writer.uint32(10).string(message.key);
908
- }
909
- if (message.value !== undefined) {
910
- CoinID.encode(message.value, writer.uint32(18).fork()).ldelim();
911
- }
912
- return writer;
913
- },
914
-
915
- decode(input: _m0.Reader | Uint8Array, length?: number): ListCoinsResponse_CoinAddressesInChainEntry {
916
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
917
- let end = length === undefined ? reader.len : reader.pos + length;
918
- const message = createBaseListCoinsResponse_CoinAddressesInChainEntry();
919
- while (reader.pos < end) {
920
- const tag = reader.uint32();
921
- switch (tag >>> 3) {
922
- case 1:
923
- if (tag !== 10) {
924
- break;
925
- }
926
-
927
- message.key = reader.string();
928
- continue;
929
- case 2:
930
- if (tag !== 18) {
931
- break;
932
- }
933
-
934
- message.value = CoinID.decode(reader, reader.uint32());
935
- continue;
936
- }
937
- if ((tag & 7) === 4 || tag === 0) {
938
- break;
939
- }
940
- reader.skipType(tag & 7);
941
- }
942
- return message;
943
- },
944
-
945
- fromJSON(object: any): ListCoinsResponse_CoinAddressesInChainEntry {
946
- return {
947
- key: isSet(object.key) ? globalThis.String(object.key) : "",
948
- value: isSet(object.value) ? CoinID.fromJSON(object.value) : undefined,
949
- };
950
- },
951
-
952
- toJSON(message: ListCoinsResponse_CoinAddressesInChainEntry): unknown {
953
- const obj: any = {};
954
- if (message.key !== "") {
955
- obj.key = message.key;
956
- }
957
- if (message.value !== undefined) {
958
- obj.value = CoinID.toJSON(message.value);
959
- }
960
- return obj;
961
- },
962
-
963
- create(base?: DeepPartial<ListCoinsResponse_CoinAddressesInChainEntry>): ListCoinsResponse_CoinAddressesInChainEntry {
964
- return ListCoinsResponse_CoinAddressesInChainEntry.fromPartial(base ?? {});
965
- },
966
- fromPartial(
967
- object: DeepPartial<ListCoinsResponse_CoinAddressesInChainEntry>,
968
- ): ListCoinsResponse_CoinAddressesInChainEntry {
969
- const message = createBaseListCoinsResponse_CoinAddressesInChainEntry();
970
- message.key = object.key ?? "";
971
- message.value = (object.value !== undefined && object.value !== null)
972
- ? CoinID.fromPartial(object.value)
973
- : undefined;
974
- return message;
975
- },
976
- };
977
-
978
- function createBaseCheckLatestPriceResponse(): CheckLatestPriceResponse {
979
- return { prices: [], latestPrice: undefined };
980
- }
981
-
982
- export const CheckLatestPriceResponse = {
983
- encode(message: CheckLatestPriceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
984
- for (const v of message.prices) {
985
- CheckLatestPriceResponse_CoinPrice.encode(v!, writer.uint32(10).fork()).ldelim();
986
- }
987
- if (message.latestPrice !== undefined) {
988
- CheckLatestPriceResponse_CoinPrice.encode(message.latestPrice, writer.uint32(18).fork()).ldelim();
989
- }
990
- return writer;
991
- },
992
-
993
- decode(input: _m0.Reader | Uint8Array, length?: number): CheckLatestPriceResponse {
994
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
995
- let end = length === undefined ? reader.len : reader.pos + length;
996
- const message = createBaseCheckLatestPriceResponse();
997
- while (reader.pos < end) {
998
- const tag = reader.uint32();
999
- switch (tag >>> 3) {
1000
- case 1:
1001
- if (tag !== 10) {
1002
- break;
1003
- }
1004
-
1005
- message.prices.push(CheckLatestPriceResponse_CoinPrice.decode(reader, reader.uint32()));
1006
- continue;
1007
- case 2:
1008
- if (tag !== 18) {
1009
- break;
1010
- }
1011
-
1012
- message.latestPrice = CheckLatestPriceResponse_CoinPrice.decode(reader, reader.uint32());
1013
- continue;
1014
- }
1015
- if ((tag & 7) === 4 || tag === 0) {
1016
- break;
1017
- }
1018
- reader.skipType(tag & 7);
1019
- }
1020
- return message;
1021
- },
1022
-
1023
- fromJSON(object: any): CheckLatestPriceResponse {
1024
- return {
1025
- prices: globalThis.Array.isArray(object?.prices)
1026
- ? object.prices.map((e: any) => CheckLatestPriceResponse_CoinPrice.fromJSON(e))
1027
- : [],
1028
- latestPrice: isSet(object.latestPrice)
1029
- ? CheckLatestPriceResponse_CoinPrice.fromJSON(object.latestPrice)
1030
- : undefined,
1031
- };
1032
- },
1033
-
1034
- toJSON(message: CheckLatestPriceResponse): unknown {
1035
- const obj: any = {};
1036
- if (message.prices?.length) {
1037
- obj.prices = message.prices.map((e) => CheckLatestPriceResponse_CoinPrice.toJSON(e));
1038
- }
1039
- if (message.latestPrice !== undefined) {
1040
- obj.latestPrice = CheckLatestPriceResponse_CoinPrice.toJSON(message.latestPrice);
1041
- }
1042
- return obj;
1043
- },
1044
-
1045
- create(base?: DeepPartial<CheckLatestPriceResponse>): CheckLatestPriceResponse {
1046
- return CheckLatestPriceResponse.fromPartial(base ?? {});
1047
- },
1048
- fromPartial(object: DeepPartial<CheckLatestPriceResponse>): CheckLatestPriceResponse {
1049
- const message = createBaseCheckLatestPriceResponse();
1050
- message.prices = object.prices?.map((e) => CheckLatestPriceResponse_CoinPrice.fromPartial(e)) || [];
1051
- message.latestPrice = (object.latestPrice !== undefined && object.latestPrice !== null)
1052
- ? CheckLatestPriceResponse_CoinPrice.fromPartial(object.latestPrice)
1053
- : undefined;
1054
- return message;
1055
- },
1056
- };
1057
-
1058
- function createBaseCheckLatestPriceResponse_CoinPrice(): CheckLatestPriceResponse_CoinPrice {
1059
- return { coinId: undefined, price: 0, timestamp: undefined };
1060
- }
1061
-
1062
- export const CheckLatestPriceResponse_CoinPrice = {
1063
- encode(message: CheckLatestPriceResponse_CoinPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1064
- if (message.coinId !== undefined) {
1065
- CoinID.encode(message.coinId, writer.uint32(10).fork()).ldelim();
1066
- }
1067
- if (message.price !== 0) {
1068
- writer.uint32(17).double(message.price);
1069
- }
1070
- if (message.timestamp !== undefined) {
1071
- Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim();
1072
- }
1073
- return writer;
1074
- },
1075
-
1076
- decode(input: _m0.Reader | Uint8Array, length?: number): CheckLatestPriceResponse_CoinPrice {
1077
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1078
- let end = length === undefined ? reader.len : reader.pos + length;
1079
- const message = createBaseCheckLatestPriceResponse_CoinPrice();
1080
- while (reader.pos < end) {
1081
- const tag = reader.uint32();
1082
- switch (tag >>> 3) {
1083
- case 1:
1084
- if (tag !== 10) {
1085
- break;
1086
- }
1087
-
1088
- message.coinId = CoinID.decode(reader, reader.uint32());
1089
- continue;
1090
- case 2:
1091
- if (tag !== 17) {
1092
- break;
1093
- }
1094
-
1095
- message.price = reader.double();
1096
- continue;
1097
- case 3:
1098
- if (tag !== 26) {
1099
- break;
1100
- }
1101
-
1102
- message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
1103
- continue;
1104
- }
1105
- if ((tag & 7) === 4 || tag === 0) {
1106
- break;
1107
- }
1108
- reader.skipType(tag & 7);
1109
- }
1110
- return message;
1111
- },
1112
-
1113
- fromJSON(object: any): CheckLatestPriceResponse_CoinPrice {
1114
- return {
1115
- coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
1116
- price: isSet(object.price) ? globalThis.Number(object.price) : 0,
1117
- timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
1118
- };
1119
- },
1120
-
1121
- toJSON(message: CheckLatestPriceResponse_CoinPrice): unknown {
1122
- const obj: any = {};
1123
- if (message.coinId !== undefined) {
1124
- obj.coinId = CoinID.toJSON(message.coinId);
1125
- }
1126
- if (message.price !== 0) {
1127
- obj.price = message.price;
1128
- }
1129
- if (message.timestamp !== undefined) {
1130
- obj.timestamp = message.timestamp.toISOString();
1131
- }
1132
- return obj;
1133
- },
1134
-
1135
- create(base?: DeepPartial<CheckLatestPriceResponse_CoinPrice>): CheckLatestPriceResponse_CoinPrice {
1136
- return CheckLatestPriceResponse_CoinPrice.fromPartial(base ?? {});
1137
- },
1138
- fromPartial(object: DeepPartial<CheckLatestPriceResponse_CoinPrice>): CheckLatestPriceResponse_CoinPrice {
1139
- const message = createBaseCheckLatestPriceResponse_CoinPrice();
1140
- message.coinId = (object.coinId !== undefined && object.coinId !== null)
1141
- ? CoinID.fromPartial(object.coinId)
1142
- : undefined;
1143
- message.price = object.price ?? 0;
1144
- message.timestamp = object.timestamp ?? undefined;
1145
- return message;
1146
- },
1147
- };
1148
-
1149
- function createBaseBackfillCoinRequest(): BackfillCoinRequest {
1150
- return {
1151
- name: "",
1152
- symbol: "",
1153
- chain: "",
1154
- address: "",
1155
- coingeckoId: "",
1156
- decimals: 0,
1157
- logoUrl: "",
1158
- projectUrl: "",
1159
- accountAddress: "",
1160
- moduleName: "",
1161
- structName: "",
1162
- };
1163
- }
1164
-
1165
- export const BackfillCoinRequest = {
1166
- encode(message: BackfillCoinRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1167
- if (message.name !== "") {
1168
- writer.uint32(10).string(message.name);
1169
- }
1170
- if (message.symbol !== "") {
1171
- writer.uint32(18).string(message.symbol);
1172
- }
1173
- if (message.chain !== "") {
1174
- writer.uint32(26).string(message.chain);
1175
- }
1176
- if (message.address !== "") {
1177
- writer.uint32(34).string(message.address);
1178
- }
1179
- if (message.coingeckoId !== "") {
1180
- writer.uint32(42).string(message.coingeckoId);
1181
- }
1182
- if (message.decimals !== 0) {
1183
- writer.uint32(48).uint32(message.decimals);
1184
- }
1185
- if (message.logoUrl !== "") {
1186
- writer.uint32(58).string(message.logoUrl);
1187
- }
1188
- if (message.projectUrl !== "") {
1189
- writer.uint32(66).string(message.projectUrl);
1190
- }
1191
- if (message.accountAddress !== "") {
1192
- writer.uint32(74).string(message.accountAddress);
1193
- }
1194
- if (message.moduleName !== "") {
1195
- writer.uint32(82).string(message.moduleName);
1196
- }
1197
- if (message.structName !== "") {
1198
- writer.uint32(90).string(message.structName);
1199
- }
1200
- return writer;
1201
- },
1202
-
1203
- decode(input: _m0.Reader | Uint8Array, length?: number): BackfillCoinRequest {
1204
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1205
- let end = length === undefined ? reader.len : reader.pos + length;
1206
- const message = createBaseBackfillCoinRequest();
1207
- while (reader.pos < end) {
1208
- const tag = reader.uint32();
1209
- switch (tag >>> 3) {
1210
- case 1:
1211
- if (tag !== 10) {
1212
- break;
1213
- }
1214
-
1215
- message.name = reader.string();
1216
- continue;
1217
- case 2:
1218
- if (tag !== 18) {
1219
- break;
1220
- }
1221
-
1222
- message.symbol = reader.string();
1223
- continue;
1224
- case 3:
1225
- if (tag !== 26) {
1226
- break;
1227
- }
1228
-
1229
- message.chain = reader.string();
1230
- continue;
1231
- case 4:
1232
- if (tag !== 34) {
1233
- break;
1234
- }
1235
-
1236
- message.address = reader.string();
1237
- continue;
1238
- case 5:
1239
- if (tag !== 42) {
1240
- break;
1241
- }
1242
-
1243
- message.coingeckoId = reader.string();
1244
- continue;
1245
- case 6:
1246
- if (tag !== 48) {
1247
- break;
1248
- }
1249
-
1250
- message.decimals = reader.uint32();
1251
- continue;
1252
- case 7:
1253
- if (tag !== 58) {
1254
- break;
1255
- }
1256
-
1257
- message.logoUrl = reader.string();
1258
- continue;
1259
- case 8:
1260
- if (tag !== 66) {
1261
- break;
1262
- }
1263
-
1264
- message.projectUrl = reader.string();
1265
- continue;
1266
- case 9:
1267
- if (tag !== 74) {
1268
- break;
1269
- }
1270
-
1271
- message.accountAddress = reader.string();
1272
- continue;
1273
- case 10:
1274
- if (tag !== 82) {
1275
- break;
1276
- }
1277
-
1278
- message.moduleName = reader.string();
1279
- continue;
1280
- case 11:
1281
- if (tag !== 90) {
1282
- break;
1283
- }
1284
-
1285
- message.structName = reader.string();
1286
- continue;
1287
- }
1288
- if ((tag & 7) === 4 || tag === 0) {
1289
- break;
1290
- }
1291
- reader.skipType(tag & 7);
1292
- }
1293
- return message;
1294
- },
1295
-
1296
- fromJSON(object: any): BackfillCoinRequest {
1297
- return {
1298
- name: isSet(object.name) ? globalThis.String(object.name) : "",
1299
- symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "",
1300
- chain: isSet(object.chain) ? globalThis.String(object.chain) : "",
1301
- address: isSet(object.address) ? globalThis.String(object.address) : "",
1302
- coingeckoId: isSet(object.coingeckoId) ? globalThis.String(object.coingeckoId) : "",
1303
- decimals: isSet(object.decimals) ? globalThis.Number(object.decimals) : 0,
1304
- logoUrl: isSet(object.logoUrl) ? globalThis.String(object.logoUrl) : "",
1305
- projectUrl: isSet(object.projectUrl) ? globalThis.String(object.projectUrl) : "",
1306
- accountAddress: isSet(object.accountAddress) ? globalThis.String(object.accountAddress) : "",
1307
- moduleName: isSet(object.moduleName) ? globalThis.String(object.moduleName) : "",
1308
- structName: isSet(object.structName) ? globalThis.String(object.structName) : "",
1309
- };
1310
- },
1311
-
1312
- toJSON(message: BackfillCoinRequest): unknown {
1313
- const obj: any = {};
1314
- if (message.name !== "") {
1315
- obj.name = message.name;
1316
- }
1317
- if (message.symbol !== "") {
1318
- obj.symbol = message.symbol;
1319
- }
1320
- if (message.chain !== "") {
1321
- obj.chain = message.chain;
1322
- }
1323
- if (message.address !== "") {
1324
- obj.address = message.address;
1325
- }
1326
- if (message.coingeckoId !== "") {
1327
- obj.coingeckoId = message.coingeckoId;
1328
- }
1329
- if (message.decimals !== 0) {
1330
- obj.decimals = Math.round(message.decimals);
1331
- }
1332
- if (message.logoUrl !== "") {
1333
- obj.logoUrl = message.logoUrl;
1334
- }
1335
- if (message.projectUrl !== "") {
1336
- obj.projectUrl = message.projectUrl;
1337
- }
1338
- if (message.accountAddress !== "") {
1339
- obj.accountAddress = message.accountAddress;
1340
- }
1341
- if (message.moduleName !== "") {
1342
- obj.moduleName = message.moduleName;
1343
- }
1344
- if (message.structName !== "") {
1345
- obj.structName = message.structName;
1346
- }
1347
- return obj;
1348
- },
1349
-
1350
- create(base?: DeepPartial<BackfillCoinRequest>): BackfillCoinRequest {
1351
- return BackfillCoinRequest.fromPartial(base ?? {});
1352
- },
1353
- fromPartial(object: DeepPartial<BackfillCoinRequest>): BackfillCoinRequest {
1354
- const message = createBaseBackfillCoinRequest();
1355
- message.name = object.name ?? "";
1356
- message.symbol = object.symbol ?? "";
1357
- message.chain = object.chain ?? "";
1358
- message.address = object.address ?? "";
1359
- message.coingeckoId = object.coingeckoId ?? "";
1360
- message.decimals = object.decimals ?? 0;
1361
- message.logoUrl = object.logoUrl ?? "";
1362
- message.projectUrl = object.projectUrl ?? "";
1363
- message.accountAddress = object.accountAddress ?? "";
1364
- message.moduleName = object.moduleName ?? "";
1365
- message.structName = object.structName ?? "";
1366
- return message;
1367
- },
1368
- };
1369
-
1370
- function createBaseBackfillCoinResponse(): BackfillCoinResponse {
1371
- return { symbol: "", message: "" };
1372
- }
1373
-
1374
- export const BackfillCoinResponse = {
1375
- encode(message: BackfillCoinResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1376
- if (message.symbol !== "") {
1377
- writer.uint32(10).string(message.symbol);
1378
- }
1379
- if (message.message !== "") {
1380
- writer.uint32(18).string(message.message);
1381
- }
1382
- return writer;
1383
- },
1384
-
1385
- decode(input: _m0.Reader | Uint8Array, length?: number): BackfillCoinResponse {
1386
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1387
- let end = length === undefined ? reader.len : reader.pos + length;
1388
- const message = createBaseBackfillCoinResponse();
1389
- while (reader.pos < end) {
1390
- const tag = reader.uint32();
1391
- switch (tag >>> 3) {
1392
- case 1:
1393
- if (tag !== 10) {
1394
- break;
1395
- }
1396
-
1397
- message.symbol = reader.string();
1398
- continue;
1399
- case 2:
1400
- if (tag !== 18) {
1401
- break;
1402
- }
1403
-
1404
- message.message = reader.string();
1405
- continue;
1406
- }
1407
- if ((tag & 7) === 4 || tag === 0) {
1408
- break;
1409
- }
1410
- reader.skipType(tag & 7);
1411
- }
1412
- return message;
1413
- },
1414
-
1415
- fromJSON(object: any): BackfillCoinResponse {
1416
- return {
1417
- symbol: isSet(object.symbol) ? globalThis.String(object.symbol) : "",
1418
- message: isSet(object.message) ? globalThis.String(object.message) : "",
1419
- };
1420
- },
1421
-
1422
- toJSON(message: BackfillCoinResponse): unknown {
1423
- const obj: any = {};
1424
- if (message.symbol !== "") {
1425
- obj.symbol = message.symbol;
1426
- }
1427
- if (message.message !== "") {
1428
- obj.message = message.message;
1429
- }
1430
- return obj;
1431
- },
1432
-
1433
- create(base?: DeepPartial<BackfillCoinResponse>): BackfillCoinResponse {
1434
- return BackfillCoinResponse.fromPartial(base ?? {});
1435
- },
1436
- fromPartial(object: DeepPartial<BackfillCoinResponse>): BackfillCoinResponse {
1437
- const message = createBaseBackfillCoinResponse();
1438
- message.symbol = object.symbol ?? "";
1439
- message.message = object.message ?? "";
1440
- return message;
1441
- },
1442
- };
1443
-
1444
- export type PriceServiceDefinition = typeof PriceServiceDefinition;
1445
- export const PriceServiceDefinition = {
1446
- name: "PriceService",
1447
- fullName: "price_service.PriceService",
1448
- methods: {
1449
- getPrice: {
1450
- name: "GetPrice",
1451
- requestType: GetPriceRequest,
1452
- requestStream: false,
1453
- responseType: GetPriceResponse,
1454
- responseStream: false,
1455
- options: {
1456
- _unknownFields: {
1457
- 8338: [new Uint8Array([0])],
1458
- 578365826: [new Uint8Array([16, 18, 14, 47, 97, 112, 105, 47, 118, 49, 47, 112, 114, 105, 99, 101, 115])],
1459
- },
1460
- },
1461
- },
1462
- batchGetPrices: {
1463
- name: "BatchGetPrices",
1464
- requestType: BatchGetPricesRequest,
1465
- requestStream: false,
1466
- responseType: BatchGetPricesResponse,
1467
- responseStream: false,
1468
- options: {
1469
- _unknownFields: {
1470
- 8338: [new Uint8Array([0])],
1471
- 578365826: [
1472
- new Uint8Array([
1473
- 25,
1474
- 34,
1475
- 20,
1476
- 47,
1477
- 97,
1478
- 112,
1479
- 105,
1480
- 47,
1481
- 118,
1482
- 49,
1483
- 47,
1484
- 112,
1485
- 114,
1486
- 105,
1487
- 99,
1488
- 101,
1489
- 115,
1490
- 47,
1491
- 98,
1492
- 97,
1493
- 116,
1494
- 99,
1495
- 104,
1496
- 58,
1497
- 1,
1498
- 42,
1499
- ]),
1500
- ],
1501
- },
1502
- },
1503
- },
1504
- listCoins: {
1505
- name: "ListCoins",
1506
- requestType: ListCoinsRequest,
1507
- requestStream: false,
1508
- responseType: ListCoinsResponse,
1509
- responseStream: false,
1510
- options: {
1511
- _unknownFields: {
1512
- 8338: [new Uint8Array([16, 42, 14, 80, 114, 105, 99, 101, 76, 105, 115, 116, 67, 111, 105, 110, 115])],
1513
- 578365826: [
1514
- new Uint8Array([
1515
- 22,
1516
- 18,
1517
- 20,
1518
- 47,
1519
- 97,
1520
- 112,
1521
- 105,
1522
- 47,
1523
- 118,
1524
- 49,
1525
- 47,
1526
- 112,
1527
- 114,
1528
- 105,
1529
- 99,
1530
- 101,
1531
- 115,
1532
- 47,
1533
- 99,
1534
- 111,
1535
- 105,
1536
- 110,
1537
- 115,
1538
- ]),
1539
- ],
1540
- },
1541
- },
1542
- },
1543
- checkLatestPrice: {
1544
- name: "CheckLatestPrice",
1545
- requestType: Empty,
1546
- requestStream: false,
1547
- responseType: CheckLatestPriceResponse,
1548
- responseStream: false,
1549
- options: {
1550
- _unknownFields: {
1551
- 8338: [new Uint8Array([0])],
1552
- 578365826: [
1553
- new Uint8Array([
1554
- 29,
1555
- 18,
1556
- 27,
1557
- 47,
1558
- 97,
1559
- 112,
1560
- 105,
1561
- 47,
1562
- 118,
1563
- 49,
1564
- 47,
1565
- 112,
1566
- 114,
1567
- 105,
1568
- 99,
1569
- 101,
1570
- 115,
1571
- 47,
1572
- 99,
1573
- 104,
1574
- 101,
1575
- 99,
1576
- 107,
1577
- 95,
1578
- 108,
1579
- 97,
1580
- 116,
1581
- 101,
1582
- 115,
1583
- 116,
1584
- ]),
1585
- ],
1586
- },
1587
- },
1588
- },
1589
- backfillCoin: {
1590
- name: "BackfillCoin",
1591
- requestType: BackfillCoinRequest,
1592
- requestStream: false,
1593
- responseType: BackfillCoinResponse,
1594
- responseStream: false,
1595
- options: {
1596
- _unknownFields: {
1597
- 578365818: [new Uint8Array([10, 18, 8, 73, 78, 84, 69, 82, 78, 65, 76])],
1598
- 578365826: [
1599
- new Uint8Array([
1600
- 28,
1601
- 34,
1602
- 23,
1603
- 47,
1604
- 97,
1605
- 112,
1606
- 105,
1607
- 47,
1608
- 118,
1609
- 49,
1610
- 47,
1611
- 112,
1612
- 114,
1613
- 105,
1614
- 99,
1615
- 101,
1616
- 115,
1617
- 47,
1618
- 98,
1619
- 97,
1620
- 99,
1621
- 107,
1622
- 102,
1623
- 105,
1624
- 108,
1625
- 108,
1626
- 58,
1627
- 1,
1628
- 42,
1629
- ]),
1630
- ],
1631
- },
1632
- },
1633
- },
1634
- },
1635
- } as const;
1636
-
1637
- export interface PriceServiceImplementation<CallContextExt = {}> {
1638
- getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;
1639
- batchGetPrices(
1640
- request: BatchGetPricesRequest,
1641
- context: CallContext & CallContextExt,
1642
- ): Promise<DeepPartial<BatchGetPricesResponse>>;
1643
- listCoins(request: ListCoinsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ListCoinsResponse>>;
1644
- checkLatestPrice(
1645
- request: Empty,
1646
- context: CallContext & CallContextExt,
1647
- ): Promise<DeepPartial<CheckLatestPriceResponse>>;
1648
- backfillCoin(
1649
- request: BackfillCoinRequest,
1650
- context: CallContext & CallContextExt,
1651
- ): Promise<DeepPartial<BackfillCoinResponse>>;
1652
- }
1653
-
1654
- export interface PriceServiceClient<CallOptionsExt = {}> {
1655
- getPrice(request: DeepPartial<GetPriceRequest>, options?: CallOptions & CallOptionsExt): Promise<GetPriceResponse>;
1656
- batchGetPrices(
1657
- request: DeepPartial<BatchGetPricesRequest>,
1658
- options?: CallOptions & CallOptionsExt,
1659
- ): Promise<BatchGetPricesResponse>;
1660
- listCoins(request: DeepPartial<ListCoinsRequest>, options?: CallOptions & CallOptionsExt): Promise<ListCoinsResponse>;
1661
- checkLatestPrice(
1662
- request: DeepPartial<Empty>,
1663
- options?: CallOptions & CallOptionsExt,
1664
- ): Promise<CheckLatestPriceResponse>;
1665
- backfillCoin(
1666
- request: DeepPartial<BackfillCoinRequest>,
1667
- options?: CallOptions & CallOptionsExt,
1668
- ): Promise<BackfillCoinResponse>;
1669
- }
1670
-
1671
- type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
1672
-
1673
- type DeepPartial<T> = T extends Builtin ? T
1674
- : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1675
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1676
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1677
- : Partial<T>;
1678
-
1679
- function toTimestamp(date: Date): Timestamp {
1680
- const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
1681
- const nanos = (date.getTime() % 1_000) * 1_000_000;
1682
- return { seconds, nanos };
1683
- }
1684
-
1685
- function fromTimestamp(t: Timestamp): Date {
1686
- let millis = (globalThis.Number(t.seconds.toString()) || 0) * 1_000;
1687
- millis += (t.nanos || 0) / 1_000_000;
1688
- return new globalThis.Date(millis);
1689
- }
1690
-
1691
- function fromJsonTimestamp(o: any): Date {
1692
- if (o instanceof globalThis.Date) {
1693
- return o;
1694
- } else if (typeof o === "string") {
1695
- return new globalThis.Date(o);
1696
- } else {
1697
- return fromTimestamp(Timestamp.fromJSON(o));
1698
- }
1699
- }
1700
-
1701
- function isObject(value: any): boolean {
1702
- return typeof value === "object" && value !== null;
1703
- }
1704
-
1705
- function isSet(value: any): boolean {
1706
- return value !== null && value !== undefined;
1707
- }