@dashevo/dapi-grpc 0.25.22 → 1.0.0-beta.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.
Files changed (31) hide show
  1. package/Cargo.toml +35 -16
  2. package/build.rs +139 -56
  3. package/clients/core/v0/nodejs/CorePromiseClient.js +124 -13
  4. package/clients/core/v0/nodejs/core_pbjs.js +1922 -987
  5. package/clients/core/v0/nodejs/core_protoc.js +1291 -645
  6. package/clients/core/v0/rust/core_example.rs +1 -1
  7. package/clients/core/v0/web/CorePromiseClient.js +49 -5
  8. package/clients/core/v0/web/core_pb.d.ts +173 -89
  9. package/clients/core/v0/web/core_pb.js +1291 -645
  10. package/clients/core/v0/web/core_pb_service.d.ts +59 -10
  11. package/clients/core/v0/web/core_pb_service.js +134 -6
  12. package/clients/platform/v0/nodejs/PlatformPromiseClient.js +208 -14
  13. package/clients/platform/v0/nodejs/platform_pbjs.js +22951 -9938
  14. package/clients/platform/v0/nodejs/platform_protoc.js +22332 -9091
  15. package/clients/platform/v0/rust/platform_example.rs +1 -1
  16. package/clients/platform/v0/web/PlatformPromiseClient.js +64 -8
  17. package/clients/platform/v0/web/platform_pb.d.ts +2057 -302
  18. package/clients/platform/v0/web/platform_pb.js +22332 -9091
  19. package/clients/platform/v0/web/platform_pb_service.d.ts +187 -35
  20. package/clients/platform/v0/web/platform_pb_service.js +355 -35
  21. package/package.json +2 -2
  22. package/protos/core/v0/core.proto +45 -23
  23. package/protos/platform/v0/platform.proto +429 -50
  24. package/src/lib.rs +26 -2
  25. package/src/mock/serde_mockable.rs +105 -0
  26. package/src/mock.rs +130 -0
  27. package/test/unit/clients/core/v0/nodejs/CorePromiseClient.spec.js +27 -6
  28. package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +55 -1
  29. package/test/unit/getCoreDefinition.spec.js +5 -2
  30. package/src/core/proto/org.dash.platform.dapi.v0.rs +0 -666
  31. package/src/platform/proto/org.dash.platform.dapi.v0.rs +0 -2481
package/Cargo.toml CHANGED
@@ -1,36 +1,50 @@
1
1
  [package]
2
2
  name = "dapi-grpc"
3
3
  description = "GRPC client for Dash Platform"
4
- version = "0.25.22"
4
+ version = "1.0.0-beta.1"
5
5
  authors = [
6
- "Samuel Westrich <sam@dash.org>",
7
- "Igor Markin <igor.markin@dash.org>",
8
- "Łukasz Klimek <lukasz.klimek@dash.org>",
9
- "Anton Suprunchuk <anton.suprunchuk@dash.org>",
10
- "Ivan Shumkov <shumkov@dash.org>",
6
+ "Samuel Westrich <sam@dash.org>",
7
+ "Igor Markin <igor.markin@dash.org>",
8
+ "Łukasz Klimek <lukasz.klimek@dash.org>",
9
+ "Anton Suprunchuk <anton.suprunchuk@dash.org>",
10
+ "Ivan Shumkov <shumkov@dash.org>",
11
11
  ]
12
12
  edition = "2021"
13
- rust-version = "1.73"
13
+ rust-version = "1.76"
14
14
  license = "MIT"
15
15
 
16
16
  [features]
17
- default = ["core", "platform", "client", "serde"]
17
+ default = ["core", "platform", "client"]
18
18
  core = []
19
19
  platform = []
20
20
  # Re-export Dash Platform protobuf types as `dapi_grpc::platform::proto`
21
+ # Note: client needs tls and tls-roots to connect to testnet which uses TLS.
21
22
  tenderdash-proto = []
