2019-11-25 13:23:49 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2020-01-08 02:03:39 +00:00
|
|
|
package bdledger.api;
|
2019-11-25 13:23:49 +00:00
|
|
|
|
|
|
|
import "bdledger/api/common.proto";
|
|
|
|
|
2020-01-08 02:03:39 +00:00
|
|
|
option go_package = "bdware.org/bdledger/pkg/api/grpc/proto";
|
|
|
|
option java_package = "bdledger.api.grpc.query";
|
|
|
|
option java_outer_classname = "QueryProto";
|
2019-11-25 13:23:49 +00:00
|
|
|
option java_multiple_files = true;
|
|
|
|
|
|
|
|
service Query {
|
|
|
|
rpc GetBlocks (BlocksRequest) returns (GetBlocksResponse);
|
|
|
|
rpc CountBlocks (BlocksRequest) returns (CountBlocksResponse);
|
|
|
|
rpc GetTransactions(TransactionsRequest) returns (GetTransactionsResponse);
|
|
|
|
rpc CountTransactions(TransactionsRequest) returns (CountTransactionsResponse);
|
|
|
|
rpc GetBlockByHash (GetBlockByHashRequest) returns (GetBlockByHashResponse);
|
|
|
|
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (GetTransactionByHashResponse);
|
|
|
|
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (GetTransactionByBlockHashAndIndexResponse);
|
|
|
|
}
|
|
|
|
|
|
|
|
// repeated Transaction/BlockFilters are combined by "&&"(and) operator;
|
|
|
|
message TransactionFilter {
|
|
|
|
bytes hash = 1;
|
|
|
|
bytes from = 2;
|
|
|
|
bytes to = 3;
|
|
|
|
bytes timestamp = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message BlockFilter {
|
|
|
|
bytes hash = 1;
|
|
|
|
int64 timestamp = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message BlocksRequest {
|
|
|
|
string ledger = 1;
|
|
|
|
repeated BlockFilter filters = 2;
|
2019-11-27 03:41:57 +00:00
|
|
|
int64 start_timestamp = 3; // required
|
2019-11-25 13:23:49 +00:00
|
|
|
int64 end_timestamp = 4;
|
|
|
|
}
|
|
|
|
message GetBlocksResponse {
|
2020-01-08 02:03:39 +00:00
|
|
|
repeated Block blocks= 1;
|
2019-11-25 13:23:49 +00:00
|
|
|
int64 start_timestamp = 2;
|
|
|
|
int64 end_timestamp = 3;
|
|
|
|
}
|
|
|
|
message CountBlocksResponse {
|
|
|
|
uint64 count = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message TransactionsRequest {
|
|
|
|
string ledger = 1;
|
|
|
|
repeated TransactionFilter filters = 2;
|
2019-11-27 03:41:57 +00:00
|
|
|
int64 start_timestamp = 3; // required
|
2019-11-25 13:23:49 +00:00
|
|
|
int64 end_timestamp = 4;
|
|
|
|
}
|
|
|
|
message GetTransactionsResponse {
|
2020-01-08 02:03:39 +00:00
|
|
|
repeated Transaction transactions = 1;
|
2019-11-25 13:23:49 +00:00
|
|
|
int64 start_timestamp = 2;
|
|
|
|
int64 end_timestamp = 3;
|
|
|
|
}
|
|
|
|
message CountTransactionsResponse {
|
|
|
|
uint64 count = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetBlockByHashRequest {
|
|
|
|
string ledger = 1;
|
|
|
|
bytes hash = 2;
|
|
|
|
bool full_transaction = 3;
|
|
|
|
}
|
|
|
|
message GetBlockByHashResponse {
|
2020-01-08 02:03:39 +00:00
|
|
|
Block block = 1;
|
2019-11-25 13:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetTransactionByHashRequest {
|
|
|
|
string ledger = 1;
|
|
|
|
bytes hash = 2;
|
|
|
|
}
|
|
|
|
message GetTransactionByHashResponse {
|
2020-01-08 02:03:39 +00:00
|
|
|
Transaction transaction = 1;
|
2019-11-25 13:23:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message GetTransactionByBlockHashAndIndexRequest {
|
|
|
|
string ledger = 1;
|
|
|
|
bytes block_hash = 2;
|
|
|
|
uint32 index = 3;
|
|
|
|
}
|
|
|
|
message GetTransactionByBlockHashAndIndexResponse {
|
2020-01-08 02:03:39 +00:00
|
|
|
Transaction transaction = 1;
|
2019-11-25 13:23:49 +00:00
|
|
|
}
|