@dashevo/dapi-grpc 3.0.1-hotfix.4 → 3.1.0-dev.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 +2 -2
- package/build.rs +29 -8
- package/eslint.config.mjs +11 -0
- package/package.json +4 -6
- package/src/lib.rs +32 -8
- package/.eslintignore +0 -3
- package/.eslintrc +0 -19
- package/lib/test/.eslintrc +0 -9
- package/src/core/client/org.dash.platform.dapi.v0.rs +0 -808
- package/src/core/wasm/org.dash.platform.dapi.v0.rs +0 -797
- package/src/drive/client/org.dash.platform.dapi.v0.rs +0 -7757
- package/src/drive/client/org.dash.platform.drive.v0.rs +0 -143
- package/src/drive/wasm/org.dash.platform.dapi.v0.rs +0 -7746
- package/src/drive/wasm/org.dash.platform.drive.v0.rs +0 -132
- package/src/platform/client/org.dash.platform.dapi.v0.rs +0 -8135
- package/src/platform/wasm/org.dash.platform.dapi.v0.rs +0 -8124
- package/test/.eslintrc +0 -9
package/Cargo.toml
CHANGED
|
@@ -39,7 +39,7 @@ serde = ["dep:serde", "dep:serde_bytes", "tenderdash-proto/serde"]
|
|
|
39
39
|
mocks = ["serde", "dep:serde_json"]
|
|
40
40
|
|
|
41
41
|
[dependencies]
|
|
42
|
-
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.5.0
|
|
42
|
+
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", tag = "v1.5.0", default-features = false }
|
|
43
43
|
|
|
44
44
|
prost = { version = "0.14" }
|
|
45
45
|
futures-core = "0.3.30"
|
|
@@ -83,6 +83,6 @@ ignored = [
|
|
|
83
83
|
"platform-version",
|
|
84
84
|
"futures-core",
|
|
85
85
|
"tonic-prost-build",
|
|
86
|
-
"getrandom",
|
|
86
|
+
"getrandom", # Ignore getrandom as we need it to enable `js` feature
|
|
87
87
|
"dash-platform-macros", # used in build.rs
|
|
88
88
|
]
|
package/build.rs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
use std::{
|
|
2
2
|
collections::HashSet,
|
|
3
|
+
env,
|
|
3
4
|
fs::{create_dir_all, remove_dir_all},
|
|
4
|
-
path::PathBuf,
|
|
5
|
+
path::{Path, PathBuf},
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
use tonic_prost_build::Builder;
|
|
@@ -13,23 +14,32 @@ const SERDE_WITH_STRING: &str =
|
|
|
13
14
|
r#"#[cfg_attr(feature = "serde", serde(with = "crate::deserialization::from_to_string"))]"#;
|
|
14
15
|
|
|
15
16
|
fn main() {
|
|
17
|
+
let output_base = resolve_output_base().unwrap_or_else(|e| {
|
|
18
|
+
eprintln!("[error] => resolve output base failed: {e}");
|
|
19
|
+
std::process::exit(1);
|
|
20
|
+
});
|
|
21
|
+
println!(
|
|
22
|
+
"cargo:rustc-env=DAPI_GRPC_OUT_DIR={}",
|
|
23
|
+
output_base.display()
|
|
24
|
+
);
|
|
25
|
+
|
|
16
26
|
#[cfg(feature = "server")]
|
|
17
|
-
generate_code(ImplType::Server);
|
|
27
|
+
generate_code(ImplType::Server, &output_base);
|
|
18
28
|
#[cfg(feature = "client")]
|
|
19
|
-
generate_code(ImplType::Client);
|
|
29
|
+
generate_code(ImplType::Client, &output_base);
|
|
20
30
|
|
|
21
31
|
if std::env::var("CARGO_CFG_TARGET_ARCH")
|
|
22
32
|
.unwrap_or_default()
|
|
23
33
|
.eq("wasm32")
|
|
24
34
|
{
|
|
25
|
-
generate_code(ImplType::Wasm);
|
|
35
|
+
generate_code(ImplType::Wasm, &output_base);
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
|
|
29
|
-
fn generate_code(typ: ImplType) {
|
|
39
|
+
fn generate_code(typ: ImplType, output_base: &Path) {
|
|
30
40
|
let core = MappingConfig::new(
|
|
31
41
|
PathBuf::from("protos/core/v0/core.proto"),
|
|
32
|
-
|
|
42
|
+
output_base.join("core"),
|
|
33
43
|
&typ,
|
|
34
44
|
);
|
|
35
45
|
|
|
@@ -39,7 +49,7 @@ fn generate_code(typ: ImplType) {
|
|
|
39
49
|
|
|
40
50
|
let platform = MappingConfig::new(
|
|
41
51
|
PathBuf::from("protos/platform/v0/platform.proto"),
|
|
42
|
-
|
|
52
|
+
output_base.join("platform"),
|
|
43
53
|
&typ,
|
|
44
54
|
);
|
|
45
55
|
|
|
@@ -49,7 +59,7 @@ fn generate_code(typ: ImplType) {
|
|
|
49
59
|
|
|
50
60
|
let drive = MappingConfig::new(
|
|
51
61
|
PathBuf::from("protos/drive/v0/drive.proto"),
|
|
52
|
-
|
|
62
|
+
output_base.join("drive"),
|
|
53
63
|
&typ,
|
|
54
64
|
);
|
|
55
65
|
|
|
@@ -60,6 +70,7 @@ fn generate_code(typ: ImplType) {
|
|
|
60
70
|
println!("cargo:rerun-if-changed=./protos");
|
|
61
71
|
println!("cargo:rerun-if-env-changed=CARGO_FEATURE_SERDE");
|
|
62
72
|
println!("cargo:rerun-if-env-changed=CARGO_CFG_TARGET_ARCH");
|
|
73
|
+
println!("cargo:rerun-if-env-changed=DAPI_GRPC_OUT_DIR");
|
|
63
74
|
}
|
|
64
75
|
|
|
65
76
|
struct MappingConfig {
|
|
@@ -462,3 +473,13 @@ fn abs_path(path: &PathBuf) -> PathBuf {
|
|
|
462
473
|
|
|
463
474
|
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(path)
|
|
464
475
|
}
|
|
476
|
+
|
|
477
|
+
/// Resolve output base directory for generated files.
|
|
478
|
+
fn resolve_output_base() -> Result<PathBuf, String> {
|
|
479
|
+
env::var("DAPI_GRPC_OUT_DIR")
|
|
480
|
+
.map(PathBuf::from)
|
|
481
|
+
.or_else(|_| env::var("OUT_DIR").map(|out_dir| PathBuf::from(out_dir).join("dapi_grpc")))
|
|
482
|
+
.map_err(|_| {
|
|
483
|
+
"OUT_DIR should be provided by Cargo; set DAPI_GRPC_OUT_DIR to override it".to_string()
|
|
484
|
+
})
|
|
485
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import baseConfig from '../../eslint/base.mjs';
|
|
2
|
+
import mochaTestConfig from '../../eslint/mocha-tests.mjs';
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
...baseConfig,
|
|
6
|
+
mochaTestConfig,
|
|
7
|
+
{
|
|
8
|
+
// Generated protobuf code - ignore clients and src generated directories
|
|
9
|
+
ignores: ['dist/**', 'node_modules/**', 'clients/**', 'src/**'],
|
|
10
|
+
},
|
|
11
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-grpc",
|
|
3
|
-
"version": "3.0.1
|
|
3
|
+
"version": "3.1.0-dev.1",
|
|
4
4
|
"description": "DAPI GRPC definition file and generated clients",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "node.js",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/dashevo/dapi-grpc#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dashevo/grpc-common": "3.0.1
|
|
48
|
+
"@dashevo/grpc-common": "3.1.0-dev.1",
|
|
49
49
|
"@dashevo/protobufjs": "6.10.5",
|
|
50
|
-
"@grpc/grpc-js": "1.
|
|
50
|
+
"@grpc/grpc-js": "^1.14.3",
|
|
51
51
|
"@improbable-eng/grpc-web": "^0.15.0",
|
|
52
52
|
"google-protobuf": "^3.12.2",
|
|
53
53
|
"long": "^5.2.0"
|
|
@@ -56,9 +56,7 @@
|
|
|
56
56
|
"chai": "^4.3.10",
|
|
57
57
|
"chai-as-promised": "^7.1.1",
|
|
58
58
|
"dirty-chai": "^2.0.1",
|
|
59
|
-
"eslint": "^
|
|
60
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
61
|
-
"eslint-plugin-import": "^2.29.0",
|
|
59
|
+
"eslint": "^9.18.0",
|
|
62
60
|
"mocha": "^11.1.0",
|
|
63
61
|
"mocha-sinon": "^2.1.2",
|
|
64
62
|
"sinon": "^17.0.1",
|
package/src/lib.rs
CHANGED
|
@@ -6,17 +6,26 @@ pub mod core {
|
|
|
6
6
|
pub mod v0 {
|
|
7
7
|
// Note: only one of the features can be analyzed at a time
|
|
8
8
|
#[cfg(all(feature = "server", not(target_arch = "wasm32")))]
|
|
9
|
-
include!(
|
|
9
|
+
include!(concat!(
|
|
10
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
11
|
+
"/core/server/org.dash.platform.dapi.v0.rs"
|
|
12
|
+
));
|
|
10
13
|
|
|
11
14
|
#[cfg(all(
|
|
12
15
|
feature = "client",
|
|
13
16
|
not(feature = "server"),
|
|
14
17
|
not(target_arch = "wasm32")
|
|
15
18
|
))]
|
|
16
|
-
include!(
|
|
19
|
+
include!(concat!(
|
|
20
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
21
|
+
"/core/client/org.dash.platform.dapi.v0.rs"
|
|
22
|
+
));
|
|
17
23
|
|
|
18
24
|
#[cfg(target_arch = "wasm32")]
|
|
19
|
-
include!(
|
|
25
|
+
include!(concat!(
|
|
26
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
27
|
+
"/core/wasm/org.dash.platform.dapi.v0.rs"
|
|
28
|
+
));
|
|
20
29
|
}
|
|
21
30
|
}
|
|
22
31
|
|
|
@@ -24,17 +33,26 @@ pub mod core {
|
|
|
24
33
|
pub mod platform {
|
|
25
34
|
pub mod v0 {
|
|
26
35
|
#[cfg(all(feature = "server", not(target_arch = "wasm32")))]
|
|
27
|
-
include!(
|
|
36
|
+
include!(concat!(
|
|
37
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
38
|
+
"/platform/server/org.dash.platform.dapi.v0.rs"
|
|
39
|
+
));
|
|
28
40
|
|
|
29
41
|
#[cfg(all(
|
|
30
42
|
feature = "client",
|
|
31
43
|
not(feature = "server"),
|
|
32
44
|
not(target_arch = "wasm32")
|
|
33
45
|
))]
|
|
34
|
-
include!(
|
|
46
|
+
include!(concat!(
|
|
47
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
48
|
+
"/platform/client/org.dash.platform.dapi.v0.rs"
|
|
49
|
+
));
|
|
35
50
|
|
|
36
51
|
#[cfg(target_arch = "wasm32")]
|
|
37
|
-
include!(
|
|
52
|
+
include!(concat!(
|
|
53
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
54
|
+
"/platform/wasm/org.dash.platform.dapi.v0.rs"
|
|
55
|
+
));
|
|
38
56
|
}
|
|
39
57
|
|
|
40
58
|
#[cfg(feature = "tenderdash-proto")]
|
|
@@ -57,14 +75,20 @@ pub(crate) mod dapi {
|
|
|
57
75
|
pub mod drive {
|
|
58
76
|
pub mod v0 {
|
|
59
77
|
#[cfg(all(feature = "server", not(target_arch = "wasm32")))]
|
|
60
|
-
include!(
|
|
78
|
+
include!(concat!(
|
|
79
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
80
|
+
"/drive/server/org.dash.platform.drive.v0.rs"
|
|
81
|
+
));
|
|
61
82
|
|
|
62
83
|
#[cfg(all(
|
|
63
84
|
feature = "client",
|
|
64
85
|
not(feature = "server"),
|
|
65
86
|
not(target_arch = "wasm32")
|
|
66
87
|
))]
|
|
67
|
-
include!(
|
|
88
|
+
include!(concat!(
|
|
89
|
+
env!("DAPI_GRPC_OUT_DIR"),
|
|
90
|
+
"/drive/client/org.dash.platform.drive.v0.rs"
|
|
91
|
+
));
|
|
68
92
|
}
|
|
69
93
|
|
|
70
94
|
#[cfg(feature = "tenderdash-proto")]
|
package/.eslintignore
DELETED
package/.eslintrc
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "airbnb-base",
|
|
3
|
-
"env": {
|
|
4
|
-
"es2020": true
|
|
5
|
-
},
|
|
6
|
-
"rules": {
|
|
7
|
-
"import/no-extraneous-dependencies": ["error", { "packageDir": "." }],
|
|
8
|
-
"no-plusplus": 0,
|
|
9
|
-
"eol-last": [
|
|
10
|
-
"error",
|
|
11
|
-
"always"
|
|
12
|
-
],
|
|
13
|
-
"class-methods-use-this": "off",
|
|
14
|
-
"curly": [
|
|
15
|
-
"error",
|
|
16
|
-
"all"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
19
|
-
}
|