@dashevo/dapi-grpc 0.24.0-dev.5 → 0.25.0-dev.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.
@@ -13,29 +13,31 @@
13
13
 
14
14
  var jspb = require('google-protobuf');
15
15
  var goog = jspb;
16
- var global = Function('return this')();
17
-
18
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest', null, global);
19
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse', null, global);
20
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.ConsensusParamsBlock', null, global);
21
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.ConsensusParamsEvidence', null, global);
22
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest', null, global);
23
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse', null, global);
24
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractRequest', null, global);
25
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractResponse', null, global);
26
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsRequest', null, global);
27
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsRequest.StartCase', null, global);
28
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsResponse', null, global);
29
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, global);
30
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, global);
31
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, global);
32
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, global);
33
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, global);
34
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.ResponseMetadata', null, global);
35
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError', null, global);
36
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest', null, global);
37
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse', null, global);
38
- goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.ResponsesCase', null, global);
16
+ const proto = {};
17
+
18
+ var google_protobuf_timestamp_pb = require('google-protobuf/google/protobuf/timestamp_pb.js');
19
+ goog.object.extend(proto, google_protobuf_timestamp_pb);
20
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastStateTransitionRequest', null, { proto });
21
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.BroadcastStateTransitionResponse', null, { proto });
22
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.ConsensusParamsBlock', null, { proto });
23
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.ConsensusParamsEvidence', null, { proto });
24
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsRequest', null, { proto });
25
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetConsensusParamsResponse', null, { proto });
26
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractRequest', null, { proto });
27
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDataContractResponse', null, { proto });
28
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsRequest', null, { proto });
29
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsRequest.StartCase', null, { proto });
30
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetDocumentsResponse', null, { proto });
31
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesRequest', null, { proto });
32
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentitiesByPublicKeyHashesResponse', null, { proto });
33
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityRequest', null, { proto });
34
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.GetIdentityResponse', null, { proto });
35
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.Proof', null, { proto });
36
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.ResponseMetadata', null, { proto });
37
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.StateTransitionBroadcastError', null, { proto });
38
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultRequest', null, { proto });
39
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse', null, { proto });
40
+ goog.exportSymbol('proto.org.dash.platform.dapi.v0.WaitForStateTransitionResultResponse.ResponsesCase', null, { proto });
39
41
  /**
40
42
  * Generated by JsPbCodeGenerator.
41
43
  * @param {Array=} opt_data Optional initial data array, typically from a
@@ -468,8 +470,9 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.toObject = function(opt_includeI
468
470
  proto.org.dash.platform.dapi.v0.Proof.toObject = function(includeInstance, msg) {
469
471
  var f, obj = {
470
472
  merkleProof: msg.getMerkleProof_asB64(),
471
- signatureLlmqHash: msg.getSignatureLlmqHash_asB64(),
472
- signature: msg.getSignature_asB64()
473
+ quorumHash: msg.getQuorumHash_asB64(),
474
+ signature: msg.getSignature_asB64(),
475
+ round: jspb.Message.getFieldWithDefault(msg, 4, 0)
473
476
  };
474
477
 
475
478
  if (includeInstance) {
@@ -512,12 +515,16 @@ proto.org.dash.platform.dapi.v0.Proof.deserializeBinaryFromReader = function(msg
512
515
  break;
513
516
  case 2:
514
517
  var value = /** @type {!Uint8Array} */ (reader.readBytes());
515
- msg.setSignatureLlmqHash(value);
518
+ msg.setQuorumHash(value);
516
519
  break;
517
520
  case 3:
518
521
  var value = /** @type {!Uint8Array} */ (reader.readBytes());
519
522
  msg.setSignature(value);
520
523
  break;
524
+ case 4:
525
+ var value = /** @type {number} */ (reader.readUint32());
526
+ msg.setRound(value);
527
+ break;
521
528
  default:
522
529
  reader.skipField();
523
530
  break;
@@ -554,7 +561,7 @@ proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message
554
561
  f
