@dashevo/dapi-grpc 5.0.0-beta.4 → 5.0.0-beta.5

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 CHANGED
@@ -76,8 +76,15 @@ getrandom = { version = "0.2", features = ["js"] }
76
76
  tonic = { version = "0.14.2", features = ["codegen"], default-features = false }
77
77
 
78
78
  [build-dependencies]
79
+ prost-build = { version = "0.14" }
79
80
  tonic-prost-build = { version = "0.14.2" }
80
81
 
82
+ [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
83
+ bytes = "1"
84
+ h2 = "0.4"
85
+ tokio = { version = "1", features = ["io-util", "macros", "rt"] }
86
+ tokio-stream = "0.1"
87
+
81
88
  [lib]
82
89
 
83
90
  [[example]]
package/build.rs CHANGED
@@ -5,6 +5,7 @@ use std::{
5
5
  path::{Path, PathBuf},
6
6
  };
7
7
 
8
+ use prost_build::{Config, Service, ServiceGenerator};
8
9
  use tonic_prost_build::Builder;
9
10
 
10
11
  const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#;
@@ -80,6 +81,30 @@ struct MappingConfig {
80
81
  out_dir: PathBuf,
81
82
  builder: Builder,
82
83
  proto_includes: Vec<PathBuf>,
84
+ server_generation: bool,
85
+ }
86
+
87
+ /// Generate clients and servers separately so their codecs can preserve decode direction.
88
+ struct ClientServerGenerator {
89
+ client: Box<dyn ServiceGenerator>,
90
+ server: Box<dyn ServiceGenerator>,
91
+ }
92
+
93
+ impl ServiceGenerator for ClientServerGenerator {
94
+ fn generate(&mut self, service: Service, buf: &mut String) {
95
+ self.client.generate(service.clone(), buf);
96
+ self.server.generate(service, buf);
97
+ }
98
+
99
+ fn finalize(&mut self, buf: &mut String) {
100
+ self.client.finalize(buf);
101
+ self.server.finalize(buf);
102
+ }
103
+
104
+ fn finalize_package(&mut self, package: &str, buf: &mut String) {
105
+ self.client.finalize_package(package, buf);
106
+ self.server.finalize_package(package, buf);
107
+ }
83
108
  }
84
109
 
85
110
  fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
@@ -166,11 +191,9 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
166
191
  // - "GetConsensusParamsResponse"
167
192
  // - "GetStatusResponse"
168
193
  //
169
- // The following responses are excluded as they need custom proof handling:
170
- // - "GetIdentityByNonUniquePublicKeyHashResponse"
171
- //
172
194
  // "GetEvonodesProposedEpochBlocksResponse" is used for 2 Requests
173
- const VERSIONED_RESPONSES: [&str; 66] = [
195
+ const VERSIONED_RESPONSES: [&str; 67] = [
196
+ "GetIdentityByNonUniquePublicKeyHashResponse",
174
197
  "GetContractModerationStatusResponse",
175
198
  "GetContractModerationEntriesResponse",
176
199
  "GetContractDocumentRemovalsResponse",
@@ -526,6 +549,7 @@ impl MappingConfig {
526
549
  out_dir,
527
550
  builder,
528
551
  proto_includes: vec![abs_path(&PathBuf::from("protos"))],
552
+ server_generation: matches!(typ, ImplType::Server),
529
553
  }
530
554
  }
531
555
 
@@ -569,8 +593,26 @@ impl MappingConfig {
569
593
  }
570
594
  create_dir_all(&self.out_dir)?;
571
595
 
572
- self.builder
573
- .compile_protos(&[self.protobuf_file], &self.proto_includes)
596
+ if self.server_generation {
597
+ let client = self.builder.clone().build_server(false).service_generator();
598
+ let server = self
599
+ .builder
600
+ .clone()
601
+ .build_client(false)
602
+ .codec_path("crate::request_codec::RequestCodec")
603
+ .service_generator();
604
+ let mut config = Config::new();
605
+ config.service_generator(Box::new(ClientServerGenerator { client, server }));
606
+
607
+ // Disable the outer generators to retain the supplied composite generator.
608
+ self.builder
609
+ .build_client(false)
610
+ .build_server(false)
611
+ .compile_with_config(config, &[self.protobuf_file], &self.proto_includes)
612
+ } else {
613
+ self.builder
614
+ .compile_protos(&[self.protobuf_file], &self.proto_includes)
615
+ }
574
616
  }
575
617
  }
