@dashevo/dapi-grpc 0.24.0-dev.6 → 0.25.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 +39 -0
- package/README.md +3 -3
- package/browser.js +13 -5
- package/build.rs +65 -0
- package/clients/core/v0/nodejs/CorePromiseClient.js +2 -1
- package/clients/core/v0/nodejs/core_protoc.js +33 -33
- package/clients/core/v0/rust/README.md +3 -0
- package/clients/core/v0/rust/core_example.rs +14 -0
- package/clients/core/v0/web/CorePromiseClient.js +159 -0
- package/clients/core/v0/web/core_pb.d.ts +783 -0
- package/clients/core/v0/web/core_pb.js +33 -33
- package/clients/core/v0/web/core_pb_service.d.ts +161 -0
- package/clients/core/v0/web/core_pb_service.js +317 -0
- package/clients/platform/v0/nodejs/PlatformPromiseClient.js +2 -1
- package/clients/platform/v0/nodejs/platform_pbjs.js +10012 -1472
- package/clients/platform/v0/nodejs/platform_protoc.js +6811 -1243
- package/clients/platform/v0/rust/README.md +3 -0
- package/clients/platform/v0/rust/platform_example.rs +15 -0
- package/clients/platform/v0/web/PlatformPromiseClient.js +130 -0
- package/clients/platform/v0/web/platform_pb.d.ts +1312 -0
- package/clients/platform/v0/web/platform_pb.js +6811 -1243
- package/clients/platform/v0/web/platform_pb_service.d.ts +272 -0
- package/clients/platform/v0/web/platform_pb_service.js +501 -0
- package/lib/utils/parseMetadata.js +27 -0
- package/node.js +4 -0
- package/package.json +15 -3
- package/protos/platform/v0/platform.proto +157 -8
- package/scripts/build.sh +85 -79
- package/scripts/patch-protobuf-js.sh +31 -0
- package/src/lib.rs +15 -0
- package/clients/core/v0/web/core_grpc_web_pb.js +0 -499
- package/clients/platform/v0/web/platform_grpc_web_pb.js +0 -509
|
@@ -1,26 +1,40 @@
|
|
|
1
1
|
syntax = "proto3";
|
|
2
|
+
import "google/protobuf/wrappers.proto";
|
|
3
|
+
import "google/protobuf/struct.proto";
|
|
2
4
|
|
|
3
5
|
package org.dash.platform.dapi.v0;
|
|
4
6
|
|
|
7
|
+
import "google/protobuf/timestamp.proto";
|
|
8
|
+
|
|
5
9
|
service Platform {
|
|
6
10
|
rpc broadcastStateTransition (BroadcastStateTransitionRequest) returns (BroadcastStateTransitionResponse);
|
|
7
11
|
rpc getIdentity (GetIdentityRequest) returns (GetIdentityResponse);
|
|
12
|
+
rpc getIdentityKeys (GetIdentityKeysRequest) returns (GetIdentityKeysResponse);
|
|
13
|
+
// rpc getIdentitiesKeys (GetIdentitiesKeysRequest) returns (GetIdentitiesKeysResponse);
|
|
14
|
+
rpc getIdentityBalance(GetIdentityRequest) returns (GetIdentityBalanceResponse);
|
|
15
|
+
rpc getIdentityBalanceAndRevision(GetIdentityRequest)
|
|
16
|
+
returns (GetIdentityBalanceAndRevisionResponse);
|
|
8
17
|
rpc getDataContract (GetDataContractRequest) returns (GetDataContractResponse);
|
|
18
|
+
rpc getDataContracts (GetDataContractsRequest) returns (GetDataContractsResponse);
|
|
9
19
|
rpc getDocuments (GetDocumentsRequest) returns (GetDocumentsResponse);
|
|
10
20
|
rpc getIdentitiesByPublicKeyHashes (GetIdentitiesByPublicKeyHashesRequest) returns (GetIdentitiesByPublicKeyHashesResponse);
|
|
21
|
+
rpc getIdentityByPublicKeyHashes (GetIdentityByPublicKeyHashesRequest) returns (GetIdentityByPublicKeyHashesResponse);
|
|
11
22
|
rpc waitForStateTransitionResult (WaitForStateTransitionResultRequest) returns (WaitForStateTransitionResultResponse);
|
|
12
23
|
rpc getConsensusParams (GetConsensusParamsRequest) returns (GetConsensusParamsResponse);
|
|
13
24
|
}
|
|
14
25
|
|
|
15
26
|
message Proof {
|
|
16
|
-
bytes
|
|
17
|
-
bytes
|
|
27
|
+
bytes grovedb_proof = 1;
|
|
28
|
+
bytes quorum_hash = 2;
|
|
18
29
|
bytes signature = 3;
|
|
30
|
+
uint32 round = 4;
|
|
19
31
|
}
|
|
20
32
|
|
|
21
33
|
message ResponseMetadata {
|
|
22
|
-
|
|
34
|
+
uint64 height = 1;
|
|
23
35
|
uint32 core_chain_locked_height = 2;
|
|
36
|
+
uint64 time_ms = 3;
|
|
37
|
+
uint32 protocol_version = 4;
|
|
24
38
|
}
|
|
25
39
|
|
|
26
40
|
message StateTransitionBroadcastError {
|
|
@@ -48,7 +62,104 @@ message GetIdentityResponse {
|
|
|
48
62
|
ResponseMetadata metadata = 3;
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
message GetIdentityBalanceResponse {
|
|
66
|
+
google.protobuf.UInt64Value balance = 1;
|
|
67
|
+
Proof proof = 2;
|
|
68
|
+
ResponseMetadata metadata = 3;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message GetIdentityBalanceAndRevisionResponse {
|
|
72
|
+
google.protobuf.UInt64Value balance = 1;
|
|
73
|
+
google.protobuf.UInt64Value revision = 2;
|
|
74
|
+
Proof proof = 3;
|
|
75
|
+
ResponseMetadata metadata = 4;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message KeyRequestType {
|
|
79
|
+
oneof request {
|
|
80
|
+
AllKeys all_keys = 1;
|
|
81
|
+
SpecificKeys specific_keys = 2;
|
|
82
|
+
SearchKey search_key = 3;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
message AllKeys {
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
message SpecificKeys {
|
|
90
|
+
repeated uint32 key_ids = 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
message SearchKey {
|
|
94
|
+
map<uint32, SecurityLevelMap> purpose_map = 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
message SecurityLevelMap {
|
|
98
|
+
enum KeyKindRequestType {
|
|
99
|
+
CURRENT_KEY_OF_KIND_REQUEST = 0;
|
|
100
|
+
ALL_KEYS_OF_KIND_REQUEST = 1;
|
|
101
|
+
}
|
|
102
|
+
map<uint32, KeyKindRequestType> security_level_map = 1;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
message GetIdentityKeysRequest {
|
|
106
|
+
bytes identity_id = 1;
|
|
107
|
+
KeyRequestType request_type = 2;
|
|
108
|
+
google.protobuf.UInt32Value limit = 3;
|
|
109
|
+
google.protobuf.UInt32Value offset = 4;
|
|
110
|
+
bool prove = 5;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
message GetIdentityKeysResponse {
|
|
114
|
+
message Keys {
|
|
115
|
+
repeated bytes keys_bytes = 1;
|
|
116
|
+
}
|
|
117
|
+
oneof result {
|
|
118
|
+
Keys keys = 1;
|
|
119
|
+
Proof proof = 2;
|
|
120
|
+
}
|
|
121
|
+
ResponseMetadata metadata = 3;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
message GetIdentitiesKeysRequest {
|
|
126
|
+
repeated bytes identity_ids = 1;
|
|
127
|
+
KeyRequestType request_type = 2;
|
|
128
|
+
google.protobuf.UInt32Value limit = 3;
|
|
129
|
+
google.protobuf.UInt32Value offset = 4;
|
|
130
|
+
bool prove = 5;
|
|
131
|
+
|
|
132
|
+
message SecurityLevelMap {
|
|
133
|
+
enum KeyKindRequestType {
|
|
134
|
+
CURRENT_KEY_OF_KIND_REQUEST = 0;
|
|
135
|
+
}
|
|
136
|
+
map<uint32, KeyKindRequestType> security_level_map = 1;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
message GetIdentitiesKeysResponse {
|
|
141
|
+
message PublicKey {
|
|
142
|
+
bytes value = 1;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
message PublicKeyEntry {
|
|
146
|
+
bytes key = 1;
|
|
147
|
+
PublicKey value = 2;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
message PublicKeyEntries {
|
|
151
|
+
repeated PublicKeyEntry public_key_entries = 1;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
oneof result {
|
|
155
|
+
PublicKeyEntries public_keys = 1;
|
|
156
|
+
Proof proof = 2;
|
|
157
|
+
}
|
|
158
|
+
ResponseMetadata metadata = 3;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
message GetDataContractRequest {
|
|
52
163
|
bytes id = 1;
|
|
53
164
|
bool prove = 2;
|
|
54
165
|
}
|
|
@@ -59,6 +170,31 @@ message GetDataContractResponse {
|
|
|
59
170
|
ResponseMetadata metadata = 3;
|
|
60
171
|
}
|
|
61
172
|
|
|
173
|
+
message GetDataContractsRequest {
|
|
174
|
+
repeated bytes ids = 1;
|
|
175
|
+
bool prove = 2;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
message GetDataContractsResponse {
|
|
179
|
+
message DataContractValue {
|
|
180
|
+
bytes value = 1;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
message DataContractEntry {
|
|
184
|
+
bytes key = 1;
|
|
185
|
+
DataContractValue value = 2;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
message DataContracts {
|
|
189
|
+
repeated DataContractEntry data_contract_entries = 1;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
oneof result {
|
|
193
|
+
DataContracts data_contracts = 1;
|
|
194
|
+
Proof proof = 2;
|
|
195
|
+
}
|
|
196
|
+
ResponseMetadata metadata = 3;
|
|
197
|
+
}
|
|
62
198
|
message GetDocumentsRequest {
|
|
63
199
|
bytes data_contract_id = 1;
|
|
64
200
|
string document_type = 2;
|
|
@@ -68,10 +204,10 @@ message GetDocumentsRequest {
|
|
|
68
204
|
|
|
69
205
|
uint32 limit = 5;
|
|
70
206
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
207
|
+
oneof start {
|
|
208
|
+
bytes start_after = 6;
|
|
209
|
+
bytes start_at = 7;
|
|
210
|
+
}
|
|
75
211
|
|
|
76
212
|
bool prove = 8;
|
|
77
213
|
}
|
|
@@ -93,6 +229,19 @@ message GetIdentitiesByPublicKeyHashesResponse {
|
|
|
93
229
|
ResponseMetadata metadata = 3;
|
|
94
230
|
}
|
|
95
231
|
|
|
232
|
+
message GetIdentityByPublicKeyHashesRequest {
|
|
233
|
+
bytes public_key_hash = 1;
|
|
234
|
+
bool prove = 2;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
message GetIdentityByPublicKeyHashesResponse {
|
|
238
|
+
oneof result {
|
|
239
|
+
bytes identity = 1;
|
|
240
|
+
Proof proof = 2;
|
|
241
|
+
}
|
|
242
|
+
ResponseMetadata metadata = 3;
|
|
243
|
+
}
|
|
244
|
+
|
|
96
245
|
message WaitForStateTransitionResultRequest {
|
|
97
246
|
bytes state_transition_hash = 1;
|
|
98
247
|
bool prove = 2;
|
package/scripts/build.sh
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
+
# shellcheck disable=SC2250
|
|
2
3
|
|
|
3
4
|
CORE_PROTO_PATH="$PWD/protos/core/v0"
|
|
4
5
|
CORE_CLIENTS_PATH="$PWD/clients/core/v0"
|
|
@@ -18,27 +19,29 @@ PLATFORM_OBJ_C_OUT_PATH="$PLATFORM_CLIENTS_PATH/objective-c"
|
|
|
18
19
|
CORE_PYTHON_OUT_PATH="$CORE_CLIENTS_PATH/python"
|
|
19
20
|
PLATFORM_PYTHON_OUT_PATH="$PLATFORM_CLIENTS_PATH/python"
|
|
20
21
|
|
|
21
|
-
PROTOC_IMAGE="
|
|
22
|
+
PROTOC_IMAGE="rvolosatovs/protoc:4.0.0"
|
|
23
|
+
|
|
24
|
+
set -ex
|
|
22
25
|
|
|
23
26
|
#################################################
|
|
24
27
|
# Generate JavaScript client for `Core` service #
|
|
25
28
|
#################################################
|
|
26
29
|
|
|
27
|
-
rm -rf "$CORE_WEB_OUT_PATH/*"
|
|
30
|
+
rm -rf "${CORE_WEB_OUT_PATH:?}/*" || true
|
|
28
31
|
|
|
29
32
|
docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
-v "$CORE_WEB_OUT_PATH:$CORE_WEB_OUT_PATH" \
|
|
34
|
+
--rm \
|
|
35
|
+
"$PROTOC_IMAGE" \
|
|
36
|
+
--js_out="import_style=commonjs:$CORE_WEB_OUT_PATH" \
|
|
37
|
+
--ts_out="service=grpc-web:$CORE_WEB_OUT_PATH" \
|
|
38
|
+
-I="$CORE_PROTO_PATH" \
|
|
39
|
+
"core.proto"
|
|
37
40
|
|
|
38
41
|
# Clean node message classes
|
|
39
42
|
|
|
40
|
-
rm -rf "$CORE_CLIENTS_PATH/nodejs/*_protoc.js"
|
|
41
|
-
rm -rf "$CORE_CLIENTS_PATH/nodejs/*_pbjs.js"
|
|
43
|
+
rm -rf "$CORE_CLIENTS_PATH/nodejs/*_protoc.js" || true
|
|
44
|
+
rm -rf "$CORE_CLIENTS_PATH/nodejs/*_pbjs.js" || true
|
|
42
45
|
|
|
43
46
|
# Copy compiled modules with message classes
|
|
44
47
|
|
|
@@ -56,21 +59,21 @@ pbjs \
|
|
|
56
59
|
# Generate JavaScript client for `Platform` service #
|
|
57
60
|
#####################################################
|
|
58
61
|
|
|
59
|
-
rm -rf "$PLATFORM_WEB_OUT_PATH/*"
|
|
62
|
+
rm -rf "${PLATFORM_WEB_OUT_PATH:?}/*" || true
|
|
60
63
|
|
|
61
64
|
docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
-v "$PLATFORM_WEB_OUT_PATH:$PLATFORM_WEB_OUT_PATH" \
|
|
66
|
+
--rm \
|
|
67
|
+
"$PROTOC_IMAGE" \
|
|
68
|
+
--js_out="import_style=commonjs:$PLATFORM_WEB_OUT_PATH" \
|
|
69
|
+
--ts_out="service=grpc-web:$PLATFORM_WEB_OUT_PATH" \
|
|
70
|
+
-I="$PLATFORM_PROTO_PATH" \
|
|
71
|
+
"platform.proto"
|
|
69
72
|
|
|
70
73
|
# Clean node message classes
|
|
71
74
|
|
|
72
|
-
rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_protoc.js"
|
|
73
|
-
rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_pbjs.js"
|
|
75
|
+
rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_protoc.js" || true
|
|
76
|
+
rm -rf "$PLATFORM_CLIENTS_PATH/nodejs/*_pbjs.js" || true
|
|
74
77
|
|
|
75
78
|
# Copy compiled modules with message classes
|
|
76
79
|
|
|
@@ -87,98 +90,101 @@ pbjs \
|
|
|
87
90
|
# Generate Java client for `Core` #
|
|
88
91
|
###################################
|
|
89
92
|
|
|
90
|
-
rm -rf "$CORE_JAVA_OUT_PATH/*"
|
|
93
|
+
rm -rf "${CORE_JAVA_OUT_PATH:?}/*" || true
|
|
91
94
|
|
|
92
95
|
docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
-v "$CORE_JAVA_OUT_PATH:$CORE_JAVA_OUT_PATH" \
|
|
97
|
+
--rm \
|
|
98
|
+
"$PROTOC_IMAGE" \
|
|
99
|
+
--plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
|
|
100
|
+
--grpc-java_out="$CORE_JAVA_OUT_PATH" \
|
|
101
|
+
--proto_path="$CORE_PROTO_PATH" \
|
|
102
|
+
-I="$CORE_PROTO_PATH" \
|
|
103
|
+
"core.proto"
|
|
101
104
|
|
|
102
105
|
#######################################
|
|
103
106
|
# Generate Java client for `Platform` #
|
|
104
107
|
#######################################
|
|
105
108
|
|
|
106
|
-
rm -rf "$PLATFORM_JAVA_OUT_PATH/*"
|
|
109
|
+
rm -rf "${PLATFORM_JAVA_OUT_PATH:?}/*" || true
|
|
107
110
|
|
|
108
111
|
docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
-v "$PLATFORM_JAVA_OUT_PATH:$PLATFORM_JAVA_OUT_PATH" \
|
|
113
|
+
--rm \
|
|
114
|
+
"$PROTOC_IMAGE" \
|
|
115
|
+
--plugin=protoc-gen-grpc=/usr/bin/protoc-gen-grpc-java \
|
|
116
|
+
--grpc-java_out="$PLATFORM_JAVA_OUT_PATH" \
|
|
117
|
+
--proto_path="$PLATFORM_PROTO_PATH" \
|
|
118
|
+
-I="$PLATFORM_PROTO_PATH" \
|
|
119
|
+
"platform.proto"
|
|
117
120
|
|
|
118
121
|
##########################################
|
|
119
122
|
# Generate Objective-C client for `Core` #
|
|
120
123
|
##########################################
|
|
121
124
|
|
|
122
|
-
rm -rf "$CORE_OBJ_C_OUT_PATH/*"
|
|
125
|
+
rm -rf "${CORE_OBJ_C_OUT_PATH:?}/*" || true
|
|
123
126
|
|
|
124
127
|
docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
-v "$CORE_OBJ_C_OUT_PATH:$CORE_OBJ_C_OUT_PATH" \
|
|
129
|
+
--rm \
|
|
130
|
+
"$PROTOC_IMAGE" \
|
|
131
|
+
--plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
|
|
132
|
+
--objc_out="$CORE_OBJ_C_OUT_PATH" \
|
|
133
|
+
--grpc_out="$CORE_OBJ_C_OUT_PATH" \
|
|
134
|
+
--proto_path="$CORE_PROTO_PATH" \
|
|
135
|
+
-I="$CORE_PROTO_PATH" \
|
|
136
|
+
"core.proto"
|
|
134
137
|
|
|
135
138
|
##############################################
|
|
136
139
|
# Generate Objective-C client for `Platform` #
|
|
137
140
|
##############################################
|
|
138
141
|
|
|
139
|
-
rm -rf "$PLATFORM_OBJ_C_OUT_PATH/*"
|
|
142
|
+
rm -rf "${PLATFORM_OBJ_C_OUT_PATH:?}/*" || true
|
|
140
143
|
|
|
141
144
|
docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
-v "$PLATFORM_OBJ_C_OUT_PATH:$PLATFORM_OBJ_C_OUT_PATH" \
|
|
146
|
+
--rm \
|
|
147
|
+
"$PROTOC_IMAGE" \
|
|
148
|
+
--plugin=protoc-gen-grpc=/usr/bin/grpc_objective_c_plugin \
|
|
149
|
+
--objc_out="$PLATFORM_OBJ_C_OUT_PATH" \
|
|
150
|
+
--grpc_out="$PLATFORM_OBJ_C_OUT_PATH" \
|
|
151
|
+
--proto_path="$PLATFORM_PROTO_PATH" \
|
|
152
|
+
-I="$PLATFORM_PROTO_PATH" \
|
|
153
|
+
"platform.proto"
|
|
151
154
|
|
|
152
155
|
#####################################
|
|
153
156
|
# Generate Python client for `Core` #
|
|
154
157
|
#####################################
|
|
155
158
|
|
|
156
|
-
rm -rf "$CORE_PYTHON_OUT_PATH/*"
|
|
159
|
+
rm -rf "${CORE_PYTHON_OUT_PATH:?}/*" || true
|
|
157
160
|
|
|
158
161
|
docker run -v "$CORE_PROTO_PATH:$CORE_PROTO_PATH" \
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
-v "$CORE_PYTHON_OUT_PATH:$CORE_PYTHON_OUT_PATH" \
|
|
163
|
+
--rm \
|
|
164
|
+
"$PROTOC_IMAGE" \
|
|
165
|
+
--plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
|
|
166
|
+
--python_out="$CORE_PYTHON_OUT_PATH" \
|
|
167
|
+
--grpc_out="$CORE_PYTHON_OUT_PATH" \
|
|
168
|
+
--proto_path="$CORE_PROTO_PATH" \
|
|
169
|
+
-I="$CORE_PROTO_PATH" \
|
|
170
|
+
"core.proto"
|
|
168
171
|
|
|
169
172
|
#########################################
|
|
170
173
|
# Generate Python client for `Platform` #
|
|
171
174
|
#########################################
|
|
172
175
|
|
|
173
|
-
rm -rf "$PLATFORM_PYTHON_OUT_PATH/*"
|
|
176
|
+
rm -rf "${PLATFORM_PYTHON_OUT_PATH:?}/*" || true
|
|
174
177
|
|
|
175
178
|
docker run -v "$PLATFORM_PROTO_PATH:$PLATFORM_PROTO_PATH" \
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
-v "$PLATFORM_PYTHON_OUT_PATH:$PLATFORM_PYTHON_OUT_PATH" \
|
|
180
|
+
--rm \
|
|
181
|
+
"$PROTOC_IMAGE" \
|
|
182
|
+
--plugin=protoc-gen-grpc=/usr/bin/grpc_python_plugin \
|
|
183
|
+
--python_out="$PLATFORM_PYTHON_OUT_PATH" \
|
|
184
|
+
--grpc_out="$PLATFORM_PYTHON_OUT_PATH" \
|
|
185
|
+
--proto_path="$PLATFORM_PROTO_PATH" \
|
|
186
|
+
-I="$PLATFORM_PROTO_PATH" \
|
|
187
|
+
"platform.proto"
|
|
188
|
+
|
|
189
|
+
# Patch generated protobuf files
|
|
190
|
+
exec "${PWD}/scripts/patch-protobuf-js.sh"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# shellcheck disable=SC2250
|
|
3
|
+
set -e
|
|
4
|
+
|
|
5
|
+
files=$(find "$PWD/clients/core/v0/web" "$PWD/clients/core/v0/nodejs" "$PWD/clients/platform/v0/web" "$PWD/clients/platform/v0/nodejs" -name "*_pb.js" -o -name "*_protoc.js")
|
|
6
|
+
OS=$(uname)
|
|
7
|
+
|
|
8
|
+
function replace_in_file() {
|
|
9
|
+
if [[ "$OS" = 'Darwin' ]]; then
|
|
10
|
+
# for MacOS
|
|
11
|
+
sed -i '' -e "$1" "$2"
|
|
12
|
+
else
|
|
13
|
+
# for Linux and Windows
|
|
14
|
+
sed -i'' -e "$1" "$2"
|
|
15
|
+
fi
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
# Loop over the files
|
|
19
|
+
for file in $files; do
|
|
20
|
+
|
|
21
|
+
replace_in_file 's/var global = Function('\''return this'\'')();/const proto = {};/g' "$file"
|
|
22
|
+
if grep -qrE "[^a-zA-Z]Function\(" "$file"; then
|
|
23
|
+
echo "Error: Function( still present"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
replace_in_file 's/, global);/, { proto });/g' "$file"
|
|
27
|
+
if grep -qrE '(^|[^a-zA-Z."])global([^a-zA-Z]|$)' "$file"; then
|
|
28
|
+
echo "Error: global still present"
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
done
|
package/src/lib.rs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pub use prost::Message;
|
|
2
|
+
|
|
3
|
+
pub mod core {
|
|
4
|
+
#[cfg(feature = "core_v0")]
|
|
5
|
+
pub mod v0 {
|
|
6
|
+
include!("core/proto/org.dash.platform.dapi.v0.rs");
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
pub mod platform {
|
|
11
|
+
#[cfg(feature = "platform_v0")]
|
|
12
|
+
pub mod v0 {
|
|
13
|
+
include!("platform/proto/org.dash.platform.dapi.v0.rs");
|
|
14
|
+
}
|
|
15
|
+
}
|