555
562
  );
556
563
  }
557
- f = message.getSignatureLlmqHash_asU8();
564
+ f = message.getQuorumHash_asU8();
558
565
  if (f.length > 0) {
559
566
  writer.writeBytes(
560
567
  2,
@@ -568,6 +575,13 @@ proto.org.dash.platform.dapi.v0.Proof.serializeBinaryToWriter = function(message
568
575
  f
569
576
  );
570
577
  }
578
+ f = message.getRound();
579
+ if (f !== 0) {
580
+ writer.writeUint32(
581
+ 4,
582
+ f
583
+ );
584
+ }
571
585
  };
572
586
 
573
587
 
@@ -614,35 +628,35 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.setMerkleProof = function(value)
614
628
 
615
629
 
616
630
  /**
617
- * optional bytes signature_llmq_hash = 2;
631
+ * optional bytes quorum_hash = 2;
618
632
  * @return {string}
619
633
  */
620
- proto.org.dash.platform.dapi.v0.Proof.prototype.getSignatureLlmqHash = function() {
634
+ proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash = function() {
621
635
  return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
622
636
  };
623
637
 
624
638
 
625
639
  /**
626
- * optional bytes signature_llmq_hash = 2;
627
- * This is a type-conversion wrapper around `getSignatureLlmqHash()`
640
+ * optional bytes quorum_hash = 2;
641
+ * This is a type-conversion wrapper around `getQuorumHash()`
628
642
  * @return {string}
629
643
  */
630
- proto.org.dash.platform.dapi.v0.Proof.prototype.getSignatureLlmqHash_asB64 = function() {
644
+ proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asB64 = function() {
631
645
  return /** @type {string} */ (jspb.Message.bytesAsB64(
632
- this.getSignatureLlmqHash()));
646
+ this.getQuorumHash()));
633
647
  };
634
648
 
635
649
 
636
650
  /**
637
- * optional bytes signature_llmq_hash = 2;
651
+ * optional bytes quorum_hash = 2;
638
652
  * Note that Uint8Array is not supported on all browsers.
639
653
  * @see http://caniuse.com/Uint8Array
640
- * This is a type-conversion wrapper around `getSignatureLlmqHash()`
654
+ * This is a type-conversion wrapper around `getQuorumHash()`
641
655
  * @return {!Uint8Array}
642
656
  */
643
- proto.org.dash.platform.dapi.v0.Proof.prototype.getSignatureLlmqHash_asU8 = function() {
657
+ proto.org.dash.platform.dapi.v0.Proof.prototype.getQuorumHash_asU8 = function() {
644
658
  return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
645
- this.getSignatureLlmqHash()));
659
+ this.getQuorumHash()));
646
660
  };
647
661
 
648
662
 
@@ -650,7 +664,7 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.getSignatureLlmqHash_asU8 = func
650
664
  * @param {!(string|Uint8Array)} value
651
665
  * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this
652
666
  */
