@dashevo/dapi-grpc 1.0.0-pr.1875.1 → 1.0.0-pr.1902.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.
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  name = "dapi-grpc"
3
3
  description = "GRPC client for Dash Platform"
4
- version = "1.0.0-pr.1875.1"
4
+ version = "1.0.0-pr.1902.1"
5
5
  authors = [
6
6
  "Samuel Westrich <sam@dash.org>",
7
7
  "Igor Markin <igor.markin@dash.org>",
@@ -14,7 +14,10 @@ rust-version = "1.76"
14
14
  license = "MIT"
15
15
 
16
16
  [features]
17
- default = ["core", "platform", "client"]
17
+ # Enable all features by default, otherwise different crates
18
+ # triggier bulding proto with different feature set that overwrites
19
+ # previous results and causes build errors
20
+ default = ["core", "platform", "client", "serde", "server"]
18
21
  core = []
19
22
  platform = []
20
23
  # Re-export Dash Platform protobuf types as `dapi_grpc::platform::proto`
@@ -30,7 +33,7 @@ client = [
30
33
  ]
31
34
  server = ["tonic/channel", "tonic/transport", "platform"]
32
35
  serde = ["dep:serde", "dep:serde_bytes"]
33
- mocks = ["serde", "dep:serde_json"]
36
+ mocks = ["dep:serde_json"]
34
37
 
35
38
  [dependencies]
36
39
  prost = { version = "0.12.3" }
@@ -61,9 +64,4 @@ name = "platform_example"
61
64
  path = "clients/platform/v0/rust/platform_example.rs"
62
65
 
63
66
  [package.metadata.cargo-machete]
64
- ignored = [
65
- "platform-version",
66
- "serde_bytes",
67
- "futures-core",
68
- "dapi-grpc-macros",
69
- ]
67
+ ignored = ["platform-version", "serde_bytes", "futures-core"]
package/build.rs CHANGED
@@ -1,21 +1,14 @@
1
1
  use std::{
2
2
  fs::{create_dir_all, remove_dir_all},
3
3
  path::PathBuf,
4
- process::exit,
5
4
  };
6
5
 
7
6
  use tonic_build::Builder;
8
7
 
9
- const SERDE_WITH_BYTES: &str = r#"#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]"#;
10
- const SERDE_WITH_BASE64: &str =
11
- r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::vec_base64string"))]"#;
12
- const SERDE_WITH_STRING: &str =
13
- r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#;
14
-
15
8
  fn main() {
16
9
  let core = MappingConfig::new(
17
10
  PathBuf::from("protos/core/v0/core.proto"),
18
- PathBuf::from("src/core"),
11
+ PathBuf::from("src/core/proto"),
19
12
  );
20
13
 
21
14
  configure_core(core)
@@ -24,7 +17,7 @@ fn main() {
24
17
 
25
18
  let platform = MappingConfig::new(
26
19
  PathBuf::from("protos/platform/v0/platform.proto"),
27
- PathBuf::from("src/platform"),
20
+ PathBuf::from("src/platform/proto"),
28
21
  );
29
22
 
30
23
  configure_platform(platform)
@@ -113,83 +106,73 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
113
106
  }
114
107
 
115
108
  // All messages can be mocked.
116
- let platform = platform.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#);
109
+ platform = platform.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#);
117
110
 
111
+ #[cfg(feature = "serde")]
118
112
  let platform = platform
119
113
  .type_attribute(
120
114
  ".",
121
- r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
115
+ r#"#[derive(::serde::Serialize, ::serde::Deserialize)]"#,
122
116
  )
123
- .type_attribute(
124
- ".",
125
- r#"#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]"#,
117
+ .type_attribute(".", r#"#[serde(rename_all = "snake_case")]"#)
118
+ .field_attribute("id", r#"#[serde(with = "serde_bytes")]"#)
119
+ .field_attribute("identity_id", r#"#[serde(with = "serde_bytes")]"#)
120
+ .field_attribute(
121
+ "ids",
122
+ r#"#[serde(with = "crate::deserialization::vec_base64string")]"#,
123
+ )
124
+ .field_attribute(
125
+ "ResponseMetadata.height",
126
+ r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
127
+ )
128
+ .field_attribute(
129
+ "ResponseMetadata.time_ms",
130
+ r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
131
+ )
132
+ .field_attribute(
133
+ "start_at_ms",
134
+ r#"#[serde(with = "crate::deserialization::from_to_string")]"#,
135
+ )
136
+ .field_attribute("public_key_hash", r#"#[serde(with = "serde_bytes")]"#)
137
+ .field_attribute(
138
+ "public_key_hashes",
139
+ r#"#[serde(with = "crate::deserialization::vec_base64string")]"#,
126
140
  )
127
- .field_attribute("id", SERDE_WITH_BYTES)
128
- .field_attribute("identity_id", SERDE_WITH_BYTES)
129
- .field_attribute("ids", SERDE_WITH_BASE64)
130
- .field_attribute("ResponseMetadata.height", SERDE_WITH_STRING)
131
- .field_attribute("ResponseMetadata.time_ms", SERDE_WITH_STRING)
132
- .field_attribute("start_at_ms", SERDE_WITH_STRING)
133
- .field_attribute("public_key_hash", SERDE_WITH_BYTES)
134
- .field_attribute("public_key_hashes", SERDE_WITH_BASE64)
135
141
  // Get documents fields
136
- .field_attribute("data_contract_id", SERDE_WITH_BYTES)
137
- .field_attribute("where", SERDE_WITH_BYTES)
138
- .field_attribute("order_by", SERDE_WITH_BYTES)
142
+ .field_attribute("data_contract_id", r#"#[serde(with = "serde_bytes")]"#)
143
+ .field_attribute("where", r#"#[serde(with = "serde_bytes")]"#)
144
+ .field_attribute("order_by", r#"#[serde(with = "serde_bytes")]"#)
139
145
  // Proof fields
140
- .field_attribute("Proof.grovedb_proof", SERDE_WITH_BYTES)
141
- .field_attribute("Proof.quorum_hash", SERDE_WITH_BYTES)
142
- .field_attribute("Proof.signature", SERDE_WITH_BYTES)
143
- .field_attribute("Proof.block_id_hash", SERDE_WITH_BYTES);
146
+ .field_attribute("Proof.grovedb_proof", r#"#[serde(with = "serde_bytes")]"#)
147
+ .field_attribute("Proof.quorum_hash", r#"#[serde(with = "serde_bytes")]"#)
148
+ .field_attribute("Proof.signature", r#"#[serde(with = "serde_bytes")]"#)
149
+ .field_attribute("Proof.block_id_hash", r#"#[serde(with = "serde_bytes")]"#);
144
150
 
145
- #[allow(clippy::let_and_return)]
146
151
  platform
147
152
  }
148
153
 
149
- fn configure_core(core: MappingConfig) -> MappingConfig {
154
+ fn configure_core(mut core: MappingConfig) -> MappingConfig {
150
155
  // All messages can be mocked.
151
- let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#);
156
+ core = core.message_attribute(".", r#"#[derive( ::dapi_grpc_macros::Mockable)]"#);
152
157
 
153
158
  // Serde support
159
+ #[cfg(feature = "serde")]
154
160
  let core = core.type_attribute(
155
161
  ".",
156
- r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
162
+ r#"#[derive(::serde::Serialize, ::serde::Deserialize)]"#,
157
163
  );
158
164
 
159
- #[allow(clippy::let_and_return)]
160
165
  core
161
166
  }
162
167
 
163
168
  impl MappingConfig {
164
- /// Create a new MappingConfig instance.
165
- ///
166
- /// ## Arguments
167
- ///
168
- /// * `protobuf_file` - Path to the protobuf file to use as input.
169
- /// * `out_dir` - Output directory where subdirectories for generated files will be created.
170
- /// Depending on the features, either `client`, `server` or `client_server` subdirectory
171
- /// will be created inside `out_dir`.
172
169
  fn new(protobuf_file: PathBuf, out_dir: PathBuf) -> Self {
173
170
  let protobuf_file = abs_path(&protobuf_file);
171
+ let out_dir = abs_path(&out_dir);
174
172
 
175
173
  let build_server = cfg!(feature = "server");
176
174
  let build_client = cfg!(feature = "client");
177
175
 
178
- // Depending on the features, we need to build the server, client or both.
179
- // We save these artifacts in separate directories to avoid overwriting the generated files
180
- // when another crate requires different features.
181
- let out_dir_suffix = match (build_server, build_client) {
182
- (true, true) => "client_server",
183
- (true, false) => "server",
184
- (false, true) => "client",
185
- (false, false) => {
186
- println!("WARNING: At least one of the features 'server' or 'client' must be enabled; dapi-grpc will not generate any files.");
187
- exit(0)
188
- }
189
- };
190
-
191
- let out_dir = abs_path(&out_dir.join(out_dir_suffix));
192
-
193
176
  let builder = tonic_build::configure()
194
177
  .build_server(build_server)
195
178
  .build_client(build_client)
@@ -30,8 +30,6 @@ const {
30
30
  GetMasternodeStatusResponse: PBJSGetMasternodeStatusResponse,
31
31
  GetBlockRequest: PBJSGetBlockRequest,
32
32
  GetBlockResponse: PBJSGetBlockResponse,
33
- GetBestBlockHeightRequest: PBJSGetBestBlockHeightRequest,
34
- GetBestBlockHeightResponse: PBJSGetBestBlockHeightResponse,
35
33
  BroadcastTransactionRequest: PBJSBroadcastTransactionRequest,
36
34
  BroadcastTransactionResponse: PBJSBroadcastTransactionResponse,
37
35
  GetTransactionRequest: PBJSGetTransactionRequest,
@@ -53,7 +51,6 @@ const {
53
51
  GetBlockchainStatusResponse: ProtocGetBlockchainStatusResponse,
54
52
  GetMasternodeStatusResponse: ProtocGetMasternodeStatusResponse,
55
53
  GetBlockResponse: ProtocGetBlockResponse,
56
- GetBestBlockHeightResponse: ProtocGetBestBlockHeightResponse,
57
54
  BroadcastTransactionResponse: ProtocBroadcastTransactionResponse,
58
55
  GetTransactionResponse: ProtocGetTransactionResponse,
59
56
  BlockHeadersWithChainLocksResponse: ProtocBlockHeadersWithChainLocksResponse,
@@ -97,10 +94,6 @@ class CorePromiseClient {
97
94
  this.client.getBlock.bind(this.client),
98
95
  );
99
96
 
100
- this.client.getBestBlockHeight = promisify(
101
- this.client.getBestBlockHeight.bind(this.client),
102
- );
103
-
104
97
  this.client.broadcastTransaction = promisify(
105
98
  this.client.broadcastTransaction.bind(this.client),
106
99
  );
@@ -176,37 +169,6 @@ class CorePromiseClient {
176
169
  );
177
170
  }
178
171
 
179
- /**
180
- * @param {!GetBestBlockHeightRequest} getBestBlockHeightRequest
181
- * @param {?Object<string, string>} metadata
182
- * @param {CallOptions} [options={}]
183
- * @return {Promise<!GetBestBlockHeightResponse>}
184
- */
185
- getBestBlockHeight(getBestBlockHeightRequest, metadata = {}, options = {}) {
186
- if (!isObject(metadata)) {
187
- throw new Error('metadata must be an object');
188
- }
189
-
190
- return this.client.getBestBlockHeight(
191
- getBestBlockHeightRequest,
192
- convertObjectToMetadata(metadata),
193
- {
194
- interceptors: [
195
- jsonToProtobufInterceptorFactory(
196
- jsonToProtobufFactory(
197
- ProtocGetBestBlockHeightResponse,
198
- PBJSGetBestBlockHeightResponse,
199
- ),
200
- protobufToJsonFactory(
201
- PBJSGetBestBlockHeightRequest,
202
- ),
203
- ),
204
- ],
205
- ...options,
206
- },
207
- );
208
- }
209
-
210
172
  /**
211
173
  * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest
212
174
  * @param {?Object<string, string>} metadata
@@ -185,39 +185,6 @@ $root.org = (function() {
185
185
  * @variation 2
186
186
  */
187
187
 
188
- /**
189
- * Callback as used by {@link org.dash.platform.dapi.v0.Core#getBestBlockHeight}.
190
- * @memberof org.dash.platform.dapi.v0.Core
191
- * @typedef getBestBlockHeightCallback
192
- * @type {function}
193
- * @param {Error|null} error Error, if any
194
- * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} [response] GetBestBlockHeightResponse
195
- */
196
-
197
- /**
198
- * Calls getBestBlockHeight.
199
- * @function getBestBlockHeight
200
- * @memberof org.dash.platform.dapi.v0.Core
201
- * @instance
202
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object
203
- * @param {org.dash.platform.dapi.v0.Core.getBestBlockHeightCallback} callback Node-style callback called with the error, if any, and GetBestBlockHeightResponse
204
- * @returns {undefined}
205
- * @variation 1
206
- */
207
- Object.defineProperty(Core.prototype.getBestBlockHeight = function getBestBlockHeight(request, callback) {
208
- return this.rpcCall(getBestBlockHeight, $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest, $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse, request, callback);
209
- }, "name", { value: "getBestBlockHeight" });
210
-
211
- /**
212
- * Calls getBestBlockHeight.
213
- * @function getBestBlockHeight
214
- * @memberof org.dash.platform.dapi.v0.Core
215
- * @instance
216
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} request GetBestBlockHeightRequest message or plain object
217
- * @returns {Promise<org.dash.platform.dapi.v0.GetBestBlockHeightResponse>} Promise
218
- * @variation 2
219
- */
220
-
221
188
  /**
222
189
  * Callback as used by {@link org.dash.platform.dapi.v0.Core#broadcastTransaction}.
223
190
  * @memberof org.dash.platform.dapi.v0.Core
@@ -3097,353 +3064,6 @@ $root.org = (function() {
3097
3064
  return GetBlockResponse;
3098
3065
  })();
3099
3066
 
3100
- v0.GetBestBlockHeightRequest = (function() {
3101
-
3102
- /**
3103
- * Properties of a GetBestBlockHeightRequest.
3104
- * @memberof org.dash.platform.dapi.v0
3105
- * @interface IGetBestBlockHeightRequest
3106
- */
3107
-
3108
- /**
3109
- * Constructs a new GetBestBlockHeightRequest.
3110
- * @memberof org.dash.platform.dapi.v0
3111
- * @classdesc Represents a GetBestBlockHeightRequest.
3112
- * @implements IGetBestBlockHeightRequest
3113
- * @constructor
3114
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set
3115
- */
3116
- function GetBestBlockHeightRequest(properties) {
3117
- if (properties)
3118
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3119
- if (properties[keys[i]] != null)
3120
- this[keys[i]] = properties[keys[i]];
3121
- }
3122
-
3123
- /**
3124
- * Creates a new GetBestBlockHeightRequest instance using the specified properties.
3125
- * @function create
3126
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3127
- * @static
3128
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest=} [properties] Properties to set
3129
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest instance
3130
- */
3131
- GetBestBlockHeightRequest.create = function create(properties) {
3132
- return new GetBestBlockHeightRequest(properties);
3133
- };
3134
-
3135
- /**
3136
- * Encodes the specified GetBestBlockHeightRequest message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages.
3137
- * @function encode
3138
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3139
- * @static
3140
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode
3141
- * @param {$protobuf.Writer} [writer] Writer to encode to
3142
- * @returns {$protobuf.Writer} Writer
3143
- */
3144
- GetBestBlockHeightRequest.encode = function encode(message, writer) {
3145
- if (!writer)
3146
- writer = $Writer.create();
3147
- return writer;
3148
- };
3149
-
3150
- /**
3151
- * Encodes the specified GetBestBlockHeightRequest message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightRequest.verify|verify} messages.
3152
- * @function encodeDelimited
3153
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3154
- * @static
3155
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightRequest} message GetBestBlockHeightRequest message or plain object to encode
3156
- * @param {$protobuf.Writer} [writer] Writer to encode to
3157
- * @returns {$protobuf.Writer} Writer
3158
- */
3159
- GetBestBlockHeightRequest.encodeDelimited = function encodeDelimited(message, writer) {
3160
- return this.encode(message, writer).ldelim();
3161
- };
3162
-
3163
- /**
3164
- * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer.
3165
- * @function decode
3166
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3167
- * @static
3168
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3169
- * @param {number} [length] Message length if known beforehand
3170
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest
3171
- * @throws {Error} If the payload is not a reader or valid buffer
3172
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
3173
- */
3174
- GetBestBlockHeightRequest.decode = function decode(reader, length) {
3175
- if (!(reader instanceof $Reader))
3176
- reader = $Reader.create(reader);
3177
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest();
3178
- while (reader.pos < end) {
3179
- var tag = reader.uint32();
3180
- switch (tag >>> 3) {
3181
- default:
3182
- reader.skipType(tag & 7);
3183
- break;
3184
- }
3185
- }
3186
- return message;
3187
- };
3188
-
3189
- /**
3190
- * Decodes a GetBestBlockHeightRequest message from the specified reader or buffer, length delimited.
3191
- * @function decodeDelimited
3192
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3193
- * @static
3194
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3195
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest
3196
- * @throws {Error} If the payload is not a reader or valid buffer
3197
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
3198
- */
3199
- GetBestBlockHeightRequest.decodeDelimited = function decodeDelimited(reader) {
3200
- if (!(reader instanceof $Reader))
3201
- reader = new $Reader(reader);
3202
- return this.decode(reader, reader.uint32());
3203
- };
3204
-
3205
- /**
3206
- * Verifies a GetBestBlockHeightRequest message.
3207
- * @function verify
3208
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3209
- * @static
3210
- * @param {Object.<string,*>} message Plain object to verify
3211
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
3212
- */
3213
- GetBestBlockHeightRequest.verify = function verify(message) {
3214
- if (typeof message !== "object" || message === null)
3215
- return "object expected";
3216
- return null;
3217
- };
3218
-
3219
- /**
3220
- * Creates a GetBestBlockHeightRequest message from a plain object. Also converts values to their respective internal types.
3221
- * @function fromObject
3222
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3223
- * @static
3224
- * @param {Object.<string,*>} object Plain object
3225
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} GetBestBlockHeightRequest
3226
- */
3227
- GetBestBlockHeightRequest.fromObject = function fromObject(object) {
3228
- if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest)
3229
- return object;
3230
- return new $root.org.dash.platform.dapi.v0.GetBestBlockHeightRequest();
3231
- };
3232
-
3233
- /**
3234
- * Creates a plain object from a GetBestBlockHeightRequest message. Also converts values to other types if specified.
3235
- * @function toObject
3236
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3237
- * @static
3238
- * @param {org.dash.platform.dapi.v0.GetBestBlockHeightRequest} message GetBestBlockHeightRequest
3239
- * @param {$protobuf.IConversionOptions} [options] Conversion options
3240
- * @returns {Object.<string,*>} Plain object
3241
- */
3242
- GetBestBlockHeightRequest.toObject = function toObject() {
3243
- return {};
3244
- };
3245
-
3246
- /**
3247
- * Converts this GetBestBlockHeightRequest to JSON.
3248
- * @function toJSON
3249
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightRequest
3250
- * @instance
3251
- * @returns {Object.<string,*>} JSON object
3252
- */
3253
- GetBestBlockHeightRequest.prototype.toJSON = function toJSON() {
3254
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3255
- };
3256
-
3257
- return GetBestBlockHeightRequest;
3258
- })();
3259
-
3260
- v0.GetBestBlockHeightResponse = (function() {
3261
-
3262
- /**
3263
- * Properties of a GetBestBlockHeightResponse.
3264
- * @memberof org.dash.platform.dapi.v0
3265
- * @interface IGetBestBlockHeightResponse
3266
- * @property {number|null} [height] GetBestBlockHeightResponse height
3267
- */
3268
-
3269
- /**
3270
- * Constructs a new GetBestBlockHeightResponse.
3271
- * @memberof org.dash.platform.dapi.v0
3272
- * @classdesc Represents a GetBestBlockHeightResponse.
3273
- * @implements IGetBestBlockHeightResponse
3274
- * @constructor
3275
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set
3276
- */
3277
- function GetBestBlockHeightResponse(properties) {
3278
- if (properties)
3279
- for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
3280
- if (properties[keys[i]] != null)
3281
- this[keys[i]] = properties[keys[i]];
3282
- }
3283
-
3284
- /**
3285
- * GetBestBlockHeightResponse height.
3286
- * @member {number} height
3287
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3288
- * @instance
3289
- */
3290
- GetBestBlockHeightResponse.prototype.height = 0;
3291
-
3292
- /**
3293
- * Creates a new GetBestBlockHeightResponse instance using the specified properties.
3294
- * @function create
3295
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3296
- * @static
3297
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse=} [properties] Properties to set
3298
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse instance
3299
- */
3300
- GetBestBlockHeightResponse.create = function create(properties) {
3301
- return new GetBestBlockHeightResponse(properties);
3302
- };
3303
-
3304
- /**
3305
- * Encodes the specified GetBestBlockHeightResponse message. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages.
3306
- * @function encode
3307
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3308
- * @static
3309
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode
3310
- * @param {$protobuf.Writer} [writer] Writer to encode to
3311
- * @returns {$protobuf.Writer} Writer
3312
- */
3313
- GetBestBlockHeightResponse.encode = function encode(message, writer) {
3314
- if (!writer)
3315
- writer = $Writer.create();
3316
- if (message.height != null && Object.hasOwnProperty.call(message, "height"))
3317
- writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.height);
3318
- return writer;
3319
- };
3320
-
3321
- /**
3322
- * Encodes the specified GetBestBlockHeightResponse message, length delimited. Does not implicitly {@link org.dash.platform.dapi.v0.GetBestBlockHeightResponse.verify|verify} messages.
3323
- * @function encodeDelimited
3324
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3325
- * @static
3326
- * @param {org.dash.platform.dapi.v0.IGetBestBlockHeightResponse} message GetBestBlockHeightResponse message or plain object to encode
3327
- * @param {$protobuf.Writer} [writer] Writer to encode to
3328
- * @returns {$protobuf.Writer} Writer
3329
- */
3330
- GetBestBlockHeightResponse.encodeDelimited = function encodeDelimited(message, writer) {
3331
- return this.encode(message, writer).ldelim();
3332
- };
3333
-
3334
- /**
3335
- * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer.
3336
- * @function decode
3337
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3338
- * @static
3339
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3340
- * @param {number} [length] Message length if known beforehand
3341
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse
3342
- * @throws {Error} If the payload is not a reader or valid buffer
3343
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
3344
- */
3345
- GetBestBlockHeightResponse.decode = function decode(reader, length) {
3346
- if (!(reader instanceof $Reader))
3347
- reader = $Reader.create(reader);
3348
- var end = length === undefined ? reader.len : reader.pos + length, message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse();
3349
- while (reader.pos < end) {
3350
- var tag = reader.uint32();
3351
- switch (tag >>> 3) {
3352
- case 1:
3353
- message.height = reader.uint32();
3354
- break;
3355
- default:
3356
- reader.skipType(tag & 7);
3357
- break;
3358
- }
3359
- }
3360
- return message;
3361
- };
3362
-
3363
- /**
3364
- * Decodes a GetBestBlockHeightResponse message from the specified reader or buffer, length delimited.
3365
- * @function decodeDelimited
3366
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3367
- * @static
3368
- * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
3369
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse
3370
- * @throws {Error} If the payload is not a reader or valid buffer
3371
- * @throws {$protobuf.util.ProtocolError} If required fields are missing
3372
- */
3373
- GetBestBlockHeightResponse.decodeDelimited = function decodeDelimited(reader) {
3374
- if (!(reader instanceof $Reader))
3375
- reader = new $Reader(reader);
3376
- return this.decode(reader, reader.uint32());
3377
- };
3378
-
3379
- /**
3380
- * Verifies a GetBestBlockHeightResponse message.
3381
- * @function verify
3382
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3383
- * @static
3384
- * @param {Object.<string,*>} message Plain object to verify
3385
- * @returns {string|null} `null` if valid, otherwise the reason why it is not
3386
- */
3387
- GetBestBlockHeightResponse.verify = function verify(message) {
3388
- if (typeof message !== "object" || message === null)
3389
- return "object expected";
3390
- if (message.height != null && message.hasOwnProperty("height"))
3391
- if (!$util.isInteger(message.height))
3392
- return "height: integer expected";
3393
- return null;
3394
- };
3395
-
3396
- /**
3397
- * Creates a GetBestBlockHeightResponse message from a plain object. Also converts values to their respective internal types.
3398
- * @function fromObject
3399
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3400
- * @static
3401
- * @param {Object.<string,*>} object Plain object
3402
- * @returns {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} GetBestBlockHeightResponse
3403
- */
3404
- GetBestBlockHeightResponse.fromObject = function fromObject(object) {
3405
- if (object instanceof $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse)
3406
- return object;
3407
- var message = new $root.org.dash.platform.dapi.v0.GetBestBlockHeightResponse();
3408
- if (object.height != null)
3409
- message.height = object.height >>> 0;
3410
- return message;
3411
- };
3412
-
3413
- /**
3414
- * Creates a plain object from a GetBestBlockHeightResponse message. Also converts values to other types if specified.
3415
- * @function toObject
3416
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3417
- * @static
3418
- * @param {org.dash.platform.dapi.v0.GetBestBlockHeightResponse} message GetBestBlockHeightResponse
3419
- * @param {$protobuf.IConversionOptions} [options] Conversion options
3420
- * @returns {Object.<string,*>} Plain object
3421
- */
3422
- GetBestBlockHeightResponse.toObject = function toObject(message, options) {
3423
- if (!options)
3424
- options = {};
3425
- var object = {};
3426
- if (options.defaults)
3427
- object.height = 0;
3428
- if (message.height != null && message.hasOwnProperty("height"))
3429
- object.height = message.height;
3430
- return object;
3431
- };
3432
-
3433
- /**
3434
- * Converts this GetBestBlockHeightResponse to JSON.
3435
- * @function toJSON
3436
- * @memberof org.dash.platform.dapi.v0.GetBestBlockHeightResponse
3437
- * @instance
3438
- * @returns {Object.<string,*>} JSON object
3439
- */
3440
- GetBestBlockHeightResponse.prototype.toJSON = function toJSON() {
3441
- return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
3442
- };
3443
-
3444
- return GetBestBlockHeightResponse;
3445
- })();
3446
-
3447
3067
  v0.BroadcastTransactionRequest = (function() {
3448
3068
 
3449
3069
  /**