@dashevo/dapi-grpc 1.0.0-dev.5 → 1.0.0-dev.7
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 +20 -13
- package/build.rs +8 -6
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +75 -0
- package/clients/platform/v0/web/PlatformPromiseClient.js +14 -0
- package/package.json +2 -2
- package/src/core/proto/org.dash.platform.dapi.v0.rs +522 -0
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +1212 -0
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +11 -0
package/Cargo.toml
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "dapi-grpc"
|
|
3
3
|
description = "GRPC client for Dash Platform"
|
|
4
|
-
version = "1.0.0-dev.
|
|
4
|
+
version = "1.0.0-dev.7"
|
|
5
5
|
authors = [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
rust-version = "1.
|
|
13
|
+
rust-version = "1.76"
|
|
14
14
|
license = "MIT"
|
|
15
15
|
|
|
16
16
|
[features]
|
|
17
|
-
|
|
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`
|
|
21
24
|
tenderdash-proto = []
|
|
22
25
|
client = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"]
|
|
26
|
+
server = ["tonic/channel", "tonic/tls", "tonic/tls-roots", "platform"]
|
|
23
27
|
serde = ["dep:serde", "dep:serde_bytes"]
|
|
24
28
|
mocks = ["dep:serde_json"]
|
|
25
29
|
|
|
26
30
|
[dependencies]
|
|
27
|
-
prost = { version = "0.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
prost = { version = "0.12.3" }
|
|
32
|
+
futures-core = "0.3.30"
|
|
33
|
+
tonic = { version = "0.11", features = [
|
|
34
|
+
"codegen",
|
|
35
|
+
"prost",
|
|
31
36
|
], default-features = false }
|
|
32
37
|
serde = { version = "1.0.171", optional = true, features = ["derive"] }
|
|
33
38
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
34
39
|
serde_json = { version = "1.0", optional = true }
|
|
35
|
-
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci",
|
|
40
|
+
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", rev = "81d28aa0b15fc0844dfa7f7251f6949f6c6c405a", features = [
|
|
41
|
+
"grpc-server",
|
|
42
|
+
] }
|
|
36
43
|
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
|
|
37
44
|
platform-version = { path = "../rs-platform-version" }
|
|
38
45
|
|
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");
|
|
@@ -164,16 +166,16 @@ impl MappingConfig {
|
|
|
164
166
|
let protobuf_file = abs_path(&protobuf_file);
|
|
165
167
|
let out_dir = abs_path(&out_dir);
|
|
166
168
|
|
|
169
|
+
let build_server = cfg!(feature = "server");
|
|
170
|
+
let build_client = cfg!(feature = "client");
|
|
171
|
+
|
|
167
172
|
let builder = tonic_build::configure()
|
|
168
|
-
.build_server(
|
|
173
|
+
.build_server(build_server)
|
|
174
|
+
.build_client(build_client)
|
|
175
|
+
.build_transport(build_server || build_client)
|
|
169
176
|
.out_dir(out_dir.clone())
|
|
170
177
|
.protoc_arg("--experimental_allow_proto3_optional");
|
|
171
178
|
|
|
172
|
-
#[cfg(feature = "client")]
|
|
173
|
-
let builder = builder.build_client(true).build_transport(true);
|
|
174
|
-
#[cfg(not(feature = "client"))]
|
|
175
|
-
let builder = builder.build_client(false).build_transport(false);
|
|
176
|
-
|
|
177
179
|
Self {
|
|
178
180
|
protobuf_file,
|
|
179
181
|
out_dir,
|
|
@@ -48,10 +48,14 @@ const {
|
|
|
48
48
|
PBJSGetProtocolVersionUpgradeVoteStatusResponse,
|
|
49
49
|
GetProtocolVersionUpgradeStateRequest: PBJSGetProtocolVersionUpgradeStateRequest,
|
|
50
50
|
GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse,
|
|
51
|
+
GetProofsRequest: PBJSGetProofsRequest,
|
|
52
|
+
GetProofsResponse: PBJSGetProofsResponse,
|
|
51
53
|
GetIdentityContractNonceRequest: PBJSGetIdentityContractNonceRequest,
|
|
52
54
|
GetIdentityContractNonceResponse: PBJSGetIdentityContractNonceResponse,
|
|
53
55
|
GetIdentityNonceRequest: PBJSGetIdentityNonceRequest,
|
|
54
56
|
GetIdentityNonceResponse: PBJSGetIdentityNonceResponse,
|
|
57
|
+
GetIdentityKeysRequest: PBJSGetIdentityKeysRequest,
|
|
58
|
+
GetIdentityKeysResponse: PBJSGetIdentityKeysResponse,
|
|
55
59
|
},
|
|
56
60
|
},
|
|
57
61
|
},
|
|
@@ -71,8 +75,10 @@ const {
|
|
|
71
75
|
GetEpochsInfoResponse: ProtocGetEpochsInfoResponse,
|
|
72
76
|
GetProtocolVersionUpgradeVoteStatusResponse: ProtocGetProtocolVersionUpgradeVoteStatusResponse,
|
|
73
77
|
GetProtocolVersionUpgradeStateResponse: ProtocGetProtocolVersionUpgradeStateResponse,
|
|
78
|
+
GetProofsResponse: ProtocGetProofsResponse,
|
|
74
79
|
GetIdentityContractNonceResponse: ProtocGetIdentityContractNonceResponse,
|
|
75
80
|
GetIdentityNonceResponse: ProtocGetIdentityNonceResponse,
|
|
81
|
+
GetIdentityKeysResponse: ProtocGetIdentityKeysResponse,
|
|
76
82
|
} = require('./platform_protoc');
|
|
77
83
|
|
|
78
84
|
const getPlatformDefinition = require('../../../../lib/getPlatformDefinition');
|
|
@@ -143,6 +149,10 @@ class PlatformPromiseClient {
|
|
|
143
149
|
this.client.getProtocolVersionUpgradeState.bind(this.client),
|
|
144
150
|
);
|
|
145
151
|
|
|
152
|
+
this.client.getProofs = promisify(
|
|
153
|
+
this.client.getProofs.bind(this.client),
|
|
154
|
+
);
|
|
155
|
+
|
|
146
156
|
this.client.getIdentityContractNonce = promisify(
|
|
147
157
|
this.client.getIdentityContractNonce.bind(this.client),
|
|
148
158
|
);
|
|
@@ -151,6 +161,10 @@ class PlatformPromiseClient {
|
|
|
151
161
|
this.client.getIdentityNonce.bind(this.client),
|
|
152
162
|
);
|
|
153
163
|
|
|
164
|
+
this.client.getIdentityKeys = promisify(
|
|
165
|
+
this.client.getIdentityKeys.bind(this.client),
|
|
166
|
+
);
|
|
167
|
+
|
|
154
168
|
this.protocolVersion = undefined;
|
|
155
169
|
}
|
|
156
170
|
|
|
@@ -510,6 +524,38 @@ class PlatformPromiseClient {
|
|
|
510
524
|
);
|
|
511
525
|
}
|
|
512
526
|
|
|
527
|
+
/**
|
|
528
|
+
*
|
|
529
|
+
* @param {!GetProofsRequest} request
|
|
530
|
+
* @param {?Object<string, string>} metadata
|
|
531
|
+
* @param {CallOptions} [options={}]
|
|
532
|
+
* @returns {Promise<!GetProofsResponse>}
|
|
533
|
+
*/
|
|
534
|
+
getProofs(request, metadata = {}, options = {}) {
|
|
535
|
+
if (!isObject(metadata)) {
|
|
536
|
+
throw new Error('metadata must be an object');
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return this.client.getProofs(
|
|
540
|
+
request,
|
|
541
|
+
convertObjectToMetadata(metadata),
|
|
542
|
+
{
|
|
543
|
+
interceptors: [
|
|
544
|
+
jsonToProtobufInterceptorFactory(
|
|
545
|
+
jsonToProtobufFactory(
|
|
546
|
+
ProtocGetProofsResponse,
|
|
547
|
+
PBJSGetProofsResponse,
|
|
548
|
+
),
|
|
549
|
+
protobufToJsonFactory(
|
|
550
|
+
PBJSGetProofsRequest,
|
|
551
|
+
),
|
|
552
|
+
),
|
|
553
|
+
],
|
|
554
|
+
...options,
|
|
555
|
+
},
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
|
|
513
559
|
/**
|
|
514
560
|
* @param {!PBJSGetIdentityContractNonceRequest} getIdentityContractNonceRequest
|
|
515
561
|
* @param {?Object<string, string>} metadata
|
|
@@ -574,6 +620,35 @@ class PlatformPromiseClient {
|
|
|
574
620
|
);
|
|
575
621
|
}
|
|
576
622
|
|
|
623
|
+
getIdentityKeys(
|
|
624
|
+
getIdentityKeysRequest,
|
|
625
|
+
metadata = {},
|
|
626
|
+
options = {},
|
|
627
|
+
) {
|
|
628
|
+
if (!isObject(metadata)) {
|
|
629
|
+
throw new Error('metadata must be an object');
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return this.client.getIdentityKeys(
|
|
633
|
+
getIdentityKeysRequest,
|
|
634
|
+
convertObjectToMetadata(metadata),
|
|
635
|
+
{
|
|
636
|
+
interceptors: [
|
|
637
|
+
jsonToProtobufInterceptorFactory(
|
|
638
|
+
jsonToProtobufFactory(
|
|
639
|
+
ProtocGetIdentityKeysResponse,
|
|
640
|
+
PBJSGetIdentityKeysResponse,
|
|
641
|
+
),
|
|
642
|
+
protobufToJsonFactory(
|
|
643
|
+
PBJSGetIdentityKeysRequest,
|
|
644
|
+
),
|
|
645
|
+
),
|
|
646
|
+
],
|
|
647
|
+
...options,
|
|
648
|
+
},
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
|
|
577
652
|
/**
|
|
578
653
|
* @param {string} protocolVersion
|
|
579
654
|
*/
|
|
@@ -204,6 +204,20 @@ class PlatformPromiseClient {
|
|
|
204
204
|
);
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
+
/**
|
|
208
|
+
* @param {!GetIdentityKeysRequest} getIdentityKeysRequest
|
|
209
|
+
* @param {?Object<string, string>} metadata
|
|
210
|
+
* @return {Promise<!GetIdentityKeysResponse>}
|
|
211
|
+
*/
|
|
212
|
+
getIdentityKeys(getIdentityKeysRequest, metadata = {}) {
|
|
213
|
+
return promisify(
|
|
214
|
+
this.client.getIdentityKeys.bind(this.client),
|
|
215
|
+
)(
|
|
216
|
+
getIdentityKeysRequest,
|
|
217
|
+
metadata,
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
|
|
207
221
|
/**
|
|
208
222
|
* @param {string} protocolVersion
|
|
209
223
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/dapi-grpc",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.7",
|
|
4
4
|
"description": "DAPI GRPC definition file and generated clients",
|
|
5
5
|
"browser": "browser.js",
|
|
6
6
|
"main": "node.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"homepage": "https://github.com/dashevo/dapi-grpc#readme",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dashevo/grpc-common": "1.0.0-dev.
|
|
48
|
+
"@dashevo/grpc-common": "1.0.0-dev.7",
|
|
49
49
|
"@dashevo/protobufjs": "6.10.5",
|
|
50
50
|
"@grpc/grpc-js": "1.4.4",
|
|
51
51
|
"@improbable-eng/grpc-web": "^0.15.0",
|