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

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/add_db_api
Browse files Browse the repository at this point in the history
# Conflicts:
#	api/api.proto
  • Loading branch information
CodeNinjaEvan committed Apr 16, 2018
2 parents 2dbee3b + 6ced950 commit c003d39
Show file tree
Hide file tree
Showing 9 changed files with 115 additions and 26 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
107 changes: 89 additions & 18 deletions api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ 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
Expand All @@ -11,80 +13,149 @@ option go_package = "github.com/tronprotocol/go-client-api/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) {
option (google.api.http) = {
post: "/wallet/totaltransaction"
body: "*"
};
}
rpc GetDynamicProperties (EmptyMessage) returns (DynamicProperties) {

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


service WalletSolidity {

rpc GetAccount (Account) returns (Account) {
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 c003d39

Please sign in to comment.