Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
Squashed 'protocol/' changes from 8a9ef78..6ced950
Browse files Browse the repository at this point in the history
6ced950 Merge pull request #23 from tronprotocol/tron_proxy
38c1d2e fix install-protobuf.sh
aeffcf9 update readme.md
23f0cce change protobuf-java to protobuf-all for protoc
950a9b9 disable travis cache
4743ea0 fix install-protobuf.sh
48a994c fix go gen script
21fba07 add protoc-go-gen dependencies
d536dda rm cached directory
84e3f19 add protoc-gen-go plugin
8ead80e add go proto ci
623ceea fix install-googleapis
65314a5 add googleapis proto file into protoc include
b33bfdd config http url for grpc
7210154 add swagger generate srcipt and swagger definitions
169058a add tron grpc proxy

git-subtree-dir: protocol
git-subtree-split: 6ced950
  • Loading branch information
ithinker1991 committed Apr 14, 2018
1 parent e590b42 commit bc147ed
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 30 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ sudo: false

before_install:
- bash install-protobuf.sh
- bash install-googleapis.sh

# check what has been installed by listing contents of protobuf folder
before_script:
Expand All @@ -16,4 +17,8 @@ before_script:
# let's use protobuf
script:
- $HOME/protobuf/bin/protoc --java_out=./ ./core/*.proto ./api/*.proto
- $HOME/protobuf/bin/protoc -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=./ ./core/*.proto
- $HOME/protobuf/bin/protoc -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --go_out=./ ./api/*.proto
- $HOME/protobuf/bin/protoc -I. -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis --grpc-gateway_out=logtostderr=true:./ ./api/*.proto

- ls -l
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

the protocol of tron including api and message.

java-tron and wallet-cli
java-tron, wallet-cli and grpc-gateway

git subtree pull --prefix src/main/protos/ protocol master
105 changes: 83 additions & 22 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,149 @@ package protocol;

import "core/Tron.proto";
import "core/Contract.proto";
import "google/api/annotations.proto";


option java_package = "org.tron.api"; //Specify the name of the package that generated the Java file
option java_outer_classname = "GrpcAPI"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/go-client-api/api";
option go_package = "github.com/tronprotocol/grpc-gateway/api";

service Wallet {

rpc GetAccount (Account) returns (Account) {
option (google.api.http) = {
post: "/wallet/getaccount"
body: "*"
};

};

rpc CreateTransaction (TransferContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/createtransaction"
body: "*"
};
};

rpc BroadcastTransaction (Transaction) returns (Return) {

option (google.api.http) = {
post: "/wallet/broadcasttransaction"
body: "*"
};
};

rpc ListAccounts (EmptyMessage) returns (AccountList) {
option (google.api.http) = {
post: "/wallet/listaccount"
body: "*"
};

};

rpc UpdateAccount (AccountUpdateContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/updateaccount"
body: "*"
};
};

rpc CreateAccount (AccountCreateContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/createaccount"
body: "*"
};
};

rpc VoteWitnessAccount (VoteWitnessContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/votewitnessaccount"
body: "*"
};
};

rpc CreateAssetIssue (AssetIssueContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/createassetissue"
body: "*"
};
};

rpc ListWitnesses (EmptyMessage) returns (WitnessList) {

option (google.api.http) = {
post: "/wallet/listwitnesses"
body: "*"
};
};

rpc UpdateWitness (WitnessUpdateContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/updatewitness"
body: "*"
};
};

rpc CreateWitness (WitnessCreateContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/createwitness"
body: "*"
};
};

rpc TransferAsset (TransferAssetContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/transferasset"
body: "*"
};
}

rpc ParticipateAssetIssue (ParticipateAssetIssueContract) returns (Transaction) {

option (google.api.http) = {
post: "/wallet/participateassetissue"
body: "*"
};
}

rpc ListNodes (EmptyMessage) returns (NodeList) {

option (google.api.http) = {
post: "/wallet/listnodes"
body: "*"
};
}
rpc GetAssetIssueList (EmptyMessage) returns (AssetIssueList) {

option (google.api.http) = {
post: "/wallet/getassetissuelist"
body: "*"
};
}
rpc GetAssetIssueByAccount (Account) returns (AssetIssueList) {

option (google.api.http) = {
post: "/wallet/getassetissuebyaccount"
body: "*"
};
}
rpc GetAssetIssueByName (BytesMessage) returns (AssetIssueContract) {

option (google.api.http) = {
post: "/wallet/getassetissuebyname"
body: "*"
};
}
rpc GetNowBlock (EmptyMessage) returns (Block) {

option (google.api.http) = {
post: "/wallet/getnowblock"
body: "*"
};
}
rpc GetBlockByNum (NumberMessage) returns (Block) {

option (google.api.http) = {
post: "/wallet/getblockbynum"
body: "*"
};
}
rpc TotalTransaction (EmptyMessage) returns (NumberMessage) {

}
rpc GetDynamicProperties (EmptyMessage) returns (DynamicProperties) {

option (google.api.http) = {
post: "/wallet/totaltransaction"
body: "*"
};
}
};
// the api of tron's db
Expand Down
2 changes: 1 addition & 1 deletion core/Contract.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package protocol;

option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file
option java_outer_classname = "Contract"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/go-client-api/core";
option go_package = "github.com/tronprotocol/grpc-gateway/core";

import "core/Tron.proto";

Expand Down
2 changes: 1 addition & 1 deletion core/Discover.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package protocol;

option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file
option java_outer_classname = "Discover"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/go-client-api/core";
option go_package = "github.com/tronprotocol/grpc-gateway/core";

message Endpoint {
bytes address = 1;
Expand Down
3 changes: 1 addition & 2 deletions core/Tron.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ package protocol;

option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file
option java_outer_classname = "Protocol"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/go-client-api/core";

option go_package = "github.com/tronprotocol/grpc-gateway/core";

enum AccountType {
Normal = 0;
Expand Down
2 changes: 1 addition & 1 deletion core/TronInventoryItems.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package protocol;

option java_package = "org.tron.protos"; //Specify the name of the package that generated the Java file
option java_outer_classname = "TronInventoryItems"; //Specify the class name of the generated Java file
option go_package = "github.com/tronprotocol/go-client-api/core";
option go_package = "github.com/tronprotocol/grpc-gateway/core";

message InventoryItems {
int32 type = 1;
Expand Down
14 changes: 14 additions & 0 deletions install-googleapis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
set -e

go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
go get -u github.com/golang/protobuf/protoc-gen-go

wget http://central.maven.org/maven2/com/google/api/grpc/googleapis-common-protos/0.0.3/googleapis-common-protos-0.0.3.jar
jar xvf googleapis-common-protos-0.0.3.jar
cp -r google/ $HOME/protobuf/include/
ls -l



4 changes: 2 additions & 2 deletions install-protobuf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
set -e
# check to see if protobuf folder is empty
if [ ! -d "$HOME/protobuf/lib" ]; then
wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-java-3.5.1.tar.gz
tar -xzvf protobuf-java-3.5.1.tar.gz
wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-all-3.5.1.tar.gz
tar -xzvf protobuf-all-3.5.1.tar.gz
cd protobuf-3.5.1 && ./configure --prefix=$HOME/protobuf && make && make install
else
echo "Using cached directory."
Expand Down

0 comments on commit bc147ed

Please sign in to comment.