@dashevo/dapi-grpc 1.0.0-dev.14 → 1.0.0-dev.16
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 +9 -7
- package/build.rs +57 -40
- package/clients/core/v0/nodejs/CorePromiseClient.js +73 -0
- package/clients/core/v0/nodejs/core_pbjs.js +783 -14
- package/clients/core/v0/nodejs/core_protoc.js +574 -0
- package/clients/core/v0/web/CorePromiseClient.js +30 -0
- package/clients/core/v0/web/core_pb.d.ts +74 -0
- package/clients/core/v0/web/core_pb.js +574 -0
- package/clients/core/v0/web/core_pb_service.d.ts +30 -0
- package/clients/core/v0/web/core_pb_service.js +88 -0
- package/package.json +2 -2
- package/protos/core/v0/core.proto +18 -0
- package/src/lib.rs +19 -2
- package/src/core/proto/org.dash.platform.dapi.v0.rs +0 -1338
- package/src/platform/proto/org.dash.platform.dapi.v0.rs +0 -4060
|
@@ -31,6 +31,15 @@ type CoregetBlock = {
|
|
|
31
31
|
readonly responseType: typeof core_pb.GetBlockResponse;
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
type CoregetBestBlockHeight = {
|
|
35
|
+
readonly methodName: string;
|
|
36
|
+
readonly service: typeof Core;
|
|
37
|
+
readonly requestStream: false;
|
|
38
|
+
readonly responseStream: false;
|
|
39
|
+
readonly requestType: typeof core_pb.GetBestBlockHeightRequest;
|
|
40
|
+
readonly responseType: typeof core_pb.GetBestBlockHeightResponse;
|
|
41
|
+
};
|
|
42
|
+
|
|
34
43
|
type CorebroadcastTransaction = {
|
|
35
44
|
readonly methodName: string;
|
|
36
45
|
readonly service: typeof Core;
|
|
@@ -76,16 +85,27 @@ type CoresubscribeToTransactionsWithProofs = {
|
|
|
76
85
|
readonly responseType: typeof core_pb.TransactionsWithProofsResponse;
|
|
77
86
|
};
|
|
78
87
|
|
|
88
|
+
type CoresubscribeToMasternodeList = {
|
|
89
|
+
readonly methodName: string;
|
|
90
|
+
readonly service: typeof Core;
|
|
91
|
+
readonly requestStream: false;
|
|
92
|
+
readonly responseStream: true;
|
|
93
|
+
readonly requestType: typeof core_pb.MasternodeListRequest;
|
|
94
|
+
readonly responseType: typeof core_pb.MasternodeListResponse;
|
|
95
|
+
};
|
|
96
|
+
|
|
79
97
|
export class Core {
|
|
80
98
|
static readonly serviceName: string;
|
|
81
99
|
static readonly getBlockchainStatus: CoregetBlockchainStatus;
|
|
82
100
|
static readonly getMasternodeStatus: CoregetMasternodeStatus;
|
|
83
101
|
static readonly getBlock: CoregetBlock;
|
|
102
|
+
static readonly getBestBlockHeight: CoregetBestBlockHeight;
|
|
84
103
|
static readonly broadcastTransaction: CorebroadcastTransaction;
|
|
85
104
|
static readonly getTransaction: CoregetTransaction;
|
|
86
105
|
static readonly getEstimatedTransactionFee: CoregetEstimatedTransactionFee;
|
|
87
106
|
static readonly subscribeToBlockHeadersWithChainLocks: CoresubscribeToBlockHeadersWithChainLocks;
|
|
88
107
|
static readonly subscribeToTransactionsWithProofs: CoresubscribeToTransactionsWithProofs;
|
|
108
|
+
static readonly subscribeToMasternodeList: CoresubscribeToMasternodeList;
|
|
89
109
|
}
|
|
90
110
|
|
|
91
111
|
export type ServiceError = { message: string, code: number; metadata: grpc.Metadata }
|
|
@@ -147,6 +167,15 @@ export class CoreClient {
|
|
|
147
167
|
requestMessage: core_pb.GetBlockRequest,
|
|
148
168
|
callback: (error: ServiceError|null, responseMessage: core_pb.GetBlockResponse|null) => void
|
|
149
169
|
): UnaryResponse;
|
|
170
|
+
getBestBlockHeight(
|
|
171
|
+
requestMessage: core_pb.GetBestBlockHeightRequest,
|
|
172
|
+
metadata: grpc.Metadata,
|
|
173
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void
|
|
174
|
+
): UnaryResponse;
|
|
175
|
+
getBestBlockHeight(
|
|
176
|
+
requestMessage: core_pb.GetBestBlockHeightRequest,
|
|
177
|
+
callback: (error: ServiceError|null, responseMessage: core_pb.GetBestBlockHeightResponse|null) => void
|
|
178
|
+
): UnaryResponse;
|
|
150
179
|
broadcastTransaction(
|
|
151
180
|
requestMessage: core_pb.BroadcastTransactionRequest,
|
|
152
181
|
metadata: grpc.Metadata,
|
|
@@ -176,5 +205,6 @@ export class CoreClient {
|
|
|
176
205
|
): UnaryResponse;
|
|
177
206
|
subscribeToBlockHeadersWithChainLocks(requestMessage: core_pb.BlockHeadersWithChainLocksRequest, metadata?: grpc.Metadata): ResponseStream<core_pb.BlockHeadersWithChainLocksResponse>;
|
|
178
207
|
subscribeToTransactionsWithProofs(requestMessage: core_pb.TransactionsWithProofsRequest, metadata?: grpc.Metadata): ResponseStream<core_pb.TransactionsWithProofsResponse>;
|
|
208
|
+
subscribeToMasternodeList(requestMessage: core_pb.MasternodeListRequest, metadata?: grpc.Metadata): ResponseStream<core_pb.MasternodeListResponse>;
|
|
179
209
|
}
|
|
180
210
|
|
|
@@ -37,6 +37,15 @@ Core.getBlock = {
|
|
|
37
37
|
responseType: core_pb.GetBlockResponse
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
+
Core.getBestBlockHeight = {
|
|
41
|
+
methodName: "getBestBlockHeight",
|
|
42
|
+
service: Core,
|
|
43
|
+
requestStream: false,
|
|
44
|
+
responseStream: false,
|
|
45
|
+
requestType: core_pb.GetBestBlockHeightRequest,
|
|
46
|
+
responseType: core_pb.GetBestBlockHeightResponse
|
|
47
|
+
};
|
|
48
|
+
|
|
40
49
|
Core.broadcastTransaction = {
|
|
41
50
|
methodName: "broadcastTransaction",
|
|
42
51
|
service: Core,
|
|
@@ -82,6 +91,15 @@ Core.subscribeToTransactionsWithProofs = {
|
|
|
82
91
|
responseType: core_pb.TransactionsWithProofsResponse
|
|
83
92
|
};
|
|
84
93
|
|
|
94
|
+
Core.subscribeToMasternodeList = {
|
|
95
|
+
methodName: "subscribeToMasternodeList",
|
|
96
|
+
service: Core,
|
|
97
|
+
requestStream: false,
|
|
98
|
+
responseStream: true,
|
|
99
|
+
requestType: core_pb.MasternodeListRequest,
|
|
100
|
+
responseType: core_pb.MasternodeListResponse
|
|
101
|
+
};
|
|
102
|
+
|
|
85
103
|
exports.Core = Core;
|
|
86
104
|
|
|
87
105
|
function CoreClient(serviceHost, options) {
|
|
@@ -182,6 +200,37 @@ CoreClient.prototype.getBlock = function getBlock(requestMessage, metadata, call
|
|
|
182
200
|
};
|
|
183
201
|
};
|
|
184
202
|
|
|
203
|
+
CoreClient.prototype.getBestBlockHeight = function getBestBlockHeight(requestMessage, metadata, callback) {
|
|
204
|
+
if (arguments.length === 2) {
|
|
205
|
+
callback = arguments[1];
|
|
206
|
+
}
|
|
207
|
+
var client = grpc.unary(Core.getBestBlockHeight, {
|
|
208
|
+
request: requestMessage,
|
|
209
|
+
host: this.serviceHost,
|
|
210
|
+
metadata: metadata,
|
|
211
|
+
transport: this.options.transport,
|
|
212
|
+
debug: this.options.debug,
|
|
213
|
+
onEnd: function (response) {
|
|
214
|
+
if (callback) {
|
|
215
|
+
if (response.status !== grpc.Code.OK) {
|
|
216
|
+
var err = new Error(response.statusMessage);
|
|
217
|
+
err.code = response.status;
|
|
218
|
+
err.metadata = response.trailers;
|
|
219
|
+
callback(err, null);
|
|
220
|
+
} else {
|
|
221
|
+
callback(null, response.message);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return {
|
|
227
|
+
cancel: function () {
|
|
228
|
+
callback = null;
|
|
229
|
+
client.close();
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
|
|
185
234
|
CoreClient.prototype.broadcastTransaction = function broadcastTransaction(requestMessage, metadata, callback) {
|
|
186
235
|
if (arguments.length === 2) {
|
|
187
236
|
callback = arguments[1];
|
|
@@ -353,5 +402,44 @@ CoreClient.prototype.subscribeToTransactionsWithProofs = function subscribeToTra
|
|
|
353
402
|
};
|
|
354
403
|
};
|
|
355
404
|
|
|
405
|
+
CoreClient.prototype.subscribeToMasternodeList = function subscribeToMasternodeList(requestMessage, metadata) {
|
|
406
|
+
var listeners = {
|
|
407
|
+
data: [],
|
|
408
|
+
end: [],
|
|
409
|
+
status: []
|
|
410
|
+
};
|
|
411
|
+
var client = grpc.invoke(Core.subscribeToMasternodeList, {
|
|
412
|
+
request: requestMessage,
|
|
413
|
+
host: this.serviceHost,
|
|
414
|
+
metadata: metadata,
|
|
415
|
+
transport: this.options.transport,
|
|
416
|
+
debug: this.options.debug,
|
|
417
|
+
onMessage: function (responseMessage) {
|
|
418
|
+
listeners.data.forEach(function (handler) {
|
|
419
|
+
handler(responseMessage);
|
|
420
|
+
});
|
|
421
|
+
},
|
|
422
|
+
onEnd: function (status, statusMessage, trailers) {
|
|
423
|
+
listeners.status.forEach(function (handler) {
|
|
424
|
+
handler({ code: status, details: statusMessage, metadata: trailers });
|
|
425
|
+
});
|
|
426
|
+
listeners.end.forEach(function (handler) {
|
|
427
|
+
handler({ code: status, details: statusMessage, metadata: trailers });
|
|
428
|
+
});
|
|
429
|
+
listeners = null;
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
return {
|
|
433
|
+
on: function (type, handler) {
|
|
434
|
+
listeners[type].push(handler);
|
|
435
|
+
return this;
|
|
436
|
+
},
|
|
437
|
+
cancel: function () {
|
|
438
|
+
listeners = null;
|
|
439
|
+
client.close();
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
};
|
|
443
|
+
|
|
356
444
|
exports.CoreClient = CoreClient;
|
|
357
445
|
|
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.16",
|
|
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.16",
|
|
49
49
|
"@dashevo/protobufjs": "6.10.5",
|
|
50
50
|
"@grpc/grpc-js": "1.4.4",
|
|
51
51
|
"@improbable-eng/grpc-web": "^0.15.0",
|
|
@@ -6,11 +6,13 @@ service Core {
|
|
|
6
6
|
rpc getBlockchainStatus (GetBlockchainStatusRequest) returns (GetBlockchainStatusResponse);
|
|
7
7
|
rpc getMasternodeStatus (GetMasternodeStatusRequest) returns (GetMasternodeStatusResponse);
|
|
8
8
|
rpc getBlock (GetBlockRequest) returns (GetBlockResponse);
|
|
9
|
+
rpc getBestBlockHeight (GetBestBlockHeightRequest) returns (GetBestBlockHeightResponse);
|
|
9
10
|
rpc broadcastTransaction (BroadcastTransactionRequest) returns (BroadcastTransactionResponse);
|
|
10
11
|
rpc getTransaction (GetTransactionRequest) returns (GetTransactionResponse);
|
|
11
12
|
rpc getEstimatedTransactionFee (GetEstimatedTransactionFeeRequest) returns (GetEstimatedTransactionFeeResponse);
|
|
12
13
|
rpc subscribeToBlockHeadersWithChainLocks (BlockHeadersWithChainLocksRequest) returns (stream BlockHeadersWithChainLocksResponse);
|
|
13
14
|
rpc subscribeToTransactionsWithProofs (TransactionsWithProofsRequest) returns (stream TransactionsWithProofsResponse);
|
|
15
|
+
rpc subscribeToMasternodeList (MasternodeListRequest) returns (stream MasternodeListResponse);
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
message GetBlockchainStatusRequest {
|
|
@@ -100,6 +102,14 @@ message GetBlockResponse {
|
|
|
100
102
|
bytes block = 1;
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
message GetBestBlockHeightRequest {
|
|
106
|
+
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
message GetBestBlockHeightResponse {
|
|
110
|
+
uint32 height = 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
103
113
|
message BroadcastTransactionRequest {
|
|
104
114
|
bytes transaction = 1;
|
|
105
115
|
bool allow_high_fees = 2;
|
|
@@ -186,3 +196,11 @@ message RawTransactions {
|
|
|
186
196
|
message InstantSendLockMessages {
|
|
187
197
|
repeated bytes messages = 1;
|
|
188
198
|
}
|
|
199
|
+
|
|
200
|
+
message MasternodeListRequest {
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
message MasternodeListResponse {
|
|
205
|
+
bytes masternode_list_diff = 1;
|
|
206
|
+
}
|
package/src/lib.rs
CHANGED
|
@@ -4,19 +4,36 @@ pub use prost::Message;
|
|
|
4
4
|
pub mod core {
|
|
5
5
|
#![allow(non_camel_case_types)]
|
|
6
6
|
pub mod v0 {
|
|
7
|
-
|
|
7
|
+
#[cfg(all(feature = "server", not(feature = "client")))]
|
|
8
|
+
include!("core/server/org.dash.platform.dapi.v0.rs");
|
|
9
|
+
|
|
10
|
+
#[cfg(all(feature = "client", not(feature = "server")))]
|
|
11
|
+
include!("core/client/org.dash.platform.dapi.v0.rs");
|
|
12
|
+
|
|
13
|
+
#[cfg(all(feature = "server", feature = "client"))]
|
|
14
|
+
include!("core/client_server/org.dash.platform.dapi.v0.rs");
|
|
8
15
|
}
|
|
9
16
|
}
|
|
10
17
|
|
|
11
18
|
#[cfg(feature = "platform")]
|
|
12
19
|
pub mod platform {
|
|
13
20
|
pub mod v0 {
|
|
14
|
-
|
|
21
|
+
#[cfg(all(feature = "server", not(feature = "client")))]
|
|
22
|
+
include!("platform/server/org.dash.platform.dapi.v0.rs");
|
|
23
|
+
|
|
24
|
+
#[cfg(all(feature = "client", not(feature = "server")))]
|
|
25
|
+
include!("platform/client/org.dash.platform.dapi.v0.rs");
|
|
26
|
+
|
|
27
|
+
#[cfg(all(feature = "server", feature = "client"))]
|
|
28
|
+
include!("platform/client_server/org.dash.platform.dapi.v0.rs");
|
|
15
29
|
}
|
|
30
|
+
|
|
16
31
|
#[cfg(feature = "tenderdash-proto")]
|
|
17
32
|
pub use tenderdash_proto as proto;
|
|
18
33
|
|
|
34
|
+
#[cfg(any(feature = "server", feature = "client"))]
|
|
19
35
|
mod versioning;
|
|
36
|
+
#[cfg(any(feature = "server", feature = "client"))]
|
|
20
37
|
pub use versioning::{VersionedGrpcMessage, VersionedGrpcResponse};
|
|
21
38
|
}
|
|
22
39
|
|