pactus-grpc 1.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Pactus blockchain
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ [![codecov](https://codecov.io/gh/pactus-project/pactus/branch/main/graph/badge.svg?token=8N6N60D5UI)](https://codecov.io/gh/pactus-project/pactus)
2
+ [![Go Report Card](https://goreportcard.com/badge/github.com/pactus-project/pactus)](https://goreportcard.com/report/github.com/pactus-project/pactus)
3
+ [![Discord](https://badgen.net/badge/icon/discord?icon=discord&label)](https://discord.gg/zPqWqV85ch)
4
+
5
+ ------
6
+
7
+ # Pactus Blockchain
8
+
9
+ A full-node implementation of the Pactus blockchain in Go.
10
+
11
+ ## Install
12
+
13
+ Please check the [install](./docs/install.md) document to build and run the Pactus blockchain.
14
+
15
+ ## Contribution
16
+
17
+ Contributions to the Pactus blockchain are appreciated.
18
+ Please read the [CONTRIBUTING](./CONTRIBUTING.md) guidelines before submitting a pull request or opening an issue.
19
+
20
+ ## License
21
+
22
+ The Pactus blockchain is under MIT [license](./LICENSE).
23
+
@@ -0,0 +1,381 @@
1
+ // GENERATED CODE -- DO NOT EDIT!
2
+
3
+ 'use strict';
4
+ var grpc = require('grpc');
5
+ var blockchain_pb = require('./blockchain_pb.js');
6
+ var transaction_pb = require('./transaction_pb.js');
7
+
8
+ function serialize_pactus_GetAccountRequest(arg) {
9
+ if (!(arg instanceof blockchain_pb.GetAccountRequest)) {
10
+ throw new Error('Expected argument of type pactus.GetAccountRequest');
11
+ }
12
+ return Buffer.from(arg.serializeBinary());
13
+ }
14
+
15
+ function deserialize_pactus_GetAccountRequest(buffer_arg) {
16
+ return blockchain_pb.GetAccountRequest.deserializeBinary(new Uint8Array(buffer_arg));
17
+ }
18
+
19
+ function serialize_pactus_GetAccountResponse(arg) {
20
+ if (!(arg instanceof blockchain_pb.GetAccountResponse)) {
21
+ throw new Error('Expected argument of type pactus.GetAccountResponse');
22
+ }
23
+ return Buffer.from(arg.serializeBinary());
24
+ }
25
+
26
+ function deserialize_pactus_GetAccountResponse(buffer_arg) {
27
+ return blockchain_pb.GetAccountResponse.deserializeBinary(new Uint8Array(buffer_arg));
28
+ }
29
+
30
+ function serialize_pactus_GetBlockHashRequest(arg) {
31
+ if (!(arg instanceof blockchain_pb.GetBlockHashRequest)) {
32
+ throw new Error('Expected argument of type pactus.GetBlockHashRequest');
33
+ }
34
+ return Buffer.from(arg.serializeBinary());
35
+ }
36
+
37
+ function deserialize_pactus_GetBlockHashRequest(buffer_arg) {
38
+ return blockchain_pb.GetBlockHashRequest.deserializeBinary(new Uint8Array(buffer_arg));
39
+ }
40
+
41
+ function serialize_pactus_GetBlockHashResponse(arg) {
42
+ if (!(arg instanceof blockchain_pb.GetBlockHashResponse)) {
43
+ throw new Error('Expected argument of type pactus.GetBlockHashResponse');
44
+ }
45
+ return Buffer.from(arg.serializeBinary());
46
+ }
47
+
48
+ function deserialize_pactus_GetBlockHashResponse(buffer_arg) {
49
+ return blockchain_pb.GetBlockHashResponse.deserializeBinary(new Uint8Array(buffer_arg));
50
+ }
51
+
52
+ function serialize_pactus_GetBlockHeightRequest(arg) {
53
+ if (!(arg instanceof blockchain_pb.GetBlockHeightRequest)) {
54
+ throw new Error('Expected argument of type pactus.GetBlockHeightRequest');
55
+ }
56
+ return Buffer.from(arg.serializeBinary());
57
+ }
58
+
59
+ function deserialize_pactus_GetBlockHeightRequest(buffer_arg) {
60
+ return blockchain_pb.GetBlockHeightRequest.deserializeBinary(new Uint8Array(buffer_arg));
61
+ }
62
+
63
+ function serialize_pactus_GetBlockHeightResponse(arg) {
64
+ if (!(arg instanceof blockchain_pb.GetBlockHeightResponse)) {
65
+ throw new Error('Expected argument of type pactus.GetBlockHeightResponse');
66
+ }
67
+ return Buffer.from(arg.serializeBinary());
68
+ }
69
+
70
+ function deserialize_pactus_GetBlockHeightResponse(buffer_arg) {
71
+ return blockchain_pb.GetBlockHeightResponse.deserializeBinary(new Uint8Array(buffer_arg));
72
+ }
73
+
74
+ function serialize_pactus_GetBlockRequest(arg) {
75
+ if (!(arg instanceof blockchain_pb.GetBlockRequest)) {
76
+ throw new Error('Expected argument of type pactus.GetBlockRequest');
77
+ }
78
+ return Buffer.from(arg.serializeBinary());
79
+ }
80
+
81
+ function deserialize_pactus_GetBlockRequest(buffer_arg) {
82
+ return blockchain_pb.GetBlockRequest.deserializeBinary(new Uint8Array(buffer_arg));
83
+ }
84
+
85
+ function serialize_pactus_GetBlockResponse(arg) {
86
+ if (!(arg instanceof blockchain_pb.GetBlockResponse)) {
87
+ throw new Error('Expected argument of type pactus.GetBlockResponse');
88
+ }
89
+ return Buffer.from(arg.serializeBinary());
90
+ }
91
+
92
+ function deserialize_pactus_GetBlockResponse(buffer_arg) {
93
+ return blockchain_pb.GetBlockResponse.deserializeBinary(new Uint8Array(buffer_arg));
94
+ }
95
+
96
+ function serialize_pactus_GetBlockchainInfoRequest(arg) {
97
+ if (!(arg instanceof blockchain_pb.GetBlockchainInfoRequest)) {
98
+ throw new Error('Expected argument of type pactus.GetBlockchainInfoRequest');
99
+ }
100
+ return Buffer.from(arg.serializeBinary());
101
+ }
102
+
103
+ function deserialize_pactus_GetBlockchainInfoRequest(buffer_arg) {
104
+ return blockchain_pb.GetBlockchainInfoRequest.deserializeBinary(new Uint8Array(buffer_arg));
105
+ }
106
+
107
+ function serialize_pactus_GetBlockchainInfoResponse(arg) {
108
+ if (!(arg instanceof blockchain_pb.GetBlockchainInfoResponse)) {
109
+ throw new Error('Expected argument of type pactus.GetBlockchainInfoResponse');
110
+ }
111
+ return Buffer.from(arg.serializeBinary());
112
+ }
113
+
114
+ function deserialize_pactus_GetBlockchainInfoResponse(buffer_arg) {
115
+ return blockchain_pb.GetBlockchainInfoResponse.deserializeBinary(new Uint8Array(buffer_arg));
116
+ }
117
+
118
+ function serialize_pactus_GetConsensusInfoRequest(arg) {
119
+ if (!(arg instanceof blockchain_pb.GetConsensusInfoRequest)) {
120
+ throw new Error('Expected argument of type pactus.GetConsensusInfoRequest');
121
+ }
122
+ return Buffer.from(arg.serializeBinary());
123
+ }
124
+
125
+ function deserialize_pactus_GetConsensusInfoRequest(buffer_arg) {
126
+ return blockchain_pb.GetConsensusInfoRequest.deserializeBinary(new Uint8Array(buffer_arg));
127
+ }
128
+
129
+ function serialize_pactus_GetConsensusInfoResponse(arg) {
130
+ if (!(arg instanceof blockchain_pb.GetConsensusInfoResponse)) {
131
+ throw new Error('Expected argument of type pactus.GetConsensusInfoResponse');
132
+ }
133
+ return Buffer.from(arg.serializeBinary());
134
+ }
135
+
136
+ function deserialize_pactus_GetConsensusInfoResponse(buffer_arg) {
137
+ return blockchain_pb.GetConsensusInfoResponse.deserializeBinary(new Uint8Array(buffer_arg));
138
+ }
139
+
140
+ function serialize_pactus_GetPublicKeyRequest(arg) {
141
+ if (!(arg instanceof blockchain_pb.GetPublicKeyRequest)) {
142
+ throw new Error('Expected argument of type pactus.GetPublicKeyRequest');
143
+ }
144
+ return Buffer.from(arg.serializeBinary());
145
+ }
146
+
147
+ function deserialize_pactus_GetPublicKeyRequest(buffer_arg) {
148
+ return blockchain_pb.GetPublicKeyRequest.deserializeBinary(new Uint8Array(buffer_arg));
149
+ }
150
+
151
+ function serialize_pactus_GetPublicKeyResponse(arg) {
152
+ if (!(arg instanceof blockchain_pb.GetPublicKeyResponse)) {
153
+ throw new Error('Expected argument of type pactus.GetPublicKeyResponse');
154
+ }
155
+ return Buffer.from(arg.serializeBinary());
156
+ }
157
+
158
+ function deserialize_pactus_GetPublicKeyResponse(buffer_arg) {
159
+ return blockchain_pb.GetPublicKeyResponse.deserializeBinary(new Uint8Array(buffer_arg));
160
+ }
161
+
162
+ function serialize_pactus_GetTxPoolContentRequest(arg) {
163
+ if (!(arg instanceof blockchain_pb.GetTxPoolContentRequest)) {
164
+ throw new Error('Expected argument of type pactus.GetTxPoolContentRequest');
165
+ }
166
+ return Buffer.from(arg.serializeBinary());
167
+ }
168
+
169
+ function deserialize_pactus_GetTxPoolContentRequest(buffer_arg) {
170
+ return blockchain_pb.GetTxPoolContentRequest.deserializeBinary(new Uint8Array(buffer_arg));
171
+ }
172
+
173
+ function serialize_pactus_GetTxPoolContentResponse(arg) {
174
+ if (!(arg instanceof blockchain_pb.GetTxPoolContentResponse)) {
175
+ throw new Error('Expected argument of type pactus.GetTxPoolContentResponse');
176
+ }
177
+ return Buffer.from(arg.serializeBinary());
178
+ }
179
+
180
+ function deserialize_pactus_GetTxPoolContentResponse(buffer_arg) {
181
+ return blockchain_pb.GetTxPoolContentResponse.deserializeBinary(new Uint8Array(buffer_arg));
182
+ }
183
+
184
+ function serialize_pactus_GetValidatorAddressesRequest(arg) {
185
+ if (!(arg instanceof blockchain_pb.GetValidatorAddressesRequest)) {
186
+ throw new Error('Expected argument of type pactus.GetValidatorAddressesRequest');
187
+ }
188
+ return Buffer.from(arg.serializeBinary());
189
+ }
190
+
191
+ function deserialize_pactus_GetValidatorAddressesRequest(buffer_arg) {
192
+ return blockchain_pb.GetValidatorAddressesRequest.deserializeBinary(new Uint8Array(buffer_arg));
193
+ }
194
+
195
+ function serialize_pactus_GetValidatorAddressesResponse(arg) {
196
+ if (!(arg instanceof blockchain_pb.GetValidatorAddressesResponse)) {
197
+ throw new Error('Expected argument of type pactus.GetValidatorAddressesResponse');
198
+ }
199
+ return Buffer.from(arg.serializeBinary());
200
+ }
201
+
202
+ function deserialize_pactus_GetValidatorAddressesResponse(buffer_arg) {
203
+ return blockchain_pb.GetValidatorAddressesResponse.deserializeBinary(new Uint8Array(buffer_arg));
204
+ }
205
+
206
+ function serialize_pactus_GetValidatorByNumberRequest(arg) {
207
+ if (!(arg instanceof blockchain_pb.GetValidatorByNumberRequest)) {
208
+ throw new Error('Expected argument of type pactus.GetValidatorByNumberRequest');
209
+ }
210
+ return Buffer.from(arg.serializeBinary());
211
+ }
212
+
213
+ function deserialize_pactus_GetValidatorByNumberRequest(buffer_arg) {
214
+ return blockchain_pb.GetValidatorByNumberRequest.deserializeBinary(new Uint8Array(buffer_arg));
215
+ }
216
+
217
+ function serialize_pactus_GetValidatorRequest(arg) {
218
+ if (!(arg instanceof blockchain_pb.GetValidatorRequest)) {
219
+ throw new Error('Expected argument of type pactus.GetValidatorRequest');
220
+ }
221
+ return Buffer.from(arg.serializeBinary());
222
+ }
223
+
224
+ function deserialize_pactus_GetValidatorRequest(buffer_arg) {
225
+ return blockchain_pb.GetValidatorRequest.deserializeBinary(new Uint8Array(buffer_arg));
226
+ }
227
+
228
+ function serialize_pactus_GetValidatorResponse(arg) {
229
+ if (!(arg instanceof blockchain_pb.GetValidatorResponse)) {
230
+ throw new Error('Expected argument of type pactus.GetValidatorResponse');
231
+ }
232
+ return Buffer.from(arg.serializeBinary());
233
+ }
234
+
235
+ function deserialize_pactus_GetValidatorResponse(buffer_arg) {
236
+ return blockchain_pb.GetValidatorResponse.deserializeBinary(new Uint8Array(buffer_arg));
237
+ }
238
+
239
+
240
+ // Blockchain service defines RPC methods for interacting with the blockchain.
241
+ var BlockchainService = exports.BlockchainService = {
242
+ // GetBlock retrieves information about a block based on the provided request
243
+ // parameters.
244
+ getBlock: {
245
+ path: '/pactus.Blockchain/GetBlock',
246
+ requestStream: false,
247
+ responseStream: false,
248
+ requestType: blockchain_pb.GetBlockRequest,
249
+ responseType: blockchain_pb.GetBlockResponse,
250
+ requestSerialize: serialize_pactus_GetBlockRequest,
251
+ requestDeserialize: deserialize_pactus_GetBlockRequest,
252
+ responseSerialize: serialize_pactus_GetBlockResponse,
253
+ responseDeserialize: deserialize_pactus_GetBlockResponse,
254
+ },
255
+ // GetBlockHash retrieves the hash of a block at the specified height.
256
+ getBlockHash: {
257
+ path: '/pactus.Blockchain/GetBlockHash',
258
+ requestStream: false,
259
+ responseStream: false,
260
+ requestType: blockchain_pb.GetBlockHashRequest,
261
+ responseType: blockchain_pb.GetBlockHashResponse,
262
+ requestSerialize: serialize_pactus_GetBlockHashRequest,
263
+ requestDeserialize: deserialize_pactus_GetBlockHashRequest,
264
+ responseSerialize: serialize_pactus_GetBlockHashResponse,
265
+ responseDeserialize: deserialize_pactus_GetBlockHashResponse,
266
+ },
267
+ // GetBlockHeight retrieves the height of a block with the specified hash.
268
+ getBlockHeight: {
269
+ path: '/pactus.Blockchain/GetBlockHeight',
270
+ requestStream: false,
271
+ responseStream: false,
272
+ requestType: blockchain_pb.GetBlockHeightRequest,
273
+ responseType: blockchain_pb.GetBlockHeightResponse,
274
+ requestSerialize: serialize_pactus_GetBlockHeightRequest,
275
+ requestDeserialize: deserialize_pactus_GetBlockHeightRequest,
276
+ responseSerialize: serialize_pactus_GetBlockHeightResponse,
277
+ responseDeserialize: deserialize_pactus_GetBlockHeightResponse,
278
+ },
279
+ // GetBlockchainInfo retrieves general information about the blockchain.
280
+ getBlockchainInfo: {
281
+ path: '/pactus.Blockchain/GetBlockchainInfo',
282
+ requestStream: false,
283
+ responseStream: false,
284
+ requestType: blockchain_pb.GetBlockchainInfoRequest,
285
+ responseType: blockchain_pb.GetBlockchainInfoResponse,
286
+ requestSerialize: serialize_pactus_GetBlockchainInfoRequest,
287
+ requestDeserialize: deserialize_pactus_GetBlockchainInfoRequest,
288
+ responseSerialize: serialize_pactus_GetBlockchainInfoResponse,
289
+ responseDeserialize: deserialize_pactus_GetBlockchainInfoResponse,
290
+ },
291
+ // GetConsensusInfo retrieves information about the consensus instances.
292
+ getConsensusInfo: {
293
+ path: '/pactus.Blockchain/GetConsensusInfo',
294
+ requestStream: false,
295
+ responseStream: false,
296
+ requestType: blockchain_pb.GetConsensusInfoRequest,
297
+ responseType: blockchain_pb.GetConsensusInfoResponse,
298
+ requestSerialize: serialize_pactus_GetConsensusInfoRequest,
299
+ requestDeserialize: deserialize_pactus_GetConsensusInfoRequest,
300
+ responseSerialize: serialize_pactus_GetConsensusInfoResponse,
301
+ responseDeserialize: deserialize_pactus_GetConsensusInfoResponse,
302
+ },
303
+ // GetAccount retrieves information about an account based on the provided
304
+ // address.
305
+ getAccount: {
306
+ path: '/pactus.Blockchain/GetAccount',
307
+ requestStream: false,
308
+ responseStream: false,
309
+ requestType: blockchain_pb.GetAccountRequest,
310
+ responseType: blockchain_pb.GetAccountResponse,
311
+ requestSerialize: serialize_pactus_GetAccountRequest,
312
+ requestDeserialize: deserialize_pactus_GetAccountRequest,
313
+ responseSerialize: serialize_pactus_GetAccountResponse,
314
+ responseDeserialize: deserialize_pactus_GetAccountResponse,
315
+ },
316
+ // GetValidator retrieves information about a validator based on the provided
317
+ // address.
318
+ getValidator: {
319
+ path: '/pactus.Blockchain/GetValidator',
320
+ requestStream: false,
321
+ responseStream: false,
322
+ requestType: blockchain_pb.GetValidatorRequest,
323
+ responseType: blockchain_pb.GetValidatorResponse,
324
+ requestSerialize: serialize_pactus_GetValidatorRequest,
325
+ requestDeserialize: deserialize_pactus_GetValidatorRequest,
326
+ responseSerialize: serialize_pactus_GetValidatorResponse,
327
+ responseDeserialize: deserialize_pactus_GetValidatorResponse,
328
+ },
329
+ // GetValidatorByNumber retrieves information about a validator based on the
330
+ // provided number.
331
+ getValidatorByNumber: {
332
+ path: '/pactus.Blockchain/GetValidatorByNumber',
333
+ requestStream: false,
334
+ responseStream: false,
335
+ requestType: blockchain_pb.GetValidatorByNumberRequest,
336
+ responseType: blockchain_pb.GetValidatorResponse,
337
+ requestSerialize: serialize_pactus_GetValidatorByNumberRequest,
338
+ requestDeserialize: deserialize_pactus_GetValidatorByNumberRequest,
339
+ responseSerialize: serialize_pactus_GetValidatorResponse,
340
+ responseDeserialize: deserialize_pactus_GetValidatorResponse,
341
+ },
342
+ // GetValidatorAddresses retrieves a list of all validator addresses.
343
+ getValidatorAddresses: {
344
+ path: '/pactus.Blockchain/GetValidatorAddresses',
345
+ requestStream: false,
346
+ responseStream: false,
347
+ requestType: blockchain_pb.GetValidatorAddressesRequest,
348
+ responseType: blockchain_pb.GetValidatorAddressesResponse,
349
+ requestSerialize: serialize_pactus_GetValidatorAddressesRequest,
350
+ requestDeserialize: deserialize_pactus_GetValidatorAddressesRequest,
351
+ responseSerialize: serialize_pactus_GetValidatorAddressesResponse,
352
+ responseDeserialize: deserialize_pactus_GetValidatorAddressesResponse,
353
+ },
354
+ // GetPublicKey retrieves the public key of an account based on the provided
355
+ // address.
356
+ getPublicKey: {
357
+ path: '/pactus.Blockchain/GetPublicKey',
358
+ requestStream: false,
359
+ responseStream: false,
360
+ requestType: blockchain_pb.GetPublicKeyRequest,
361
+ responseType: blockchain_pb.GetPublicKeyResponse,
362
+ requestSerialize: serialize_pactus_GetPublicKeyRequest,
363
+ requestDeserialize: deserialize_pactus_GetPublicKeyRequest,
364
+ responseSerialize: serialize_pactus_GetPublicKeyResponse,
365
+ responseDeserialize: deserialize_pactus_GetPublicKeyResponse,
366
+ },
367
+ // GetTxPoolContent retrieves current transactions in the transaction pool.
368
+ getTxPoolContent: {
369
+ path: '/pactus.Blockchain/GetTxPoolContent',
370
+ requestStream: false,
371
+ responseStream: false,
372
+ requestType: blockchain_pb.GetTxPoolContentRequest,
373
+ responseType: blockchain_pb.GetTxPoolContentResponse,
374
+ requestSerialize: serialize_pactus_GetTxPoolContentRequest,
375
+ requestDeserialize: deserialize_pactus_GetTxPoolContentRequest,
376
+ responseSerialize: serialize_pactus_GetTxPoolContentResponse,
377
+ responseDeserialize: deserialize_pactus_GetTxPoolContentResponse,
378
+ },
379
+ };
380
+
381
+ exports.BlockchainClient = grpc.makeGenericClientConstructor(BlockchainService);