22
- client = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"]
23
+ client = [
24
+ "tonic/channel",
25
+ "tonic/transport",
26
+ "tonic/tls",
27
+ "tonic/tls-roots",
28
+ "tonic/tls-webpki-roots",
29
+ "platform",
30
+ ]
31
+ server = ["tonic/channel", "tonic/transport", "platform"]
23
32
  serde = ["dep:serde", "dep:serde_bytes"]
33
+ mocks = ["serde", "dep:serde_json"]
24
34
 
25
35
  [dependencies]
26
- prost = { version = "0.11.9" }
27
- tonic = { version = "0.9.2", features = [
28
- "codegen",
29
- "prost",
36
+ prost = { version = "0.12.3" }
37
+ futures-core = "0.3.30"
38
+ tonic = { version = "0.11", features = [
39
+ "codegen",
40
+ "prost",
30
41
  ], default-features = false }
31
- serde = { version = "1.0.171", optional = true, features = ["derive"] }
42
+ serde = { version = "1.0.197", optional = true, features = ["derive"] }
32
43
  serde_bytes = { version = "0.11.12", optional = true }
33
- tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci" }
44
+ serde_json = { version = "1.0", optional = true }
45
+ tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "1.0.0", tag = "v1.0.0", default-features = false, features = [
46
+ "grpc",
47
+ ] }
34
48
  dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
35
49
  platform-version = { path = "../rs-platform-version" }
36
50
 
@@ -49,4 +63,9 @@ name = "platform_example"
49
63
  path = "clients/platform/v0/rust/platform_example.rs"
50
64
 
51
65
  [package.metadata.cargo-machete]
52
- ignored = ["platform-version", "serde_bytes"]
66
+ ignored = [
67
+ "platform-version",
68
+ "serde_bytes",
69
+ "futures-core",
70
+ "dapi-grpc-macros",
71
+ ]
package/build.rs CHANGED
@@ -1,12 +1,36 @@
1
1
  use std::{
2
+ collections::HashSet,
2
3
  fs::{create_dir_all, remove_dir_all},
3
4
  path::PathBuf,
5
+ process::exit,
4
6
  };
5
7
 
6
8
  use tonic_build::Builder;
7
9
 
10
+ const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#;
11
+ const SERDE_WITH_BASE64: &str =
12
+ r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::vec_base64string"))]"#;
13
+ const SERDE_WITH_STRING: &str =
14
+ r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#;
15
+
8
16
  fn main() {
9
- generate().expect("failed to compile protobuf definitions");
17
+ let core = MappingConfig::new(
18
+ PathBuf::from("protos/core/v0/core.proto"),
19
+ PathBuf::from("src/core"),
20
+ );
21
+
22
+ configure_core(core)
23
+ .generate()
24
+ .expect("generate core proto");
25
+
26
+ let platform = MappingConfig::new(
27
+ PathBuf::from("protos/platform/v0/platform.proto"),
28
+ PathBuf::from("src/platform"),
29
+ );
30
+
31
+ configure_platform(platform)
32
+ .generate()
33
+ .expect("generate platform proto");
10
34
 
11
35
  println!("cargo:rerun-if-changed=./protos");
12
36
  println!("cargo:rerun-if-env-changed=CARGO_FEATURE_SERDE");
@@ -18,29 +42,20 @@ struct MappingConfig {
18
42
  builder: Builder,
19
43
  proto_includes: Vec<PathBuf>,
20
44
  }
21
- /// Generate Rust definitions from Protobuf definitions
22
- pub fn generate() -> Result<(), std::io::Error> {
23
- let core = MappingConfig::new(
24
- PathBuf::from("protos/core/v0/core.proto"),
25
- PathBuf::from("src/core/proto"),
26
- );
27
- core.generate().unwrap();
28
-
29
- let mut platform = MappingConfig::new(
30
- PathBuf::from("protos/platform/v0/platform.proto"),
31
- PathBuf::from("src/platform/proto"),
32
- );
33
45
 
46
+ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
34
47
  // Derive features for versioned messages
35
48
  //
36
49
  // "GetConsensusParamsRequest" is excluded as this message does not support proofs
37
- const VERSIONED_REQUESTS: [&str; 15] = [
50
+ const VERSIONED_REQUESTS: [&str; 25] = [
38
51
  "GetDataContractHistoryRequest",
39
52
  "GetDataContractRequest",
40
53
  "GetDataContractsRequest",
41
54
  "GetDocumentsRequest",
42
55
  "GetIdentitiesByPublicKeyHashesRequest",
43
56
  "GetIdentitiesRequest",
57
+ "GetIdentityNonceRequest",
58
+ "GetIdentityContractNonceRequest",
44
59
  "GetIdentityBalanceAndRevisionRequest",
45
60
  "GetIdentityBalanceRequest",
46
61
  "GetIdentityByPublicKeyHashRequest",
@@ -50,10 +65,18 @@ pub fn generate() -> Result<(), std::io::Error> {
50
65
  "WaitForStateTransitionResultRequest",
51
66
  "GetProtocolVersionUpgradeStateRequest",
52
67
  "GetProtocolVersionUpgradeVoteStatusRequest",
68
+ "GetPathElementsRequest",
69
+ "GetIdentitiesContractKeysRequest",
70
+ "GetPrefundedSpecializedBalanceRequest",
71
+ "GetContestedResourcesRequest",
72
+ "GetContestedResourceVoteStateRequest",
73
+ "GetContestedResourceVotersForIdentityRequest",
74
+ "GetContestedResourceIdentityVotesRequest",
75
+ "GetVotePollsByEndDateRequest",
53
76
  ];
54
77
 
55
78
  // "GetConsensusParamsResponse" is excluded as this message does not support proofs
56
- const VERSIONED_RESPONSES: [&str; 16] = [
79
+ const VERSIONED_RESPONSES: [&str; 26] = [
57
80
  "GetDataContractHistoryResponse",
58
81
  "GetDataContractResponse",
59
82
  "GetDataContractsResponse",
@@ -62,6 +85,8 @@ pub fn generate() -> Result<(), std::io::Error> {
62
85
  "GetIdentitiesResponse",
63
86
  "GetIdentityBalanceAndRevisionResponse",
64
87
  "GetIdentityBalanceResponse",
88
+ "GetIdentityNonceResponse",
89
+ "GetIdentityContractNonceResponse",
65
90
  "GetIdentityByPublicKeyHashResponse",
66
91
  "GetIdentityKeysResponse",
67
92
  "GetIdentityResponse",
@@ -70,8 +95,19 @@ pub fn generate() -> Result<(), std::io::Error> {
70
95
  "GetEpochsInfoResponse",
71
96
  "GetProtocolVersionUpgradeStateResponse",
72
97
  "GetProtocolVersionUpgradeVoteStatusResponse",
98
+ "GetPathElementsResponse",
99
+ "GetIdentitiesContractKeysResponse",
100
+ "GetPrefundedSpecializedBalanceResponse",
101
+ "GetContestedResourcesResponse",
102
+ "GetContestedResourceVoteStateResponse",
103
+ "GetContestedResourceVotersForIdentityResponse",
104
+ "GetContestedResourceIdentityVotesResponse",
105
+ "GetVotePollsByEndDateResponse",
73
106
  ];
74
107
 
108
+ check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS");
109
+ check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES");
110
+
75
111
  // Derive VersionedGrpcMessage on requests
76
112
  for msg in VERSIONED_REQUESTS {
77
113
  platform = platform
@@ -92,66 +128,113 @@ pub fn generate() -> Result<(), std::io::Error> {
92
128
  .message_attribute(msg, r#"#[grpc_versions(0)]"#);
93
129
  }
94
130
 
95
- #[cfg(feature = "serde")]
131
+ // All messages can be mocked.
132
+ let platform = platform.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#);
133
+
96
134
  let platform = platform
97
135
  .type_attribute(
98
136
  ".",
99
- r#"#[derive(::serde::Serialize, ::serde::Deserialize)]"#,
100
- )
101
- .type_attribute(".", r#"#[serde(rename_all = "snake_case")]"#)
102
- .field_attribute("id", r#"#[serde(with = "serde_bytes")]"#)
103
- .field_attribute("identity_id", r#"#[serde(with = "serde_bytes")]"#)
104
- .field_attribute(
105
- "ids",
106
- r#"#[serde(with = "crate::deserialization::vec_base64string")]"#,
107
- )
108
- .field_attribute(
109
- "ResponseMetadata.height",
110
- r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
137
+ r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
111
138
  )
112
- .field_attribute(
113
- "ResponseMetadata.time_ms",
114
- r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
115
- )
116
- .field_attribute(
117
- "start_at_ms",
118
- r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
119
- )
120
- .field_attribute("public_key_hash", r#"#[serde(with = "serde_bytes")]"#)
121
- .field_attribute(
122
- "public_key_hashes",
123
- r#"#[serde(with = "crate::deserialization::vec_base64string")]"#,
139
+ .type_attribute(
140
+ ".",
141
+ r#"#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]"#,
124
142
  )
143
+ .field_attribute("id", SERDE_WITH_BYTES)
144
+ .field_attribute("identity_id", SERDE_WITH_BYTES)
145
+ .field_attribute("ids", SERDE_WITH_BASE64)
146
+ .field_attribute("ResponseMetadata.height", SERDE_WITH_STRING)
147
+ .field_attribute("ResponseMetadata.time_ms", SERDE_WITH_STRING)
148
+ .field_attribute("start_at_ms", SERDE_WITH_STRING)
149
+ .field_attribute("public_key_hash", SERDE_WITH_BYTES)
150
+ .field_attribute("public_key_hashes", SERDE_WITH_BASE64)
125
151
  // Get documents fields
126
- .field_attribute("data_contract_id", r#"#[serde(with = "serde_bytes")]"#)
127
- .field_attribute("where", r#"#[serde(with = "serde_bytes")]"#)
128
- .field_attribute("order_by", r#"#[serde(with = "serde_bytes")]"#)
152
+ .field_attribute("data_contract_id", SERDE_WITH_BYTES)
153
+ .field_attribute("where", SERDE_WITH_BYTES)
154
+ .field_attribute("order_by", SERDE_WITH_BYTES)
129
155
  // Proof fields
130
- .field_attribute("Proof.grovedb_proof", r#"#[serde(with = "serde_bytes")]"#)
131
- .field_attribute("Proof.quorum_hash", r#"#[serde(with = "serde_bytes")]"#)
132
- .field_attribute("Proof.signature", r#"#[serde(with = "serde_bytes")]"#)
133
- .field_attribute("Proof.block_id_hash", r#"#[serde(with = "serde_bytes")]"#);
156
+ .field_attribute("Proof.grovedb_proof", SERDE_WITH_BYTES)
157
+ .field_attribute("Proof.quorum_hash", SERDE_WITH_BYTES)
158
+ .field_attribute("Proof.signature", SERDE_WITH_BYTES)
159
+ .field_attribute("Proof.block_id_hash", SERDE_WITH_BYTES);
160
+
161
+ #[allow(clippy::let_and_return)]
162
+ platform
163
+ }
134
164
 
135
- platform.generate().unwrap();
165
+ /// Check for duplicate messages in the list.
166
+ fn check_unique(messages: &[&'static str]) -> Result<(), String> {
167
+ let mut hashset: HashSet<&'static str> = HashSet::new();
168
+ let mut duplicates = String::new();
136
169
 
137
- Ok(())
170
+ for value in messages {
171
+ if !hashset.insert(*value) {
172
+ duplicates.push_str(value);
173
+ duplicates.push_str(", ");
174
+ }
175
+ }
176
+
177
+ if duplicates.is_empty() {
178
+ Ok(())
179
+ } else {
180
+ Err(format!(
181
+ "Duplicate messages found: {}",
182
+ duplicates.trim_end_matches(", ")
183
+ ))
184
+ }
185
+ }
186
+
187
+ fn configure_core(core: MappingConfig) -> MappingConfig {
188
+ // All messages can be mocked.
189
+ let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#);
190
+
191
+ // Serde support
192
+ let core = core.type_attribute(
193
+ ".",
194
+ r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
195
+ );
196
+
197
+ #[allow(clippy::let_and_return)]
198
+ core
138
199
  }
139
200
 
140
201
  impl MappingConfig {
202
+ /// Create a new MappingConfig instance.
203
+ ///
204
+ /// ## Arguments
205
+ ///
206
+ /// * `protobuf_file` - Path to the protobuf file to use as input.
207
+ /// * `out_dir` - Output directory where subdirectories for generated files will be created.
208
+ /// Depending on the features, either `client`, `server` or `client_server` subdirectory
209
+ /// will be created inside `out_dir`.
141
210
  fn new(protobuf_file: PathBuf, out_dir: PathBuf) -> Self {
142
211
  let protobuf_file = abs_path(&protobuf_file);
143
- let out_dir = abs_path(&out_dir);
212
+
213
+ let build_server = cfg!(feature = "server");
214
+ let build_client = cfg!(feature = "client");
215
+
216
+ // Depending on the features, we need to build the server, client or both.
217
+ // We save these artifacts in separate directories to avoid overwriting the generated files
218
+ // when another crate requires different features.
219
+ let out_dir_suffix = match (build_server, build_client) {
220
+ (true, true) => "client_server",
221
+ (true, false) => "server",
222
+ (false, true) => "client",
223
+ (false, false) => {
224
+ println!("WARNING: At least one of the features 'server' or 'client' must be enabled; dapi-grpc will not generate any files.");
225
+ exit(0)
226
+ }
227
+ };
228
+
229
+ let out_dir = abs_path(&out_dir.join(out_dir_suffix));
144
230
 
145
231
  let builder = tonic_build::configure()
146
- .build_server(false)
232
+ .build_server(build_server)
233
+ .build_client(build_client)
234
+ .build_transport(build_server || build_client)
147
235
  .out_dir(out_dir.clone())
148
236
  .protoc_arg("--experimental_allow_proto3_optional");
149
237
 
150
- #[cfg(feature = "client")]
151
- let builder = builder.build_client(true).build_transport(true);
152
- #[cfg(not(feature = "client"))]
153
- let builder = builder.build_client(false).build_transport(false);
154
-
155
238
  Self {
156
239
  protobuf_file,
157
240
  out_dir,
@@ -24,10 +24,14 @@ const {
24
24
  platform: {
25
25
  dapi: {
26
26
  v0: {
27
- GetStatusRequest: PBJSGetStatusRequest,
28
- GetStatusResponse: PBJSGetStatusResponse,
27
+ GetBlockchainStatusRequest: PBJSGetBlockchainStatusRequest,
28
+ GetBlockchainStatusResponse: PBJSGetBlockchainStatusResponse,
29
+ GetMasternodeStatusRequest: PBJSGetMasternodeStatusRequest,
30
+ GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse,
29
31
  GetBlockRequest: PBJSGetBlockRequest,
30
32
  GetBlockResponse: PBJSGetBlockResponse,
33
+ GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest,
34
+ GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse,
31
35
  BroadcastTransactionRequest: PBJSBroadcastTransactionRequest,
32
36
  BroadcastTransactionResponse: PBJSBroadcastTransactionResponse,
33
37
  GetTransactionRequest: PBJSGetTransactionRequest,
@@ -38,6 +42,8 @@ const {
38
42
  GetEstimatedTransactionFeeResponse: PBJSGetEstimatedTransactionFeeResponse,
39
43
  TransactionsWithProofsRequest: PBJSTransactionsWithProofsRequest,
40
44
  TransactionsWithProofsResponse: PBJSTransactionsWithProofsResponse,
45
+ MasternodeListRequest: PBJSMasternodeListRequest,
46
+ MasternodeListResponse: PBJSMasternodeListResponse,
41
47
  },
42
48
  },
43
49
  },
@@ -46,13 +52,16 @@ const {
46
52
  } = require('./core_pbjs');
47
53
 
48
54
  const {
49
- GetStatusResponse: ProtocGetStatusResponse,
55
+ GetBlockchainStatusResponse: ProtocGetBlockchainStatusResponse,
56
+ GetMasternodeStatusResponse: ProtocGetMasternodeStatusResponse,
50
57
  GetBlockResponse: ProtocGetBlockResponse,
58
+ GetBestBlockHeightResponse: ProtocGetBestBlockHeightResponse,
51
59
  BroadcastTransactionResponse: ProtocBroadcastTransactionResponse,
52
60
  GetTransactionResponse: ProtocGetTransactionResponse,
53
61
  BlockHeadersWithChainLocksResponse: ProtocBlockHeadersWithChainLocksResponse,
54
62
  GetEstimatedTransactionFeeResponse: ProtocGetEstimatedTransactionFeeResponse,
55
63
  TransactionsWithProofsResponse: ProtocTransactionsWithProofsResponse,
64
+ MasternodeListResponse: ProtocMasternodeListResponse,
56
65
  } = require('./core_protoc');
57
66
 
58
67
  const getCoreDefinition = require('../../../../lib/getCoreDefinition');
@@ -79,14 +88,22 @@ class CorePromiseClient {
79
88
 
80
89
  this.client = new CoreNodeJSClient(strippedHostname, credentials, options);
81
90
 
82
- this.client.getStatus = promisify(
83
- this.client.getStatus.bind(this.client),
91
+ this.client.getBlockchainStatus = promisify(
92
+ this.client.getBlockchainStatus.bind(this.client),
93
+ );
94
+
95
+ this.client.getMasternodeStatus = promisify(
96
+ this.client.getMasternodeStatus.bind(this.client),
84
97
  );
85
98
 
86
99
  this.client.getBlock = promisify(
87
100
  this.client.getBlock.bind(this.client),
88
101
  );
89
102
 
103
+ this.client.getBestBlockHeight = promisify(
104
+ this.client.getBestBlockHeight.bind(this.client),
105
+ );
106
+
90
107
  this.client.broadcastTransaction = promisify(
91
108
  this.client.broadcastTransaction.bind(this.client),
92
109
  );
@@ -101,28 +118,28 @@ class CorePromiseClient {
101
118
  }
102
119
 
103
120
  /**
104
- * @param {!GetStatusRequest} getStatusRequest
121
+ * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest
105
122
  * @param {?Object<string, string>} metadata
106
123
  * @param {CallOptions} [options={}]
107
- * @return {Promise<!GetStatusResponse>}
124
+ * @return {Promise<!GetBlockchainStatusResponse>}
108
125
  */
109
- getStatus(getStatusRequest, metadata = {}, options = {}) {
126
+ getBlockchainStatus(getBlockchainStatusRequest, metadata = {}, options = {}) {
110
127
  if (!isObject(metadata)) {
111
128
  throw new Error('metadata must be an object');
112
129
  }
113
130
 
114
- return this.client.getStatus(
115
- getStatusRequest,
131
+ return this.client.getBlockchainStatus(
132
+ getBlockchainStatusRequest,
116
133
  convertObjectToMetadata(metadata),
117
134
  {
118
135
  interceptors: [
119
136
  jsonToProtobufInterceptorFactory(
120
137
  jsonToProtobufFactory(
121
- ProtocGetStatusResponse,
122
- PBJSGetStatusResponse,
138
+ ProtocGetBlockchainStatusResponse,
139
+ PBJSGetBlockchainStatusResponse,
123
140
  ),
124
141
  protobufToJsonFactory(
125
- PBJSGetStatusRequest,
142
+ PBJSGetBlockchainStatusRequest,
126
143
  ),
127
144
  ),
128
145
  ],
@@ -162,6 +179,68 @@ class CorePromiseClient {
162
179
  );
163
180
  }
164
181
 
182
+ /**
183
+ * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest
184
+ * @param {?Object<string, string>} metadata
185
+ * @param {CallOptions} [options={}]
186
+ * @return {Promise<!GetBestBlockHeightResponse>}
187
+ */
188
+ getBestBlockHeight(getBestBlockHeightRequest, metadata = {}, options = {}) {
189
+ if (!isObject(metadata)) {
190
+ throw new Error('metadata must be an object');
191
+ }
192
+
193
+ return this.client.getBestBlockHeight(
194
+ getBestBlockHeightRequest,
195
+ convertObjectToMetadata(metadata),
196
+ {
197
+ interceptors: [
198
+ jsonToProtobufInterceptorFactory(
199
+ jsonToProtobufFactory(
200
+ ProtocGetBestBlockHeightResponse,
201
+ PBJSGetBestBlockHeightResponse,
202
+ ),
203
+ protobufToJsonFactory(
204
+ PBJSGetBestBlockHeightRequest,
205
+ ),
206
+ ),
207
+ ],
208
+ ...options,
209
+ },
210
+ );
211
+ }
212
+
213
+ /**
214
+ * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest
215
+ * @param {?Object<string, string>} metadata
216
+ * @param {CallOptions} [options={}]
217
+ * @return {Promise<!GetMasternodeStatusResponse>}
218
+ */
219
+ getMasternodeStatus(getMasternodeStatusRequest, metadata = {}, options = {}) {
220
+ if (!isObject(metadata)) {
221
+ throw new Error('metadata must be an object');
222
+ }
223
+
224
+ return this.client.getMasternodeStatus(
225
+ getMasternodeStatusRequest,
226
+ convertObjectToMetadata(metadata),
227
+ {
228
+ interceptors: [
229
+ jsonToProtobufInterceptorFactory(
230
+ jsonToProtobufFactory(
231
+ ProtocGetMasternodeStatusResponse,
232
+ PBJSGetMasternodeStatusResponse,
233
+ ),
234
+ protobufToJsonFactory(
235
+ PBJSGetMasternodeStatusRequest,
236
+ ),
237
+ ),
238
+ ],
239
+ ...options,
240
+ },
241
+ );
242
+ }
243
+
165
244
  /**
166
245
  * @param {!BroadcastTransactionRequest} broadcastTransactionRequest
167
246
  * @param {?Object<string, string>} metadata
@@ -322,6 +401,38 @@ class CorePromiseClient {
322
401
  },
323
402
  );
324
403
  }
404
+
405
+ /**
406
+ * @param {MasternodeListRequest} masternodeListRequest The request proto
407
+ * @param {?Object<string, string>} metadata User defined call metadata
408
+ * @param {CallOptions} [options={}]
409
+ * @return {!grpc.web.ClientReadableStream<!MasternodeListResponse>|undefined}
410
+ * The XHR Node Readable Stream
411
+ */
412
+ subscribeToMasternodeList(masternodeListRequest, metadata = {}, options = {}) {
413
+ if (!isObject(metadata)) {
414
+ throw new Error('metadata must be an object');
415
+ }
416
+
417
+ return this.client.subscribeToMasternodeList(
418
+ masternodeListRequest,
419
+ convertObjectToMetadata(metadata),
420
+ {
421
+ interceptors: [
422
+ jsonToProtobufInterceptorFactory(
423
+ jsonToProtobufFactory(
424
+ ProtocMasternodeListResponse,
425
+ PBJSMasternodeListResponse,
426
+ ),
427
+ protobufToJsonFactory(
428
+ PBJSMasternodeListRequest,
429
+ ),
430
+ ),
431
+ ],
432
+ ...options,
433
+ },
434
+ );
435
+ }
325
436
  }
326
437
 
327
438
  module.exports = CorePromiseClient;