bdledger-apis/bdledger/api/query_service.proto

90 lines
2.4 KiB
Protocol Buffer
Raw Normal View History

syntax = "proto3";
package bdledger.api.txledger;
import "bdledger/api/common.proto";
option go_package = "bdware.org/bdledger/sdk/api/grpc/txledger";
option java_package = "bdledger.api.grpc.txledger";
option java_outer_classname = "TransactionLedgerProto";
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;
required int64 start_timestamp = 3;
int64 end_timestamp = 4;
}
message GetBlocksResponse {
repeated common.Block blocks= 1;
int64 start_timestamp = 2;
int64 end_timestamp = 3;
}
message CountBlocksResponse {
uint64 count = 1;
}
message TransactionsRequest {
string ledger = 1;
repeated TransactionFilter filters = 2;
required int64 start_timestamp = 3;
int64 end_timestamp = 4;
}
message GetTransactionsResponse {
repeated common.Transaction Transactions = 1;
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 {
common.Block block = 1;
}
message GetTransactionByHashRequest {
string ledger = 1;
bytes hash = 2;
}
message GetTransactionByHashResponse {
common.Transaction transaction = 1;
}
message GetTransactionByBlockHashAndIndexRequest {
string ledger = 1;
bytes block_hash = 2;
uint32 index = 3;
}
message GetTransactionByBlockHashAndIndexResponse {
common.Transaction transaction = 1;
}