@dashevo/dapi-grpc 1.1.1 → 1.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -247,6 +247,15 @@ type PlatformgetPathElements = {
247
247
  readonly responseType: typeof platform_pb.GetPathElementsResponse;
248
248
  };
249
249
 
250
+ type PlatformgetStatus = {
251
+ readonly methodName: string;
252
+ readonly service: typeof Platform;
253
+ readonly requestStream: false;
254
+ readonly responseStream: false;
255
+ readonly requestType: typeof platform_pb.GetStatusRequest;
256
+ readonly responseType: typeof platform_pb.GetStatusResponse;
257
+ };
258
+
250
259
  export class Platform {
251
260
  static readonly serviceName: string;
252
261
  static readonly broadcastStateTransition: PlatformbroadcastStateTransition;
@@ -276,6 +285,7 @@ export class Platform {
276
285
  static readonly getPrefundedSpecializedBalance: PlatformgetPrefundedSpecializedBalance;
277
286
  static readonly getTotalCreditsInPlatform: PlatformgetTotalCreditsInPlatform;
278
287
  static readonly getPathElements: PlatformgetPathElements;
288
+ static readonly getStatus: PlatformgetStatus;
279
289
  }
280
290
 
281
291
  export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
@@ -553,5 +563,14 @@ export class PlatformClient {
553
563
  requestMessage: platform_pb.GetPathElementsRequest,
554
564
  callback: (error: ServiceError|null, responseMessage: platform_pb.GetPathElementsResponse|null) => void
555
565
  ): UnaryResponse;
566
+ getStatus(
567
+ requestMessage: platform_pb.GetStatusRequest,
568
+ metadata: grpc.Metadata,
569
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetStatusResponse|null) => void
570
+ ): UnaryResponse;
571
+ getStatus(
572
+ requestMessage: platform_pb.GetStatusRequest,
573
+ callback: (error: ServiceError|null, responseMessage: platform_pb.GetStatusResponse|null) => void
574
+ ): UnaryResponse;
556
575
  }
557
576
 
@@ -253,6 +253,15 @@ Platform.getPathElements = {
253
253
  responseType: platform_pb.GetPathElementsResponse
254
254
  };
255
255
 
256
+ Platform.getStatus = {
257
+ methodName: "getStatus",
258
+ service: Platform,
259
+ requestStream: false,
260
+ responseStream: false,
261
+ requestType: platform_pb.GetStatusRequest,
262
+ responseType: platform_pb.GetStatusResponse
263
+ };
264
+
256
265
  exports.Platform = Platform;
257
266
 
258
267
  function PlatformClient(serviceHost, options) {
@@ -1097,5 +1106,36 @@ PlatformClient.prototype.getPathElements = function getPathElements(requestMessa
1097
1106
  };
1098
1107
  };
1099
1108
 
1109
+ PlatformClient.prototype.getStatus = function getStatus(requestMessage, metadata, callback) {
1110
+ if (arguments.length === 2) {
1111
+ callback = arguments[1];
1112
+ }
1113
+ var client = grpc.unary(Platform.getStatus, {
1114
+ request: requestMessage,
1115
+ host: this.serviceHost,
1116
+ metadata: metadata,
1117
+ transport: this.options.transport,
1118
+ debug: this.options.debug,
1119
+ onEnd: function (response) {
1120
+ if (callback) {
1121
+ if (response.status !== grpc.Code.OK) {
1122
+ var err = new Error(response.statusMessage);
1123
+ err.code = response.status;
1124
+ err.metadata = response.trailers;
1125
+ callback(err, null);
1126
+ } else {
1127
+ callback(null, response.message);
1128
+ }
1129
+ }
1130
+ }
1131
+ });
1132
+ return {
1133
+ cancel: function () {
1134
+ callback = null;
1135
+ client.close();
1136
+ }
1137
+ };
1138
+ };
1139
+
1100
1140
  exports.PlatformClient = PlatformClient;
1101
1141
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dapi-grpc",
3
- "version": "1.1.1",
3
+ "version": "1.2.0-rc.1",
4
4
  "description": "DAPI GRPC definition file and generated clients",
5
5
  "browser": "browser.js",
6
6
  "main": "node.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/dashevo/dapi-grpc#readme",