653
- proto.org.dash.platform.dapi.v0.Proof.prototype.setSignatureLlmqHash = function(value) {
667
+ proto.org.dash.platform.dapi.v0.Proof.prototype.setQuorumHash = function(value) {
654
668
  return jspb.Message.setProto3BytesField(this, 2, value);
655
669
  };
656
670
 
@@ -697,6 +711,24 @@ proto.org.dash.platform.dapi.v0.Proof.prototype.setSignature = function(value) {
697
711
  };
698
712
 
699
713
 
714
+ /**
715
+ * optional uint32 round = 4;
716
+ * @return {number}
717
+ */
718
+ proto.org.dash.platform.dapi.v0.Proof.prototype.getRound = function() {
719
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
720
+ };
721
+
722
+
723
+ /**
724
+ * @param {number} value
725
+ * @return {!proto.org.dash.platform.dapi.v0.Proof} returns this
726
+ */
727
+ proto.org.dash.platform.dapi.v0.Proof.prototype.setRound = function(value) {
728
+ return jspb.Message.setProto3IntField(this, 4, value);
729
+ };
730
+
731
+
700
732
 
701
733
 
702
734
 
@@ -730,7 +762,9 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.toObject = function(o
730
762
  proto.org.dash.platform.dapi.v0.ResponseMetadata.toObject = function(includeInstance, msg) {
731
763
  var f, obj = {
732
764
  height: jspb.Message.getFieldWithDefault(msg, 1, 0),
733
- coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0)
765
+ coreChainLockedHeight: jspb.Message.getFieldWithDefault(msg, 2, 0),
766
+ timeMs: jspb.Message.getFieldWithDefault(msg, 3, 0),
767
+ protocolVersion: jspb.Message.getFieldWithDefault(msg, 4, 0)
734
768
  };
735
769
 
736
770
  if (includeInstance) {
@@ -775,6 +809,14 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.deserializeBinaryFromReader = f
775
809
  var value = /** @type {number} */ (reader.readUint32());
776
810
  msg.setCoreChainLockedHeight(value);
777
811
  break;
812
+ case 3:
813
+ var value = /** @type {number} */ (reader.readUint64());
814
+ msg.setTimeMs(value);
815
+ break;
816
+ case 4:
817
+ var value = /** @type {number} */ (reader.readUint32());
818
+ msg.setProtocolVersion(value);
819
+ break;
778
820
  default:
779
821
  reader.skipField();
780
822
  break;
@@ -818,6 +860,20 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.serializeBinaryToWriter = funct
818
860
  f
819
861
  );
820
862
  }
863
+ f = message.getTimeMs();
864
+ if (f !== 0) {
865
+ writer.writeUint64(
866
+ 3,
867
+ f
868
+ );
869
+ }
870
+ f = message.getProtocolVersion();
871
+ if (f !== 0) {
872
+ writer.writeUint32(
873
+ 4,
874
+ f
875
+ );
876
+ }
821
877
  };
822
878
 
823
879
 
@@ -857,6 +913,42 @@ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setCoreChainLockedHei
857
913
  };
858
914
 
859
915
 
916
+ /**
917
+ * optional uint64 time_ms = 3;
918
+ * @return {number}
919
+ */
920
+ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getTimeMs = function() {
921
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
922
+ };
923
+
924
+
925
+ /**
926
+ * @param {number} value
927
+ * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this
928
+ */
929
+ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setTimeMs = function(value) {
930
+ return jspb.Message.setProto3IntField(this, 3, value);
931
+ };
932
+
933
+
934
+ /**
935
+ * optional uint32 protocol_version = 4;
936
+ * @return {number}
937
+ */
938
+ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.getProtocolVersion = function() {
939
+ return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
940
+ };
941
+
942
+
943
+ /**
944
+ * @param {number} value
945
+ * @return {!proto.org.dash.platform.dapi.v0.ResponseMetadata} returns this
946
+ */
947
+ proto.org.dash.platform.dapi.v0.ResponseMetadata.prototype.setProtocolVersion = function(value) {
948
+ return jspb.Message.setProto3IntField(this, 4, value);
949
+ };
950
+
951
+
860
952
 
861
953
 
862
954
 
