@dashevo/dapi-grpc 1.0.0-dev.10 → 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.
@@ -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 CoregetStatus = {
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.GetStatusRequest;
13
- readonly responseType: typeof core_pb.GetStatusResponse;
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 getStatus: CoregetStatus;
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
- getStatus(
114
- requestMessage: core_pb.GetStatusRequest,
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.GetStatusResponse|null) => void
135
+ callback: (error: ServiceError|null, responseMessage: core_pb.GetMasternodeStatusResponse|null) => void
117
136
  ): UnaryResponse;
118
- getStatus(
119
- requestMessage: core_pb.GetStatusRequest,
120
- callback: (error: ServiceError|null, responseMessage: core_pb.GetStatusResponse|null) => void
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.getStatus = {
14
- methodName: "getStatus",
13
+ Core.getBlockchainStatus = {
14
+ methodName: "getBlockchainStatus",
15
15
  service: Core,
16
16
  requestStream: false,
17
17
  responseStream: false,
18
- requestType: core_pb.GetStatusRequest,
19
- responseType: core_pb.GetStatusResponse
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.getStatus = function getStatus(requestMessage, metadata, callback) {
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.getStatus, {
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
- GetIdentitiesByPublicKeyHashesRequest: PBJSGetIdentitiesByPublicKeyHashesRequest,
38
- GetIdentitiesByPublicKeyHashesResponse: PBJSGetIdentitiesByPublicKeyHashesResponse,
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
- GetIdentitiesByPublicKeyHashesResponse: ProtocGetIdentitiesByPublicKeyHashesResponse,
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.getIdentitiesByPublicKeyHashes = promisify(
129
- this.client.getIdentitiesByPublicKeyHashes.bind(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 {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest
371
+ * @param {!GetIdentityByPublicKeyHashRequest} getIdentityByPublicKeyHashRequest
331
372
  * @param {?Object<string, string>} metadata
332
373
  * @param {CallOptions} [options={}]
333
- * @returns {Promise<!GetIdentitiesByPublicKeyHashesResponse>}
374
+ * @returns {Promise<!GetIdentityByPublicKeyHashResponse>}
334
375
  */
335
- getIdentitiesByPublicKeyHashes(
336
- getIdentitiesByPublicKeyHashesRequest,
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.getIdentitiesByPublicKeyHashes(
345
- getIdentitiesByPublicKeyHashesRequest,
385
+ return this.client.getIdentityByPublicKeyHash(
386
+ getIdentityByPublicKeyHashRequest,
346
387
  convertObjectToMetadata(metadata),
347
388
  {
348
389
  interceptors: [
349
390
  jsonToProtobufInterceptorFactory(
350
391
  jsonToProtobufFactory(
351
- ProtocGetIdentitiesByPublicKeyHashesResponse,
352
- PBJSGetIdentitiesByPublicKeyHashesResponse,
392
+ ProtocGetIdentityByPublicKeyHashResponse,
393
+ PBJSGetIdentityByPublicKeyHashResponse,
353
394
  ),
354
395
  protobufToJsonFactory(
355
- PBJSGetIdentitiesByPublicKeyHashesRequest,
396
+ PBJSGetIdentityByPublicKeyHashRequest,
356
397
  ),
357
398
  ),
358
399
  ],