@dashevo/dapi-grpc 1.0.0-pr.1694.9 → 1.0.0-pr.1825.10

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,26 +1,37 @@
1
1
  [package]
2
2
  name = "dapi-grpc"
3
3
  description = "GRPC client for Dash Platform"
4
- version = "1.0.0-pr.1694.9"
4
+ version = "1.0.0-pr.1825.10"
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
13
  rust-version = "1.76"
14
14
  license = "MIT"
15
15
 
16
16
  [features]
17
- default = ["core", "platform", "client", "serde"]
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`
24
+ # Note: client needs tls and tls-roots to connect to testnet which uses TLS.
21
25
  tenderdash-proto = []
22
- client = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"]
23
- server = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"]
26
+ client = [
27
+ "tonic/channel",
28
+ "tonic/transport",
29
+ "tonic/tls",
30
+ "tonic/tls-roots",
31
+ "tonic/tls-webpki-roots",
32
+ "platform",
33
+ ]
34
+ server = ["tonic/channel", "tonic/transport", "platform"]
24
35
  serde = ["dep:serde", "dep:serde_bytes"]
25
36
  mocks = ["dep:serde_json"]
26
37
 
@@ -28,15 +39,13 @@ mocks = ["dep:serde_json"]
28
39
  prost = { version = "0.12.3" }
29
40
  futures-core = "0.3.30"
30
41
  tonic = { version = "0.11", features = [
31
- "codegen",
32
- "prost",
42
+ "codegen",
43
+ "prost",
33
44
  ], default-features = false }
34
- serde = { version = "1.0.171", optional = true, features = ["derive"] }
45
+ serde = { version = "1.0.197", optional = true, features = ["derive"] }
35
46
  serde_bytes = { version = "0.11.12", optional = true }
36
47
  serde_json = { version = "1.0", optional = true }
37
- tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", rev = "47d4105a49a4a332d5578a91371333686c7c5b1a", features = [
38
- "grpc-server",
39
- ] }
48
+ tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", default-features = false }
40
49
  dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
41
50
  platform-version = { path = "../rs-platform-version" }
42
51
 
@@ -55,4 +64,4 @@ name = "platform_example"
55
64
  path = "clients/platform/v0/rust/platform_example.rs"
56
65
 
57
66
  [package.metadata.cargo-machete]
58
- ignored = ["platform-version", "serde_bytes"]
67
+ ignored = ["platform-version", "serde_bytes", "futures-core"]
package/build.rs CHANGED
@@ -10,6 +10,7 @@ fn main() {
10
10
  PathBuf::from("protos/core/v0/core.proto"),
11
11
  PathBuf::from("src/core/proto"),
12
12
  );
13
+
13
14
  configure_core(core)
14
15
  .generate()
15
16
  .expect("generate core proto");
@@ -18,6 +19,7 @@ fn main() {
18
19
  PathBuf::from("protos/platform/v0/platform.proto"),
19
20
  PathBuf::from("src/platform/proto"),
20
21
  );
22
+
21
23
  configure_platform(platform)
22
24
  .generate()
23
25
  .expect("generate platform proto");
@@ -37,13 +39,15 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
37
39
  // Derive features for versioned messages
38
40
  //
39
41
  // "GetConsensusParamsRequest" is excluded as this message does not support proofs
40
- const VERSIONED_REQUESTS: [&str; 15] = [
42
+ const VERSIONED_REQUESTS: [&str; 18] = [
41
43
  "GetDataContractHistoryRequest",
42
44
  "GetDataContractRequest",
43
45
  "GetDataContractsRequest",
44
46
  "GetDocumentsRequest",
45
47
  "GetIdentitiesByPublicKeyHashesRequest",
46
48
  "GetIdentitiesRequest",
49
+ "GetIdentityNonceRequest",
50
+ "GetIdentityContractNonceRequest",
47
51
  "GetIdentityBalanceAndRevisionRequest",
48
52
  "GetIdentityBalanceRequest",
49
53
  "GetIdentityByPublicKeyHashRequest",
@@ -53,10 +57,11 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
53
57
  "WaitForStateTransitionResultRequest",
54
58
  "GetProtocolVersionUpgradeStateRequest",
55
59
  "GetProtocolVersionUpgradeVoteStatusRequest",
60
+ "GetPathElementsRequest",
56
61
  ];
57
62
 
58
63
  // "GetConsensusParamsResponse" is excluded as this message does not support proofs
59
- const VERSIONED_RESPONSES: [&str; 16] = [
64
+ const VERSIONED_RESPONSES: [&str; 19] = [
60
65
  "GetDataContractHistoryResponse",
61
66
  "GetDataContractResponse",
62
67
  "GetDataContractsResponse",
@@ -65,6 +70,8 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
65
70
  "GetIdentitiesResponse",
66
71
  "GetIdentityBalanceAndRevisionResponse",
67
72
  "GetIdentityBalanceResponse",
73
+ "GetIdentityNonceResponse",
74
+ "GetIdentityContractNonceResponse",
68
75
  "GetIdentityByPublicKeyHashResponse",
69
76
  "GetIdentityKeysResponse",
70
77
  "GetIdentityResponse",
@@ -73,6 +80,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
73
80
  "GetEpochsInfoResponse",
74
81
  "GetProtocolVersionUpgradeStateResponse",
75
82
  "GetProtocolVersionUpgradeVoteStatusResponse",
83
+ "GetPathElementsResponse",
76
84
  ];
77
85
 
78
86
  // Derive VersionedGrpcMessage on requests
@@ -24,8 +24,10 @@ 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,
31
33
  BroadcastTransactionRequest: PBJSBroadcastTransactionRequest,
@@ -46,7 +48,8 @@ const {
46
48
  } = require('./core_pbjs');
47
49
 
48
50
  const {
49
- GetStatusResponse: ProtocGetStatusResponse,
51
+ GetBlockchainStatusResponse: ProtocGetBlockchainStatusResponse,
52
+ GetMasternodeStatusResponse: ProtocGetMasternodeStatusResponse,
50
53
  GetBlockResponse: ProtocGetBlockResponse,
51
54
  BroadcastTransactionResponse: ProtocBroadcastTransactionResponse,
52
55
  GetTransactionResponse: ProtocGetTransactionResponse,
@@ -79,8 +82,12 @@ class CorePromiseClient {
79
82
 
80
83
  this.client = new CoreNodeJSClient(strippedHostname, credentials, options);
81
84
 
82
- this.client.getStatus = promisify(
83
- this.client.getStatus.bind(this.client),
85
+ this.client.getBlockchainStatus = promisify(
86
+ this.client.getBlockchainStatus.bind(this.client),
87
+ );
88
+
89
+ this.client.getMasternodeStatus = promisify(
90
+ this.client.getMasternodeStatus.bind(this.client),
84
91
  );
85
92
 
86
93
  this.client.getBlock = promisify(
@@ -101,28 +108,28 @@ class CorePromiseClient {
101
108
  }
102
109
 
103
110
  /**
104
- * @param {!GetStatusRequest} getStatusRequest
111
+ * @param {!GetBlockchainStatusRequest} getBlockchainStatusRequest
105
112
  * @param {?Object<string, string>} metadata
106
113
  * @param {CallOptions} [options={}]
107
- * @return {Promise<!GetStatusResponse>}
114
+ * @return {Promise<!GetBlockchainStatusResponse>}
108
115
  */
109
- getStatus(getStatusRequest, metadata = {}, options = {}) {
116
+ getBlockchainStatus(getBlockchainStatusRequest, metadata = {}, options = {}) {
110
117
  if (!isObject(metadata)) {
111
118
  throw new Error('metadata must be an object');
112
119
  }
113
120
 
114
- return this.client.getStatus(
115
- getStatusRequest,
121
+ return this.client.getBlockchainStatus(
122
+ getBlockchainStatusRequest,
116
123
  convertObjectToMetadata(metadata),
117
124
  {
118
125
  interceptors: [
119
126
  jsonToProtobufInterceptorFactory(
120
127
  jsonToProtobufFactory(
121
- ProtocGetStatusResponse,
122
- PBJSGetStatusResponse,
128
+ ProtocGetBlockchainStatusResponse,
129
+ PBJSGetBlockchainStatusResponse,
123
130
  ),
124
131
  protobufToJsonFactory(
125
- PBJSGetStatusRequest,
132
+ PBJSGetBlockchainStatusRequest,
126
133
  ),
127
134
  ),
128
135
  ],
@@ -162,6 +169,37 @@ class CorePromiseClient {
162
169
  );
163
170
  }
164
171
 
172
+ /**
173
+ * @param {!GetMasternodeStatusRequest} getMasternodeStatusRequest
174
+ * @param {?Object<string, string>} metadata
175
+ * @param {CallOptions} [options={}]
176
+ * @return {Promise<!GetMasternodeStatusResponse>}
177
+ */
178
+ getMasternodeStatus(getMasternodeStatusRequest, metadata = {}, options = {}) {
179
+ if (!isObject(metadata)) {
180
+ throw new Error('metadata must be an object');
181
+ }
182
+
183
+ return this.client.getMasternodeStatus(
184
+ getMasternodeStatusRequest,
185
+ convertObjectToMetadata(metadata),
186
+ {
187
+ interceptors: [
188
+ jsonToProtobufInterceptorFactory(
189
+ jsonToProtobufFactory(
190
+ ProtocGetMasternodeStatusResponse,
191
+ PBJSGetMasternodeStatusResponse,
192
+ ),
193
+ protobufToJsonFactory(
194
+ PBJSGetMasternodeStatusRequest,
195
+ ),
196
+ ),
197
+ ],
198
+ ...options,
199
+ },
200
+ );
201
+ }
202
+
165
203
  /**
166
204
  * @param {!BroadcastTransactionRequest} broadcastTransactionRequest
167
205
  * @param {?Object<string, string>} metadata