@@ -0,0 +1,130 @@
1
+ const { PlatformClient } = require('./platform_pb_service');
2
+ const { promisify } = require('util');
3
+
4
+ class PlatformPromiseClient {
5
+ /**
6
+ * @param {string} hostname
7
+ * @param {?Object} credentials
8
+ * @param {?Object} options
9
+ */
10
+ constructor(hostname, credentials , options = {}) {
11
+ this.client = new PlatformClient(hostname, options)
12
+
13
+ this.protocolVersion = undefined;
14
+ }
15
+
16
+ /**
17
+ * @param {!BroadcastStateTransitionRequest} broadcastStateTransitionRequest
18
+ * @param {?Object<string, string>} metadata
19
+ * @return {Promise<!BroadcastStateTransitionResponse>}
20
+ */
21
+ broadcastStateTransition(broadcastStateTransitionRequest, metadata = {}) {
22
+ return promisify(
23
+ this.client.broadcastStateTransition.bind(this.client),
24
+ )(
25
+ broadcastStateTransitionRequest,
26
+ metadata,
27
+ );
28
+ }
29
+
30
+ /**
31
+ * @param {!GetIdentityRequest} getIdentityRequest
32
+ * @param {?Object<string, string>} metadata
33
+ * @return {Promise<!GetIdentityResponse>}
34
+ */
35
+ getIdentity(getIdentityRequest, metadata = {}) {
36
+ return promisify(
37
+ this.client.getIdentity.bind(this.client),
38
+ )(
39
+ getIdentityRequest,
40
+ metadata,
41
+ );
42
+ }
43
+
44
+ /**
45
+ *
46
+ * @param {!GetDataContractRequest} getDataContractRequest
47
+ * @param {?Object<string, string>} metadata
48
+ * @returns {Promise<!GetDataContractResponse>}
49
+ */
50
+ getDataContract(getDataContractRequest, metadata = {}) {
51
+ return promisify(
52
+ this.client.getDataContract.bind(this.client),
53
+ )(
54
+ getDataContractRequest,
55
+ metadata,
56
+ );
57
+ }
58
+
59
+ /**
60
+ *
61
+ * @param {!GetDocumentsRequest} getDocumentsRequest
62
+ * @param {?Object<string, string>} metadata
63
+ * @returns {Promise<!GetDocumentsResponse>}
64
+ */
65
+ getDocuments(getDocumentsRequest, metadata = {}) {
66
+ return promisify(
67
+ this.client.getDocuments.bind(this.client),
68
+ )(
69
+ getDocumentsRequest,
70
+ metadata,
71
+ );
72
+ }
73
+
74
+ /**
75
+ * @param {!GetIdentitiesByPublicKeyHashesRequest} getIdentitiesByPublicKeyHashesRequest
76
+ * @param {?Object<string, string>} metadata
77
+ * @returns {Promise<!GetIdentitiesByPublicKeyHashesResponse>}
78
+ */
79
+ getIdentitiesByPublicKeyHashes(
80
+ getIdentitiesByPublicKeyHashesRequest, metadata = {}
81
+ ) {
82
+ return promisify(
83
+ this.client.getIdentitiesByPublicKeyHashes.bind(this.client),
84
+ )(
85
+ getIdentitiesByPublicKeyHashesRequest,
86
+ metadata,
87
+ );
88
+ }
89
+
90
+ /**
91
+ * @param {!WaitForStateTransitionResultRequest} waitForStateTransitionResultRequest
92
+ * @param {?Object<string, string>} metadata
93
+ * @returns {Promise<!WaitForStateTransitionResultResponse>}
94
+ */
95
+ waitForStateTransitionResult(
96
+ waitForStateTransitionResultRequest, metadata = {}
97
+ ) {
98
+ return promisify(
99
+ this.client.waitForStateTransitionResult.bind(this.client),
100
+ )(
101
+ waitForStateTransitionResultRequest,
102
+ metadata,
103
+ );
104
+ }
105
+
106
+ /**
107
+ * @param {!GetConsensusParamsRequest} getConsensusParamsRequest
108
+ * @param {?Object<string, string>} metadata
109
+ * @returns {Promise<!GetConsensusParamsResponse>}
110
+ */
111
+ getConsensusParams(
112
+ getConsensusParamsRequest, metadata = {}
113
+ ) {
114
+ return promisify(
115
+ this.client.getConsensusParams.bind(this.client),
116
+ )(
117
+ getConsensusParamsRequest,
118
+ metadata,
119
+ );
120
+ }
121
+
122
+ /**
123
+ * @param {string} protocolVersion
124
+ */
125
+ setProtocolVersion(protocolVersion) {
126
+ this.setProtocolVersion = protocolVersion;
127
+ }
128
+ }
129
+
130
+ module.exports = PlatformPromiseClient;