@dashevo/dapi-grpc 2.1.3 → 3.0.0-dev.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 +5 -4
- package/build.rs +64 -7
- package/clients/drive/v0/nodejs/drive_pbjs.js +4287 -0
- package/clients/platform/v0/nodejs/platform_pbjs.js +4287 -0
- package/clients/platform/v0/nodejs/platform_protoc.js +3985 -1
- package/clients/platform/v0/web/platform_pb.d.ts +530 -0
- package/clients/platform/v0/web/platform_pb.js +3985 -1
- package/clients/platform/v0/web/platform_pb_service.d.ts +76 -0
- package/clients/platform/v0/web/platform_pb_service.js +160 -0
- package/package.json +2 -2
- package/protos/platform/v0/platform.proto +96 -0
- package/src/core/client/org.dash.platform.dapi.v0.rs +29 -29
- package/src/core/wasm/org.dash.platform.dapi.v0.rs +29 -29
- package/src/drive/client/org.dash.platform.dapi.v0.rs +692 -302
- package/src/drive/client/org.dash.platform.drive.v0.rs +2 -2
- package/src/drive/wasm/org.dash.platform.dapi.v0.rs +692 -302
- package/src/drive/wasm/org.dash.platform.drive.v0.rs +2 -2
- package/src/lib.rs +3 -1
- package/src/platform/client/org.dash.platform.dapi.v0.rs +842 -424
- package/src/platform/versioning.rs +8 -0
- package/src/platform/wasm/org.dash.platform.dapi.v0.rs +842 -424
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 =
|
|
4
|
+
version.workspace = true
|
|
5
5
|
authors = [
|
|
6
6
|
"Samuel Westrich <sam@dash.org>",
|
|
7
7
|
"Igor Markin <igor.markin@dash.org>",
|
|
@@ -46,7 +46,7 @@ futures-core = "0.3.30"
|
|
|
46
46
|
serde = { version = "1.0.219", optional = true, features = ["derive"] }
|
|
47
47
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
48
48
|
serde_json = { version = "1.0", optional = true }
|
|
49
|
-
|
|
49
|
+
dash-platform-macros = { path = "../rs-dash-platform-macros" }
|
|
50
50
|
platform-version = { path = "../rs-platform-version" }
|
|
51
51
|
tonic-prost = { version = "0.14.2" }
|
|
52
52
|
|
|
@@ -81,7 +81,8 @@ path = "clients/platform/v0/rust/platform_example.rs"
|
|
|
81
81
|
[package.metadata.cargo-machete]
|
|
82
82
|
ignored = [
|
|
83
83
|
"platform-version",
|
|
84
|
-
"serde_bytes",
|
|
85
84
|
"futures-core",
|
|
86
|
-
"
|
|
85
|
+
"tonic-prost-build",
|
|
86
|
+
"getrandom", # Ignore getrandom as we need it to enable `js` feature
|
|
87
|
+
"dash-platform-macros", # used in build.rs
|
|
87
88
|
]
|
package/build.rs
CHANGED
|
@@ -73,7 +73,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
73
73
|
// Derive features for versioned messages
|
|
74
74
|
//
|
|
75
75
|
// "GetConsensusParamsRequest" is excluded as this message does not support proofs
|
|
76
|
-
const VERSIONED_REQUESTS: [&str;
|
|
76
|
+
const VERSIONED_REQUESTS: [&str; 46] = [
|
|
77
77
|
"GetDataContractHistoryRequest",
|
|
78
78
|
"GetDataContractRequest",
|
|
79
79
|
"GetDataContractsRequest",
|
|
@@ -118,8 +118,14 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
118
118
|
"GetGroupActionsRequest",
|
|
119
119
|
"GetGroupActionSignersRequest",
|
|
120
120
|
"GetFinalizedEpochInfosRequest",
|
|
121
|
+
"GetAddressInfoRequest",
|
|
122
|
+
"GetAddressesInfosRequest",
|
|
121
123
|
];
|
|
122
124
|
|
|
125
|
+
const PROOF_ONLY_VERSIONED_REQUESTS: [&str; 1] = ["GetAddressesTrunkStateRequest"];
|
|
126
|
+
|
|
127
|
+
const MERK_PROOF_VERSIONED_REQUESTS: [&str; 1] = ["GetAddressesBranchStateRequest"];
|
|
128
|
+
|
|
123
129
|
// The following responses are excluded as they don't support proofs:
|
|
124
130
|
// - "GetConsensusParamsResponse"
|
|
125
131
|
// - "GetStatusResponse"
|
|
@@ -128,7 +134,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
128
134
|
// - "GetIdentityByNonUniquePublicKeyHashResponse"
|
|
129
135
|
//
|
|
130
136
|
// "GetEvonodesProposedEpochBlocksResponse" is used for 2 Requests
|
|
131
|
-
const VERSIONED_RESPONSES: [&str;
|
|
137
|
+
const VERSIONED_RESPONSES: [&str; 44] = [
|
|
132
138
|
"GetDataContractHistoryResponse",
|
|
133
139
|
"GetDataContractResponse",
|
|
134
140
|
"GetDataContractsResponse",
|
|
@@ -171,17 +177,37 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
171
177
|
"GetGroupActionsResponse",
|
|
172
178
|
"GetGroupActionSignersResponse",
|
|
173
179
|
"GetFinalizedEpochInfosResponse",
|
|
180
|
+
"GetAddressInfoResponse",
|
|
181
|
+
"GetAddressesInfosResponse",
|
|
174
182
|
];
|
|
175
183
|
|
|
184
|
+
const PROOF_ONLY_VERSIONED_RESPONSES: [&str; 1] = ["GetAddressesTrunkStateResponse"];
|
|
185
|
+
|
|
186
|
+
const MERK_PROOF_VERSIONED_RESPONSES: [&str; 1] = ["GetAddressesBranchStateResponse"];
|
|
187
|
+
|
|
176
188
|
check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS");
|
|
177
189
|
check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES");
|
|
190
|
+
check_unique(&PROOF_ONLY_VERSIONED_REQUESTS).expect("PROOF_ONLY_VERSIONED_REQUESTS");
|
|
191
|
+
check_unique(&PROOF_ONLY_VERSIONED_RESPONSES).expect("PROOF_ONLY_VERSIONED_RESPONSES");
|
|
192
|
+
check_unique(&MERK_PROOF_VERSIONED_REQUESTS).expect("MERK_PROOF_VERSIONED_REQUESTS");
|
|
193
|
+
check_unique(&MERK_PROOF_VERSIONED_RESPONSES).expect("MERK_PROOF_VERSIONED_RESPONSES");
|
|
178
194
|
|
|
179
195
|
// Derive VersionedGrpcMessage on requests
|
|
180
196
|
for msg in VERSIONED_REQUESTS {
|
|
181
197
|
platform = platform
|
|
182
198
|
.message_attribute(
|
|
183
199
|
msg,
|
|
184
|
-
r#"#[derive(::
|
|
200
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage)]"#,
|
|
201
|
+
)
|
|
202
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Derive ProofOnlyVersionedGrpcMessage on requests
|
|
206
|
+
for msg in PROOF_ONLY_VERSIONED_REQUESTS {
|
|
207
|
+
platform = platform
|
|
208
|
+
.message_attribute(
|
|
209
|
+
msg,
|
|
210
|
+
r#"#[derive(::dash_platform_macros::ProofOnlyVersionedGrpcMessage)]"#,
|
|
185
211
|
)
|
|
186
212
|
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
187
213
|
}
|
|
@@ -191,13 +217,44 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
191
217
|
platform = platform
|
|
192
218
|
.message_attribute(
|
|
193
219
|
msg,
|
|
194
|
-
r#"#[derive(::
|
|
220
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::VersionedGrpcResponse)]"#,
|
|
221
|
+
)
|
|
222
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Derive VersionedGrpcMessage and ProofOnlyVersionedGrpcResponse on responses
|
|
226
|
+
for msg in PROOF_ONLY_VERSIONED_RESPONSES {
|
|
227
|
+
platform = platform
|
|
228
|
+
.message_attribute(
|
|
229
|
+
msg,
|
|
230
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::ProofOnlyVersionedGrpcResponse)]"#,
|
|
231
|
+
)
|
|
232
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Derive VersionedGrpcMessage on merk proof requests
|
|
236
|
+
for msg in MERK_PROOF_VERSIONED_REQUESTS {
|
|
237
|
+
platform = platform
|
|
238
|
+
.message_attribute(
|
|
239
|
+
msg,
|
|
240
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage)]"#,
|
|
241
|
+
)
|
|
242
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Derive VersionedGrpcMessage and MerkProofVersionedGrpcResponse on responses
|
|
246
|
+
for msg in MERK_PROOF_VERSIONED_RESPONSES {
|
|
247
|
+
platform = platform
|
|
248
|
+
.message_attribute(
|
|
249
|
+
msg,
|
|
250
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::MerkProofVersionedGrpcResponse)]"#,
|
|
195
251
|
)
|
|
196
252
|
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
197
253
|
}
|
|
198
254
|
|
|
199
255
|
// All messages can be mocked.
|
|
200
|
-
let platform =
|
|
256
|
+
let platform =
|
|
257
|
+
platform.message_attribute(".", r#"#[derive( ::dash_platform_macros::Mockable)]"#);
|
|
201
258
|
|
|
202
259
|
let platform = platform
|
|
203
260
|
.type_attribute(
|
|
@@ -232,7 +289,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
232
289
|
|
|
233
290
|
fn configure_drive(drive: MappingConfig) -> MappingConfig {
|
|
234
291
|
drive
|
|
235
|
-
.message_attribute(".", r#"#[derive( ::
|
|
292
|
+
.message_attribute(".", r#"#[derive( ::dash_platform_macros::Mockable)]"#)
|
|
236
293
|
.type_attribute(
|
|
237
294
|
".",
|
|
238
295
|
r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
|
|
@@ -267,7 +324,7 @@ fn check_unique(messages: &[&'static str]) -> Result<(), String> {
|
|
|
267
324
|
|
|
268
325
|
fn configure_core(core: MappingConfig) -> MappingConfig {
|
|
269
326
|
// All messages can be mocked.
|
|
270
|
-
let core = core.message_attribute(".", r#"#[derive(::
|
|
327
|
+
let core = core.message_attribute(".", r#"#[derive(::dash_platform_macros::Mockable)]"#);
|
|
271
328
|
|
|
272
329
|
// Serde support
|
|
273
330
|
let core = core.type_attribute(
|