576
618
 
@@ -41636,6 +41636,8 @@ $root.org = (function() {
41636
41636
  * @property {number} STARTS_WITH=10 STARTS_WITH value
41637
41637
  * @property {number} IN_TIME_RANGE=11 IN_TIME_RANGE value
41638
41638
  * @property {number} IN_INTEGER_RANGE=12 IN_INTEGER_RANGE value
41639
+ * @property {number} CONTAINS=13 CONTAINS value
41640
+ * @property {number} CONTAINS_ANY=14 CONTAINS_ANY value
41639
41641
  */
41640
41642
  GetDocumentsRequest.WhereOperator = (function() {
41641
41643
  var valuesById = {}, values = Object.create(valuesById);
@@ -41652,6 +41654,8 @@ $root.org = (function() {
41652
41654
  values[valuesById[10] = "STARTS_WITH"] = 10;
41653
41655
  values[valuesById[11] = "IN_TIME_RANGE"] = 11;
41654
41656
  values[valuesById[12] = "IN_INTEGER_RANGE"] = 12;
41657
+ values[valuesById[13] = "CONTAINS"] = 13;
41658
+ values[valuesById[14] = "CONTAINS_ANY"] = 14;
41655
41659
  return values;
41656
41660
  })();
41657
41661
 
@@ -43552,6 +43556,8 @@ $root.org = (function() {
43552
43556
  case 10:
43553
43557
  case 11:
43554
43558
  case 12:
43559
+ case 13:
43560
+ case 14:
43555
43561
  break;
43556
43562
  }
43557
43563
  if (message.value != null && message.hasOwnProperty("value")) {
@@ -43639,6 +43645,14 @@ $root.org = (function() {
43639
43645
  case 12:
43640
43646
  message.operator = 12;
43641
43647
  break;
43648
+ case "CONTAINS":
43649
+ case 13:
43650
+ message.operator = 13;
43651
+ break;
43652
+ case "CONTAINS_ANY":
43653
+ case 14:
43654
+ message.operator = 14;
43655
+ break;
43642
43656
  }
43643
43657
  if (object.value != null) {
43644
43658
  if (typeof object.value !== "object")
@@ -55359,7 +55373,7 @@ $root.org = (function() {
55359
55373
  * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse
55360
55374
  * @interface IGetIdentityByNonUniquePublicKeyHashResponseV0
55361
55375
  * @property {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityResponse|null} [identity] GetIdentityByNonUniquePublicKeyHashResponseV0 identity
55362
- * @property {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse|null} [proof] GetIdentityByNonUniquePublicKeyHashResponseV0 proof
55376
+ * @property {org.dash.platform.dapi.v0.IProof|null} [proof] GetIdentityByNonUniquePublicKeyHashResponseV0 proof
55363
55377
  * @property {org.dash.platform.dapi.v0.IResponseMetadata|null} [metadata] GetIdentityByNonUniquePublicKeyHashResponseV0 metadata
55364
55378
  */
55365
55379
 
@@ -55388,7 +55402,7 @@ $root.org = (function() {
55388
55402
 
55389
55403
  /**
55390
55404
  * GetIdentityByNonUniquePublicKeyHashResponseV0 proof.
55391
- * @member {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse|null|undefined} proof
55405
+ * @member {org.dash.platform.dapi.v0.IProof|null|undefined} proof
55392
55406
  * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0
55393
55407
  * @instance
55394
55408
  */
@@ -55442,10 +55456,10 @@ $root.org = (function() {
55442
55456
  writer = $Writer.create();
55443
55457
  if (message.identity != null && Object.hasOwnProperty.call(message, "identity"))
55444
55458
  $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityResponse.encode(message.identity, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
55445
- if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
55446
- $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.encode(message.proof, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
55447
55459
  if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata"))
55448
55460
  $root.org.dash.platform.dapi.v0.ResponseMetadata.encode(message.metadata, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim();
55461
+ if (message.proof != null && Object.hasOwnProperty.call(message, "proof"))
55462
+ $root.org.dash.platform.dapi.v0.Proof.encode(message.proof, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim();
55449
55463
  return writer;
55450
55464
  };
55451
55465
 
@@ -55483,8 +55497,8 @@ $root.org = (function() {
55483
55497
  case 1:
55484
55498
  message.identity = $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityResponse.decode(reader, reader.uint32());
55485
55499
  break;
55486
- case 2:
55487
- message.proof = $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.decode(reader, reader.uint32());
55500
+ case 4:
55501
+ message.proof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32());
55488
55502
  break;
55489
55503
  case 3:
55490
55504
  message.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.decode(reader, reader.uint32());
@@ -55538,7 +55552,7 @@ $root.org = (function() {
55538
55552
  return "result: multiple values";
55539
55553
  properties.result = 1;
55540
55554
  {
55541
- var error = $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.verify(message.proof);
55555
+ var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.proof);
55542
55556
  if (error)
55543
55557
  return "proof." + error;
55544
55558
  }
@@ -55571,7 +55585,7 @@ $root.org = (function() {
55571
55585
  if (object.proof != null) {
55572
55586
  if (typeof object.proof !== "object")
55573
55587
  throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.proof: object expected");
55574
- message.proof = $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.fromObject(object.proof);
55588
+ message.proof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.proof);
55575
55589
  }
55576
55590
  if (object.metadata != null) {
55577
55591
  if (typeof object.metadata !== "object")
@@ -55601,13 +55615,13 @@ $root.org = (function() {
55601
55615
  if (options.oneofs)
55602
55616
  object.result = "identity";
55603
55617
  }
55618
+ if (message.metadata != null && message.hasOwnProperty("metadata"))
55619
+ object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options);
55604
55620
  if (message.proof != null && message.hasOwnProperty("proof")) {
55605
- object.proof = $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.toObject(message.proof, options);
55621
+ object.proof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.proof, options);
55606
55622
  if (options.oneofs)
55607
55623
  object.result = "proof";
55608
55624
  }
55609
- if (message.metadata != null && message.hasOwnProperty("metadata"))
55610
- object.metadata = $root.org.dash.platform.dapi.v0.ResponseMetadata.toObject(message.metadata, options);
55611
55625
  return object;
55612
55626
  };
55613
55627
 
@@ -55818,230 +55832,6 @@ $root.org = (function() {
55818
55832
  return IdentityResponse;
55819
55833
  })();
55820
55834
 
55821
- GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse = (function() {
55822
-
55823
- /**
55824
- * Properties of an IdentityProvedResponse.
55825
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0
55826
- * @interface IIdentityProvedResponse
55827
- * @property {org.dash.platform.dapi.v0.IProof|null} [grovedbIdentityPublicKeyHashProof] IdentityProvedResponse grovedbIdentityPublicKeyHashProof
55828
- * @property {Uint8Array|null} [identityProofBytes] IdentityProvedResponse identityProofBytes
55829
- */
55830
-
55831
- /**
55832
- * Constructs a new IdentityProvedResponse.
55833
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0
55834
- * @classdesc Represents an IdentityProvedResponse.
55835
- * @implements IIdentityProvedResponse
55836
- * @constructor
55837
- * @param {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse=} [properties] Properties to set
55838
- */
55839
- function IdentityProvedResponse(properties) {
55840
- if (properties)
55841
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
55842
- if (properties[keys[i]] != null)
55843
- this[keys[i]] = properties[keys[i]];
55844
- }
55845
-
55846
- /**
55847
- * IdentityProvedResponse grovedbIdentityPublicKeyHashProof.
55848
- * @member {org.dash.platform.dapi.v0.IProof|null|undefined} grovedbIdentityPublicKeyHashProof
55849
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55850
- * @instance
55851
- */
55852
- IdentityProvedResponse.prototype.grovedbIdentityPublicKeyHashProof = null;
55853
-
55854
- /**
55855
- * IdentityProvedResponse identityProofBytes.
55856
- * @member {Uint8Array} identityProofBytes
55857
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55858
- * @instance
55859
- */
55860
- IdentityProvedResponse.prototype.identityProofBytes = $util.newBuffer([]);
55861
-
55862
- /**
55863
- * Creates a new IdentityProvedResponse instance using the specified properties.
55864
- * @function create
55865
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55866
- * @static
55867
- * @param {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse=} [properties] Properties to set
55868
- * @returns {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse} IdentityProvedResponse instance
55869
- */
55870
- IdentityProvedResponse.create = function create(properties) {
55871
- return new IdentityProvedResponse(properties);
55872
- };
55873
-
55874
- /**
55875
- * Encodes the specified IdentityProvedResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.verify|verify} messages.
55876
- * @function encode
55877
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55878
- * @static
55879
- * @param {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse} message IdentityProvedResponse message or plain object to encode
55880
- * @param {$protobuf.Writer} [writer] Writer to encode to
55881
- * @returns {$protobuf.Writer} Writer
55882
- */
55883
- IdentityProvedResponse.encode = function encode(message, writer) {
55884
- if (!writer)
55885
- writer = $Writer.create();
55886
- if (message.grovedbIdentityPublicKeyHashProof != null && Object.hasOwnProperty.call(message, "grovedbIdentityPublicKeyHashProof"))
55887
- $root.org.dash.platform.dapi.v0.Proof.encode(message.grovedbIdentityPublicKeyHashProof, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
55888
- if (message.identityProofBytes != null && Object.hasOwnProperty.call(message, "identityProofBytes"))
55889
- writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.identityProofBytes);
55890
- return writer;
55891
- };
55892
-
55893
- /**
55894
- * Encodes the specified IdentityProvedResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.verify|verify} messages.
55895
- * @function encodeDelimited
55896
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55897
- * @static
55898
- * @param {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IIdentityProvedResponse} message IdentityProvedResponse message or plain object to encode
55899
- * @param {$protobuf.Writer} [writer] Writer to encode to
55900
- * @returns {$protobuf.Writer} Writer
55901
- */
55902
- IdentityProvedResponse.encodeDelimited = function encodeDelimited(message, writer) {
55903
- return this.encode(message, writer).ldelim();
55904
- };
55905
-
55906
- /**
55907
- * Decodes an IdentityProvedResponse message from the specified reader or buffer.
55908
- * @function decode
55909
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55910
- * @static
55911
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
55912
- * @param {number} [length] Message length if known beforehand
55913
- * @returns {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse} IdentityProvedResponse
55914
- * @throws {Error} If the payload is not a reader or valid buffer
55915
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
55916
- */
55917
- IdentityProvedResponse.decode = function decode(reader, length) {
55918
- if (!(reader instanceof $Reader))
55919
- reader = $Reader.create(reader);
55920
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse();
55921
- while (reader.pos < end) {
55922
- var tag = reader.uint32();
55923
- switch (tag >>> 3) {
55924
- case 1:
55925
- message.grovedbIdentityPublicKeyHashProof = $root.org.dash.platform.dapi.v0.Proof.decode(reader, reader.uint32());
55926
- break;
55927
- case 2:
55928
- message.identityProofBytes = reader.bytes();
55929
- break;
55930
- default:
55931
- reader.skipType(tag & 7);
55932
- break;
55933
- }
55934
- }
55935
- return message;
55936
- };
55937
-
55938
- /**
55939
- * Decodes an IdentityProvedResponse message from the specified reader or buffer, length delimited.
55940
- * @function decodeDelimited
55941
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55942
- * @static
55943
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
55944
- * @returns {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse} IdentityProvedResponse
55945
- * @throws {Error} If the payload is not a reader or valid buffer
55946
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
55947
- */
55948
- IdentityProvedResponse.decodeDelimited = function decodeDelimited(reader) {
55949
- if (!(reader instanceof $Reader))
55950
- reader = new $Reader(reader);
55951
- return this.decode(reader, reader.uint32());
55952
- };
55953
-
55954
- /**
55955
- * Verifies an IdentityProvedResponse message.
55956
- * @function verify
55957
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55958
- * @static
55959
- * @param {Object.<string,*>} message Plain object to verify
55960
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
55961
- */
55962
- IdentityProvedResponse.verify = function verify(message) {
55963
- if (typeof message !== "object" || message === null)
55964
- return "object expected";
55965
- if (message.grovedbIdentityPublicKeyHashProof != null && message.hasOwnProperty("grovedbIdentityPublicKeyHashProof")) {
55966
- var error = $root.org.dash.platform.dapi.v0.Proof.verify(message.grovedbIdentityPublicKeyHashProof);
55967
- if (error)
55968
- return "grovedbIdentityPublicKeyHashProof." + error;
55969
- }
55970
- if (message.identityProofBytes != null && message.hasOwnProperty("identityProofBytes"))
55971
- if (!(message.identityProofBytes && typeof message.identityProofBytes.length === "number" || $util.isString(message.identityProofBytes)))
55972
- return "identityProofBytes: buffer expected";
55973
- return null;
55974
- };
55975
-
55976
- /**
55977
- * Creates an IdentityProvedResponse message from a plain object. Also converts values to their respective internal types.
55978
- * @function fromObject
55979
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
55980
- * @static
55981
- * @param {Object.<string,*>} object Plain object
55982
- * @returns {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse} IdentityProvedResponse
55983
- */
55984
- IdentityProvedResponse.fromObject = function fromObject(object) {
55985
- if (object instanceof $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse)
55986
- return object;
55987
- var message = new $root.org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse();
55988
- if (object.grovedbIdentityPublicKeyHashProof != null) {
55989
- if (typeof object.grovedbIdentityPublicKeyHashProof !== "object")
55990
- throw TypeError(".org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse.grovedbIdentityPublicKeyHashProof: object expected");
55991
- message.grovedbIdentityPublicKeyHashProof = $root.org.dash.platform.dapi.v0.Proof.fromObject(object.grovedbIdentityPublicKeyHashProof);
55992
- }
55993
- if (object.identityProofBytes != null)
55994
- if (typeof object.identityProofBytes === "string")
55995
- $util.base64.decode(object.identityProofBytes, message.identityProofBytes = $util.newBuffer($util.base64.length(object.identityProofBytes)), 0);
55996
- else if (object.identityProofBytes.length >= 0)
55997
- message.identityProofBytes = object.identityProofBytes;
55998
- return message;
55999
- };
56000
-
56001
- /**
56002
- * Creates a plain object from an IdentityProvedResponse message. Also converts values to other types if specified.
56003
- * @function toObject
56004
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
56005
- * @static
56006
- * @param {org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse} message IdentityProvedResponse
56007
- * @param {$protobuf.IConversionOptions} [options] Conversion options
56008
- * @returns {Object.<string,*>} Plain object
56009
- */
56010
- IdentityProvedResponse.toObject = function toObject(message, options) {
56011
- if (!options)
56012
- options = {};
56013
- var object = {};
56014
- if (options.defaults) {
56015
- object.grovedbIdentityPublicKeyHashProof = null;
56016
- if (options.bytes === String)
56017
- object.identityProofBytes = "";
56018
- else {
56019
- object.identityProofBytes = [];
56020
- if (options.bytes !== Array)
56021
- object.identityProofBytes = $util.newBuffer(object.identityProofBytes);
56022
- }
56023
- }
56024
- if (message.grovedbIdentityPublicKeyHashProof != null && message.hasOwnProperty("grovedbIdentityPublicKeyHashProof"))
56025
- object.grovedbIdentityPublicKeyHashProof = $root.org.dash.platform.dapi.v0.Proof.toObject(message.grovedbIdentityPublicKeyHashProof, options);
56026
- if (message.identityProofBytes != null && message.hasOwnProperty("identityProofBytes"))
56027
- object.identityProofBytes = options.bytes === String ? $util.base64.encode(message.identityProofBytes, 0, message.identityProofBytes.length) : options.bytes === Array ? Array.prototype.slice.call(message.identityProofBytes) : message.identityProofBytes;
56028
- return object;
56029
- };
56030
-
56031
- /**
56032
- * Converts this IdentityProvedResponse to JSON.
56033
- * @function toJSON
56034
- * @memberof org.dash.platform.dapi.v0.GetIdentityByNonUniquePublicKeyHashResponse.GetIdentityByNonUniquePublicKeyHashResponseV0.IdentityProvedResponse
56035
- * @instance
56036
- * @returns {Object.<string,*>} JSON object
56037
- */
56038
- IdentityProvedResponse.prototype.toJSON = function toJSON() {
56039
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
56040
- };
56041
-
56042
- return IdentityProvedResponse;
56043
- })();
56044
-
56045
55835
  return GetIdentityByNonUniquePublicKeyHashResponseV0;
56046
55836
  })();
56047
55837