Add error info
This commit is contained in:
		
							parent
							
								
									dbc8d522b6
								
							
						
					
					
						commit
						5b0dc19856
					
				@ -11,11 +11,11 @@ option java_multiple_files = true;
 | 
			
		||||
 | 
			
		||||
service AccountingChain {
 | 
			
		||||
    rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse);
 | 
			
		||||
    rpc GetBlockByNumber (GetBlockByNumberRequest) returns (Block);
 | 
			
		||||
    rpc GetBlockByHash (GetBlockByHashRequest) returns (Block);
 | 
			
		||||
    rpc GetTransactionByHash (GetTransactionByHashRequest) returns (Transaction);
 | 
			
		||||
    rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (Transaction);
 | 
			
		||||
    rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (Transaction);
 | 
			
		||||
    rpc GetBlockByNumber (GetBlockByNumberRequest) returns (BlockResponse);
 | 
			
		||||
    rpc GetBlockByHash (GetBlockByHashRequest) returns (BlockResponse);
 | 
			
		||||
    rpc GetTransactionByHash (GetTransactionByHashRequest) returns (TransactionResponse);
 | 
			
		||||
    rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (TransactionResponse);
 | 
			
		||||
    rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (TransactionResponse);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message Transaction {
 | 
			
		||||
@ -49,7 +49,8 @@ message BlockNumberRequest {
 | 
			
		||||
    string ledger = 1;
 | 
			
		||||
}
 | 
			
		||||
message BlockNumberResponse {
 | 
			
		||||
    uint64 block_number = 1;
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
    uint64 block_number = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message GetBlockByNumberRequest {
 | 
			
		||||
@ -64,6 +65,11 @@ message GetBlockByHashRequest {
 | 
			
		||||
    bool full_transaction = 3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message BlockResponse {
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
    Block block = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message GetTransactionByHashRequest {
 | 
			
		||||
    string ledger = 1;
 | 
			
		||||
    bytes hash = 2;
 | 
			
		||||
@ -80,3 +86,8 @@ message GetTransactionByBlockHashAndIndexRequest {
 | 
			
		||||
    bytes block_hash = 2;
 | 
			
		||||
    uint32 index = 3;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message TransactionResponse {
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
    Transaction transaction = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,12 @@ option java_package = "bdchain.api.grpc";
 | 
			
		||||
option java_outer_classname = "CommonProto";
 | 
			
		||||
option java_multiple_files = true;
 | 
			
		||||
 | 
			
		||||
message Error {
 | 
			
		||||
    string code = 1; // One of a server-defined set of error codes.
 | 
			
		||||
    string message = 2; // A human-readable representation of the error.
 | 
			
		||||
    string target = 3; // The target of the error.
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* 事务类型 */
 | 
			
		||||
enum TransactionType {
 | 
			
		||||
    RECORD = 0; // 通用数据记录
 | 
			
		||||
 | 
			
		||||
@ -20,11 +20,12 @@ message CreateLedgerRequest {
 | 
			
		||||
    string name = 1;
 | 
			
		||||
}
 | 
			
		||||
message CreateLedgerResponse {
 | 
			
		||||
    bool ok = 1;
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message GetLedgersResponse {
 | 
			
		||||
    repeated string ledgers = 1;
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
    repeated string ledgers = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
message SendTransactionRequest {
 | 
			
		||||
@ -38,5 +39,6 @@ message SendTransactionRequest {
 | 
			
		||||
    Transaction transaction = 2;
 | 
			
		||||
}
 | 
			
		||||
message SendTransactionResponse {
 | 
			
		||||
    bytes hash = 1;
 | 
			
		||||
    Error error = 1;
 | 
			
		||||
    bytes hash = 2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user