@dashevo/dapi-grpc 2.2.0-dev.2 → 3.0.0-dev.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 +4 -3
- package/build.rs +68 -7
- package/clients/drive/v0/nodejs/drive_pbjs.js +7433 -0
- package/clients/platform/v0/nodejs/platform_pbjs.js +7433 -0
- package/clients/platform/v0/nodejs/platform_protoc.js +32705 -25840
- package/clients/platform/v0/web/platform_pb.d.ts +913 -0
- package/clients/platform/v0/web/platform_pb.js +32705 -25840
- 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 +160 -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 +976 -302
- package/src/drive/client/org.dash.platform.drive.v0.rs +2 -2
- package/src/drive/wasm/org.dash.platform.dapi.v0.rs +976 -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 +1140 -424
- package/src/platform/versioning.rs +8 -0
- package/src/platform/wasm/org.dash.platform.dapi.v0.rs +1140 -424
package/Cargo.toml
CHANGED
|
@@ -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; 48] = [
|
|
77
77
|
"GetDataContractHistoryRequest",
|
|
78
78
|
"GetDataContractRequest",
|
|
79
79
|
"GetDataContractsRequest",
|
|
@@ -118,8 +118,16 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
118
118
|
"GetGroupActionsRequest",
|
|
119
119
|
"GetGroupActionSignersRequest",
|
|
120
120
|
"GetFinalizedEpochInfosRequest",
|
|
121
|
+
"GetAddressInfoRequest",
|
|
122
|
+
"GetAddressesInfosRequest",
|
|
123
|
+
"GetRecentAddressBalanceChangesRequest",
|
|
124
|
+
"GetRecentCompactedAddressBalanceChangesRequest",
|
|
121
125
|
];
|
|
122
126
|
|
|
127
|
+
const PROOF_ONLY_VERSIONED_REQUESTS: [&str; 1] = ["GetAddressesTrunkStateRequest"];
|
|
128
|
+
|
|
129
|
+
const MERK_PROOF_VERSIONED_REQUESTS: [&str; 1] = ["GetAddressesBranchStateRequest"];
|
|
130
|
+
|
|
123
131
|
// The following responses are excluded as they don't support proofs:
|
|
124
132
|
// - "GetConsensusParamsResponse"
|
|
125
133
|
// - "GetStatusResponse"
|
|
@@ -128,7 +136,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
128
136
|
// - "GetIdentityByNonUniquePublicKeyHashResponse"
|
|
129
137
|
//
|
|
130
138
|
// "GetEvonodesProposedEpochBlocksResponse" is used for 2 Requests
|
|
131
|
-
const VERSIONED_RESPONSES: [&str;
|
|
139
|
+
const VERSIONED_RESPONSES: [&str; 46] = [
|
|
132
140
|
"GetDataContractHistoryResponse",
|
|
133
141
|
"GetDataContractResponse",
|
|
134
142
|
"GetDataContractsResponse",
|
|
@@ -171,17 +179,39 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
171
179
|
"GetGroupActionsResponse",
|
|
172
180
|
"GetGroupActionSignersResponse",
|
|
173
181
|
"GetFinalizedEpochInfosResponse",
|
|
182
|
+
"GetAddressInfoResponse",
|
|
183
|
+
"GetAddressesInfosResponse",
|
|
184
|
+
"GetRecentAddressBalanceChangesResponse",
|
|
185
|
+
"GetRecentCompactedAddressBalanceChangesResponse",
|
|
174
186
|
];
|
|
175
187
|
|
|
188
|
+
const PROOF_ONLY_VERSIONED_RESPONSES: [&str; 1] = ["GetAddressesTrunkStateResponse"];
|
|
189
|
+
|
|
190
|
+
const MERK_PROOF_VERSIONED_RESPONSES: [&str; 1] = ["GetAddressesBranchStateResponse"];
|
|
191
|
+
|
|
176
192
|
check_unique(&VERSIONED_REQUESTS).expect("VERSIONED_REQUESTS");
|
|
177
193
|
check_unique(&VERSIONED_RESPONSES).expect("VERSIONED_RESPONSES");
|
|
194
|
+
check_unique(&PROOF_ONLY_VERSIONED_REQUESTS).expect("PROOF_ONLY_VERSIONED_REQUESTS");
|
|
195
|
+
check_unique(&PROOF_ONLY_VERSIONED_RESPONSES).expect("PROOF_ONLY_VERSIONED_RESPONSES");
|
|
196
|
+
check_unique(&MERK_PROOF_VERSIONED_REQUESTS).expect("MERK_PROOF_VERSIONED_REQUESTS");
|
|
197
|
+
check_unique(&MERK_PROOF_VERSIONED_RESPONSES).expect("MERK_PROOF_VERSIONED_RESPONSES");
|
|
178
198
|
|
|
179
199
|
// Derive VersionedGrpcMessage on requests
|
|
180
200
|
for msg in VERSIONED_REQUESTS {
|
|
181
201
|
platform = platform
|
|
182
202
|
.message_attribute(
|
|
183
203
|
msg,
|
|
184
|
-
r#"#[derive(::
|
|
204
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage)]"#,
|
|
205
|
+
)
|
|
206
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Derive ProofOnlyVersionedGrpcMessage on requests
|
|
210
|
+
for msg in PROOF_ONLY_VERSIONED_REQUESTS {
|
|
211
|
+
platform = platform
|
|
212
|
+
.message_attribute(
|
|
213
|
+
msg,
|
|
214
|
+
r#"#[derive(::dash_platform_macros::ProofOnlyVersionedGrpcMessage)]"#,
|
|
185
215
|
)
|
|
186
216
|
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
187
217
|
}
|
|
@@ -191,13 +221,44 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
191
221
|
platform = platform
|
|
192
222
|
.message_attribute(
|
|
193
223
|
msg,
|
|
194
|
-
r#"#[derive(::
|
|
224
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::VersionedGrpcResponse)]"#,
|
|
225
|
+
)
|
|
226
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Derive VersionedGrpcMessage and ProofOnlyVersionedGrpcResponse on responses
|
|
230
|
+
for msg in PROOF_ONLY_VERSIONED_RESPONSES {
|
|
231
|
+
platform = platform
|
|
232
|
+
.message_attribute(
|
|
233
|
+
msg,
|
|
234
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::ProofOnlyVersionedGrpcResponse)]"#,
|
|
235
|
+
)
|
|
236
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// Derive VersionedGrpcMessage on merk proof requests
|
|
240
|
+
for msg in MERK_PROOF_VERSIONED_REQUESTS {
|
|
241
|
+
platform = platform
|
|
242
|
+
.message_attribute(
|
|
243
|
+
msg,
|
|
244
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage)]"#,
|
|
245
|
+
)
|
|
246
|
+
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Derive VersionedGrpcMessage and MerkProofVersionedGrpcResponse on responses
|
|
250
|
+
for msg in MERK_PROOF_VERSIONED_RESPONSES {
|
|
251
|
+
platform = platform
|
|
252
|
+
.message_attribute(
|
|
253
|
+
msg,
|
|
254
|
+
r#"#[derive(::dash_platform_macros::VersionedGrpcMessage,::dash_platform_macros::MerkProofVersionedGrpcResponse)]"#,
|
|
195
255
|
)
|
|
196
256
|
.message_attribute(msg, r#"#[grpc_versions(0)]"#);
|
|
197
257
|
}
|
|
198
258
|
|
|
199
259
|
// All messages can be mocked.
|
|
200
|
-
let platform =
|
|
260
|
+
let platform =
|
|
261
|
+
platform.message_attribute(".", r#"#[derive( ::dash_platform_macros::Mockable)]"#);
|
|
201
262
|
|
|
202
263
|
let platform = platform
|
|
203
264
|
.type_attribute(
|
|
@@ -232,7 +293,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
232
293
|
|
|
233
294
|
fn configure_drive(drive: MappingConfig) -> MappingConfig {
|
|
234
295
|
drive
|
|
235
|
-
.message_attribute(".", r#"#[derive( ::
|
|
296
|
+
.message_attribute(".", r#"#[derive( ::dash_platform_macros::Mockable)]"#)
|
|
236
297
|
.type_attribute(
|
|
237
298
|
".",
|
|
238
299
|
r#"#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]"#,
|
|
@@ -267,7 +328,7 @@ fn check_unique(messages: &[&'static str]) -> Result<(), String> {
|
|
|
267
328
|
|
|
268
329
|
fn configure_core(core: MappingConfig) -> MappingConfig {
|
|
269
330
|
// All messages can be mocked.
|
|
270
|
-
let core = core.message_attribute(".", r#"#[derive(::
|
|
331
|
+
let core = core.message_attribute(".", r#"#[derive(::dash_platform_macros::Mockable)]"#);
|
|
271
332
|
|
|
272
333
|
// Serde support
|
|
273
334
|
let core = core.type_attribute(
|