@sentio/sdk 1.27.10 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/gen/google/protobuf/timestamp.d.ts +18 -0
- package/lib/gen/google/protobuf/timestamp.js +75 -0
- package/lib/gen/google/protobuf/timestamp.js.map +1 -0
- package/lib/gen/service/price/protos/price.d.ts +85 -0
- package/lib/gen/service/price/protos/price.js +281 -0
- package/lib/gen/service/price/protos/price.js.map +1 -0
- package/lib/utils/price.d.ts +2 -0
- package/lib/utils/price.js +11 -0
- package/lib/utils/price.js.map +1 -0
- package/package.json +1 -1
- package/src/gen/google/protobuf/timestamp.ts +105 -0
- package/src/gen/service/price/protos/price.ts +394 -0
- package/src/utils/price.ts +8 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export interface Timestamp {
|
|
4
|
+
seconds: Long;
|
|
5
|
+
nanos: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const Timestamp: {
|
|
8
|
+
encode(message: Timestamp, writer?: _m0.Writer): _m0.Writer;
|
|
9
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp;
|
|
10
|
+
fromJSON(object: any): Timestamp;
|
|
11
|
+
toJSON(message: Timestamp): unknown;
|
|
12
|
+
fromPartial(object: DeepPartial<Timestamp>): Timestamp;
|
|
13
|
+
};
|
|
14
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
15
|
+
declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
16
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
17
|
+
} : Partial<T>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Timestamp = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
function createBaseTimestamp() {
|
|
11
|
+
return { seconds: long_1.default.ZERO, nanos: 0 };
|
|
12
|
+
}
|
|
13
|
+
exports.Timestamp = {
|
|
14
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
15
|
+
if (!message.seconds.isZero()) {
|
|
16
|
+
writer.uint32(8).int64(message.seconds);
|
|
17
|
+
}
|
|
18
|
+
if (message.nanos !== 0) {
|
|
19
|
+
writer.uint32(16).int32(message.nanos);
|
|
20
|
+
}
|
|
21
|
+
return writer;
|
|
22
|
+
},
|
|
23
|
+
decode(input, length) {
|
|
24
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
25
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
26
|
+
const message = createBaseTimestamp();
|
|
27
|
+
while (reader.pos < end) {
|
|
28
|
+
const tag = reader.uint32();
|
|
29
|
+
switch (tag >>> 3) {
|
|
30
|
+
case 1:
|
|
31
|
+
message.seconds = reader.int64();
|
|
32
|
+
break;
|
|
33
|
+
case 2:
|
|
34
|
+
message.nanos = reader.int32();
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
reader.skipType(tag & 7);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return message;
|
|
42
|
+
},
|
|
43
|
+
fromJSON(object) {
|
|
44
|
+
return {
|
|
45
|
+
seconds: isSet(object.seconds)
|
|
46
|
+
? long_1.default.fromValue(object.seconds)
|
|
47
|
+
: long_1.default.ZERO,
|
|
48
|
+
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
toJSON(message) {
|
|
52
|
+
const obj = {};
|
|
53
|
+
message.seconds !== undefined &&
|
|
54
|
+
(obj.seconds = (message.seconds || long_1.default.ZERO).toString());
|
|
55
|
+
message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
|
|
56
|
+
return obj;
|
|
57
|
+
},
|
|
58
|
+
fromPartial(object) {
|
|
59
|
+
const message = createBaseTimestamp();
|
|
60
|
+
message.seconds =
|
|
61
|
+
object.seconds !== undefined && object.seconds !== null
|
|
62
|
+
? long_1.default.fromValue(object.seconds)
|
|
63
|
+
: long_1.default.ZERO;
|
|
64
|
+
message.nanos = object.nanos ?? 0;
|
|
65
|
+
return message;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
69
|
+
minimal_1.default.util.Long = long_1.default;
|
|
70
|
+
minimal_1.default.configure();
|
|
71
|
+
}
|
|
72
|
+
function isSet(value) {
|
|
73
|
+
return value !== null && value !== undefined;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=timestamp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../../../src/gen/google/protobuf/timestamp.ts"],"names":[],"mappings":";;;;;;AAAA,oBAAoB;AACpB,gDAAwB;AACxB,iEAAqC;AAOrC,SAAS,mBAAmB;IAC1B,OAAO,EAAE,OAAO,EAAE,cAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAC1C,CAAC;AAEY,QAAA,SAAS,GAAG;IACvB,MAAM,CACJ,OAAkB,EAClB,SAAqB,iBAAG,CAAC,MAAM,CAAC,MAAM,EAAE;QAExC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE;YAC7B,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC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"long\";\nimport _m0 from \"protobufjs/minimal\";\n\nexport interface Timestamp {\n seconds: Long;\n nanos: number;\n}\n\nfunction createBaseTimestamp(): Timestamp {\n return { seconds: Long.ZERO, nanos: 0 };\n}\n\nexport const Timestamp = {\n encode(\n message: Timestamp,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (!message.seconds.isZero()) {\n writer.uint32(8).int64(message.seconds);\n }\n if (message.nanos !== 0) {\n writer.uint32(16).int32(message.nanos);\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseTimestamp();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.seconds = reader.int64() as Long;\n break;\n case 2:\n message.nanos = reader.int32();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): Timestamp {\n return {\n seconds: isSet(object.seconds)\n ? Long.fromValue(object.seconds)\n : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n },\n\n toJSON(message: Timestamp): unknown {\n const obj: any = {};\n message.seconds !== undefined &&\n (obj.seconds = (message.seconds || Long.ZERO).toString());\n message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));\n return obj;\n },\n\n fromPartial(object: DeepPartial<Timestamp>): Timestamp {\n const message = createBaseTimestamp();\n message.seconds =\n object.seconds !== undefined && object.seconds !== null\n ? Long.fromValue(object.seconds)\n : Long.ZERO;\n message.nanos = object.nanos ?? 0;\n return message;\n },\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | boolean\n | undefined;\n\ntype DeepPartial<T> = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { CallContext, CallOptions } from "nice-grpc-common";
|
|
2
|
+
import Long from "long";
|
|
3
|
+
import _m0 from "protobufjs/minimal";
|
|
4
|
+
export interface CoinID {
|
|
5
|
+
symbol: string | undefined;
|
|
6
|
+
address: CoinID_AddressIdentifier | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface CoinID_AddressIdentifier {
|
|
9
|
+
address: string;
|
|
10
|
+
chain: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GetPriceRequest {
|
|
13
|
+
timestamp: Date | undefined;
|
|
14
|
+
coinId: CoinID | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface GetPriceResponse {
|
|
17
|
+
price: number;
|
|
18
|
+
timestamp: Date | undefined;
|
|
19
|
+
}
|
|
20
|
+
export declare const CoinID: {
|
|
21
|
+
encode(message: CoinID, writer?: _m0.Writer): _m0.Writer;
|
|
22
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CoinID;
|
|
23
|
+
fromJSON(object: any): CoinID;
|
|
24
|
+
toJSON(message: CoinID): unknown;
|
|
25
|
+
fromPartial(object: DeepPartial<CoinID>): CoinID;
|
|
26
|
+
};
|
|
27
|
+
export declare const CoinID_AddressIdentifier: {
|
|
28
|
+
encode(message: CoinID_AddressIdentifier, writer?: _m0.Writer): _m0.Writer;
|
|
29
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CoinID_AddressIdentifier;
|
|
30
|
+
fromJSON(object: any): CoinID_AddressIdentifier;
|
|
31
|
+
toJSON(message: CoinID_AddressIdentifier): unknown;
|
|
32
|
+
fromPartial(object: DeepPartial<CoinID_AddressIdentifier>): CoinID_AddressIdentifier;
|
|
33
|
+
};
|
|
34
|
+
export declare const GetPriceRequest: {
|
|
35
|
+
encode(message: GetPriceRequest, writer?: _m0.Writer): _m0.Writer;
|
|
36
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest;
|
|
37
|
+
fromJSON(object: any): GetPriceRequest;
|
|
38
|
+
toJSON(message: GetPriceRequest): unknown;
|
|
39
|
+
fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest;
|
|
40
|
+
};
|
|
41
|
+
export declare const GetPriceResponse: {
|
|
42
|
+
encode(message: GetPriceResponse, writer?: _m0.Writer): _m0.Writer;
|
|
43
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse;
|
|
44
|
+
fromJSON(object: any): GetPriceResponse;
|
|
45
|
+
toJSON(message: GetPriceResponse): unknown;
|
|
46
|
+
fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse;
|
|
47
|
+
};
|
|
48
|
+
export declare type PriceServiceDefinition = typeof PriceServiceDefinition;
|
|
49
|
+
export declare const PriceServiceDefinition: {
|
|
50
|
+
readonly name: "PriceService";
|
|
51
|
+
readonly fullName: "price_service.PriceService";
|
|
52
|
+
readonly methods: {
|
|
53
|
+
readonly getPrice: {
|
|
54
|
+
readonly name: "GetPrice";
|
|
55
|
+
readonly requestType: {
|
|
56
|
+
encode(message: GetPriceRequest, writer?: _m0.Writer): _m0.Writer;
|
|
57
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest;
|
|
58
|
+
fromJSON(object: any): GetPriceRequest;
|
|
59
|
+
toJSON(message: GetPriceRequest): unknown;
|
|
60
|
+
fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest;
|
|
61
|
+
};
|
|
62
|
+
readonly requestStream: false;
|
|
63
|
+
readonly responseType: {
|
|
64
|
+
encode(message: GetPriceResponse, writer?: _m0.Writer): _m0.Writer;
|
|
65
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse;
|
|
66
|
+
fromJSON(object: any): GetPriceResponse;
|
|
67
|
+
toJSON(message: GetPriceResponse): unknown;
|
|
68
|
+
fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse;
|
|
69
|
+
};
|
|
70
|
+
readonly responseStream: false;
|
|
71
|
+
readonly options: {};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export interface PriceServiceServiceImplementation<CallContextExt = {}> {
|
|
76
|
+
getPrice(request: GetPriceRequest, context: CallContext & CallContextExt): Promise<DeepPartial<GetPriceResponse>>;
|
|
77
|
+
}
|
|
78
|
+
export interface PriceServiceClient<CallOptionsExt = {}> {
|
|
79
|
+
getPrice(request: DeepPartial<GetPriceRequest>, options?: CallOptions & CallOptionsExt): Promise<GetPriceResponse>;
|
|
80
|
+
}
|
|
81
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
82
|
+
declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
83
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
84
|
+
} : Partial<T>;
|
|
85
|
+
export {};
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PriceServiceDefinition = exports.GetPriceResponse = exports.GetPriceRequest = exports.CoinID_AddressIdentifier = exports.CoinID = void 0;
|
|
7
|
+
const timestamp_1 = require("../../../google/protobuf/timestamp");
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
function createBaseCoinID() {
|
|
11
|
+
return { symbol: undefined, address: undefined };
|
|
12
|
+
}
|
|
13
|
+
exports.CoinID = {
|
|
14
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
15
|
+
if (message.symbol !== undefined) {
|
|
16
|
+
writer.uint32(18).string(message.symbol);
|
|
17
|
+
}
|
|
18
|
+
if (message.address !== undefined) {
|
|
19
|
+
exports.CoinID_AddressIdentifier.encode(message.address, writer.uint32(26).fork()).ldelim();
|
|
20
|
+
}
|
|
21
|
+
return writer;
|
|
22
|
+
},
|
|
23
|
+
decode(input, length) {
|
|
24
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
25
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
26
|
+
const message = createBaseCoinID();
|
|
27
|
+
while (reader.pos < end) {
|
|
28
|
+
const tag = reader.uint32();
|
|
29
|
+
switch (tag >>> 3) {
|
|
30
|
+
case 2:
|
|
31
|
+
message.symbol = reader.string();
|
|
32
|
+
break;
|
|
33
|
+
case 3:
|
|
34
|
+
message.address = exports.CoinID_AddressIdentifier.decode(reader, reader.uint32());
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
reader.skipType(tag & 7);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return message;
|
|
42
|
+
},
|
|
43
|
+
fromJSON(object) {
|
|
44
|
+
return {
|
|
45
|
+
symbol: isSet(object.symbol) ? String(object.symbol) : undefined,
|
|
46
|
+
address: isSet(object.address)
|
|
47
|
+
? exports.CoinID_AddressIdentifier.fromJSON(object.address)
|
|
48
|
+
: undefined,
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
toJSON(message) {
|
|
52
|
+
const obj = {};
|
|
53
|
+
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
54
|
+
message.address !== undefined &&
|
|
55
|
+
(obj.address = message.address
|
|
56
|
+
? exports.CoinID_AddressIdentifier.toJSON(message.address)
|
|
57
|
+
: undefined);
|
|
58
|
+
return obj;
|
|
59
|
+
},
|
|
60
|
+
fromPartial(object) {
|
|
61
|
+
const message = createBaseCoinID();
|
|
62
|
+
message.symbol = object.symbol ?? undefined;
|
|
63
|
+
message.address =
|
|
64
|
+
object.address !== undefined && object.address !== null
|
|
65
|
+
? exports.CoinID_AddressIdentifier.fromPartial(object.address)
|
|
66
|
+
: undefined;
|
|
67
|
+
return message;
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
function createBaseCoinID_AddressIdentifier() {
|
|
71
|
+
return { address: "", chain: "" };
|
|
72
|
+
}
|
|
73
|
+
exports.CoinID_AddressIdentifier = {
|
|
74
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
75
|
+
if (message.address !== "") {
|
|
76
|
+
writer.uint32(10).string(message.address);
|
|
77
|
+
}
|
|
78
|
+
if (message.chain !== "") {
|
|
79
|
+
writer.uint32(18).string(message.chain);
|
|
80
|
+
}
|
|
81
|
+
return writer;
|
|
82
|
+
},
|
|
83
|
+
decode(input, length) {
|
|
84
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
85
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
86
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
87
|
+
while (reader.pos < end) {
|
|
88
|
+
const tag = reader.uint32();
|
|
89
|
+
switch (tag >>> 3) {
|
|
90
|
+
case 1:
|
|
91
|
+
message.address = reader.string();
|
|
92
|
+
break;
|
|
93
|
+
case 2:
|
|
94
|
+
message.chain = reader.string();
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
reader.skipType(tag & 7);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return message;
|
|
102
|
+
},
|
|
103
|
+
fromJSON(object) {
|
|
104
|
+
return {
|
|
105
|
+
address: isSet(object.address) ? String(object.address) : "",
|
|
106
|
+
chain: isSet(object.chain) ? String(object.chain) : "",
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
toJSON(message) {
|
|
110
|
+
const obj = {};
|
|
111
|
+
message.address !== undefined && (obj.address = message.address);
|
|
112
|
+
message.chain !== undefined && (obj.chain = message.chain);
|
|
113
|
+
return obj;
|
|
114
|
+
},
|
|
115
|
+
fromPartial(object) {
|
|
116
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
117
|
+
message.address = object.address ?? "";
|
|
118
|
+
message.chain = object.chain ?? "";
|
|
119
|
+
return message;
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
function createBaseGetPriceRequest() {
|
|
123
|
+
return { timestamp: undefined, coinId: undefined };
|
|
124
|
+
}
|
|
125
|
+
exports.GetPriceRequest = {
|
|
126
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
127
|
+
if (message.timestamp !== undefined) {
|
|
128
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(10).fork()).ldelim();
|
|
129
|
+
}
|
|
130
|
+
if (message.coinId !== undefined) {
|
|
131
|
+
exports.CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();
|
|
132
|
+
}
|
|
133
|
+
return writer;
|
|
134
|
+
},
|
|
135
|
+
decode(input, length) {
|
|
136
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
137
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
138
|
+
const message = createBaseGetPriceRequest();
|
|
139
|
+
while (reader.pos < end) {
|
|
140
|
+
const tag = reader.uint32();
|
|
141
|
+
switch (tag >>> 3) {
|
|
142
|
+
case 1:
|
|
143
|
+
message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
144
|
+
break;
|
|
145
|
+
case 2:
|
|
146
|
+
message.coinId = exports.CoinID.decode(reader, reader.uint32());
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
reader.skipType(tag & 7);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return message;
|
|
154
|
+
},
|
|
155
|
+
fromJSON(object) {
|
|
156
|
+
return {
|
|
157
|
+
timestamp: isSet(object.timestamp)
|
|
158
|
+
? fromJsonTimestamp(object.timestamp)
|
|
159
|
+
: undefined,
|
|
160
|
+
coinId: isSet(object.coinId) ? exports.CoinID.fromJSON(object.coinId) : undefined,
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
toJSON(message) {
|
|
164
|
+
const obj = {};
|
|
165
|
+
message.timestamp !== undefined &&
|
|
166
|
+
(obj.timestamp = message.timestamp.toISOString());
|
|
167
|
+
message.coinId !== undefined &&
|
|
168
|
+
(obj.coinId = message.coinId ? exports.CoinID.toJSON(message.coinId) : undefined);
|
|
169
|
+
return obj;
|
|
170
|
+
},
|
|
171
|
+
fromPartial(object) {
|
|
172
|
+
const message = createBaseGetPriceRequest();
|
|
173
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
174
|
+
message.coinId =
|
|
175
|
+
object.coinId !== undefined && object.coinId !== null
|
|
176
|
+
? exports.CoinID.fromPartial(object.coinId)
|
|
177
|
+
: undefined;
|
|
178
|
+
return message;
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
function createBaseGetPriceResponse() {
|
|
182
|
+
return { price: 0, timestamp: undefined };
|
|
183
|
+
}
|
|
184
|
+
exports.GetPriceResponse = {
|
|
185
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
186
|
+
if (message.price !== 0) {
|
|
187
|
+
writer.uint32(9).double(message.price);
|
|
188
|
+
}
|
|
189
|
+
if (message.timestamp !== undefined) {
|
|
190
|
+
timestamp_1.Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(18).fork()).ldelim();
|
|
191
|
+
}
|
|
192
|
+
return writer;
|
|
193
|
+
},
|
|
194
|
+
decode(input, length) {
|
|
195
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
196
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
197
|
+
const message = createBaseGetPriceResponse();
|
|
198
|
+
while (reader.pos < end) {
|
|
199
|
+
const tag = reader.uint32();
|
|
200
|
+
switch (tag >>> 3) {
|
|
201
|
+
case 1:
|
|
202
|
+
message.price = reader.double();
|
|
203
|
+
break;
|
|
204
|
+
case 2:
|
|
205
|
+
message.timestamp = fromTimestamp(timestamp_1.Timestamp.decode(reader, reader.uint32()));
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
reader.skipType(tag & 7);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return message;
|
|
213
|
+
},
|
|
214
|
+
fromJSON(object) {
|
|
215
|
+
return {
|
|
216
|
+
price: isSet(object.price) ? Number(object.price) : 0,
|
|
217
|
+
timestamp: isSet(object.timestamp)
|
|
218
|
+
? fromJsonTimestamp(object.timestamp)
|
|
219
|
+
: undefined,
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
toJSON(message) {
|
|
223
|
+
const obj = {};
|
|
224
|
+
message.price !== undefined && (obj.price = message.price);
|
|
225
|
+
message.timestamp !== undefined &&
|
|
226
|
+
(obj.timestamp = message.timestamp.toISOString());
|
|
227
|
+
return obj;
|
|
228
|
+
},
|
|
229
|
+
fromPartial(object) {
|
|
230
|
+
const message = createBaseGetPriceResponse();
|
|
231
|
+
message.price = object.price ?? 0;
|
|
232
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
233
|
+
return message;
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
exports.PriceServiceDefinition = {
|
|
237
|
+
name: "PriceService",
|
|
238
|
+
fullName: "price_service.PriceService",
|
|
239
|
+
methods: {
|
|
240
|
+
getPrice: {
|
|
241
|
+
name: "GetPrice",
|
|
242
|
+
requestType: exports.GetPriceRequest,
|
|
243
|
+
requestStream: false,
|
|
244
|
+
responseType: exports.GetPriceResponse,
|
|
245
|
+
responseStream: false,
|
|
246
|
+
options: {},
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
function toTimestamp(date) {
|
|
251
|
+
const seconds = numberToLong(date.getTime() / 1_000);
|
|
252
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
253
|
+
return { seconds, nanos };
|
|
254
|
+
}
|
|
255
|
+
function fromTimestamp(t) {
|
|
256
|
+
let millis = t.seconds.toNumber() * 1_000;
|
|
257
|
+
millis += t.nanos / 1_000_000;
|
|
258
|
+
return new Date(millis);
|
|
259
|
+
}
|
|
260
|
+
function fromJsonTimestamp(o) {
|
|
261
|
+
if (o instanceof Date) {
|
|
262
|
+
return o;
|
|
263
|
+
}
|
|
264
|
+
else if (typeof o === "string") {
|
|
265
|
+
return new Date(o);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return fromTimestamp(timestamp_1.Timestamp.fromJSON(o));
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function numberToLong(number) {
|
|
272
|
+
return long_1.default.fromNumber(number);
|
|
273
|
+
}
|
|
274
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
275
|
+
minimal_1.default.util.Long = long_1.default;
|
|
276
|
+
minimal_1.default.configure();
|
|
277
|
+
}
|
|
278
|
+
function isSet(value) {
|
|
279
|
+
return value !== null && value !== undefined;
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../../../../src/gen/service/price/protos/price.ts"],"names":[],"mappings":";;;;;;AAEA,kEAA+D;AAC/D,gDAAwB;AACxB,iEAAqC;AAsBrC,SAAS,gBAAgB;IACvB,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACnD,CAAC;AAEY,QAAA,MAAM,GAAG;IACpB,MAAM,CACJ,OAAe,EACf,SAAqB,iBAAG,CAAC,MAAM,CAAC,MAAM,EAAE;QAExC,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE;YAChC,MAAM,CAAC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protobuf/timestamp\";\nimport Long from \"long\";\nimport _m0 from \"protobufjs/minimal\";\n\nexport interface CoinID {\n symbol: string | undefined;\n address: CoinID_AddressIdentifier | undefined;\n}\n\nexport interface CoinID_AddressIdentifier {\n address: string;\n chain: string;\n}\n\nexport interface GetPriceRequest {\n timestamp: Date | undefined;\n coinId: CoinID | undefined;\n}\n\nexport interface GetPriceResponse {\n price: number;\n timestamp: Date | undefined;\n}\n\nfunction createBaseCoinID(): CoinID {\n return { symbol: undefined, address: undefined };\n}\n\nexport const CoinID = {\n encode(\n message: CoinID,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.symbol !== undefined) {\n writer.uint32(18).string(message.symbol);\n }\n if (message.address !== undefined) {\n CoinID_AddressIdentifier.encode(\n message.address,\n writer.uint32(26).fork()\n ).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 2:\n message.symbol = reader.string();\n break;\n case 3:\n message.address = CoinID_AddressIdentifier.decode(\n reader,\n reader.uint32()\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID {\n return {\n symbol: isSet(object.symbol) ? String(object.symbol) : undefined,\n address: isSet(object.address)\n ? CoinID_AddressIdentifier.fromJSON(object.address)\n : undefined,\n };\n },\n\n toJSON(message: CoinID): unknown {\n const obj: any = {};\n message.symbol !== undefined && (obj.symbol = message.symbol);\n message.address !== undefined &&\n (obj.address = message.address\n ? CoinID_AddressIdentifier.toJSON(message.address)\n : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<CoinID>): CoinID {\n const message = createBaseCoinID();\n message.symbol = object.symbol ?? undefined;\n message.address =\n object.address !== undefined && object.address !== null\n ? CoinID_AddressIdentifier.fromPartial(object.address)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {\n return { address: \"\", chain: \"\" };\n}\n\nexport const CoinID_AddressIdentifier = {\n encode(\n message: CoinID_AddressIdentifier,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.address !== \"\") {\n writer.uint32(10).string(message.address);\n }\n if (message.chain !== \"\") {\n writer.uint32(18).string(message.chain);\n }\n return writer;\n },\n\n decode(\n input: _m0.Reader | Uint8Array,\n length?: number\n ): CoinID_AddressIdentifier {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseCoinID_AddressIdentifier();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.address = reader.string();\n break;\n case 2:\n message.chain = reader.string();\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): CoinID_AddressIdentifier {\n return {\n address: isSet(object.address) ? String(object.address) : \"\",\n chain: isSet(object.chain) ? String(object.chain) : \"\",\n };\n },\n\n toJSON(message: CoinID_AddressIdentifier): unknown {\n const obj: any = {};\n message.address !== undefined && (obj.address = message.address);\n message.chain !== undefined && (obj.chain = message.chain);\n return obj;\n },\n\n fromPartial(\n object: DeepPartial<CoinID_AddressIdentifier>\n ): CoinID_AddressIdentifier {\n const message = createBaseCoinID_AddressIdentifier();\n message.address = object.address ?? \"\";\n message.chain = object.chain ?? \"\";\n return message;\n },\n};\n\nfunction createBaseGetPriceRequest(): GetPriceRequest {\n return { timestamp: undefined, coinId: undefined };\n}\n\nexport const GetPriceRequest = {\n encode(\n message: GetPriceRequest,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.timestamp !== undefined) {\n Timestamp.encode(\n toTimestamp(message.timestamp),\n writer.uint32(10).fork()\n ).ldelim();\n }\n if (message.coinId !== undefined) {\n CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceRequest();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.timestamp = fromTimestamp(\n Timestamp.decode(reader, reader.uint32())\n );\n break;\n case 2:\n message.coinId = CoinID.decode(reader, reader.uint32());\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceRequest {\n return {\n timestamp: isSet(object.timestamp)\n ? fromJsonTimestamp(object.timestamp)\n : undefined,\n coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,\n };\n },\n\n toJSON(message: GetPriceRequest): unknown {\n const obj: any = {};\n message.timestamp !== undefined &&\n (obj.timestamp = message.timestamp.toISOString());\n message.coinId !== undefined &&\n (obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {\n const message = createBaseGetPriceRequest();\n message.timestamp = object.timestamp ?? undefined;\n message.coinId =\n object.coinId !== undefined && object.coinId !== null\n ? CoinID.fromPartial(object.coinId)\n : undefined;\n return message;\n },\n};\n\nfunction createBaseGetPriceResponse(): GetPriceResponse {\n return { price: 0, timestamp: undefined };\n}\n\nexport const GetPriceResponse = {\n encode(\n message: GetPriceResponse,\n writer: _m0.Writer = _m0.Writer.create()\n ): _m0.Writer {\n if (message.price !== 0) {\n writer.uint32(9).double(message.price);\n }\n if (message.timestamp !== undefined) {\n Timestamp.encode(\n toTimestamp(message.timestamp),\n writer.uint32(18).fork()\n ).ldelim();\n }\n return writer;\n },\n\n decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {\n const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);\n let end = length === undefined ? reader.len : reader.pos + length;\n const message = createBaseGetPriceResponse();\n while (reader.pos < end) {\n const tag = reader.uint32();\n switch (tag >>> 3) {\n case 1:\n message.price = reader.double();\n break;\n case 2:\n message.timestamp = fromTimestamp(\n Timestamp.decode(reader, reader.uint32())\n );\n break;\n default:\n reader.skipType(tag & 7);\n break;\n }\n }\n return message;\n },\n\n fromJSON(object: any): GetPriceResponse {\n return {\n price: isSet(object.price) ? Number(object.price) : 0,\n timestamp: isSet(object.timestamp)\n ? fromJsonTimestamp(object.timestamp)\n : undefined,\n };\n },\n\n toJSON(message: GetPriceResponse): unknown {\n const obj: any = {};\n message.price !== undefined && (obj.price = message.price);\n message.timestamp !== undefined &&\n (obj.timestamp = message.timestamp.toISOString());\n return obj;\n },\n\n fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {\n const message = createBaseGetPriceResponse();\n message.price = object.price ?? 0;\n message.timestamp = object.timestamp ?? undefined;\n return message;\n },\n};\n\nexport type PriceServiceDefinition = typeof PriceServiceDefinition;\nexport const PriceServiceDefinition = {\n name: \"PriceService\",\n fullName: \"price_service.PriceService\",\n methods: {\n getPrice: {\n name: \"GetPrice\",\n requestType: GetPriceRequest,\n requestStream: false,\n responseType: GetPriceResponse,\n responseStream: false,\n options: {},\n },\n },\n} as const;\n\nexport interface PriceServiceServiceImplementation<CallContextExt = {}> {\n getPrice(\n request: GetPriceRequest,\n context: CallContext & CallContextExt\n ): Promise<DeepPartial<GetPriceResponse>>;\n}\n\nexport interface PriceServiceClient<CallOptionsExt = {}> {\n getPrice(\n request: DeepPartial<GetPriceRequest>,\n options?: CallOptions & CallOptionsExt\n ): Promise<GetPriceResponse>;\n}\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | boolean\n | undefined;\n\ntype DeepPartial<T> = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array<infer U>\n ? Array<DeepPartial<U>>\n : T extends ReadonlyArray<infer U>\n ? ReadonlyArray<DeepPartial<U>>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial<T[K]> }\n : Partial<T>;\n\nfunction toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1_000) * 1_000_000;\n return { seconds, nanos };\n}\n\nfunction fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1_000;\n millis += t.nanos / 1_000_000;\n return new Date(millis);\n}\n\nfunction fromJsonTimestamp(o: any): Date {\n if (o instanceof Date) {\n return o;\n } else if (typeof o === \"string\") {\n return new Date(o);\n } else {\n return fromTimestamp(Timestamp.fromJSON(o));\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nif (_m0.util.Long !== Long) {\n _m0.util.Long = Long as any;\n _m0.configure();\n}\n\nfunction isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPriceClient = void 0;
|
|
4
|
+
const price_1 = require("../gen/service/price/protos/price");
|
|
5
|
+
const nice_grpc_1 = require("nice-grpc");
|
|
6
|
+
function getPriceClient(address) {
|
|
7
|
+
const channel = (0, nice_grpc_1.createChannel)(address);
|
|
8
|
+
return (0, nice_grpc_1.createClient)(price_1.PriceServiceDefinition, channel);
|
|
9
|
+
}
|
|
10
|
+
exports.getPriceClient = getPriceClient;
|
|
11
|
+
//# sourceMappingURL=price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/utils/price.ts"],"names":[],"mappings":";;;AAAA,6DAA8F;AAC9F,yCAAuD;AAEvD,SAAgB,cAAc,CAAC,OAAe;IAC5C,MAAM,OAAO,GAAG,IAAA,yBAAa,EAAC,OAAO,CAAC,CAAA;IAEtC,OAAO,IAAA,wBAAY,EAAC,8BAAsB,EAAE,OAAO,CAAC,CAAA;AACtD,CAAC;AAJD,wCAIC","sourcesContent":["import { PriceServiceClient, PriceServiceDefinition } from '../gen/service/price/protos/price'\nimport { createChannel, createClient } from 'nice-grpc'\n\nexport function getPriceClient(address: string): PriceServiceClient {\n const channel = createChannel(address)\n\n return createClient(PriceServiceDefinition, channel)\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.28.0",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"compile_target": "yarn tsc -b src/target-ethers-sentio/tsconfig.json",
|
|
7
7
|
"compile": "tsc -p . && cp src/cli/webpack.config.js lib/cli && cp src/utils/*.csv lib/utils",
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import Long from "long";
|
|
3
|
+
import _m0 from "protobufjs/minimal";
|
|
4
|
+
|
|
5
|
+
export interface Timestamp {
|
|
6
|
+
seconds: Long;
|
|
7
|
+
nanos: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function createBaseTimestamp(): Timestamp {
|
|
11
|
+
return { seconds: Long.ZERO, nanos: 0 };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Timestamp = {
|
|
15
|
+
encode(
|
|
16
|
+
message: Timestamp,
|
|
17
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
18
|
+
): _m0.Writer {
|
|
19
|
+
if (!message.seconds.isZero()) {
|
|
20
|
+
writer.uint32(8).int64(message.seconds);
|
|
21
|
+
}
|
|
22
|
+
if (message.nanos !== 0) {
|
|
23
|
+
writer.uint32(16).int32(message.nanos);
|
|
24
|
+
}
|
|
25
|
+
return writer;
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): Timestamp {
|
|
29
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
30
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
31
|
+
const message = createBaseTimestamp();
|
|
32
|
+
while (reader.pos < end) {
|
|
33
|
+
const tag = reader.uint32();
|
|
34
|
+
switch (tag >>> 3) {
|
|
35
|
+
case 1:
|
|
36
|
+
message.seconds = reader.int64() as Long;
|
|
37
|
+
break;
|
|
38
|
+
case 2:
|
|
39
|
+
message.nanos = reader.int32();
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
reader.skipType(tag & 7);
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return message;
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
fromJSON(object: any): Timestamp {
|
|
50
|
+
return {
|
|
51
|
+
seconds: isSet(object.seconds)
|
|
52
|
+
? Long.fromValue(object.seconds)
|
|
53
|
+
: Long.ZERO,
|
|
54
|
+
nanos: isSet(object.nanos) ? Number(object.nanos) : 0,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
toJSON(message: Timestamp): unknown {
|
|
59
|
+
const obj: any = {};
|
|
60
|
+
message.seconds !== undefined &&
|
|
61
|
+
(obj.seconds = (message.seconds || Long.ZERO).toString());
|
|
62
|
+
message.nanos !== undefined && (obj.nanos = Math.round(message.nanos));
|
|
63
|
+
return obj;
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
fromPartial(object: DeepPartial<Timestamp>): Timestamp {
|
|
67
|
+
const message = createBaseTimestamp();
|
|
68
|
+
message.seconds =
|
|
69
|
+
object.seconds !== undefined && object.seconds !== null
|
|
70
|
+
? Long.fromValue(object.seconds)
|
|
71
|
+
: Long.ZERO;
|
|
72
|
+
message.nanos = object.nanos ?? 0;
|
|
73
|
+
return message;
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type Builtin =
|
|
78
|
+
| Date
|
|
79
|
+
| Function
|
|
80
|
+
| Uint8Array
|
|
81
|
+
| string
|
|
82
|
+
| number
|
|
83
|
+
| boolean
|
|
84
|
+
| undefined;
|
|
85
|
+
|
|
86
|
+
type DeepPartial<T> = T extends Builtin
|
|
87
|
+
? T
|
|
88
|
+
: T extends Long
|
|
89
|
+
? string | number | Long
|
|
90
|
+
: T extends Array<infer U>
|
|
91
|
+
? Array<DeepPartial<U>>
|
|
92
|
+
: T extends ReadonlyArray<infer U>
|
|
93
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
94
|
+
: T extends {}
|
|
95
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
96
|
+
: Partial<T>;
|
|
97
|
+
|
|
98
|
+
if (_m0.util.Long !== Long) {
|
|
99
|
+
_m0.util.Long = Long as any;
|
|
100
|
+
_m0.configure();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function isSet(value: any): boolean {
|
|
104
|
+
return value !== null && value !== undefined;
|
|
105
|
+
}
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { CallContext, CallOptions } from "nice-grpc-common";
|
|
3
|
+
import { Timestamp } from "../../../google/protobuf/timestamp";
|
|
4
|
+
import Long from "long";
|
|
5
|
+
import _m0 from "protobufjs/minimal";
|
|
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
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface GetPriceResponse {
|
|
23
|
+
price: number;
|
|
24
|
+
timestamp: Date | undefined;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function createBaseCoinID(): CoinID {
|
|
28
|
+
return { symbol: undefined, address: undefined };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const CoinID = {
|
|
32
|
+
encode(
|
|
33
|
+
message: CoinID,
|
|
34
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
35
|
+
): _m0.Writer {
|
|
36
|
+
if (message.symbol !== undefined) {
|
|
37
|
+
writer.uint32(18).string(message.symbol);
|
|
38
|
+
}
|
|
39
|
+
if (message.address !== undefined) {
|
|
40
|
+
CoinID_AddressIdentifier.encode(
|
|
41
|
+
message.address,
|
|
42
|
+
writer.uint32(26).fork()
|
|
43
|
+
).ldelim();
|
|
44
|
+
}
|
|
45
|
+
return writer;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): CoinID {
|
|
49
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
50
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
51
|
+
const message = createBaseCoinID();
|
|
52
|
+
while (reader.pos < end) {
|
|
53
|
+
const tag = reader.uint32();
|
|
54
|
+
switch (tag >>> 3) {
|
|
55
|
+
case 2:
|
|
56
|
+
message.symbol = reader.string();
|
|
57
|
+
break;
|
|
58
|
+
case 3:
|
|
59
|
+
message.address = CoinID_AddressIdentifier.decode(
|
|
60
|
+
reader,
|
|
61
|
+
reader.uint32()
|
|
62
|
+
);
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
reader.skipType(tag & 7);
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return message;
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
fromJSON(object: any): CoinID {
|
|
73
|
+
return {
|
|
74
|
+
symbol: isSet(object.symbol) ? String(object.symbol) : undefined,
|
|
75
|
+
address: isSet(object.address)
|
|
76
|
+
? CoinID_AddressIdentifier.fromJSON(object.address)
|
|
77
|
+
: undefined,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
toJSON(message: CoinID): unknown {
|
|
82
|
+
const obj: any = {};
|
|
83
|
+
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
84
|
+
message.address !== undefined &&
|
|
85
|
+
(obj.address = message.address
|
|
86
|
+
? CoinID_AddressIdentifier.toJSON(message.address)
|
|
87
|
+
: undefined);
|
|
88
|
+
return obj;
|
|
89
|
+
},
|
|
90
|
+
|
|
91
|
+
fromPartial(object: DeepPartial<CoinID>): CoinID {
|
|
92
|
+
const message = createBaseCoinID();
|
|
93
|
+
message.symbol = object.symbol ?? undefined;
|
|
94
|
+
message.address =
|
|
95
|
+
object.address !== undefined && object.address !== null
|
|
96
|
+
? CoinID_AddressIdentifier.fromPartial(object.address)
|
|
97
|
+
: undefined;
|
|
98
|
+
return message;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
function createBaseCoinID_AddressIdentifier(): CoinID_AddressIdentifier {
|
|
103
|
+
return { address: "", chain: "" };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const CoinID_AddressIdentifier = {
|
|
107
|
+
encode(
|
|
108
|
+
message: CoinID_AddressIdentifier,
|
|
109
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
110
|
+
): _m0.Writer {
|
|
111
|
+
if (message.address !== "") {
|
|
112
|
+
writer.uint32(10).string(message.address);
|
|
113
|
+
}
|
|
114
|
+
if (message.chain !== "") {
|
|
115
|
+
writer.uint32(18).string(message.chain);
|
|
116
|
+
}
|
|
117
|
+
return writer;
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
decode(
|
|
121
|
+
input: _m0.Reader | Uint8Array,
|
|
122
|
+
length?: number
|
|
123
|
+
): CoinID_AddressIdentifier {
|
|
124
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
125
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
126
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
127
|
+
while (reader.pos < end) {
|
|
128
|
+
const tag = reader.uint32();
|
|
129
|
+
switch (tag >>> 3) {
|
|
130
|
+
case 1:
|
|
131
|
+
message.address = reader.string();
|
|
132
|
+
break;
|
|
133
|
+
case 2:
|
|
134
|
+
message.chain = reader.string();
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
reader.skipType(tag & 7);
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return message;
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
fromJSON(object: any): CoinID_AddressIdentifier {
|
|
145
|
+
return {
|
|
146
|
+
address: isSet(object.address) ? String(object.address) : "",
|
|
147
|
+
chain: isSet(object.chain) ? String(object.chain) : "",
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
toJSON(message: CoinID_AddressIdentifier): unknown {
|
|
152
|
+
const obj: any = {};
|
|
153
|
+
message.address !== undefined && (obj.address = message.address);
|
|
154
|
+
message.chain !== undefined && (obj.chain = message.chain);
|
|
155
|
+
return obj;
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
fromPartial(
|
|
159
|
+
object: DeepPartial<CoinID_AddressIdentifier>
|
|
160
|
+
): CoinID_AddressIdentifier {
|
|
161
|
+
const message = createBaseCoinID_AddressIdentifier();
|
|
162
|
+
message.address = object.address ?? "";
|
|
163
|
+
message.chain = object.chain ?? "";
|
|
164
|
+
return message;
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
function createBaseGetPriceRequest(): GetPriceRequest {
|
|
169
|
+
return { timestamp: undefined, coinId: undefined };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const GetPriceRequest = {
|
|
173
|
+
encode(
|
|
174
|
+
message: GetPriceRequest,
|
|
175
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
176
|
+
): _m0.Writer {
|
|
177
|
+
if (message.timestamp !== undefined) {
|
|
178
|
+
Timestamp.encode(
|
|
179
|
+
toTimestamp(message.timestamp),
|
|
180
|
+
writer.uint32(10).fork()
|
|
181
|
+
).ldelim();
|
|
182
|
+
}
|
|
183
|
+
if (message.coinId !== undefined) {
|
|
184
|
+
CoinID.encode(message.coinId, writer.uint32(18).fork()).ldelim();
|
|
185
|
+
}
|
|
186
|
+
return writer;
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceRequest {
|
|
190
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
191
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
192
|
+
const message = createBaseGetPriceRequest();
|
|
193
|
+
while (reader.pos < end) {
|
|
194
|
+
const tag = reader.uint32();
|
|
195
|
+
switch (tag >>> 3) {
|
|
196
|
+
case 1:
|
|
197
|
+
message.timestamp = fromTimestamp(
|
|
198
|
+
Timestamp.decode(reader, reader.uint32())
|
|
199
|
+
);
|
|
200
|
+
break;
|
|
201
|
+
case 2:
|
|
202
|
+
message.coinId = CoinID.decode(reader, reader.uint32());
|
|
203
|
+
break;
|
|
204
|
+
default:
|
|
205
|
+
reader.skipType(tag & 7);
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return message;
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
fromJSON(object: any): GetPriceRequest {
|
|
213
|
+
return {
|
|
214
|
+
timestamp: isSet(object.timestamp)
|
|
215
|
+
? fromJsonTimestamp(object.timestamp)
|
|
216
|
+
: undefined,
|
|
217
|
+
coinId: isSet(object.coinId) ? CoinID.fromJSON(object.coinId) : undefined,
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
|
|
221
|
+
toJSON(message: GetPriceRequest): unknown {
|
|
222
|
+
const obj: any = {};
|
|
223
|
+
message.timestamp !== undefined &&
|
|
224
|
+
(obj.timestamp = message.timestamp.toISOString());
|
|
225
|
+
message.coinId !== undefined &&
|
|
226
|
+
(obj.coinId = message.coinId ? CoinID.toJSON(message.coinId) : undefined);
|
|
227
|
+
return obj;
|
|
228
|
+
},
|
|
229
|
+
|
|
230
|
+
fromPartial(object: DeepPartial<GetPriceRequest>): GetPriceRequest {
|
|
231
|
+
const message = createBaseGetPriceRequest();
|
|
232
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
233
|
+
message.coinId =
|
|
234
|
+
object.coinId !== undefined && object.coinId !== null
|
|
235
|
+
? CoinID.fromPartial(object.coinId)
|
|
236
|
+
: undefined;
|
|
237
|
+
return message;
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
function createBaseGetPriceResponse(): GetPriceResponse {
|
|
242
|
+
return { price: 0, timestamp: undefined };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export const GetPriceResponse = {
|
|
246
|
+
encode(
|
|
247
|
+
message: GetPriceResponse,
|
|
248
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
249
|
+
): _m0.Writer {
|
|
250
|
+
if (message.price !== 0) {
|
|
251
|
+
writer.uint32(9).double(message.price);
|
|
252
|
+
}
|
|
253
|
+
if (message.timestamp !== undefined) {
|
|
254
|
+
Timestamp.encode(
|
|
255
|
+
toTimestamp(message.timestamp),
|
|
256
|
+
writer.uint32(18).fork()
|
|
257
|
+
).ldelim();
|
|
258
|
+
}
|
|
259
|
+
return writer;
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): GetPriceResponse {
|
|
263
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
264
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
265
|
+
const message = createBaseGetPriceResponse();
|
|
266
|
+
while (reader.pos < end) {
|
|
267
|
+
const tag = reader.uint32();
|
|
268
|
+
switch (tag >>> 3) {
|
|
269
|
+
case 1:
|
|
270
|
+
message.price = reader.double();
|
|
271
|
+
break;
|
|
272
|
+
case 2:
|
|
273
|
+
message.timestamp = fromTimestamp(
|
|
274
|
+
Timestamp.decode(reader, reader.uint32())
|
|
275
|
+
);
|
|
276
|
+
break;
|
|
277
|
+
default:
|
|
278
|
+
reader.skipType(tag & 7);
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return message;
|
|
283
|
+
},
|
|
284
|
+
|
|
285
|
+
fromJSON(object: any): GetPriceResponse {
|
|
286
|
+
return {
|
|
287
|
+
price: isSet(object.price) ? Number(object.price) : 0,
|
|
288
|
+
timestamp: isSet(object.timestamp)
|
|
289
|
+
? fromJsonTimestamp(object.timestamp)
|
|
290
|
+
: undefined,
|
|
291
|
+
};
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
toJSON(message: GetPriceResponse): unknown {
|
|
295
|
+
const obj: any = {};
|
|
296
|
+
message.price !== undefined && (obj.price = message.price);
|
|
297
|
+
message.timestamp !== undefined &&
|
|
298
|
+
(obj.timestamp = message.timestamp.toISOString());
|
|
299
|
+
return obj;
|
|
300
|
+
},
|
|
301
|
+
|
|
302
|
+
fromPartial(object: DeepPartial<GetPriceResponse>): GetPriceResponse {
|
|
303
|
+
const message = createBaseGetPriceResponse();
|
|
304
|
+
message.price = object.price ?? 0;
|
|
305
|
+
message.timestamp = object.timestamp ?? undefined;
|
|
306
|
+
return message;
|
|
307
|
+
},
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
export type PriceServiceDefinition = typeof PriceServiceDefinition;
|
|
311
|
+
export const PriceServiceDefinition = {
|
|
312
|
+
name: "PriceService",
|
|
313
|
+
fullName: "price_service.PriceService",
|
|
314
|
+
methods: {
|
|
315
|
+
getPrice: {
|
|
316
|
+
name: "GetPrice",
|
|
317
|
+
requestType: GetPriceRequest,
|
|
318
|
+
requestStream: false,
|
|
319
|
+
responseType: GetPriceResponse,
|
|
320
|
+
responseStream: false,
|
|
321
|
+
options: {},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
} as const;
|
|
325
|
+
|
|
326
|
+
export interface PriceServiceServiceImplementation<CallContextExt = {}> {
|
|
327
|
+
getPrice(
|
|
328
|
+
request: GetPriceRequest,
|
|
329
|
+
context: CallContext & CallContextExt
|
|
330
|
+
): Promise<DeepPartial<GetPriceResponse>>;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export interface PriceServiceClient<CallOptionsExt = {}> {
|
|
334
|
+
getPrice(
|
|
335
|
+
request: DeepPartial<GetPriceRequest>,
|
|
336
|
+
options?: CallOptions & CallOptionsExt
|
|
337
|
+
): Promise<GetPriceResponse>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
type Builtin =
|
|
341
|
+
| Date
|
|
342
|
+
| Function
|
|
343
|
+
| Uint8Array
|
|
344
|
+
| string
|
|
345
|
+
| number
|
|
346
|
+
| boolean
|
|
347
|
+
| undefined;
|
|
348
|
+
|
|
349
|
+
type DeepPartial<T> = T extends Builtin
|
|
350
|
+
? T
|
|
351
|
+
: T extends Long
|
|
352
|
+
? string | number | Long
|
|
353
|
+
: T extends Array<infer U>
|
|
354
|
+
? Array<DeepPartial<U>>
|
|
355
|
+
: T extends ReadonlyArray<infer U>
|
|
356
|
+
? ReadonlyArray<DeepPartial<U>>
|
|
357
|
+
: T extends {}
|
|
358
|
+
? { [K in keyof T]?: DeepPartial<T[K]> }
|
|
359
|
+
: Partial<T>;
|
|
360
|
+
|
|
361
|
+
function toTimestamp(date: Date): Timestamp {
|
|
362
|
+
const seconds = numberToLong(date.getTime() / 1_000);
|
|
363
|
+
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
364
|
+
return { seconds, nanos };
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function fromTimestamp(t: Timestamp): Date {
|
|
368
|
+
let millis = t.seconds.toNumber() * 1_000;
|
|
369
|
+
millis += t.nanos / 1_000_000;
|
|
370
|
+
return new Date(millis);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function fromJsonTimestamp(o: any): Date {
|
|
374
|
+
if (o instanceof Date) {
|
|
375
|
+
return o;
|
|
376
|
+
} else if (typeof o === "string") {
|
|
377
|
+
return new Date(o);
|
|
378
|
+
} else {
|
|
379
|
+
return fromTimestamp(Timestamp.fromJSON(o));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
function numberToLong(number: number) {
|
|
384
|
+
return Long.fromNumber(number);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (_m0.util.Long !== Long) {
|
|
388
|
+
_m0.util.Long = Long as any;
|
|
389
|
+
_m0.configure();
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function isSet(value: any): boolean {
|
|
393
|
+
return value !== null && value !== undefined;
|
|
394
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PriceServiceClient, PriceServiceDefinition } from '../gen/service/price/protos/price'
|
|
2
|
+
import { createChannel, createClient } from 'nice-grpc'
|
|
3
|
+
|
|
4
|
+
export function getPriceClient(address: string): PriceServiceClient {
|
|
5
|
+
const channel = createChannel(address)
|
|
6
|
+
|
|
7
|
+
return createClient(PriceServiceDefinition, channel)
|
|
8
|
+
}
|