This commit is contained in:
Nex 2020-03-07 13:15:29 +08:00
parent 5ff6cc24ee
commit c1b575d50c
2 changed files with 42 additions and 42 deletions

View File

@ -14,5 +14,5 @@ service Node {
} }
message ClientVersionResponse { message ClientVersionResponse {
string version = 1; // string version = 1; //
} }

View File

@ -10,80 +10,80 @@ option java_outer_classname = "QueryProto";
option java_multiple_files = true; option java_multiple_files = true;
service Query { service Query {
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse); rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse); rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse);
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse); rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse); rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse);
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse); rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse);
rpc GetTransactions (TransactionsRequest) returns (GetTransactionsResponse); rpc GetTransactions (TransactionsRequest) returns (GetTransactionsResponse);
rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse); rpc CountTransactions (TransactionsRequest) returns (CountTransactionsResponse);
} }
message BlockFilter { message BlockFilter {
bytes hash = 1; bytes hash = 1;
int64 timestamp = 2; int64 timestamp = 2;
} }
// repeated Transaction/BlockFilters are combined by "&&"(and) operator; // repeated Transaction/BlockFilters are combined by "&&"(and) operator;
message TransactionFilter { message TransactionFilter {
bytes hash = 1; bytes hash = 1;
bytes from = 2; bytes from = 2;
bytes to = 3; bytes to = 3;
bytes timestamp = 4; bytes timestamp = 4;
} }
message GetBlockByHashRequest { message GetBlockByHashRequest {
string ledger = 1; string ledger = 1;
bytes hash = 2; bytes hash = 2;
bool full_transactions = 3; bool full_transactions = 3;
} }
message GetBlockByHashResponse { message GetBlockByHashResponse {
Block block = 1; Block block = 1;
} }
message BlocksRequest { message BlocksRequest {
string ledger = 1; string ledger = 1;
repeated BlockFilter filters = 2; repeated BlockFilter filters = 2;
int64 start_timestamp = 3; // required int64 start_timestamp = 3; // required
int64 end_timestamp = 4; int64 end_timestamp = 4;
} }
message GetBlocksResponse { message GetBlocksResponse {
repeated Block blocks = 1; repeated Block blocks = 1;
int64 start_timestamp = 2; int64 start_timestamp = 2;
int64 end_timestamp = 3; int64 end_timestamp = 3;
} }
message CountBlocksResponse { message CountBlocksResponse {
uint64 count = 1; uint64 count = 1;
} }
message GetTransactionByHashRequest { message GetTransactionByHashRequest {
string ledger = 1; string ledger = 1;
bytes hash = 2; bytes hash = 2;
} }
message GetTransactionByHashResponse { message GetTransactionByHashResponse {
Transaction transaction = 1; Transaction transaction = 1;
} }
message GetTransactionByBlockHashAndIndexRequest { message GetTransactionByBlockHashAndIndexRequest {
string ledger = 1; string ledger = 1;
bytes block_hash = 2; bytes block_hash = 2;
uint32 index = 3; uint32 index = 3;
} }
message GetTransactionByBlockHashAndIndexResponse { message GetTransactionByBlockHashAndIndexResponse {
Transaction transaction = 1; Transaction transaction = 1;
} }
message TransactionsRequest { message TransactionsRequest {
string ledger = 1; string ledger = 1;
repeated TransactionFilter filters = 2; repeated TransactionFilter filters = 2;
int64 start_timestamp = 3; // required int64 start_timestamp = 3; // required
int64 end_timestamp = 4; int64 end_timestamp = 4;
} }
message GetTransactionsResponse { message GetTransactionsResponse {
repeated Transaction transactions = 1; repeated Transaction transactions = 1;
int64 start_timestamp = 2; int64 start_timestamp = 2;
int64 end_timestamp = 3; int64 end_timestamp = 3;
} }
message CountTransactionsResponse { message CountTransactionsResponse {
uint64 count = 1; uint64 count = 1;
} }