Commit 4641f0b4 authored by vicotor's avatar vicotor

update nebulaapi

parent 69b9c4b3
module github.com/cmpchain/metaprotocol module github.com/cmpchain/metaprotocol
go 1.19 go 1.18
require ( require (
google.golang.org/grpc v1.50.1 google.golang.org/grpc v1.50.1
......
...@@ -22,7 +22,7 @@ type P2PServer struct { ...@@ -22,7 +22,7 @@ type P2PServer struct {
} }
type NebulaServer struct { type NebulaServer struct {
metanebula.UnimplementedShelfServiceServer metanebula.UnimplementedNebulaServiceServer
} }
type SentryServer struct { type SentryServer struct {
......
...@@ -7,23 +7,7 @@ import "google/protobuf/field_mask.proto"; ...@@ -7,23 +7,7 @@ import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "nebula/v1/resource.proto"; import "nebula/v1/resource.proto";
// The standard List request definition. message NodeVersionRequest { }
message Example {
// Only retrieve shelves after this time.
google.protobuf.Timestamp after_time = 1;
// Only retrieve shelves before this time.
google.protobuf.Timestamp before_time = 2;
// The start index for pagination.
uint64 start = 3;
// The maximum number of shelves to return.
uint64 max_size = 4;
// The unique id of the parent example for which to list the shelves.
string example_id = 5;
}
message NodeVersionRequest {
string id = 1;
}
message NodeVersionResponse { message NodeVersionResponse {
bytes version = 1; bytes version = 1;
...@@ -39,33 +23,25 @@ message Sha3Response { ...@@ -39,33 +23,25 @@ message Sha3Response {
bytes hash = 1; bytes hash = 1;
} }
message NetVersionRequest { message NetVersionRequest { }
string id = 1;
}
message NetVersionResponse { message NetVersionResponse {
bytes version = 1; bytes version = 1;
} }
message NetPeerCountRequest { message NetPeerCountRequest { }
string id = 1;
}
message NetPeerCountResponse { message NetPeerCountResponse {
uint32 peer_count = 1; uint32 peer_count = 1;
} }
message ProtocolVersionRequest { message ProtocolVersionRequest { }
string id = 1;
}
message ProtocolVersionResponse { message ProtocolVersionResponse {
bytes version = 1; bytes version = 1;
} }
message SyncingRequest { message SyncingRequest { }
string id = 1;
}
message SyncingResponse { message SyncingResponse {
bytes start = 1; bytes start = 1;
...@@ -73,50 +49,38 @@ message SyncingResponse { ...@@ -73,50 +49,38 @@ message SyncingResponse {
bytes current = 3; bytes current = 3;
} }
message CoinbaseRequest { message CoinbaseRequest { }
string id = 1;
}
message CoinbaseResponse { message CoinbaseResponse {
bytes address = 1; bytes address = 1;
} }
message MiningRequest { message MiningRequest { }
string id = 1;
}
message MiningResponse { message MiningResponse {
string status = 1; string status = 1;
} }
message HashRateRequest { message HashRateRequest { }
string id = 1;
}
message HashRateResponse { message HashRateResponse {
string result = 1; string result = 1;
} }
message GasPriceRequest { message GasPriceRequest { }
string id = 1;
}
message GasPriceResponse { message GasPriceResponse {
// gas price in wei. // gas price in wei.
bytes gas_price = 1; bytes gas_price = 1;
} }
message AccountsRequest { message AccountsRequest { }
string id = 1;
}
message AccountsResponse { message AccountsResponse {
repeated bytes address = 1; repeated bytes address = 1;
} }
message HeightRequest { message HeightRequest { }
string id = 1;
}
message HeightResponse { message HeightResponse {
bytes height = 1; bytes height = 1;
...@@ -151,7 +115,7 @@ message StorageResponse { ...@@ -151,7 +115,7 @@ message StorageResponse {
bytes data = 4; bytes data = 4;
} }
message GetNonceRequest { message NonceRequest {
// request address // request address
bytes address = 1; bytes address = 1;
// request block number // request block number
...@@ -167,7 +131,7 @@ message NonceResponse { ...@@ -167,7 +131,7 @@ message NonceResponse {
bytes nonce = 3; bytes nonce = 3;
} }
message GetTransactionCountRequest { message TransactionCountRequest {
// request address // request address
bytes address = 1; bytes address = 1;
// request block number // request block number
...@@ -263,4 +227,174 @@ message SendRawTransactionRequest { ...@@ -263,4 +227,174 @@ message SendRawTransactionRequest {
message SendRawTransactionResponse { message SendRawTransactionResponse {
bytes tx_hash = 1; bytes tx_hash = 1;
}
message CallRequest {
bytes signed_tx = 1;
}
message CallResponse {
bytes result = 1;
}
message EstimateGasRequest {
bytes signed_tx = 1;
}
message EstimateGasResponse {
bytes result = 1;
uint32 gas = 2;
}
message BlockByHashRequest {
bytes block_hash = 1;
}
message BlockByHashResponse {
bytes block = 1;
}
message BlockByNumberRequest {
bytes block_id = 1;
}
message BlockByNumberResponse {
bytes block = 1;
}
message TransactionByHashRequest {
bytes tx_hash = 1;
}
message TransactionByHashResponse {
bytes tx_data = 1;
}
message TransactionByBlockHashAndIndexRequest {
bytes block_hash = 1;
uint32 index = 2;
}
message TransactionByBlockHashAndIndexResponse {
bytes tx_data = 1;
}
message TransactionByBlockNumberAndIndexRequest {
bytes block_id = 1;
uint32 index = 2;
}
message TransactionByBlockNumberAndIndexResponse {
bytes tx_data = 1;
}
message TransactionReceiptRequest {
bytes tx_hash = 1;
}
message TransactionReceiptResponse {
bytes tx_receipt = 1;
}
message UncleByBlockHashAndIndexRequest {
bytes block_hash = 1;
uint32 index = 2;
}
message UncleByBlockHashAndIndexResponse {
bytes uncle_block = 1;
}
message UncleByBlockNumberAndIndexRequest {
bytes block_id = 1;
uint32 index = 2;
}
message UncleByBlockNumberAndIndexResponse {
bytes uncle_block = 1;
}
message CompilersRequest {
}
message CompilersResponse {
bytes compilers = 1;
}
message CompileSolidityRequest {
bytes source = 1;
}
message CompileSolidityResponse {
bytes code = 1;
}
message CompileLLLRequest {
bytes source = 1;
}
message CompileLLLResponse {
bytes code = 1;
}
message CompileSerpentRequest {
bytes source = 1;
}
message CompileSerpentResponse {
bytes code = 1;
}
message NewFilterRequest {
bytes param = 1;
}
message NewFilterResponse {
bytes filter_id = 1;
}
message NewBlockFilterRequest { }
message NewBlockFilterResponse {
bytes filter_id = 1;
}
message PendingTransactionFilterRequest { }
message PendingTransactionFilterResponse {
bytes filter_id = 1;
}
message UninstallFilterRequest {
bytes filter_id = 1;
}
message UninstallFilterResponse {
bool result = 1;
}
message FilterChangesRequest {
bytes filter_id = 1;
}
message FilterChangesResponse {
bytes info = 1;
}
message FilterLogsRequest {
bytes filter_id = 1;
}
message FilterLogsResponse {
bytes logs = 1;
}
message LogsRequest {
bytes param = 1;
}
message LogsResponse {
bytes logs = 1;
} }
\ No newline at end of file
syntax = "proto3";
package nebula.v1;
//option go_package = "nebulav1";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "nebula/v1/resource.proto";
// The standard List request definition.
// message Example {
// // Only retrieve shelves after this time.
// google.protobuf.Timestamp after_time = 1;
// // Only retrieve shelves before this time.
// google.protobuf.Timestamp before_time = 2;
// // The start index for pagination.
// uint64 start = 3;
// // The maximum number of shelves to return.
// uint64 max_size = 4;
// // The unique id of the parent example for which to list the shelves.
// string example_id = 5;
// }
// message GetBlockByNumberRequest {
// // request block number
// bytes block_id = 1;
// }
// message BlockResponse {
// bytes block_info = 1;
// }
...@@ -2,41 +2,80 @@ syntax = "proto3"; ...@@ -2,41 +2,80 @@ syntax = "proto3";
package nebula.v1; package nebula.v1;
//option go_package = "nebulav1"; //option go_package = "nebulav1";
import "google/protobuf/empty.proto";
import "nebula/v1/request_response.proto"; import "nebula/v1/request_response.proto";
import "nebula/v1/block_req_res.proto"; import "nebula/v1/account_req_res.proto";
service NebulaService { service NebulaService {
// web3
rpc Sha3(Sha3Request) returns (Sha3Response) {};
rpc NodeVersion(google.protobuf.Empty) returns (NodeVersionResponse) {};
// network info service
rpc NetVersion(google.protobuf.Empty) returns (NetVersionResponse) {};
rpc NetPeerCount(google.protobuf.Empty) returns (NetPeerCountResponse) {};
// node status
rpc ProtocolVersion(google.protobuf.Empty) returns (ProtocolVersionResponse) {};
rpc Syncing(google.protobuf.Empty) returns (SyncingResponse) {};
rpc Coinbase(google.protobuf.Empty) returns (CoinbaseResponse) {};
rpc Mining(google.protobuf.Empty) returns (MiningResponse) {};
rpc HashRate(google.protobuf.Empty) returns (HashRateResponse) {};
rpc Accounts(google.protobuf.Empty) returns (AccountsResponse) {};
// tx operatoration
rpc GasPrice(google.protobuf.Empty) returns (GasPriceResponse) {};
// block info service // block info service
// rpc rpc BlockNumber(google.protobuf.Empty) returns (HeightResponse) {};
rpc BlockByHash(BlockByHashRequest) returns (BlockByHashResponse) {};
rpc BlockByNumber(BlockByNumberRequest) returns (BlockByNumberResponse) {};
rpc BlockTransactionCountByHash(BlockTransactionCountByHashRequest) returns (BlockTransactionCountByHashResponse) {};
rpc BlockTransactionCountByNumber(BlockTransactionCountByNumberRequest) returns (BlockTransactionCountByNumberResponse) {};
rpc UncleCountByHash(UncleCountByHashRequest) returns (UncleCountByHashResponse) {};
rpc UncleCountByNumber(UncleCountByNumberRequest) returns (UncleCountByNumberResponse) {};
rpc UncleByBlockHashAndIndex(UncleByBlockHashAndIndexRequest) returns (UncleByBlockHashAndIndexResponse) {};
rpc UncleByBlockNumberAndIndex(UncleByBlockNumberAndIndexRequest) returns (UncleByBlockNumberAndIndexResponse) {};
// compiler
rpc Compilers(CompilersRequest) returns (CompilersResponse) {};
rpc CompileSolidity(CompileSolidityRequest) returns (CompileSolidityResponse) {};
rpc CompileLLL(CompileLLLRequest) returns (CompileLLLResponse) {};
rpc CompileSerpent(CompileSerpentRequest) returns (CompileSerpentResponse) {};
// transaction info service // transaction info service
rpc EstimateGas(EstimateGasRequest) returns (EstimateGasResponse) {};
rpc TransactionByHash(TransactionByHashRequest) returns (TransactionByHashResponse) {};
rpc TransactionByBlockHashAndIndex(TransactionByBlockHashAndIndexRequest) returns (TransactionByBlockHashAndIndexResponse) {};
rpc TransactionByBlockNumberAndIndex(TransactionByBlockNumberAndIndexRequest) returns (TransactionByBlockNumberAndIndexResponse) {};
rpc TransactionReceipt(TransactionReceiptRequest) returns (TransactionReceiptResponse) {};
// account info service // account info service
rpc Balance(BalanceRequest) returns (BalanceResponse) {};
rpc Storage(StorageRequest) returns (StorageResponse) {};
rpc Nonce(NonceRequest) returns (NonceResponse) {};
rpc TransactionCount(TransactionCountRequest) returns (TransactionCountResponse) {};
rpc GetCode(GetCodeRequest) returns (GetCodeResponse) {};
rpc Sign(SignRequest) returns (SignResponse) {};
rpc SignTransaction(SignTransactionRequest) returns (SignTransactionResponse) {};
rpc SendTransaction(SendTransactionRequest) returns (SendTransactionResponse) {};
rpc SendRawTransaction(SendRawTransactionRequest) returns (SendRawTransactionResponse) {};
rpc Call(CallRequest) returns (CallResponse) {};
// network info service // filter
rpc NewFilter(NewFilterRequest) returns (NewFilterResponse) {};
rpc NewBlockFilter(google.protobuf.Empty) returns (NewBlockFilterResponse) {};
rpc PendingTransactionFilter(google.protobuf.Empty) returns (PendingTransactionFilterResponse) {};
rpc UninstallFilter(UninstallFilterRequest) returns (UninstallFilterResponse) {};
rpc FilterChanges(FilterChangesRequest) returns (FilterChangesResponse) {};
rpc FilterLogs(FilterLogsRequest) returns (FilterLogsResponse) {};
rpc Logs(LogsRequest) returns (LogsResponse) {};
// node info service
// consensus info service // consensus info service
// }
} \ No newline at end of file
// ShelfService defines methods for managing shelves.
service ShelfService {
// ListShelves retrieves a list of shelf resources from the server.
//rpc ListShelves(ListShelvesRequest) returns (ListShelvesResponse) {}
// BatchGetShelves retrieves multiple shelf resources from the server.
// rpc BatchGetShelves(BatchGetShelvesRequest) returns (BatchGetShelvesResponse) {}
// // GetShelf retrieves a single shelf resource from the server.
// rpc GetShelf(GetShelfRequest) returns (GetShelfResponse) {}
// // CreateShelf creates a new shelf resource on the server.
// rpc CreateShelf(CreateShelfRequest) returns (CreateShelfResponse) {}
// // UpdateShelf updates the shelf resource on the server.
// rpc UpdateShelf(UpdateShelfRequest) returns (UpdateShelfResponse) {}
// // DeleteShelf deletes the shelf resource from the server.
// rpc DeleteShelf(DeleteShelfRequest) returns (DeleteShelfResponse) {}
}
syntax = "proto3";
package nebula.v1;
//option go_package = "nebulav1";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "nebula/v1/resource.proto";
// The standard List request definition.
// message Example {
// // Only retrieve shelves after this time.
// google.protobuf.Timestamp after_time = 1;
// // Only retrieve shelves before this time.
// google.protobuf.Timestamp before_time = 2;
// // The start index for pagination.
// uint64 start = 3;
// // The maximum number of shelves to return.
// uint64 max_size = 4;
// // The unique id of the parent example for which to list the shelves.
// string example_id = 5;
// }
message GetBlockByNumberRequest {
// request block number
bytes block_id = 1;
}
message BlockResponse {
bytes block_info = 1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment