diff --git a/trident-java/README.md b/trident-java/README.md index 52013d9..076e6a2 100644 --- a/trident-java/README.md +++ b/trident-java/README.md @@ -27,7 +27,7 @@ Then add required packages as dependencies. Please add dependencies locally. ```groovy dependencies { // protobuf & grpc - implementation 'com.google.protobuf:protobuf-java:3.25.0' + implementation 'com.google.protobuf:protobuf-java:3.25.5' implementation fileTree(dir:'../core') implementation fileTree(dir:'../utils') @@ -51,21 +51,21 @@ dependencies { org.tron.trident abi - 0.9.0 + 0.9.1 system your path org.tron.trident utils - 0.9.0 + 0.9.1 system your path org.tron.trident core - 0.9.0 + 0.9.1 system your path diff --git a/trident-java/build.gradle b/trident-java/build.gradle index 2ce34cd..ddcfc18 100644 --- a/trident-java/build.gradle +++ b/trident-java/build.gradle @@ -8,7 +8,7 @@ ext { } allprojects { - version '0.9.0' + version '0.9.1' group = 'org.tron.trident' repositories { diff --git a/trident-java/core/build.gradle b/trident-java/core/build.gradle index 3292056..9fb4e59 100644 --- a/trident-java/core/build.gradle +++ b/trident-java/core/build.gradle @@ -17,14 +17,14 @@ dependencies { implementation 'io.grpc:grpc-stub:1.58.1' compileOnly 'org.apache.tomcat:annotations-api:6.0.53' // necessary for Java 9+ //json parsing - implementation 'com.google.protobuf:protobuf-java-util:3.25.0' + implementation 'com.google.protobuf:protobuf-java-util:3.25.5' implementation "org.bouncycastle:bcprov-jdk15on:$bouncycastleVersion" } protobuf { protoc { - artifact = 'com.google.protobuf:protoc:3.25.0' + artifact = 'com.google.protobuf:protoc:3.25.5' } plugins { grpc { diff --git a/trident-java/core/src/main/java/org/tron/trident/api/GrpcAPI.java b/trident-java/core/src/main/java/org/tron/trident/api/GrpcAPI.java index 17918f0..823528b 100644 --- a/trident-java/core/src/main/java/org/tron/trident/api/GrpcAPI.java +++ b/trident-java/core/src/main/java/org/tron/trident/api/GrpcAPI.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: api/api.proto -// Protobuf Java Version: 3.25.0 +// Protobuf Java Version: 3.25.5 package org.tron.trident.api; public final class GrpcAPI { diff --git a/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java b/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java index 4e58fcb..64010fe 100644 --- a/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java +++ b/trident-java/core/src/main/java/org/tron/trident/core/ApiWrapper.java @@ -228,7 +228,7 @@ public static ApiWrapper ofMainnet(String hexPrivateKey) { * @return a ApiWrapper object */ public static ApiWrapper ofShasta(String hexPrivateKey) { - return new ApiWrapper(Constant.TRONGRID_SHASTA, Constant.TRONGRID_SHASTA_SOLIDITY, hexPrivateKey); + return new ApiWrapper(Constant.TRONGRID_SHASTA, Constant.TRONGRID_SHASTA_SOLIDITY, hexPrivateKey); } /** @@ -360,15 +360,18 @@ private TransactionCapsule createTransaction( */ public TransactionExtention createTransactionExtention(Message request, Transaction.Contract.ContractType contractType) throws IllegalException { TransactionExtention.Builder trxExtBuilder = TransactionExtention.newBuilder(); - + TransactionReturn.Builder retBuilder = TransactionReturn.newBuilder(); try { TransactionCapsule trx = createTransaction(request, contractType); trxExtBuilder.setTransaction(trx.getTransaction()); trxExtBuilder.setTxid(ByteString.copyFrom(Sha256Hash.hash(true, trx.getTransaction().getRawData().toByteArray()))); + retBuilder.setResult(true).setCode(TransactionReturn.response_code.SUCCESS); } catch (Exception e) { + retBuilder.setResult(false).setCode(TransactionReturn.response_code.OTHER_ERROR) + .setMessage(ByteString.copyFromUtf8(e.getClass() + " : " + e.getMessage())); throw new IllegalException("createTransactionExtention error,"+e.getMessage()); } - + trxExtBuilder.setResult(retBuilder); return trxExtBuilder.build(); } @@ -394,30 +397,43 @@ private String resolveResultCode(int code) { switch (code) { case 0: responseCode = "SUCCESS"; + break; case 1: responseCode = "SIGERROR"; + break; case 2: responseCode = "CONTRACT_VALIDATE_ERROR"; + break; case 3: responseCode = "CONTRACT_EXE_ERROR"; + break; case 4: responseCode = "BANDWITH_ERROR"; + break; case 5: responseCode = "DUP_TRANSACTION_ERROR"; + break; case 6: responseCode = "TAPOS_ERROR"; + break; case 7: responseCode = "TOO_BIG_TRANSACTION_ERROR"; + break; case 8: responseCode = "TRANSACTION_EXPIRATION_ERROR"; + break; case 9: responseCode = "SERVER_BUSY"; + break; case 10: responseCode = "NO_CONNECTION"; + break; case 11: responseCode = "NOT_ENOUGH_EFFECTIVE_CONNECTION"; + break; case 20: responseCode = "OTHER_ERROR"; + break; } return responseCode; } diff --git a/trident-java/core/src/main/java/org/tron/trident/core/Constant.java b/trident-java/core/src/main/java/org/tron/trident/core/Constant.java index f80d1b2..1221037 100644 --- a/trident-java/core/src/main/java/org/tron/trident/core/Constant.java +++ b/trident-java/core/src/main/java/org/tron/trident/core/Constant.java @@ -7,7 +7,7 @@ public final class Constant{ public static final String TRONGRID_MAIN_NET_SOLIDITY = "grpc.trongrid.io:50052"; public static final String TRONGRID_SHASTA = "grpc.shasta.trongrid.io:50051"; - public static final String TRONGRID_SHASTA_SOLIDITY = "grpc.shasta.trongrid.io:50052"; + public static final String TRONGRID_SHASTA_SOLIDITY = "grpc.shasta.trongrid.io:50052"; //Public Fullnode, maintained by official team public static final String FULLNODE_NILE = "grpc.nile.trongrid.io:50051"; diff --git a/trident-java/core/src/main/java/org/tron/trident/proto/Chain.java b/trident-java/core/src/main/java/org/tron/trident/proto/Chain.java index 7586e91..e7ee36f 100644 --- a/trident-java/core/src/main/java/org/tron/trident/proto/Chain.java +++ b/trident-java/core/src/main/java/org/tron/trident/proto/Chain.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: core/chain.proto -// Protobuf Java Version: 3.25.0 +// Protobuf Java Version: 3.25.5 package org.tron.trident.proto; public final class Chain { diff --git a/trident-java/core/src/main/java/org/tron/trident/proto/Common.java b/trident-java/core/src/main/java/org/tron/trident/proto/Common.java index 98ab04a..ff62bef 100644 --- a/trident-java/core/src/main/java/org/tron/trident/proto/Common.java +++ b/trident-java/core/src/main/java/org/tron/trident/proto/Common.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: core/common.proto -// Protobuf Java Version: 3.25.0 +// Protobuf Java Version: 3.25.5 package org.tron.trident.proto; public final class Common { diff --git a/trident-java/core/src/main/java/org/tron/trident/proto/Contract.java b/trident-java/core/src/main/java/org/tron/trident/proto/Contract.java index 3d75cde..b423487 100644 --- a/trident-java/core/src/main/java/org/tron/trident/proto/Contract.java +++ b/trident-java/core/src/main/java/org/tron/trident/proto/Contract.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: core/contract.proto -// Protobuf Java Version: 3.25.0 +// Protobuf Java Version: 3.25.5 package org.tron.trident.proto; public final class Contract { diff --git a/trident-java/core/src/main/java/org/tron/trident/proto/Response.java b/trident-java/core/src/main/java/org/tron/trident/proto/Response.java index 285248a..764a050 100644 --- a/trident-java/core/src/main/java/org/tron/trident/proto/Response.java +++ b/trident-java/core/src/main/java/org/tron/trident/proto/Response.java @@ -1,7 +1,7 @@ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: core/response.proto -// Protobuf Java Version: 3.25.0 +// Protobuf Java Version: 3.25.5 package org.tron.trident.proto; public final class Response {