Update naming
This commit is contained in:
parent
fa403bc24e
commit
cafc744da9
@ -1,31 +1,31 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bg.api;
|
package bdchain.api;
|
||||||
|
|
||||||
import "bg/api/common.proto";
|
import "bdchain/api/common.proto";
|
||||||
|
|
||||||
option go_package = "bg/api/protobuf/ac_chain";
|
option go_package = "bdchain/api/protobuf/ac_chain";
|
||||||
option java_package = "bg.protobuf";
|
option java_package = "bdchain.protobuf";
|
||||||
option java_outer_classname = "AcChainProto";
|
option java_outer_classname = "AccountingChainProto";
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
|
|
||||||
service AcChain {
|
service AccountingChain {
|
||||||
rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse);
|
rpc BlockNumber (BlockNumberRequest) returns (BlockNumberResponse);
|
||||||
rpc GetBlockByNumber (GetBlockByNumberRequest) returns (Block);
|
rpc GetBlockByNumber (GetBlockByNumberRequest) returns (Block);
|
||||||
rpc GetBlockByHash (GetBlockByHashRequest) returns (Block);
|
rpc GetBlockByHash (GetBlockByHashRequest) returns (Block);
|
||||||
rpc GetMessageByHash (GetMessageByHashRequest) returns (Block);
|
rpc GetTransactionByHash (GetTransactionByHashRequest) returns (Block);
|
||||||
rpc GetMessageByBlockNumberAndIndex (GetMessageByBlockNumberAndIndexRequest) returns (Message);
|
rpc GetTransactionByBlockNumberAndIndex (GetTransactionByBlockNumberAndIndexRequest) returns (Transaction);
|
||||||
rpc GetMessageByBlockHashAndIndex (GetMessageByBlockHashAndIndexRequest) returns (Message);
|
rpc GetTransactionByBlockHashAndIndex (GetTransactionByBlockHashAndIndexRequest) returns (Transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
message Message {
|
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; // 事务的哈希
|
||||||
MessageType 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
|
||||||
@ -40,9 +40,9 @@ message Block {
|
|||||||
bytes witness = 4; // 见证者账户地址
|
bytes witness = 4; // 见证者账户地址
|
||||||
uint64 timestamp = 5; // 区块产生时的UNIX时间戳
|
uint64 timestamp = 5; // 区块产生时的UNIX时间戳
|
||||||
uint64 size = 6; // 区块大小的字节数
|
uint64 size = 6; // 区块大小的字节数
|
||||||
bytes message_root = 7; // 区块的消息树根
|
bytes transactions_root = 7; // 区块的事务树根
|
||||||
repeated Message messages = 8; // 消息对象的数组,或为空
|
repeated Transaction transactions = 8; // 事务对象的数组,或为空
|
||||||
repeated bytes message_hashes = 9; // 32字节的交易哈希的数组,或为空
|
repeated bytes transaction_hashes = 9; // 32字节的交易哈希的数组,或为空
|
||||||
}
|
}
|
||||||
|
|
||||||
message BlockNumberRequest {
|
message BlockNumberRequest {
|
||||||
@ -64,18 +64,18 @@ message GetBlockByHashRequest {
|
|||||||
bool full_transaction = 3;
|
bool full_transaction = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetMessageByHashRequest {
|
message GetTransactionByHashRequest {
|
||||||
string ledger = 1;
|
string ledger = 1;
|
||||||
bytes hash = 2;
|
bytes hash = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetMessageByBlockNumberAndIndexRequest {
|
message GetTransactionByBlockNumberAndIndexRequest {
|
||||||
string ledger = 1;
|
string ledger = 1;
|
||||||
uint64 block_number = 2;
|
uint64 block_number = 2;
|
||||||
uint32 index = 3;
|
uint32 index = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetMessageByBlockHashAndIndexRequest {
|
message GetTransactionByBlockHashAndIndexRequest {
|
||||||
string ledger = 1;
|
string ledger = 1;
|
||||||
bytes block_hash = 2;
|
bytes block_hash = 2;
|
||||||
uint32 index = 3;
|
uint32 index = 3;
|
@ -1,15 +1,16 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bg.api;
|
package bdchain.api;
|
||||||
|
|
||||||
option go_package = "bg/api/protobuf/common";
|
option go_package = "bdchain/api/protobuf/common";
|
||||||
option java_package = "bg.protobuf";
|
option java_package = "bdchain.protobuf";
|
||||||
option java_outer_classname = "CommonProto";
|
option java_outer_classname = "CommonProto";
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
|
|
||||||
enum MessageType {
|
/* 事务类型 */
|
||||||
|
enum TransactionType {
|
||||||
RECORD = 0; // 通用数据记录
|
RECORD = 0; // 通用数据记录
|
||||||
TRANSACTION = 1; // 交易
|
MESSAGE = 1; // 消息
|
||||||
CONTRACT_CREATION = 2; // 合约创建
|
CONTRACT_CREATION = 2; // 合约创建
|
||||||
CONTRACT_INVOCATION = 3; // 合约调用
|
CONTRACT_INVOCATION = 3; // 合约调用
|
||||||
}
|
}
|
@ -1,19 +1,19 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package bg.api;
|
package bdchain.api;
|
||||||
|
|
||||||
import "google/protobuf/empty.proto";
|
import "google/protobuf/empty.proto";
|
||||||
import "bg/api/common.proto";
|
import "bdchain/api/common.proto";
|
||||||
|
|
||||||
option go_package = "bg/api/protobuf/tx_ledger";
|
option go_package = "bdchain/api/protobuf/tx_ledger";
|
||||||
option java_package = "bg.protobuf";
|
option java_package = "bdchain.protobuf";
|
||||||
option java_outer_classname = "TxLedgerProto";
|
option java_outer_classname = "TransactionLedgerProto";
|
||||||
option java_multiple_files = true;
|
option java_multiple_files = true;
|
||||||
|
|
||||||
service TxLedger {
|
service TransactionLedger {
|
||||||
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 SendMessage (SendMessageRequest) returns (SendMessageResponse);
|
rpc SendTransaction (SendTransactionRequest) returns (SendTransactionResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
message CreateLedgerRequest {
|
message CreateLedgerRequest {
|
||||||
@ -27,16 +27,16 @@ message GetLedgersResponse {
|
|||||||
repeated string ledgers = 1;
|
repeated string ledgers = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SendMessageRequest {
|
message SendTransactionRequest {
|
||||||
string ledger = 1;
|
string ledger = 1;
|
||||||
message Message {
|
message Transaction {
|
||||||
MessageType type = 1;
|
TransactionType type = 1;
|
||||||
bytes from = 2;
|
bytes from = 2;
|
||||||
bytes to = 3;
|
bytes to = 3;
|
||||||
bytes data = 4;
|
bytes data = 4;
|
||||||
}
|
}
|
||||||
Message message = 2;
|
Transaction transaction = 2;
|
||||||
}
|
}
|
||||||
message SendMessageResponse {
|
message SendTransactionResponse {
|
||||||
bytes hash = 1;
|
bytes hash = 1;
|
||||||
}
|
}
|
8
gen.bat
8
gen.bat
@ -1,4 +1,4 @@
|
|||||||
mkdir go
|
mkdir gen\go
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/common.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/common.proto
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/tx_ledger.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/tx_ledger.proto
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/ac_chain.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/ac_chain.proto
|
||||||
|
9
gen.sh
9
gen.sh
@ -1,4 +1,5 @@
|
|||||||
mkdir go
|
#!/usr/bin/env bash
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/common.proto
|
mkdir -p gen/go
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/tx_ledger.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/common.proto
|
||||||
protoc -I . --go_out=plugins=grpc:go bg/api/ac_chain.proto
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/tx_ledger.proto
|
||||||
|
protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/ac_chain.proto
|
||||||
|
Loading…
Reference in New Issue
Block a user