Fix code style

This commit is contained in:
Nex 2018-10-08 21:38:12 +08:00
parent dd26770c1c
commit d6dacf48e0
3 changed files with 77 additions and 77 deletions

View File

@ -11,85 +11,85 @@ option java_outer_classname = "AccountingChainProto";
option java_multiple_files = true; option java_multiple_files = true;
service AccountingChain { service AccountingChain {
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse); rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse); rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse);
rpc GetBlockByNumber (GetBlockByNumberRequest) returns (BlockResponse); rpc GetBlockByNumber (GetBlockByNumberRequest) returns (BlockResponse);
rpc GetBlockByHash (GetBlockByHashRequest) returns (BlockResponse); rpc GetBlockByHash (GetBlockByHashRequest) returns (BlockResponse);
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (TransactionResponse); rpc GetTransactionByHash (GetTransactionByHashRequest) returns (TransactionResponse);
rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (TransactionResponse); rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (TransactionResponse);
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (TransactionResponse); rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (TransactionResponse);
} }
message Transaction { message Transaction {
uint64 block_number = 1; // `null` uint64 block_number = 1; // `null`
bytes block_hash = 2; // `null` bytes block_hash = 2; // `null`
uint32 index = 3; // index`null` uint32 index = 3; // index`null`
bytes hash = 4; // bytes hash = 4; //
TransactionType type = 5; // TransactionType type = 5; //
bytes from = 6; // bytes from = 6; //
uint64 nonce = 7; // uint64 nonce = 7; //
bytes to = 8; // `null` bytes to = 8; // `null`
bytes data = 9; // bytes data = 9; //
bytes v = 10; // ECDSA recovery id bytes v = 10; // ECDSA recovery id
bytes r = 11; // ECDSA signature r bytes r = 11; // ECDSA signature r
bytes s = 12; // ECDSA signature s bytes s = 12; // ECDSA signature s
} }
message Block { message Block {
uint64 number = 1; // `null` uint64 number = 1; // `null`
bytes hash = 2; // `null` bytes hash = 2; // `null`
bytes parent_hash = 3; // bytes parent_hash = 3; //
bytes witness = 4; // bytes witness = 4; //
uint64 timestamp = 5; // UNIX时间戳 uint64 timestamp = 5; // UNIX时间戳
uint64 size = 6; // uint64 size = 6; //
bytes transactions_root = 7; // bytes transactions_root = 7; //
repeated Transaction transactions = 8; // repeated Transaction transactions = 8; //
repeated bytes transaction_hashes = 9; // 32 repeated bytes transaction_hashes = 9; // 32
} }
message BlockNumberRequest { message BlockNumberRequest {
string ledger = 1; string ledger = 1;
} }
message BlockNumberResponse { message BlockNumberResponse {
Error error = 1; Error error = 1;
uint64 block_number = 2; uint64 block_number = 2;
} }
message GetBlockByNumberRequest { message GetBlockByNumberRequest {
string ledger = 1; string ledger = 1;
uint64 number = 2; uint64 number = 2;
bool full_transaction = 3; bool full_transaction = 3;
} }
message GetBlockByHashRequest { message GetBlockByHashRequest {
string ledger = 1; string ledger = 1;
bytes hash = 2; bytes hash = 2;
bool full_transaction = 3; bool full_transaction = 3;
} }
message BlockResponse { message BlockResponse {
Error error = 1; Error error = 1;
Block block = 2; Block block = 2;
} }
message GetTransactionByHashRequest { message GetTransactionByHashRequest {
string ledger = 1; string ledger = 1;
bytes hash = 2; bytes hash = 2;
} }
message GetTransactionByBlockNumberAndIndexRequest { message GetTransactionByBlockNumberAndIndexRequest {
string ledger = 1; string ledger = 1;
uint64 block_number = 2; uint64 block_number = 2;
uint32 index = 3; uint32 index = 3;
} }
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 TransactionResponse { message TransactionResponse {
Error error = 1; Error error = 1;
Transaction transaction = 2; Transaction transaction = 2;
} }

View File

@ -8,21 +8,21 @@ option java_outer_classname = "CommonProto";
option java_multiple_files = true; option java_multiple_files = true;
message Error { message Error {
string code = 1; // One of a server-defined set of error codes. string code = 1; // One of a server-defined set of error codes.
string message = 2; // A human-readable representation of the error. string message = 2; // A human-readable representation of the error.
string target = 3; // The target of the error. string target = 3; // The target of the error.
repeated Error details = 4; // An array of details about specific errors that led to this reported error. repeated Error details = 4; // An array of details about specific errors that led to this reported error.
} }
message ClientVersionResponse { message ClientVersionResponse {
Error error = 1; Error error = 1;
string version = 2; // string version = 2; //
} }
/* 事务类型 */ /* 事务类型 */
enum TransactionType { enum TransactionType {
RECORD = 0; // RECORD = 0; //
MESSAGE = 1; // MESSAGE = 1; //
CONTRACT_CREATION = 2; // CONTRACT_CREATION = 2; //
CONTRACT_INVOCATION = 3; // CONTRACT_INVOCATION = 3; //
} }

View File

@ -11,35 +11,35 @@ option java_outer_classname = "TransactionLedgerProto";
option java_multiple_files = true; option java_multiple_files = true;
service TransactionLedger { service TransactionLedger {
rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse); rpc ClientVersion (google.protobuf.Empty) returns (ClientVersionResponse);
rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse); rpc CreateLedger (CreateLedgerRequest) returns (CreateLedgerResponse);
rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse); rpc GetLedgers (google.protobuf.Empty) returns (GetLedgersResponse);
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse); rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
} }
message CreateLedgerRequest { message CreateLedgerRequest {
string name = 1; string name = 1;
} }
message CreateLedgerResponse { message CreateLedgerResponse {
Error error = 1; Error error = 1;
} }
message GetLedgersResponse { message GetLedgersResponse {
Error error = 1; Error error = 1;
repeated string ledgers = 2; repeated string ledgers = 2;
} }
message SendTransactionRequest { message SendTransactionRequest {
string ledger = 1; string ledger = 1;
message Transaction { message Transaction {
TransactionType type = 1; TransactionType type = 1;
bytes from = 2; bytes from = 2;
bytes to = 3; bytes to = 3;
bytes data = 4; bytes data = 4;
} }
Transaction transaction = 2; Transaction transaction = 2;
} }
message SendTransactionResponse { message SendTransactionResponse {
Error error = 1; Error error = 1;
bytes hash = 2; bytes hash = 2;
} }