47
47
  "dependencies": {
48
- "@dashevo/grpc-common": "1.1.1",
48
+ "@dashevo/grpc-common": "1.2.0-rc.1",
49
49
  "@dashevo/protobufjs": "6.10.5",
50
50
  "@grpc/grpc-js": "1.4.4",
51
51
  "@improbable-eng/grpc-web": "^0.15.0",
@@ -47,6 +47,7 @@ service Platform {
47
47
  rpc getPrefundedSpecializedBalance(GetPrefundedSpecializedBalanceRequest) returns (GetPrefundedSpecializedBalanceResponse);
48
48
  rpc getTotalCreditsInPlatform(GetTotalCreditsInPlatformRequest) returns (GetTotalCreditsInPlatformResponse);
49
49
  rpc getPathElements(GetPathElementsRequest) returns (GetPathElementsResponse);
50
+ rpc getStatus(GetStatusRequest) returns (GetStatusResponse);
50
51
  }
51
52
 
52
53
  // Proof message includes cryptographic proofs for validating responses
@@ -1001,3 +1002,100 @@ message GetPathElementsResponse {
1001
1002
  GetPathElementsResponseV0 v0 = 1;
1002
1003
  }
1003
1004
  }
1005
+
1006
+ message GetStatusRequest {
1007
+ message GetStatusRequestV0 {
1008
+ }
1009
+
1010
+ oneof version { GetStatusRequestV0 v0 = 1; }
1011
+ }
1012
+
1013
+
1014
+ message GetStatusResponse {
1015
+ message GetStatusResponseV0 {
1016
+ message Version {
1017
+ message Software {
1018
+ string dapi = 1;
1019
+ // It will be missing if Drive is not responding
1020
+ optional string drive = 2;
1021
+ // It will be missing if Tenderdash is not responding
1022
+ optional string tenderdash = 3;
1023
+ }
1024
+
1025
+ message Protocol {
1026
+ message Tenderdash {
1027
+ uint32 p2p = 1;
1028
+ uint32 block = 2;
1029
+ }
1030
+
1031
+ message Drive {
1032
+ uint32 latest = 3;
1033
+ uint32 current = 4;
1034
+ }
1035
+
1036
+ Tenderdash tenderdash = 1;
1037
+ Drive drive = 2;
1038
+ }
1039
+
1040
+ Software software = 1;
1041
+ Protocol protocol = 2;
1042
+ }
1043
+
1044
+ message Time {
1045
+ uint64 local = 1;
1046
+ // It will be missing if Drive is not responding
1047
+ optional uint64 block = 2;
1048
+ // It will be missing if Drive is not responding
1049
+ optional uint64 genesis = 3;
1050
+ // It will be missing if Drive is not responding
1051
+ optional uint32 epoch = 4;
1052
+ }
1053
+
1054
+ message Node {
1055
+ // Platform node ID
1056
+ bytes id = 1;
1057
+ // Evo masternode pro tx hash. It will be absent if the node is a fullnode
1058
+ optional bytes pro_tx_hash = 2;
1059
+ }
1060
+
1061
+ message Chain {
1062
+ bool catching_up = 1;
1063
+ bytes latest_block_hash = 2;
1064
+ bytes latest_app_hash = 3;
1065
+ uint64 latest_block_height = 4;
1066
+ bytes earliest_block_hash = 5;
1067
+ bytes earliest_app_hash = 6;
1068
+ uint64 earliest_block_height = 7;
1069
+ uint64 max_peer_block_height = 9;
1070
+ // Latest known core height in consensus.
1071
+ // It will be missing if Drive is not responding
1072
+ optional uint32 core_chain_locked_height = 10;
1073
+ }
1074
+
1075
+ message Network {
1076
+ string chain_id = 1;
1077
+ uint32 peers_count = 2;
1078
+ bool listening = 3;
1079
+ }
1080
+
1081
+ message StateSync {
1082
+ uint64 total_synced_time = 1;
1083
+ uint64 remaining_time = 2;
1084
+ uint32 total_snapshots = 3;
1085
+ uint64 chunk_process_avg_time = 4;
1086
+ uint64 snapshot_height = 5;
1087
+ uint64 snapshot_chunks_count = 6;
1088
+ uint64 backfilled_blocks = 7;
1089
+ uint64 backfill_blocks_total = 8;
1090
+ }
1091
+
1092
+ Version version = 1;
1093
+ Node node = 2;
1094
+ Chain chain = 3;
1095
+ Network network = 4;
1096
+ StateSync state_sync = 5;
1097
+ Time time = 6;
1098
+ }
1099
+
1100
+ oneof version { GetStatusResponseV0 v0 = 1; }
1101
+ }