@dashevo/dapi-grpc 1.0.0-pr.1694.9 → 1.0.0-pr.1825.2
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 +24 -16
- package/build.rs +10 -2
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +114 -0
- package/clients/platform/v0/nodejs/platform_pbjs.js +14806 -11646
- package/clients/platform/v0/nodejs/platform_protoc.js +9975 -6878
- package/clients/platform/v0/web/PlatformPromiseClient.js +42 -0
- package/clients/platform/v0/web/platform_pb.d.ts +413 -0
- package/clients/platform/v0/web/platform_pb.js +9975 -6878
- package/clients/platform/v0/web/platform_pb_service.d.ts +57 -0
- package/clients/platform/v0/web/platform_pb_service.js +120 -0
- package/package.json +2 -2
- package/protos/platform/v0/platform.proto +83 -0
- package/src/lib.rs +1 -0
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +519 -0
- package/test/unit/clients/platform/v0/nodejs/PlatformPromiseClient.spec.js +33 -0
package/Cargo.toml
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "dapi-grpc"
|
|
3
3
|
description = "GRPC client for Dash Platform"
|
|
4
|
-
version = "1.0.0-pr.
|
|
4
|
+
version = "1.0.0-pr.1825.2"
|
|
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
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`
|
|
24
|
+
# Note: client needs tls and tls-roots to connect to testnet which uses TLS.
|
|
21
25
|
tenderdash-proto = []
|
|
22
|
-
client = [
|
|
23
|
-
|
|
26
|
+
client = [
|
|
27
|
+
"tonic/channel",
|
|
28
|
+
"tonic/transport",
|
|
29
|
+
"tonic/tls",
|
|
30
|
+
"tonic/tls-roots",
|
|
31
|
+
"platform",
|
|
32
|
+
]
|
|
33
|
+
server = ["tonic/channel", "tonic/transport", "platform"]
|
|
24
34
|
serde = ["dep:serde", "dep:serde_bytes"]
|
|
25
35
|
mocks = ["dep:serde_json"]
|
|
26
36
|
|
|
@@ -28,15 +38,13 @@ mocks = ["dep:serde_json"]
|
|
|
28
38
|
prost = { version = "0.12.3" }
|
|
29
39
|
futures-core = "0.3.30"
|
|
30
40
|
tonic = { version = "0.11", features = [
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
"codegen",
|
|
42
|
+
"prost",
|
|
33
43
|
], default-features = false }
|
|
34
|
-
serde = { version = "1.0.
|
|
44
|
+
serde = { version = "1.0.197", optional = true, features = ["derive"] }
|
|
35
45
|
serde_bytes = { version = "0.11.12", optional = true }
|
|
36
46
|
serde_json = { version = "1.0", optional = true }
|
|
37
|
-
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci",
|
|
38
|
-
"grpc-server",
|
|
39
|
-
] }
|
|
47
|
+
tenderdash-proto = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "0.14.0-dev.12", default-features = false }
|
|
40
48
|
dapi-grpc-macros = { path = "../rs-dapi-grpc-macros" }
|
|
41
49
|
platform-version = { path = "../rs-platform-version" }
|
|
42
50
|
|
|
@@ -55,4 +63,4 @@ name = "platform_example"
|
|
|
55
63
|
path = "clients/platform/v0/rust/platform_example.rs"
|
|
56
64
|
|
|
57
65
|
[package.metadata.cargo-machete]
|
|
58
|
-
ignored = ["platform-version", "serde_bytes"]
|
|
66
|
+
ignored = ["platform-version", "serde_bytes", "futures-core"]
|
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");
|
|
@@ -37,13 +39,15 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
37
39
|
// Derive features for versioned messages
|
|
38
40
|
//
|
|
39
41
|
// "GetConsensusParamsRequest" is excluded as this message does not support proofs
|
|
40
|
-
const VERSIONED_REQUESTS: [&str;
|
|
42
|
+
const VERSIONED_REQUESTS: [&str; 18] = [
|
|
41
43
|
"GetDataContractHistoryRequest",
|
|
42
44
|
"GetDataContractRequest",
|
|
43
45
|
"GetDataContractsRequest",
|
|
44
46
|
"GetDocumentsRequest",
|
|
45
47
|
"GetIdentitiesByPublicKeyHashesRequest",
|
|
46
48
|
"GetIdentitiesRequest",
|
|
49
|
+
"GetIdentityNonceRequest",
|
|
50
|
+
"GetIdentityContractNonceRequest",
|
|
47
51
|
"GetIdentityBalanceAndRevisionRequest",
|
|
48
52
|
"GetIdentityBalanceRequest",
|
|
49
53
|
"GetIdentityByPublicKeyHashRequest",
|
|
@@ -53,10 +57,11 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
53
57
|
"WaitForStateTransitionResultRequest",
|
|
54
58
|
"GetProtocolVersionUpgradeStateRequest",
|
|
55
59
|
"GetProtocolVersionUpgradeVoteStatusRequest",
|
|
60
|
+
"GetPathElementsRequest",
|
|
56
61
|
];
|
|
57
62
|
|
|
58
63
|
// "GetConsensusParamsResponse" is excluded as this message does not support proofs
|
|
59
|
-
const VERSIONED_RESPONSES: [&str;
|
|
64
|
+
const VERSIONED_RESPONSES: [&str; 19] = [
|
|
60
65
|
"GetDataContractHistoryResponse",
|
|
61
66
|
"GetDataContractResponse",
|
|
62
67
|
"GetDataContractsResponse",
|
|
@@ -65,6 +70,8 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
65
70
|
"GetIdentitiesResponse",
|
|
66
71
|
"GetIdentityBalanceAndRevisionResponse",
|
|
67
72
|
"GetIdentityBalanceResponse",
|
|
73
|
+
"GetIdentityNonceResponse",
|
|
74
|
+
"GetIdentityContractNonceResponse",
|
|
68
75
|
"GetIdentityByPublicKeyHashResponse",
|
|
69
76
|
"GetIdentityKeysResponse",
|
|
70
77
|
"GetIdentityResponse",
|
|
@@ -73,6 +80,7 @@ fn configure_platform(mut platform: MappingConfig) -> MappingConfig {
|
|
|
73
80
|
"GetEpochsInfoResponse",
|
|
74
81
|
"GetProtocolVersionUpgradeStateResponse",
|
|
75
82
|
"GetProtocolVersionUpgradeVoteStatusResponse",
|
|
83
|
+
"GetPathElementsResponse",
|
|
76
84
|
];
|
|
77
85
|
|
|
78
86
|
// Derive VersionedGrpcMessage on requests
|
|
@@ -50,6 +50,12 @@ const {
|
|
|
50
50
|
GetProtocolVersionUpgradeStateResponse: PBJSGetProtocolVersionUpgradeStateResponse,
|
|
51
51
|
GetProofsRequest: PBJSGetProofsRequest,
|
|
52
52
|
GetProofsResponse: PBJSGetProofsResponse,
|
|
53
|
+
GetIdentityContractNonceRequest: PBJSGetIdentityContractNonceRequest,
|
|
54
|
+
GetIdentityContractNonceResponse: PBJSGetIdentityContractNonceResponse,
|
|
55
|
+
GetIdentityNonceRequest: PBJSGetIdentityNonceRequest,
|
|
56
|
+
GetIdentityNonceResponse: PBJSGetIdentityNonceResponse,
|
|
57
|
+
GetIdentityKeysRequest: PBJSGetIdentityKeysRequest,
|
|
58
|
+
GetIdentityKeysResponse: PBJSGetIdentityKeysResponse,
|
|
53
59
|
},
|
|
54
60
|
},
|
|
55
61
|
},
|
|
@@ -70,6 +76,9 @@ const {
|
|
|
70
76
|
GetProtocolVersionUpgradeVoteStatusResponse: ProtocGetProtocolVersionUpgradeVoteStatusResponse,
|
|
71
77
|
GetProtocolVersionUpgradeStateResponse: ProtocGetProtocolVersionUpgradeStateResponse,
|
|
72
78
|
GetProofsResponse: ProtocGetProofsResponse,
|
|
79
|
+
GetIdentityContractNonceResponse: ProtocGetIdentityContractNonceResponse,
|
|
80
|
+
GetIdentityNonceResponse: ProtocGetIdentityNonceResponse,
|
|
81
|
+
GetIdentityKeysResponse: ProtocGetIdentityKeysResponse,
|
|
73
82
|
} = require('./platform_protoc');
|
|
74
83
|
|
|
75
84
|
const getPlatformDefinition = require('../../../../lib/getPlatformDefinition');
|
|
@@ -144,6 +153,18 @@ class PlatformPromiseClient {
|
|
|
144
153
|
this.client.getProofs.bind(this.client),
|
|
145
154
|
);
|
|
146
155
|
|
|
156
|
+
this.client.getIdentityContractNonce = promisify(
|
|
157
|
+
this.client.getIdentityContractNonce.bind(this.client),
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
this.client.getIdentityNonce = promisify(
|
|
161
|
+
this.client.getIdentityNonce.bind(this.client),
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
this.client.getIdentityKeys = promisify(
|
|
165
|
+
this.client.getIdentityKeys.bind(this.client),
|
|
166
|
+
);
|
|
167
|
+
|
|
147
168
|
this.protocolVersion = undefined;
|
|
148
169
|
}
|
|
149
170
|
|
|
@@ -535,6 +556,99 @@ class PlatformPromiseClient {
|
|
|
535
556
|
);
|
|
536
557
|
}
|
|
537
558
|
|
|
559
|
+
/**
|
|
560
|
+
* @param {!PBJSGetIdentityContractNonceRequest} getIdentityContractNonceRequest
|
|
561
|
+
* @param {?Object<string, string>} metadata
|
|
562
|
+
* @param {CallOptions} [options={}]
|
|
563
|
+
* @return {Promise<!GetIdentityContractNonceResponse>}
|
|
564
|
+
*/
|
|
565
|
+
getIdentityContractNonce(
|
|
566
|
+
getIdentityContractNonceRequest,
|
|
567
|
+
metadata = {},
|
|
568
|
+
options = {},
|
|
569
|
+
) {
|
|
570
|
+
if (!isObject(metadata)) {
|
|
571
|
+
throw new Error('metadata must be an object');
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return this.client.getIdentityContractNonce(
|
|
575
|
+
getIdentityContractNonceRequest,
|
|
576
|
+
convertObjectToMetadata(metadata),
|
|
577
|
+
{
|
|
578
|
+
interceptors: [
|
|
579
|
+
jsonToProtobufInterceptorFactory(
|
|
580
|
+
jsonToProtobufFactory(
|
|
581
|
+
ProtocGetIdentityContractNonceResponse,
|
|
582
|
+
PBJSGetIdentityContractNonceResponse,
|
|
583
|
+
),
|
|
584
|
+
protobufToJsonFactory(
|
|
585
|
+
PBJSGetIdentityContractNonceRequest,
|
|
586
|
+
),
|
|
587
|
+
),
|
|
588
|
+
],
|
|
589
|
+
...options,
|
|
590
|
+
},
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
getIdentityNonce(
|
|
595
|
+
getIdentityNonceRequest,
|
|
596
|
+
metadata = {},
|
|
597
|
+
options = {},
|
|
598
|
+
) {
|
|
599
|
+
if (!isObject(metadata)) {
|
|
600
|
+
throw new Error('metadata must be an object');
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return this.client.getIdentityNonce(
|
|
604
|
+
getIdentityNonceRequest,
|
|
605
|
+
convertObjectToMetadata(metadata),
|
|
606
|
+
{
|
|
607
|
+
interceptors: [
|
|
608
|
+
jsonToProtobufInterceptorFactory(
|
|
609
|
+
jsonToProtobufFactory(
|
|
610
|
+
ProtocGetIdentityNonceResponse,
|
|
611
|
+
PBJSGetIdentityNonceResponse,
|
|
612
|
+
),
|
|
613
|
+
protobufToJsonFactory(
|
|
614
|
+
PBJSGetIdentityNonceRequest,
|
|
615
|
+
),
|
|
616
|
+
),
|
|
617
|
+
],
|
|
618
|
+
...options,
|
|
619
|
+
},
|
|
620
|
+
);
|
|
621
|
+
}
|
|
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
|
+
|
|
538
652
|
/**
|
|
539
653
|
* @param {string} protocolVersion
|
|
540
654
|
*/
|