-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.proto
More file actions
634 lines (602 loc) · 16.3 KB
/
Copy pathapi.proto
File metadata and controls
634 lines (602 loc) · 16.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
syntax = "proto3";
import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
package api_pb;
option go_package = ".;api_pb";
message NodeInfo {
message ProtocolVersion {
string p2p = 3;
string block = 1;
string app = 2;
}
ProtocolVersion protocol_version = 8;
string id = 1;
string listen_addr = 2;
string network = 3;
string version = 4;
string channels = 5;
string moniker = 6;
message Other {
string tx_index = 2;
string rpc_address = 1;
}
Other other = 7;
}
message NetInfoResponse {
bool listening = 4;
repeated string listeners = 1;
string count_peers = 2;
message Peer {
NodeInfo node_info = 4;
bool is_outbound = 1;
message ConnectionStatus {
string duration = 4;
message Monitor {
bool active = 13;
string start = 1;
string duration = 2;
string idle = 3;
string bytes = 4;
string samples = 5;
string inst_rate = 6;
string cur_rate = 7;
string avg_rate = 8;
string peak_rate = 9;
string bytes_rem = 10;
string time_rem = 11;
string progress = 12;
}
Monitor SendMonitor = 1;
Monitor RecvMonitor = 2;
message Channel {
string id = 5;
string send_queue_capacity = 1;
string send_queue_size = 2;
string priority = 3;
string recently_sent = 4;
}
repeated Channel channels = 3;
}
ConnectionStatus connection_status = 2;
string remote_ip = 3;
}
repeated Peer peers = 3;
}
message StatusResponse {
string version = 8;
string latest_block_hash = 1;
string latest_app_hash = 2;
string latest_block_height = 3;
string latest_block_time = 4;
string keep_last_states = 5;
string total_slashed = 10;
bool catching_up = 6;
string public_key = 7;
string node_id = 9;
}
message GenesisResponse {
string genesis_time = 1;
string chain_id = 2;
message ConsensusParams {
message Block {
string max_bytes = 1;
string max_gas = 2;
string time_iota_ms = 3;
}
Block block = 1;
message Evidence {
string max_age_num_blocks = 1;
string max_age_duration = 2;
}
Evidence evidence = 2;
message Validator {
repeated string public_key_types = 1;
}
Validator validator = 3;
}
ConsensusParams consensus_params = 3;
string app_hash = 4;
google.protobuf.Struct app_state = 5;
}
message MinGasPriceResponse {
string min_gas_price = 3;
}
message BlockRequest {
uint64 height = 1;
enum Field {
transactions = 0;
missed = 1;
block_reward = 2;
size = 3;
proposer = 4;
validators = 5;
evidence = 6;
}
repeated Field fields = 2;
}
message BlockResponse {
string hash = 1;
string height = 2;
string time = 3;
string transactions_count = 4;
message Transaction {
string hash = 1;
string raw_tx = 2;
string from = 3;
string nonce = 4;
string gas_price = 5;
string type = 6;
google.protobuf.Struct data = 7;
bytes payload = 8;
bytes service_data = 9;
string gas = 10;
string gas_coin = 11;
map<string, string> tags = 12;
string code = 13;
string log = 14;
}
repeated Transaction transactions = 6;
string block_reward = 7;
string size = 8;
string proposer = 9;
message Validator {
string public_key = 1;
bool signed = 2;
}
repeated Validator validators = 10;
message Evidence {
message Evidence {
string height = 1;
string time = 2;
string address = 3;
string hash = 4;
}
repeated Evidence evidence = 1;
}
Evidence evidence = 11;
repeated string missed = 12;
}
message MaxGasRequest {
uint64 height = 1;
}
message MaxGasResponse {
string max_gas = 3;
}
message AddressRequest {
string address = 1;
uint64 height = 2;
bool delegated = 4;
reserved "frozen", "total";
}
message AddressBalance {
string value = 2;
string noah_value = 3;
}
message AddressDelegatedBalance {
string value = 2;
string noah_value = 3;
string delegate_noah_value = 4;
}
message AddressResponse {
map<string, AddressBalance> balance = 1;
map<string, AddressDelegatedBalance> delegated = 3;
map<string, AddressBalance> total = 4;
string transactions_count = 2;
string noah_value = 5;
}
message AddressesRequest {
repeated string addresses = 1;
uint64 height = 2;
bool delegated = 4;
reserved "frozen", "total";
}
message AddressesResponse {
message Result {
map<string, AddressBalance> balance = 2;
map<string, AddressDelegatedBalance> delegated = 6;
map<string, AddressBalance> total = 4;
string transactions_count = 3;
string noah_value = 5;
}
map<string, Result> addresses = 3;
}
enum CandidateStatus {
_ = 0;
CandidateOff = 1;
CandidateOn = 2;
ValidatorOn = 3;
}
message CandidateRequest {
string public_key = 1;
uint64 height = 2;
}
message CandidateResponse {
string reward_address = 1;
string total_stake = 2;
string public_key = 3;
string commission = 4;
string used_slots = 7;
string uniq_users = 8;
string min_stake = 9;
message Stake {
string owner = 1;
string coin = 2;
string value = 3;
string noah_value = 4;
}
repeated Stake stakes = 5;
string status = 6;
}
message CandidatesRequest {
uint64 height = 1;
bool include_stakes = 2;
CandidateStatus status = 3;
}
message CandidatesResponse {
repeated CandidateResponse candidates = 3;
}
message CoinInfoRequest {
uint64 height = 1;
string symbol = 2;
}
message CoinInfoResponse {
string name = 1;
string symbol = 2;
string volume = 3;
string crr = 4;
string reserve_balance = 5;
}
message SendTransactionResponse {
string code = 1;
string data = 2;
string log = 3;
string hash = 4;
}
message SendTransactionRequest {
string tx = 1;
}
message TransactionResponse {
string hash = 1;
string raw_tx = 2;
string height = 3;
string index = 4;
string from = 5;
string nonce = 6;
string gas = 7;
string gas_price = 8;
string gas_coin = 9;
string type = 10;
google.protobuf.Struct data = 11;
bytes payload = 12;
map<string, string> tags = 13;
string code = 14;
string log = 15;
}
message TransactionRequest {
string hash = 1;
}
message TransactionsResponse {
repeated TransactionResponse transactions = 3;
}
message TransactionsRequest {
string query = 1;
int32 page = 2;
int32 per_page = 3;
}
message EstimateCoinBuyRequest {
string coin_to_buy = 1;
string coin_to_sell = 2;
string value_to_buy = 3;
uint64 height = 4;
}
message EstimateCoinBuyResponse {
string will_pay = 1;
string commission = 2;
}
message EstimateCoinSellRequest {
string coin_to_sell = 1;
string coin_to_buy = 2;
string value_to_sell = 3;
uint64 height = 4;
}
message EstimateCoinSellResponse {
string will_get = 1;
string commission = 2;
}
message EstimateCoinSellAllResponse {
string will_get = 1;
}
message EstimateCoinSellAllRequest {
string coin_to_sell = 1;
string coin_to_buy = 2;
string value_to_sell = 3;
uint64 gas_price = 4;
uint64 height = 5;
}
message EstimateTxCommissionResponse {
string commission = 1;
}
message EstimateTxCommissionRequest {
message TransactionData {
string gas_coin = 3;
enum Type {
_ = 0;
Send = 1;
SellCoin = 2;
SellAllCoin = 3;
BuyCoin = 4;
CreateCoin = 5;
DeclareCandidacy = 6;
Delegate = 7;
Unbond = 8;
RedeemCheck = 9;
SetCandidateOnline = 10;
SetCandidateOffline = 11;
CreateMultisig = 12;
Multisend = 13;
EditCandidate = 14;
}
Type type = 4;
bytes payload = 5;
int64 mtxs = 6;
}
oneof Transaction {
string tx = 1;
TransactionData data = 3;
}
uint64 height = 2;
}
message EventsRequest {
uint64 height = 1;
repeated string search = 2;
}
message EventsResponse {
message Event {
string type = 1;
google.protobuf.Struct value = 2;
}
repeated Event events = 1;
}
message MissedBlocksRequest {
string public_key = 1;
uint64 height = 2;
}
message MissedBlocksResponse {
string missed_blocks = 1;
string missed_blocks_count = 2;
}
message UnconfirmedTxsResponse {
string transactions_count = 1;
string total_transactions = 2;
string total_bytes = 3;
repeated string transactions = 4;
}
message UnconfirmedTxsRequest {
int32 limit = 1;
}
message ValidatorsRequest {
uint64 height = 1;
int32 page = 2;
int32 per_page = 3;
}
message ValidatorsResponse {
message Result {
string public_key = 1;
string voting_power = 2;
}
repeated Result validators = 3;
}
message SubscribeRequest {
string query = 1;
}
message SubscribeResponse {
string query = 1;
google.protobuf.Struct data = 2;
message Event {
string key = 1;
repeated string events = 2;
}
repeated Event events = 3;
}
message HaltsRequest {
uint64 height = 1;
}
message HaltsResponse {
repeated string votes = 1;
}
message FrozenRequest {
string address = 1;
string coin = 2;
}
message FrozenResponse {
message Frozen {
string height = 1;
string address = 2;
string candidate_key = 3;
string coin = 4;
string value = 5;
}
repeated Frozen frozen = 1;
}
message StakesRequest {
string public_key = 1;
string coin = 2;
string address = 3;
uint64 height = 4;
}
message StakesResponse {
message Stake {
string address = 1;
string pub_key = 2;
string coin = 3;
string value = 4;
string noah_value = 5;
}
repeated Stake stakes = 1;
}
service ApiService {
//Subscribe returns a subscription for events by query.
rpc Subscribe (SubscribeRequest) returns (stream SubscribeResponse) {
option (google.api.http) = {
get: "/subscribe"
};
}
//Halts
rpc Halts (HaltsRequest) returns (HaltsResponse) {
option (google.api.http) = {
get: "/halts"
};
}
//Genesis returns genesis file.
rpc Genesis (google.protobuf.Empty) returns (GenesisResponse) {
option (google.api.http) = {
get: "/genesis"
};
}
//MinGasPrice returns current min gas price.
rpc MinGasPrice (google.protobuf.Empty) returns (MinGasPriceResponse) {
option (google.api.http) = {
get: "/min_gas_price"
};
}
//NetInfo returns network info
rpc NetInfo (google.protobuf.Empty) returns (NetInfoResponse) {
option (google.api.http) = {
get: "/net_info"
};
}
//Status returns node status including pubkey, latest block.
rpc Status (google.protobuf.Empty) returns (StatusResponse) {
option (google.api.http) = {
get: "/status"
};
}
//Address returns coins list, balance and transaction count of an address.
rpc Address (AddressRequest) returns (AddressResponse) {
option (google.api.http) = {
get: "/address/{address}"
};
}
//Addresses returns list of addresses.
rpc Addresses (AddressesRequest) returns (AddressesResponse) {
option (google.api.http) = {
get: "/addresses"
};
}
//Block returns block data at given height.
rpc Block (BlockRequest) returns (BlockResponse) {
option (google.api.http) = {
get: "/block/{height}"
};
}
//Candidate returns candidate’s info by provided public_key. It will respond with 404 code if candidate is not found.
rpc Candidate (CandidateRequest) returns (CandidateResponse) {
option (google.api.http) = {
get: "/candidate/{public_key}"
};
}
//Candidates returns list of candidates.
rpc Candidates (CandidatesRequest) returns (CandidatesResponse) {
option (google.api.http) = {
get: "/candidates"
};
}
//CoinInfo returns information about coin. Note: this method does not return information about base coins (qNOAH and NOAH).
rpc CoinInfo (CoinInfoRequest) returns (CoinInfoResponse) {
option (google.api.http) = {
get: "/coin_info/{symbol}"
};
}
//EstimateCoinBuy return estimate of buy coin transaction.
rpc EstimateCoinBuy (EstimateCoinBuyRequest) returns (EstimateCoinBuyResponse) {
option (google.api.http) = {
get: "/estimate_coin_buy"
};
}
//EstimateCoinSell return estimate of sell coin transaction.
rpc EstimateCoinSell (EstimateCoinSellRequest) returns (EstimateCoinSellResponse) {
option (google.api.http) = {
get: "/estimate_coin_sell"
};
}
//EstimateCoinSellAll return estimate of sell all coin transaction.
rpc EstimateCoinSellAll (EstimateCoinSellAllRequest) returns (EstimateCoinSellAllResponse) {
option (google.api.http) = {
get: "/estimate_coin_sell_all"
};
}
//EstimateTxCommission return estimate of transaction.
rpc EstimateTxCommission (EstimateTxCommissionRequest) returns (EstimateTxCommissionResponse) {
option (google.api.http) = {
get: "/estimate_tx_commission/{tx}"
additional_bindings {
get: "/estimate_tx_commission"
}
};
}
//Events returns events at given height.
rpc Events (EventsRequest) returns (EventsResponse) {
option (google.api.http) = {
get: "/events/{height}"
};
}
//MaxGas returns current max gas.
rpc MaxGas (MaxGasRequest) returns (MaxGasResponse) {
option (google.api.http) = {
get: "/max_gas"
};
}
//MissedBlocks returns missed blocks by validator public key.
rpc MissedBlocks (MissedBlocksRequest) returns (MissedBlocksResponse) {
option (google.api.http) = {
get: "/missed_blocks/{public_key}"
};
}
//SendTransaction returns the result of sending signed tx. To ensure that transaction was successfully committed to the blockchain, you need to find the transaction by the hash and ensure that the status code equals to 0.
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse) {
option (google.api.http) = {
get: "/send_transaction/{tx}"
additional_bindings {
post: "/send_transaction"
body: "*"
}
};
}
//Transaction returns transaction info.
rpc Transaction (TransactionRequest) returns (TransactionResponse) {
option (google.api.http) = {
get: "/transaction/{hash}"
};
}
//Transactions return transactions by query.
rpc Transactions (TransactionsRequest) returns (TransactionsResponse) {
option (google.api.http) = {
get: "/transactions"
};
}
//UnconfirmedTxs returns unconfirmed transactions.
rpc UnconfirmedTxs (UnconfirmedTxsRequest) returns (UnconfirmedTxsResponse) {
option (google.api.http) = {
get: "/unconfirmed_txs"
};
}
//Validators returns list of active validators.
rpc Validators (ValidatorsRequest) returns (ValidatorsResponse) {
option (google.api.http) = {
get: "/validators"
};
}
//Validators returns frozen balance.
rpc Frozen (FrozenRequest) returns (FrozenResponse) {
option (google.api.http) = {
get: "/frozen"
};
}
//Stakes
rpc Stakes (StakesRequest) returns (StakesResponse) {
option (google.api.http) = {
get: "/stakes/{public_key}"
};
}
}