@dashevo/dapi-grpc 1.0.0-dev.11 → 1.0.0-dev.12
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/Cargo.toml +2 -1
- package/build.rs +4 -2
- package/clients/core/v0/nodejs/CorePromiseClient.js +51 -13
- package/clients/core/v0/nodejs/core_pbjs.js +869 -703
- package/clients/core/v0/nodejs/core_protoc.js +681 -609
- package/clients/core/v0/web/CorePromiseClient.js +19 -5
- package/clients/core/v0/web/core_pb.d.ts +99 -89
- package/clients/core/v0/web/core_pb.js +681 -609
- package/clients/core/v0/web/core_pb_service.d.ts +29 -10
- package/clients/core/v0/web/core_pb_service.js +46 -6
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +55 -14
- package/clients/platform/v0/nodejs/platform_pbjs.js +7805 -7761
- package/clients/platform/v0/nodejs/platform_protoc.js +7845 -7749
- package/clients/platform/v0/web/PlatformPromiseClient.js +22 -8
- package/clients/platform/v0/web/platform_pb.d.ts +388 -372
- package/clients/platform/v0/web/platform_pb.js +7845 -7749
- package/clients/platform/v0/web/platform_pb_service.d.ts +35 -35
- package/clients/platform/v0/web/platform_pb_service.js +35 -35
- package/package.json +2 -2
- package/protos/core/v0/core.proto +27 -23
- package/protos/platform/v0/platform.proto +49 -64
- package/src/core/proto/org.dash.platform.dapi.v0.rs +196 -101
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +197 -345
- package/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +27 -6
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +21 -0
- package/test/unit/getCoreDefinition.spec.js +5 -2
|
@@ -4,13 +4,22 @@
|
|
|
4
4
|
import * as core_pb from "./core_pb";
|
|
5
5
|
import {grpc} from "@improbable-eng/grpc-web";
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type CoregetBlockchainStatus = {
|
|
8
8
|
readonly methodName: string;
|
|
9
9
|
readonly service: typeof Core;
|
|
10
10
|
readonly requestStream: false;
|
|
11
11
|
readonly responseStream: false;
|
|
12
|
-
readonly requestType: typeof core_pb.
|
|
13
|
-
readonly responseType: typeof core_pb.
|
|
12
|
+
readonly requestType: typeof core_pb.GetBlockchainStatusRequest;
|
|
13
|
+
readonly responseType: typeof core_pb.GetBlockchainStatusResponse;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type CoregetMasternodeStatus = {
|
|
17
|
+
readonly methodName: string;
|
|
18
|
+
readonly service: typeof Core;
|
|
19
|
+
readonly requestStream: false;
|
|
20
|
+
readonly responseStream: false;
|
|
21
|
+
readonly requestType: typeof core_pb.GetMasternodeStatusRequest;
|
|
22
|
+
readonly responseType: typeof core_pb.GetMasternodeStatusResponse;
|
|
14
23
|
};
|
|
15
24
|
|
|
16
25
|
type CoregetBlock = {
|
|
@@ -69,7 +78,8 @@ type CoresubscribeToTransactionsWithProofs = {
|
|
|
69
78
|
|
|
70
79
|
export class Core {
|
|
71
80
|
static readonly serviceName: string;
|
|
72
|
-
static readonly
|
|
81
|
+
static readonly getBlockchainStatus: CoregetBlockchainStatus;
|
|
82
|
+
static readonly getMasternodeStatus: CoregetMasternodeStatus;
|
|
73
83
|
static readonly getBlock: CoregetBlock;
|
|
74
84
|
static readonly broadcastTransaction: CorebroadcastTransaction;
|
|
75
85
|
static readonly getTransaction: CoregetTransaction;
|
|
@@ -110,14 +120,23 @@ export class CoreClient {
|
|
|
110
120
|
readonly serviceHost: string;
|
|
111
121
|
|
|
112
122
|
constructor(serviceHost: string, options?: grpc.RpcOptions);
|
|
113
|
-
|
|
114
|
-
requestMessage: core_pb.
|
|
123
|
+
getBlockchainStatus(
|
|
124
|
+
requestMessage: core_pb.GetBlockchainStatusRequest,
|
|
125
|
+
metadata: grpc.Metadata,
|
|
126
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void
|
|
127
|
+
): UnaryResponse;
|
|
128
|
+
getBlockchainStatus(
|
|
129
|
+
requestMessage: core_pb.GetBlockchainStatusRequest,
|
|
130
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockchainStatusResponse|null) => void
|
|
131
|
+
): UnaryResponse;
|
|
132
|
+
getMasternodeStatus(
|
|
133
|
+
requestMessage: core_pb.GetMasternodeStatusRequest,
|
|
115
134
|
metadata: grpc.Metadata,
|
|
116
|
-
callback: (error: ServiceError|null, responseMessage: core_pb.
|
|
135
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void
|
|
117
136
|
): UnaryResponse;
|
|
118
|
-
|
|
119
|
-
requestMessage: core_pb.
|
|
120
|
-
callback: (error: ServiceError|null, responseMessage: core_pb.
|
|
137
|
+
getMasternodeStatus(
|
|
138
|
+
requestMessage: core_pb.GetMasternodeStatusRequest,
|
|
139
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void
|
|
121
140
|
): UnaryResponse;
|
|
122
141
|
getBlock(
|
|
123
142
|
requestMessage: core_pb.GetBlockRequest,
|
|
@@ -10,13 +10,22 @@ var Core = (function () {
|
|
|
10
10
|
return Core;
|
|
11
11
|
}());
|
|
12
12
|
|
|
13
|
-
Core.
|
|
14
|
-
methodName: "
|
|
13
|
+
Core.getBlockchainStatus = {
|
|
14
|
+
methodName: "getBlockchainStatus",
|
|
15
15
|
service: Core,
|
|
16
16
|
requestStream: false,
|
|
17
17
|
responseStream: false,
|
|
18
|
-
requestType: core_pb.
|
|
19
|
-
responseType: core_pb.
|
|
18
|
+
requestType: core_pb.GetBlockchainStatusRequest,
|
|
19
|
+
responseType: core_pb.GetBlockchainStatusResponse
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
Core.getMasternodeStatus = {
|
|
23
|
+
methodName: "getMasternodeStatus",
|
|
24
|
+
service: Core,
|
|
25
|
+
requestStream: false,
|
|
26
|
+
responseStream: false,
|
|
27
|
+
requestType: core_pb.GetMasternodeStatusRequest,
|
|
28
|
+
responseType: core_pb.GetMasternodeStatusResponse
|
|
20
29
|
};
|
|
21
30
|
|
|
22
31
|
Core.getBlock = {
|
|
@@ -80,11 +89,42 @@ function CoreClient(serviceHost, options) {
|
|
|
80
89
|
this.options = options || {};
|
|
81
90
|
}
|
|
82
91
|
|
|
83
|
-
CoreClient.prototype.
|
|
92
|
+
CoreClient.prototype.getBlockchainStatus = function getBlockchainStatus(requestMessage, metadata, callback) {
|
|
93
|
+
if (arguments.length === 2) {
|
|
94
|
+
callback = arguments[1];
|
|
95
|
+
}
|
|
96
|
+
var client = grpc.unary(Core.getBlockchainStatus, {
|
|
97
|
+
request: requestMessage,
|
|
98
|
+
host: this.serviceHost,
|
|
99
|
+
metadata: metadata,
|
|
100
|
+
transport: this.options.transport,
|
|
101
|
+
debug: this.options.debug,
|
|
102
|
+
onEnd: function (response) {
|
|
103
|
+
if (callback) {
|
|
104
|
+
if (response.status !== grpc.Code.OK) {
|
|
105
|
+
var err = new Error(response.statusMessage);
|
|
106
|
+
err.code = response.status;
|
|
107
|
+
err.metadata = response.trailers;
|
|
108
|
+
callback(err, null);
|
|
109
|
+
} else {
|
|
110
|
+
callback(null, response.message);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
cancel: function () {
|
|
117
|
+
callback = null;
|
|
118
|
+
client.close();
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
CoreClient.prototype.getMasternodeStatus = function getMasternodeStatus(requestMessage, metadata, callback) {
|
|
84
124
|
if (arguments.length === 2) {
|
|
85
125
|
callback = arguments[1];
|
|
86
126
|
}
|
|
87
|
-
var client = grpc.unary(Core.
|
|
127
|
+
var client = grpc.unary(Core.getMasternodeStatus, {
|
|
88
128
|
request: requestMessage,
|
|
89
129
|
host: this.serviceHost,
|
|
90
130
|
metadata: metadata,
|
|
@@ -28,14 +28,16 @@ const {
|
|
|
28
28
|
BroadcastStateTransitionResponse: PBJSBroadcastStateTransitionResponse,
|
|
29
29
|
GetIdentityRequest: PBJSGetIdentityRequest,
|
|
30
30
|
GetIdentityResponse: PBJSGetIdentityResponse,
|
|
31
|
+
GetIdentitiesContractKeysRequest: PBJSGetIdentitiesContractKeysRequest,
|
|
32
|
+
GetIdentitiesContractKeysResponse: PBJSGetIdentitiesContractKeysResponse,
|
|
31
33
|
GetDataContractRequest: PBJSGetDataContractRequest,
|
|
32
34
|
GetDataContractResponse: PBJSGetDataContractResponse,
|
|
33
35
|
GetDataContractHistoryRequest: PBJSGetDataContractHistoryRequest,
|
|
34
36
|
GetDataContractHistoryResponse: PBJSGetDataContractHistoryResponse,
|
|
35
37
|
GetDocumentsRequest: PBJSGetDocumentsRequest,
|
|
36
38
|
GetDocumentsResponse: PBJSGetDocumentsResponse,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
GetIdentityByPublicKeyHashRequest: PBJSGetIdentityByPublicKeyHashRequest,
|
|
40
|
+
GetIdentityByPublicKeyHashResponse: PBJSGetIdentityByPublicKeyHashResponse,
|
|
39
41
|
WaitForStateTransitionResultRequest: PBJSWaitForStateTransitionResultRequest,
|
|
40
42
|
WaitForStateTransitionResultResponse: PBJSWaitForStateTransitionResultResponse,
|
|
41
43
|
GetConsensusParamsRequest: PBJSGetConsensusParamsRequest,
|
|
@@ -66,10 +68,11 @@ const {
|
|
|
66
68
|
const {
|
|
67
69
|
BroadcastStateTransitionResponse: ProtocBroadcastStateTransitionResponse,
|
|
68
70
|
GetIdentityResponse: ProtocGetIdentityResponse,
|
|
71
|
+
GetIdentitiesContractKeysResponse: ProtocGetIdentitiesContractKeysResponse,
|
|
69
72
|
GetDataContractResponse: ProtocGetDataContractResponse,
|
|
70
73
|
GetDataContractHistoryResponse: ProtocGetDataContractHistoryResponse,
|
|
71
74
|
GetDocumentsResponse: ProtocGetDocumentsResponse,
|
|
72
|
-
|
|
75
|
+
GetIdentityByPublicKeyHashResponse: ProtocGetIdentityByPublicKeyHashResponse,
|
|
73
76
|
WaitForStateTransitionResultResponse: ProtocWaitForStateTransitionResultResponse,
|
|
74
77
|
GetConsensusParamsResponse: ProtocGetConsensusParamsResponse,
|
|
75
78
|
GetEpochsInfoResponse: ProtocGetEpochsInfoResponse,
|
|
@@ -113,6 +116,10 @@ class PlatformPromiseClient {
|
|
|
113
116
|
this.client.getIdentity.bind(this.client),
|
|
114
117
|
);
|
|
115
118
|
|
|
119
|
+
this.client.getIdentitiesContractKeys = promisify(
|
|
120
|
+
this.client.getIdentitiesContractKeys.bind(this.client),
|
|
121
|
+
);
|
|
122
|
+
|
|
116
123
|
this.client.getDataContract = promisify(
|
|
117
124
|
this.client.getDataContract.bind(this.client),
|
|
118
125
|
);
|
|
@@ -125,8 +132,8 @@ class PlatformPromiseClient {
|
|
|
125
132
|
this.client.getDocuments.bind(this.client),
|
|
126
133
|
);
|
|
127
134
|
|
|
128
|
-
this.client.
|
|
129
|
-
this.client.
|
|
135
|
+
this.client.getIdentityByPublicKeyHash = promisify(
|
|
136
|
+
this.client.getIdentityByPublicKeyHash.bind(this.client),
|
|
130
137
|
);
|
|
131
138
|
|
|
132
139
|
this.client.waitForStateTransitionResult = promisify(
|
|
@@ -230,6 +237,40 @@ class PlatformPromiseClient {
|
|
|
230
237
|
);
|
|
231
238
|
}
|
|
232
239
|
|
|
240
|
+
/**
|
|
241
|
+
* @param {!GetIdentitiesContractKeysRequest} getIdentitiesContractKeysRequest
|
|
242
|
+
* @param {?Object<string, string>} metadata
|
|
243
|
+
* @param {CallOptions} [options={}]
|
|
244
|
+
* @returns {Promise<!GetIdentitiesContractKeysResponse>}
|
|
245
|
+
*/
|
|
246
|
+
getIdentitiesContractKeys(
|
|
247
|
+
getIdentitiesContractKeysRequest,
|
|
248
|
+
metadata = {},
|
|
249
|
+
options = {},
|
|
250
|
+
) {
|
|
251
|
+
if (!isObject(metadata)) {
|
|
252
|
+
throw new Error('metadata must be an object');
|
|
253
|
+
}
|
|
254
|
+
return this.client.getIdentitiesContractKeys(
|
|
255
|
+
getIdentitiesContractKeysRequest,
|
|
256
|
+
convertObjectToMetadata(metadata),
|
|
257
|
+
{
|
|
258
|
+
interceptors: [
|
|
259
|
+
jsonToProtobufInterceptorFactory(
|
|
260
|
+
jsonToProtobufFactory(
|
|
261
|
+
ProtocGetIdentitiesContractKeysResponse,
|
|
262
|
+
PBJSGetIdentitiesContractKeysResponse,
|
|
263
|
+
),
|
|
264
|
+
protobufToJsonFactory(
|
|
265
|
+
PBJSGetIdentitiesContractKeysRequest,
|
|
266
|
+
),
|
|
267
|
+
),
|
|
268
|
+
],
|
|
269
|
+
...options,
|
|
270
|
+
},
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
233
274
|
/**
|
|
234
275
|
*
|
|
235
276
|
* @param {!GetDataContractRequest} getDataContractRequest
|
|
@@ -327,13 +368,13 @@ class PlatformPromiseClient {
|
|
|
327
368
|
}
|
|
328
369
|
|
|
329
370
|
/**
|
|
330
|
-
* @param {!
|
|
371
|
+
* @param {!GetIdentityByPublicKeyHashRequest} getIdentityByPublicKeyHashRequest
|
|
331
372
|
* @param {?Object<string, string>} metadata
|
|
332
373
|
* @param {CallOptions} [options={}]
|
|
333
|
-
* @returns {Promise<!
|
|
374
|
+
* @returns {Promise<!GetIdentityByPublicKeyHashResponse>}
|
|
334
375
|
*/
|
|
335
|
-
|
|
336
|
-
|
|
376
|
+
getIdentityByPublicKeyHash(
|
|
377
|
+
getIdentityByPublicKeyHashRequest,
|
|
337
378
|
metadata = {},
|
|
338
379
|
options = {},
|
|
339
380
|
) {
|
|
@@ -341,18 +382,18 @@ class PlatformPromiseClient {
|
|
|
341
382
|
throw new Error('metadata must be an object');
|
|
342
383
|
}
|
|
343
384
|
|
|
344
|
-
return this.client.
|
|
345
|
-
|
|
385
|
+
return this.client.getIdentityByPublicKeyHash(
|
|
386
|
+
getIdentityByPublicKeyHashRequest,
|
|
346
387
|
convertObjectToMetadata(metadata),
|
|
347
388
|
{
|
|
348
389
|
interceptors: [
|
|
349
390
|
jsonToProtobufInterceptorFactory(
|
|
350
391
|
jsonToProtobufFactory(
|
|
351
|
-
|
|
352
|
-
|
|
392
|
+
ProtocGetIdentityByPublicKeyHashResponse,
|
|
393
|
+
PBJSGetIdentityByPublicKeyHashResponse,
|
|
353
394
|
),
|
|
354
395
|
protobufToJsonFactory(
|
|
355
|
-
|
|
396
|
+
PBJSGetIdentityByPublicKeyHashRequest,
|
|
356
397
|
),
|
|
357
398
|
),
|
|
358
399
|
],
|