@dashevo/dapi-grpc 1.0.0-pr.1937.B.3 → 1.0.0-rc.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 +4 -2
- package/build.rs +40 -2
- package/clients/platform/v0/nodejs/platform_pbjs.js +11068 -61
- package/clients/platform/v0/nodejs/platform_protoc.js +20266 -9012
- package/clients/platform/v0/web/platform_pb.d.ts +1482 -0
- package/clients/platform/v0/web/platform_pb.js +20266 -9012
- package/clients/platform/v0/web/platform_pb_service.d.ts +114 -0
- package/clients/platform/v0/web/platform_pb_service.js +240 -0
- package/package.json +2 -2
- package/protos/platform/v0/platform.proto +487 -148
- package/src/mock/serde_mockable.rs +105 -0
- package/src/mock.rs +62 -0
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +1 -1
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-
|
|
4
|
+
version = "1.0.0-rc.1"
|
|
5
5
|
authors = [
|
|
6
6
|
"Samuel Westrich <sam@dash.org>",
|
|
7
7
|
"Igor Markin <igor.markin@dash.org>",
|
|
@@ -42,7 +42,9 @@ tonic = { version = "0.11", features = [
|
|
|
42
42
|
serde = { version = "1.0.197", optional = true, features = ["derive"] }
|
|
43
43
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
44
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
|
|
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
|
+
] }
|
|
46
48
|
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
|
|
47
49
|
platform-version = { path = "../rs-platform-version" }
|
|
48
50
|
|
package/build.rs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
use std::{
|
|
2
|
+
collections::HashSet,
|
|
2
3
|
fs::{create_dir_all, remove_dir_all},
|
|
3
4
|
path::PathBuf,
|
|
4
5
|
process::exit,
|
|
@@ -46,7 +47,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
46
47
|
// Derive features for versioned messages
|
|
47
48
|
//
|
|
48
49
|
// "GetConsensusParamsRequest" is excluded as this message does not support proofs
|
|
49
|
-
const VERSIONED_REQUESTS: [&str;
|
|
50
|
+
const VERSIONED_REQUESTS: [&str; 25] = [
|
|
50
51
|
"GetDataContractHistoryRequest",
|
|
51
52
|
"GetDataContractRequest",
|
|
52
53
|
"GetDataContractsRequest",
|
|
@@ -66,10 +67,16 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
66
67
|
"GetProtocolVersionUpgradeVoteStatusRequest",
|
|
67
68
|
"GetPathElementsRequest",
|
|
68
69
|
"GetIdentitiesContractKeysRequest",
|
|
70
|
+
"GetPrefundedSpecializedBalanceRequest",
|
|
71
|
+
"GetContestedResourcesRequest",
|
|
72
|
+
"GetContestedResourceVoteStateRequest",
|
|
73
|
+
"GetContestedResourceVotersForIdentityRequest",
|
|
74
|
+
"GetContestedResourceIdentityVotesRequest",
|
|
75
|
+
"GetVotePollsByEndDateRequest",
|
|
69
76
|
];
|
|
70
77
|
|
|
71
78
|
// "GetConsensusParamsResponse" is excluded as this message does not support proofs
|
|
72
|
-
const VERSIONED_RESPONSES: [&str;
|
|
79
|
+
const VERSIONED_RESPONSES: [&str; 26] = [
|
|
73
80
|
"GetDataContractHistoryResponse",
|
|
74
81
|
"GetDataContractResponse",
|
|
75
82
|
"GetDataContractsResponse",
|
|
@@ -90,8 +97,17 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
90
97
|
"GetProtocolVersionUpgradeVoteStatusResponse",
|
|
91
98
|
"GetPathElementsResponse",
|
|
92
99
|
"GetIdentitiesContractKeysResponse",
|
|
100
|
+
"GetPrefundedSpecializedBalanceResponse",
|
|
101
|
+
"GetContestedResourcesResponse",
|
|
102
|
+
"GetContestedResourceVoteStateResponse",
|
|
103
|
+
"GetContestedResourceVotersForIdentityResponse",
|
|
104
|
+
"GetContestedResourceIdentityVotesResponse",
|
|
105
|
+
"GetVotePollsByEndDateResponse",
|
|
93
106
|
];
|
|
94
107
|
|
|
108
|
+
check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS");
|
|
109
|
+
check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES");
|
|
110
|
+
|
|
95
111
|
// Derive VersionedGrpcMessage on requests
|
|
96
112
|
for msg in VERSIONED_REQUESTS {
|
|
97
113
|
platform = platform
|
|
@@ -146,6 +162,28 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
146
162
|
platform
|
|
147
163
|
}
|
|
148
164
|
|
|
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();
|
|
169
|
+
|
|
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
|
+
|
|
149
187
|
fn configure_core(core: MappingConfig) -> MappingConfig {
|
|
150
188
|
// All messages can be mocked.
|
|
151
189
|
let core = core.message_attribute(".", r#"#[derive(::dapi_grpc_macros::Mockable)]"#);
|