@sentio/protos 2.26.1 → 2.26.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.
- package/lib/builtin.d.ts +6 -0
- package/lib/builtin.d.ts.map +1 -0
- package/lib/builtin.js +2 -0
- package/lib/builtin.js.map +1 -0
- package/lib/chainquery/protos/chainquery.d.ts +605 -0
- package/lib/chainquery/protos/chainquery.d.ts.map +1 -0
- package/lib/chainquery/protos/chainquery.js +1362 -0
- package/lib/chainquery/protos/chainquery.js.map +1 -0
- package/lib/google/protobuf/empty.d.ts +17 -0
- package/lib/google/protobuf/empty.d.ts.map +1 -0
- package/lib/google/protobuf/empty.js +39 -0
- package/lib/google/protobuf/empty.js.map +1 -0
- package/lib/google/protobuf/struct.d.ts +77 -0
- package/lib/google/protobuf/struct.d.ts.map +1 -0
- package/lib/google/protobuf/struct.js +377 -0
- package/lib/google/protobuf/struct.js.map +1 -0
- package/lib/google/protobuf/timestamp.d.ts +19 -0
- package/lib/google/protobuf/timestamp.d.ts.map +1 -0
- package/lib/google/protobuf/timestamp.js +69 -0
- package/lib/google/protobuf/timestamp.js.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +6 -0
- package/lib/index.js.map +1 -0
- package/lib/processor/protos/processor.d.ts +1063 -0
- package/lib/processor/protos/processor.d.ts.map +1 -0
- package/lib/processor/protos/processor.js +5016 -0
- package/lib/processor/protos/processor.js.map +1 -0
- package/lib/service/price/protos/price.d.ts +210 -0
- package/lib/service/price/protos/price.d.ts.map +1 -0
- package/lib/service/price/protos/price.js +633 -0
- package/lib/service/price/protos/price.js.map +1 -0
- package/package.json +1 -1
- package/src/builtin.ts +11 -0
- package/src/chainquery/protos/chainquery.ts +1726 -0
- package/src/google/protobuf/empty.ts +55 -0
- package/src/google/protobuf/struct.ts +433 -0
- package/src/google/protobuf/timestamp.ts +90 -0
- package/src/index.ts +9 -0
- package/src/processor/protos/processor.ts +5849 -0
- package/src/service/price/protos/price.ts +777 -0
|
@@ -0,0 +1,777 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type { CallContext, CallOptions } from "nice-grpc-common";
|
|
3
|
+
import _m0 from "protobufjs/minimal.js";
|
|
4
|
+
import { Timestamp } from "../../../google/protobuf/timestamp.js";
|
|
5
|
+
|
|
6
|
+
export interface CoinID {
|
|
7
|
+
symbol?: string | undefined;
|
|
8
|
+
address?: CoinID_AddressIdentifier | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface CoinID_AddressIdentifier {
|
|
12
|
+
address: string;
|
|
13
|
+
chain: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface GetPriceRequest {
|
|
17
|
+
timestamp: Date | undefined;
|
|
18
|
+
coinId: CoinID | undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface GetPriceResponse {
|
|
22
|
+
price: number;
|
|
23
|
+
timestamp: Date | undefined;
|
|
24
|
+
}
|
|
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
|
+
|
|
45
|
+
export interface ListCoinsRequest {
|
|
46
|
+
limit: number;
|
|
47
|
+
offset: number;
|
|
48
|
+
searchQuery: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ListCoinsResponse {
|
|
52
|
+
coins: CoinID[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function createBaseCoinID(): CoinID {
|
|
56
|
+
return { symbol: undefined, address: undefined };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const CoinID = {
|
|
60
|
+
encode(message: CoinID, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
61
|
+
if (message.symbol !== undefined) {
|
|
62
|
+
writer.uint32(18).string(message.symbol);
|
|
63
|
+
}
|
|
64
|
+
if (message.address !== undefined) {
|
|
65
|
+
CoinID_AddressIdentifier.encode(message.address, writer.uint32(26).fork()).ldelim();
|
|
66
|
+
}
|
|
67
|
+
return writer;
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {
|
|
71
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
72
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
73
|
+
const message = createBaseCoinID();
|
|
74
|
+
while (reader.pos < end) {
|
|
75
|
+
const tag = reader.uint32();
|
|
76
|
+
switch (tag >>> 3) {
|
|
77
|
+
case 2:
|
|
78
|
+
message.symbol = reader.string();
|
|
79
|
+
break;
|
|
80
|
+
case 3:
|
|
81
|
+
message.address = CoinID_AddressIdentifier.decode(reader, reader.uint32());
|
|
82
|
+
break;
|
|
83
|
+
default:
|
|
84
|
+
reader.skipType(tag & 7);
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return message;
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
fromJSON(object: any): CoinID {
|
|
92
|
+
return {
|
|
93
|
+
symbol: isSet(object.symbol) ? String(object.symbol) : undefined,
|
|
94
|
+
address: isSet(object.address) ? CoinID_AddressIdentifier.fromJSON(object.address) : undefined,
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
toJSON(message: CoinID): unknown {
|
|
99
|
+
const obj: any = {};
|
|
100
|
+
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
101
|
+
message.address !== undefined &&
|
|
102
|
+
(obj.address = message.address ? CoinID_AddressIdentifier.toJSON(message.address) : undefined);
|
|
103
|
+
return obj;
|
|
104
|
+
},
|
|
105
|
+
|
|
106
|
+
create(base?: DeepPartial<CoinID>): CoinID {
|
|
107
|
+
return CoinID.fromPartial(base ?? {});
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
fromPartial(object: DeepPartial<CoinID>): CoinID {
|
|
111
|
+
const message = createBaseCoinID();
|
|
112
|
+
message.symbol = object.symbol ?? undefined;
|
|
113
|
+
message.address = (object.address !== undefined && object.address !== null)
|
|
114
|
+
? CoinID_AddressIdentifier.fromPartial(object.address)
|
|
115
|
+
: undefined;
|
|
116
|
+
return message;
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
function createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {
|
|
121
|
+
return { address: "", chain: "" };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const CoinID_AddressIdentifier = {
|
|
125
|
+
encode(message: CoinID_AddressIdentifier, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
126
|
+
if (message.address !== "") {
|
|
127
|
+
writer.uint32(10).string(message.address);
|
|
128
|
+
}
|
|
129
|
+
if (message.chain !== "") {
|
|
130
|
+
writer.uint32(18).string(message.chain);
|
|
131
|
+
}
|
|
132
|
+
return writer;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CoinID_AddressIdentifier {
|
|
136
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
137
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
138
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
139
|
+
while (reader.pos < end) {
|
|
140
|
+
const tag = reader.uint32();
|
|
141
|
+
switch (tag >>> 3) {
|
|
142
|
+
case 1:
|
|
143
|
+
message.address = reader.string();
|
|
144
|
+
break;
|
|
145
|
+
case 2:
|
|
146
|
+
message.chain = reader.string();
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
reader.skipType(tag & 7);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return message;
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
fromJSON(object: any): CoinID_AddressIdentifier {
|
|
157
|
+
return {
|
|
158
|
+
address: isSet(object.address) ? String(object.address) : "",
|
|
159
|
+
chain: isSet(object.chain) ? String(object.chain) : "",
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
toJSON(message: CoinID_AddressIdentifier): unknown {
|
|
164
|
+
const obj: any = {};
|
|
165
|
+
message.address !== undefined && (obj.address = message.address);
|
|
166
|
+
message.chain !== undefined && (obj.chain = message.chain);
|
|
167
|
+
return obj;
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
create(base?: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier {
|
|
171
|
+
return CoinID_AddressIdentifier.fromPartial(base ?? {});
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
fromPartial(object: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier {
|
|
175
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
176
|
+
message.address = object.address ?? "";
|
|
177
|
+
message.chain = object.chain ?? "";
|
|
178
|
+
return message;
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
function createBaseGetPriceRequest(): GetPriceRequest {
|
|
183
|
+
return { timestamp: undefined, coinId: undefined };
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const GetPriceRequest = {
|
|
187
|
+
encode(message: GetPriceRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
188
|
+
if (message.timestamp !== undefined) {
|
|
189
|
+
Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim();
|
|
190
|
+
}
|
|
191
|
+
if (message.coinId !== undefined) {
|
|
192
|
+
CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();
|
|
193
|
+
}
|
|
194
|
+
return writer;
|
|
195
|
+
},
|
|
196
|
+
|
|
197
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {
|
|
198
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
199
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
200
|
+
const message = createBaseGetPriceRequest();
|
|
201
|
+
while (reader.pos < end) {
|
|
202
|
+
const tag = reader.uint32();
|
|
203
|
+
switch (tag >>> 3) {
|
|
204
|
+
case 1:
|
|
205
|
+
message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
206
|
+
break;
|
|
207
|
+
case 2:
|
|
208
|
+
message.coinId = CoinID.decode(reader, reader.uint32());
|
|
209
|
+
break;
|
|
210
|
+
default:
|
|
211
|
+
reader.skipType(tag & 7);
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return message;
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
fromJSON(object: any): GetPriceRequest {
|
|
219
|
+
return {
|
|
220
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
221
|
+
coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
|
|
222
|
+
};
|
|
223
|
+
},
|
|
224
|
+
|
|
225
|
+
toJSON(message: GetPriceRequest): unknown {
|
|
226
|
+
const obj: any = {};
|
|
227
|
+
message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
|
|
228
|
+
message.coinId !== undefined && (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);
|
|
229
|
+
return obj;
|
|
230
|
+
},
|
|
231
|
+
|
|
232
|
+
create(base?: DeepPartial<GetPriceRequest>): GetPriceRequest {
|
|
233
|
+
return GetPriceRequest.fromPartial(base ?? {});
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {
|
|
237
|
+
const message = createBaseGetPriceRequest();
|
|
238
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
239
|
+
message.coinId = (object.coinId !== undefined && object.coinId !== null)
|
|
240
|
+
? CoinID.fromPartial(object.coinId)
|
|
241
|
+
: undefined;
|
|
242
|
+
return message;
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
function createBaseGetPriceResponse(): GetPriceResponse {
|
|
247
|
+
return { price: 0, timestamp: undefined };
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export const GetPriceResponse = {
|
|
251
|
+
encode(message: GetPriceResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
252
|
+
if (message.price !== 0) {
|
|
253
|
+
writer.uint32(9).double(message.price);
|
|
254
|
+
}
|
|
255
|
+
if (message.timestamp !== undefined) {
|
|
256
|
+
Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim();
|
|
257
|
+
}
|
|
258
|
+
return writer;
|
|
259
|
+
},
|
|
260
|
+
|
|
261
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {
|
|
262
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
263
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
264
|
+
const message = createBaseGetPriceResponse();
|
|
265
|
+
while (reader.pos < end) {
|
|
266
|
+
const tag = reader.uint32();
|
|
267
|
+
switch (tag >>> 3) {
|
|
268
|
+
case 1:
|
|
269
|
+
message.price = reader.double();
|
|
270
|
+
break;
|
|
271
|
+
case 2:
|
|
272
|
+
message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
273
|
+
break;
|
|
274
|
+
default:
|
|
275
|
+
reader.skipType(tag & 7);
|
|
276
|
+
break;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
return message;
|
|
280
|
+
},
|
|
281
|
+
|
|
282
|
+
fromJSON(object: any): GetPriceResponse {
|
|
283
|
+
return {
|
|
284
|
+
price: isSet(object.price) ? Number(object.price) : 0,
|
|
285
|
+
timestamp: isSet(object.timestamp) ? fromJsonTimestamp(object.timestamp) : undefined,
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
|
|
289
|
+
toJSON(message: GetPriceResponse): unknown {
|
|
290
|
+
const obj: any = {};
|
|
291
|
+
message.price !== undefined && (obj.price = message.price);
|
|
292
|
+
message.timestamp !== undefined && (obj.timestamp = message.timestamp.toISOString());
|
|
293
|
+
return obj;
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
create(base?: DeepPartial<GetPriceResponse>): GetPriceResponse {
|
|
297
|
+
return GetPriceResponse.fromPartial(base ?? {});
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {
|
|
301
|
+
const message = createBaseGetPriceResponse();
|
|
302
|
+
message.price = object.price ?? 0;
|
|
303
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
304
|
+
return message;
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
function createBaseBatchGetPricesRequest(): BatchGetPricesRequest {
|
|
309
|
+
return { timestamps: [], coinIds: [] };
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export const BatchGetPricesRequest = {
|
|
313
|
+
encode(message: BatchGetPricesRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
314
|
+
for (const v of message.timestamps) {
|
|
315
|
+
Timestamp.encode(toTimestamp(v!), writer.uint32(10).fork()).ldelim();
|
|
316
|
+
}
|
|
317
|
+
for (const v of message.coinIds) {
|
|
318
|
+
CoinID.encode(v!, writer.uint32(18).fork()).ldelim();
|
|
319
|
+
}
|
|
320
|
+
return writer;
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesRequest {
|
|
324
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
325
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
326
|
+
const message = createBaseBatchGetPricesRequest();
|
|
327
|
+
while (reader.pos < end) {
|
|
328
|
+
const tag = reader.uint32();
|
|
329
|
+
switch (tag >>> 3) {
|
|
330
|
+
case 1:
|
|
331
|
+
message.timestamps.push(fromTimestamp(Timestamp.decode(reader, reader.uint32())));
|
|
332
|
+
break;
|
|
333
|
+
case 2:
|
|
334
|
+
message.coinIds.push(CoinID.decode(reader, reader.uint32()));
|
|
335
|
+
break;
|
|
336
|
+
default:
|
|
337
|
+
reader.skipType(tag & 7);
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return message;
|
|
342
|
+
},
|
|
343
|
+
|
|
344
|
+
fromJSON(object: any): BatchGetPricesRequest {
|
|
345
|
+
return {
|
|
346
|
+
timestamps: Array.isArray(object?.timestamps) ? object.timestamps.map((e: any) => fromJsonTimestamp(e)) : [],
|
|
347
|
+
coinIds: Array.isArray(object?.coinIds) ? object.coinIds.map((e: any) => CoinID.fromJSON(e)) : [],
|
|
348
|
+
};
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
toJSON(message: BatchGetPricesRequest): unknown {
|
|
352
|
+
const obj: any = {};
|
|
353
|
+
if (message.timestamps) {
|
|
354
|
+
obj.timestamps = message.timestamps.map((e) => e.toISOString());
|
|
355
|
+
} else {
|
|
356
|
+
obj.timestamps = [];
|
|
357
|
+
}
|
|
358
|
+
if (message.coinIds) {
|
|
359
|
+
obj.coinIds = message.coinIds.map((e) => e ? CoinID.toJSON(e) : undefined);
|
|
360
|
+
} else {
|
|
361
|
+
obj.coinIds = [];
|
|
362
|
+
}
|
|
363
|
+
return obj;
|
|
364
|
+
},
|
|
365
|
+
|
|
366
|
+
create(base?: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
|
|
367
|
+
return BatchGetPricesRequest.fromPartial(base ?? {});
|
|
368
|
+
},
|
|
369
|
+
|
|
370
|
+
fromPartial(object: DeepPartial<BatchGetPricesRequest>): BatchGetPricesRequest {
|
|
371
|
+
const message = createBaseBatchGetPricesRequest();
|
|
372
|
+
message.timestamps = object.timestamps?.map((e) => e) || [];
|
|
373
|
+
message.coinIds = object.coinIds?.map((e) => CoinID.fromPartial(e)) || [];
|
|
374
|
+
return message;
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
function createBaseBatchGetPricesResponse(): BatchGetPricesResponse {
|
|
379
|
+
return { prices: [] };
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export const BatchGetPricesResponse = {
|
|
383
|
+
encode(message: BatchGetPricesResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
384
|
+
for (const v of message.prices) {
|
|
385
|
+
BatchGetPricesResponse_CoinPrice.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
386
|
+
}
|
|
387
|
+
return writer;
|
|
388
|
+
},
|
|
389
|
+
|
|
390
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse {
|
|
391
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
392
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
393
|
+
const message = createBaseBatchGetPricesResponse();
|
|
394
|
+
while (reader.pos < end) {
|
|
395
|
+
const tag = reader.uint32();
|
|
396
|
+
switch (tag >>> 3) {
|
|
397
|
+
case 1:
|
|
398
|
+
message.prices.push(BatchGetPricesResponse_CoinPrice.decode(reader, reader.uint32()));
|
|
399
|
+
break;
|
|
400
|
+
default:
|
|
401
|
+
reader.skipType(tag & 7);
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
return message;
|
|
406
|
+
},
|
|
407
|
+
|
|
408
|
+
fromJSON(object: any): BatchGetPricesResponse {
|
|
409
|
+
return {
|
|
410
|
+
prices: Array.isArray(object?.prices)
|
|
411
|
+
? object.prices.map((e: any) => BatchGetPricesResponse_CoinPrice.fromJSON(e))
|
|
412
|
+
: [],
|
|
413
|
+
};
|
|
414
|
+
},
|
|
415
|
+
|
|
416
|
+
toJSON(message: BatchGetPricesResponse): unknown {
|
|
417
|
+
const obj: any = {};
|
|
418
|
+
if (message.prices) {
|
|
419
|
+
obj.prices = message.prices.map((e) => e ? BatchGetPricesResponse_CoinPrice.toJSON(e) : undefined);
|
|
420
|
+
} else {
|
|
421
|
+
obj.prices = [];
|
|
422
|
+
}
|
|
423
|
+
return obj;
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
create(base?: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
|
|
427
|
+
return BatchGetPricesResponse.fromPartial(base ?? {});
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
fromPartial(object: DeepPartial<BatchGetPricesResponse>): BatchGetPricesResponse {
|
|
431
|
+
const message = createBaseBatchGetPricesResponse();
|
|
432
|
+
message.prices = object.prices?.map((e) => BatchGetPricesResponse_CoinPrice.fromPartial(e)) || [];
|
|
433
|
+
return message;
|
|
434
|
+
},
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
function createBaseBatchGetPricesResponse_CoinPrice(): BatchGetPricesResponse_CoinPrice {
|
|
438
|
+
return { coinId: undefined, price: undefined, error: undefined };
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export const BatchGetPricesResponse_CoinPrice = {
|
|
442
|
+
encode(message: BatchGetPricesResponse_CoinPrice, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
443
|
+
if (message.coinId !== undefined) {
|
|
444
|
+
CoinID.encode(message.coinId, writer.uint32(10).fork()).ldelim();
|
|
445
|
+
}
|
|
446
|
+
if (message.price !== undefined) {
|
|
447
|
+
BatchGetPricesResponse_CoinPrice_Price.encode(message.price, writer.uint32(18).fork()).ldelim();
|
|
448
|
+
}
|
|
449
|
+
if (message.error !== undefined) {
|
|
450
|
+
writer.uint32(26).string(message.error);
|
|
451
|
+
}
|
|
452
|
+
return writer;
|
|
453
|
+
},
|
|
454
|
+
|
|
455
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice {
|
|
456
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
457
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
458
|
+
const message = createBaseBatchGetPricesResponse_CoinPrice();
|
|
459
|
+
while (reader.pos < end) {
|
|
460
|
+
const tag = reader.uint32();
|
|
461
|
+
switch (tag >>> 3) {
|
|
462
|
+
case 1:
|
|
463
|
+
message.coinId = CoinID.decode(reader, reader.uint32());
|
|
464
|
+
break;
|
|
465
|
+
case 2:
|
|
466
|
+
message.price = BatchGetPricesResponse_CoinPrice_Price.decode(reader, reader.uint32());
|
|
467
|
+
break;
|
|
468
|
+
case 3:
|
|
469
|
+
message.error = reader.string();
|
|
470
|
+
break;
|
|
471
|
+
default:
|
|
472
|
+
reader.skipType(tag & 7);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return message;
|
|
477
|
+
},
|
|
478
|
+
|
|
479
|
+
fromJSON(object: any): BatchGetPricesResponse_CoinPrice {
|
|
480
|
+
return {
|
|
481
|
+
coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
|
|
482
|
+
price: isSet(object.price) ? BatchGetPricesResponse_CoinPrice_Price.fromJSON(object.price) : undefined,
|
|
483
|
+
error: isSet(object.error) ? String(object.error) : undefined,
|
|
484
|
+
};
|
|
485
|
+
},
|
|
486
|
+
|
|
487
|
+
toJSON(message: BatchGetPricesResponse_CoinPrice): unknown {
|
|
488
|
+
const obj: any = {};
|
|
489
|
+
message.coinId !== undefined && (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);
|
|
490
|
+
message.price !== undefined &&
|
|
491
|
+
(obj.price = message.price ? BatchGetPricesResponse_CoinPrice_Price.toJSON(message.price) : undefined);
|
|
492
|
+
message.error !== undefined && (obj.error = message.error);
|
|
493
|
+
return obj;
|
|
494
|
+
},
|
|
495
|
+
|
|
496
|
+
create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
|
|
497
|
+
return BatchGetPricesResponse_CoinPrice.fromPartial(base ?? {});
|
|
498
|
+
},
|
|
499
|
+
|
|
500
|
+
fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice>): BatchGetPricesResponse_CoinPrice {
|
|
501
|
+
const message = createBaseBatchGetPricesResponse_CoinPrice();
|
|
502
|
+
message.coinId = (object.coinId !== undefined && object.coinId !== null)
|
|
503
|
+
? CoinID.fromPartial(object.coinId)
|
|
504
|
+
: undefined;
|
|
505
|
+
message.price = (object.price !== undefined && object.price !== null)
|
|
506
|
+
? BatchGetPricesResponse_CoinPrice_Price.fromPartial(object.price)
|
|
507
|
+
: undefined;
|
|
508
|
+
message.error = object.error ?? undefined;
|
|
509
|
+
return message;
|
|
510
|
+
},
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
function createBaseBatchGetPricesResponse_CoinPrice_Price(): BatchGetPricesResponse_CoinPrice_Price {
|
|
514
|
+
return { results: [] };
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export const BatchGetPricesResponse_CoinPrice_Price = {
|
|
518
|
+
encode(message: BatchGetPricesResponse_CoinPrice_Price, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
519
|
+
for (const v of message.results) {
|
|
520
|
+
GetPriceResponse.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
521
|
+
}
|
|
522
|
+
return writer;
|
|
523
|
+
},
|
|
524
|
+
|
|
525
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): BatchGetPricesResponse_CoinPrice_Price {
|
|
526
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
527
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
528
|
+
const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
|
|
529
|
+
while (reader.pos < end) {
|
|
530
|
+
const tag = reader.uint32();
|
|
531
|
+
switch (tag >>> 3) {
|
|
532
|
+
case 1:
|
|
533
|
+
message.results.push(GetPriceResponse.decode(reader, reader.uint32()));
|
|
534
|
+
break;
|
|
535
|
+
default:
|
|
536
|
+
reader.skipType(tag & 7);
|
|
537
|
+
break;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
return message;
|
|
541
|
+
},
|
|
542
|
+
|
|
543
|
+
fromJSON(object: any): BatchGetPricesResponse_CoinPrice_Price {
|
|
544
|
+
return {
|
|
545
|
+
results: Array.isArray(object?.results) ? object.results.map((e: any) => GetPriceResponse.fromJSON(e)) : [],
|
|
546
|
+
};
|
|
547
|
+
},
|
|
548
|
+
|
|
549
|
+
toJSON(message: BatchGetPricesResponse_CoinPrice_Price): unknown {
|
|
550
|
+
const obj: any = {};
|
|
551
|
+
if (message.results) {
|
|
552
|
+
obj.results = message.results.map((e) => e ? GetPriceResponse.toJSON(e) : undefined);
|
|
553
|
+
} else {
|
|
554
|
+
obj.results = [];
|
|
555
|
+
}
|
|
556
|
+
return obj;
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
create(base?: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
|
|
560
|
+
return BatchGetPricesResponse_CoinPrice_Price.fromPartial(base ?? {});
|
|
561
|
+
},
|
|
562
|
+
|
|
563
|
+
fromPartial(object: DeepPartial<BatchGetPricesResponse_CoinPrice_Price>): BatchGetPricesResponse_CoinPrice_Price {
|
|
564
|
+
const message = createBaseBatchGetPricesResponse_CoinPrice_Price();
|
|
565
|
+
message.results = object.results?.map((e) => GetPriceResponse.fromPartial(e)) || [];
|
|
566
|
+
return message;
|
|
567
|
+
},
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
function createBaseListCoinsRequest(): ListCoinsRequest {
|
|
571
|
+
return { limit: 0, offset: 0, searchQuery: "" };
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
export const ListCoinsRequest = {
|
|
575
|
+
encode(message: ListCoinsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
576
|
+
if (message.limit !== 0) {
|
|
577
|
+
writer.uint32(8).int32(message.limit);
|
|
578
|
+
}
|
|
579
|
+
if (message.offset !== 0) {
|
|
580
|
+
writer.uint32(16).int32(message.offset);
|
|
581
|
+
}
|
|
582
|
+
if (message.searchQuery !== "") {
|
|
583
|
+
writer.uint32(26).string(message.searchQuery);
|
|
584
|
+
}
|
|
585
|
+
return writer;
|
|
586
|
+
},
|
|
587
|
+
|
|
588
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ListCoinsRequest {
|
|
589
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
590
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
591
|
+
const message = createBaseListCoinsRequest();
|
|
592
|
+
while (reader.pos < end) {
|
|
593
|
+
const tag = reader.uint32();
|
|
594
|
+
switch (tag >>> 3) {
|
|
595
|
+
case 1:
|
|
596
|
+
message.limit = reader.int32();
|
|
597
|
+
break;
|
|
598
|
+
case 2:
|
|
599
|
+
message.offset = reader.int32();
|
|
600
|
+
break;
|
|
601
|
+
case 3:
|
|
602
|
+
message.searchQuery = reader.string();
|
|
603
|
+
break;
|
|
604
|
+
default:
|
|
605
|
+
reader.skipType(tag & 7);
|
|
606
|
+
break;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
return message;
|
|
610
|
+
},
|
|
611
|
+
|
|
612
|
+
fromJSON(object: any): ListCoinsRequest {
|
|
613
|
+
return {
|
|
614
|
+
limit: isSet(object.limit) ? Number(object.limit) : 0,
|
|
615
|
+
offset: isSet(object.offset) ? Number(object.offset) : 0,
|
|
616
|
+
searchQuery: isSet(object.searchQuery) ? String(object.searchQuery) : "",
|
|
617
|
+
};
|
|
618
|
+
},
|
|
619
|
+
|
|
620
|
+
toJSON(message: ListCoinsRequest): unknown {
|
|
621
|
+
const obj: any = {};
|
|
622
|
+
message.limit !== undefined && (obj.limit = Math.round(message.limit));
|
|
623
|
+
message.offset !== undefined && (obj.offset = Math.round(message.offset));
|
|
624
|
+
message.searchQuery !== undefined && (obj.searchQuery = message.searchQuery);
|
|
625
|
+
return obj;
|
|
626
|
+
},
|
|
627
|
+
|
|
628
|
+
create(base?: DeepPartial<ListCoinsRequest>): ListCoinsRequest {
|
|
629
|
+
return ListCoinsRequest.fromPartial(base ?? {});
|
|
630
|
+
},
|
|
631
|
+
|
|
632
|
+
fromPartial(object: DeepPartial<ListCoinsRequest>): ListCoinsRequest {
|
|
633
|
+
const message = createBaseListCoinsRequest();
|
|
634
|
+
message.limit = object.limit ?? 0;
|
|
635
|
+
message.offset = object.offset ?? 0;
|
|
636
|
+
message.searchQuery = object.searchQuery ?? "";
|
|
637
|
+
return message;
|
|
638
|
+
},
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
function createBaseListCoinsResponse(): ListCoinsResponse {
|
|
642
|
+
return { coins: [] };
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
export const ListCoinsResponse = {
|
|
646
|
+
encode(message: ListCoinsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
|
647
|
+
for (const v of message.coins) {
|
|
648
|
+
CoinID.encode(v!, writer.uint32(10).fork()).ldelim();
|
|
649
|
+
}
|
|
650
|
+
return writer;
|
|
651
|
+
},
|
|
652
|
+
|
|
653
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): ListCoinsResponse {
|
|
654
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
655
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
656
|
+
const message = createBaseListCoinsResponse();
|
|
657
|
+
while (reader.pos < end) {
|
|
658
|
+
const tag = reader.uint32();
|
|
659
|
+
switch (tag >>> 3) {
|
|
660
|
+
case 1:
|
|
661
|
+
message.coins.push(CoinID.decode(reader, reader.uint32()));
|
|
662
|
+
break;
|
|
663
|
+
default:
|
|
664
|
+
reader.skipType(tag & 7);
|
|
665
|
+
break;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return message;
|
|
669
|
+
},
|
|
670
|
+
|
|
671
|
+
fromJSON(object: any): ListCoinsResponse {
|
|
672
|
+
return { coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => CoinID.fromJSON(e)) : [] };
|
|
673
|
+
},
|
|
674
|
+
|
|
675
|
+
toJSON(message: ListCoinsResponse): unknown {
|
|
676
|
+
const obj: any = {};
|
|
677
|
+
if (message.coins) {
|
|
678
|
+
obj.coins = message.coins.map((e) => e ? CoinID.toJSON(e) : undefined);
|
|
679
|
+
} else {
|
|
680
|
+
obj.coins = [];
|
|
681
|
+
}
|
|
682
|
+
return obj;
|
|
683
|
+
},
|
|
684
|
+
|
|
685
|
+
create(base?: DeepPartial<ListCoinsResponse>): ListCoinsResponse {
|
|
686
|
+
return ListCoinsResponse.fromPartial(base ?? {});
|
|
687
|
+
},
|
|
688
|
+
|
|
689
|
+
fromPartial(object: DeepPartial<ListCoinsResponse>): ListCoinsResponse {
|
|
690
|
+
const message = createBaseListCoinsResponse();
|
|
691
|
+
message.coins = object.coins?.map((e) => CoinID.fromPartial(e)) || [];
|
|
692
|
+
return message;
|
|
693
|
+
},
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
export type PriceServiceDefinition = typeof PriceServiceDefinition;
|
|
697
|
+
export const PriceServiceDefinition = {
|
|
698
|
+
name: "PriceService",
|
|
699
|
+
fullName: "price_service.PriceService",
|
|
700
|
+
methods: {
|
|
701
|
+
getPrice: {
|
|
702
|
+
name: "GetPrice",
|
|
703
|
+
requestType: GetPriceRequest,
|
|
704
|
+
requestStream: false,
|
|
705
|
+
responseType: GetPriceResponse,
|
|
706
|
+
responseStream: false,
|
|
707
|
+
options: {},
|
|
708
|
+
},
|
|
709
|
+
batchGetPrices: {
|
|
710
|
+
name: "BatchGetPrices",
|
|
711
|
+
requestType: BatchGetPricesRequest,
|
|
712
|
+
requestStream: false,
|
|
713
|
+
responseType: BatchGetPricesResponse,
|
|
714
|
+
responseStream: false,
|
|
715
|
+
options: {},
|
|
716
|
+
},
|
|
717
|
+
listCoins: {
|
|
718
|
+
name: "ListCoins",
|
|
719
|
+
requestType: ListCoinsRequest,
|
|
720
|
+
requestStream: false,
|
|
721
|
+
responseType: ListCoinsResponse,
|
|
722
|
+
responseStream: false,
|
|
723
|
+
options: {},
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
} as const;
|
|
727
|
+
|
|
728
|
+
export interface PriceServiceImplementation<CallContextExt = {}> {
|
|
729
|
+
getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;
|
|
730
|
+
batchGetPrices(
|
|
731
|
+
request: BatchGetPricesRequest,
|
|
732
|
+
context: CallContext & CallContextExt,
|
|
733
|
+
): Promise<DeepPartial<BatchGetPricesResponse>>;
|
|
734
|
+
listCoins(request: ListCoinsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<ListCoinsResponse>>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export interface PriceServiceClient<CallOptionsExt = {}> {
|
|
738
|
+
getPrice(request: DeepPartial<GetPriceRequest>, options?: CallOptions & CallOptionsExt): Promise<GetPriceResponse>;
|
|
739
|
+
batchGetPrices(
|
|
740
|
+
request: DeepPartial<BatchGetPricesRequest>,
|
|
741
|
+
options?: CallOptions & CallOptionsExt,
|
|
742
|
+
): Promise<BatchGetPricesResponse>;
|
|
743
|
+
listCoins(request: DeepPartial<ListCoinsRequest>, options?: CallOptions & CallOptionsExt): Promise<ListCoinsResponse>;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
747
|
+
|
|
748
|
+
type DeepPartial<T> = T extends Builtin ? T
|
|
749
|
+
: T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
|
|
750
|
+
: T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
751
|
+
: Partial<T>;
|
|
752
|
+
|
|
753
|
+
function toTimestamp(date: Date): Timestamp {
|
|
754
|
+
const seconds = BigInt(Math.trunc(date.getTime() / 1_000));
|
|
755
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
756
|
+
return { seconds, nanos };
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
760
|
+
let millis = Number(t.seconds.toString()) * 1_000;
|
|
761
|
+
millis += t.nanos / 1_000_000;
|
|
762
|
+
return new Date(millis);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
function fromJsonTimestamp(o: any): Date {
|
|
766
|
+
if (o instanceof Date) {
|
|
767
|
+
return o;
|
|
768
|
+
} else if (typeof o === "string") {
|
|
769
|
+
return new Date(o);
|
|
770
|
+
} else {
|
|
771
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function isSet(value: any): boolean {
|
|
776
|
+
return value !== null && value !== undefined;
|
|
777
|
+
}
|