Skip to content

Commit b74caf2

Browse files
committed
change checkStyle
1 parent 078af23 commit b74caf2

1 file changed

Lines changed: 47 additions & 41 deletions

File tree

‎src/test/java/stest/tron/wallet/common/client/utils/HttpMethed.java‎

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
package stest.tron.wallet.common.client.utils;
22

3-
import com.alibaba.fastjson.JSON;
43
import com.alibaba.fastjson.JSONObject;
54
import com.google.gson.Gson;
65
import com.google.gson.JsonArray;
76
import com.google.gson.JsonObject;
7+
import com.google.gson.JsonParser;
88
import java.nio.charset.Charset;
99
import java.util.HashMap;
1010
import java.util.Map;
1111

12-
import com.google.gson.JsonParser;
1312
import lombok.extern.slf4j.Slf4j;
1413
import org.apache.http.HttpResponse;
1514
import org.apache.http.client.HttpClient;
@@ -201,38 +200,11 @@ public static HttpResponse sendCoin(String httpNode, byte[] fromAddress, byte[]
201200
return response;
202201
}
203202

204-
/**
205-
* constructor.
206-
*/
207-
public static String sendCoinGetTxid(String httpNode, byte[] fromAddress, byte[] toAddress,
208-
Long amount, String fromKey) {
209-
try {
210-
final String requestUrl = "http://" + httpNode + "/wallet/createtransaction";
211-
JsonObject userBaseObj2 = new JsonObject();
212-
userBaseObj2.addProperty("to_address", ByteArray.toHexString(toAddress));
213-
userBaseObj2.addProperty("owner_address", ByteArray.toHexString(fromAddress));
214-
userBaseObj2.addProperty("amount", amount);
215-
response = createConnect(requestUrl, userBaseObj2);
216-
transactionString = EntityUtils.toString(response.getEntity());
217-
logger.info(transactionString);
218-
transactionSignString = gettransactionsign(httpNode, transactionString, fromKey);
219-
logger.info(transactionSignString);
220-
response = broadcastTransaction(httpNode, transactionSignString);
221-
} catch (Exception e) {
222-
e.printStackTrace();
223-
httppost.releaseConnection();
224-
return null;
225-
}
226-
responseContent = HttpMethed.parseStringContent(transactionString);
227-
logger.info(responseContent.getString("txID"));
228-
return responseContent.getString("txID");
229-
}
230-
231203
/**
232204
* constructor.
233205
*/
234206
public static HttpResponse sendCoin(String httpNode, byte[] fromAddress, byte[] toAddress,
235-
Long amount, String[] managerKeys) {
207+
Long amount, String[] managerKeys) {
236208
try {
237209
final String requestUrl = "http://" + httpNode + "/wallet/createtransaction";
238210
JsonObject userBaseObj2 = new JsonObject();
@@ -266,6 +238,33 @@ public static HttpResponse sendCoin(String httpNode, byte[] fromAddress, byte[]
266238
return response;
267239
}
268240

241+
/**
242+
* constructor.
243+
*/
244+
public static String sendCoinGetTxid(String httpNode, byte[] fromAddress, byte[] toAddress,
245+
Long amount, String fromKey) {
246+
try {
247+
final String requestUrl = "http://" + httpNode + "/wallet/createtransaction";
248+
JsonObject userBaseObj2 = new JsonObject();
249+
userBaseObj2.addProperty("to_address", ByteArray.toHexString(toAddress));
250+
userBaseObj2.addProperty("owner_address", ByteArray.toHexString(fromAddress));
251+
userBaseObj2.addProperty("amount", amount);
252+
response = createConnect(requestUrl, userBaseObj2);
253+
transactionString = EntityUtils.toString(response.getEntity());
254+
logger.info(transactionString);
255+
transactionSignString = gettransactionsign(httpNode, transactionString, fromKey);
256+
logger.info(transactionSignString);
257+
response = broadcastTransaction(httpNode, transactionSignString);
258+
} catch (Exception e) {
259+
e.printStackTrace();
260+
httppost.releaseConnection();
261+
return null;
262+
}
263+
responseContent = HttpMethed.parseStringContent(transactionString);
264+
logger.info(responseContent.getString("txID"));
265+
return responseContent.getString("txID");
266+
}
267+
269268
/**
270269
* constructor.
271270
*/
@@ -1104,7 +1103,8 @@ public static HttpResponse getExchangeById(String httpNode, Integer exchangeId)
11041103
/**
11051104
* constructor.
11061105
*/
1107-
public static HttpResponse getExchangeByIdFromSolidity(String httpSolidityNode, Integer exchangeId) {
1106+
public static HttpResponse getExchangeByIdFromSolidity(String httpSolidityNode,
1107+
Integer exchangeId) {
11081108
try {
11091109
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/getexchangebyid";
11101110
JsonObject userBaseObj2 = new JsonObject();
@@ -1155,7 +1155,8 @@ public static HttpResponse getAssetIssueListByName(String httpNode, String name)
11551155
/**
11561156
* constructor.
11571157
*/
1158-
public static HttpResponse getAssetIssueListByNameFromSolidity(String httpSolidityNode, String name) {
1158+
public static HttpResponse getAssetIssueListByNameFromSolidity(String httpSolidityNode,
1159+
String name) {
11591160
try {
11601161
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/getassetissuelistbyname";
11611162
JsonObject userBaseObj2 = new JsonObject();
@@ -1189,7 +1190,8 @@ public static HttpResponse getAssetIssueById(String httpNode, String assetIssueI
11891190
/**
11901191
* constructor.
11911192
*/
1192-
public static HttpResponse getAssetIssueByIdFromSolidity(String httpSolidityNode, String assetIssueId) {
1193+
public static HttpResponse getAssetIssueByIdFromSolidity(String httpSolidityNode,
1194+
String assetIssueId) {
11931195
try {
11941196
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/getassetissuebyid";
11951197
JsonObject userBaseObj2 = new JsonObject();
@@ -1258,7 +1260,8 @@ public static HttpResponse getTransactionInfoById(String httpNode, String txid)
12581260
/**
12591261
* constructor.
12601262
*/
1261-
public static HttpResponse getTransactionInfoByIdFromSolidity(String httpSolidityNode, String txid) {
1263+
public static HttpResponse getTransactionInfoByIdFromSolidity(String httpSolidityNode,
1264+
String txid) {
12621265
try {
12631266
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/gettransactioninfobyid";
12641267
JsonObject userBaseObj2 = new JsonObject();
@@ -1293,15 +1296,16 @@ public static HttpResponse getTransactionCountByBlocknumFromSolidity(String http
12931296
/**
12941297
* constructor.
12951298
*/
1296-
public static HttpResponse getTransactionsFromThisFromSolidity(String httpSolidityNode, byte[] fromAddress, long offset, long limit) {
1299+
public static HttpResponse getTransactionsFromThisFromSolidity(String httpSolidityNode,
1300+
byte[] fromAddress, long offset, long limit) {
12971301
try {
1298-
String requestUrl = "http://" + httpSolidityNode + "/walletextension/gettransactionsfromthis";
12991302
Map<String, String> map1 = new HashMap<String, String>();
13001303
Map<String, Object> map = new HashMap<String, Object>();
13011304
map1.put("address", ByteArray.toHexString(fromAddress));
13021305
map.put("account", map1);
13031306
map.put("offset", offset);
13041307
map.put("limit", limit);
1308+
String requestUrl = "http://" + httpSolidityNode + "/walletextension/gettransactionsfromthis";
13051309
String jsonStr = new Gson().toJson(map);
13061310
JsonObject jsonObj = new JsonParser().parse(jsonStr).getAsJsonObject();
13071311
response = createConnect(requestUrl, jsonObj);
@@ -1316,15 +1320,16 @@ public static HttpResponse getTransactionsFromThisFromSolidity(String httpSolidi
13161320
/**
13171321
* constructor.
13181322
*/
1319-
public static HttpResponse getTransactionsToThisFromSolidity(String httpSolidityNode, byte[] toAddress, long offset, long limit) {
1323+
public static HttpResponse getTransactionsToThisFromSolidity(String httpSolidityNode,
1324+
byte[] toAddress, long offset, long limit) {
13201325
try {
1321-
String requestUrl = "http://" + httpSolidityNode + "/walletextension/gettransactionstothis";
13221326
Map<String, String> map1 = new HashMap<String, String>();
13231327
Map<String, Object> map = new HashMap<String, Object>();
13241328
map1.put("address", ByteArray.toHexString(toAddress));
13251329
map.put("account", map1);
13261330
map.put("offset", offset);
13271331
map.put("limit", limit);
1332+
String requestUrl = "http://" + httpSolidityNode + "/walletextension/gettransactionstothis";
13281333
String jsonStr = new Gson().toJson(map);
13291334
JsonObject jsonObj = new JsonParser().parse(jsonStr).getAsJsonObject();
13301335
response = createConnect(requestUrl, jsonObj);
@@ -1654,7 +1659,8 @@ public static HttpResponse getDelegatedResourceAccountIndex(String httpNode,byte
16541659
/**
16551660
* constructor.
16561661
*/
1657-
public static HttpResponse getDelegatedResourceAccountIndexFromSolidity(String httpSolidityNode,byte[] queryAddress) {
1662+
public static HttpResponse getDelegatedResourceAccountIndexFromSolidity(String httpSolidityNode,
1663+
byte[] queryAddress) {
16581664
try {
16591665
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/getdelegatedresourceaccountindex";
16601666
JsonObject userBaseObj2 = new JsonObject();
@@ -1754,8 +1760,8 @@ public static HttpResponse getPaginatedAssetissueList(String httpNode, Integer o
17541760
/**
17551761
* constructor.
17561762
*/
1757-
public static HttpResponse getPaginatedAssetissueListFromSolidity(String httpSolidityNode, Integer offset,
1758-
Integer limit) {
1763+
public static HttpResponse getPaginatedAssetissueListFromSolidity(String httpSolidityNode,
1764+
Integer offset, Integer limit) {
17591765
try {
17601766
String requestUrl = "http://" + httpSolidityNode + "/walletsolidity/getpaginatedassetissuelist";
17611767
JsonObject userBaseObj2 = new JsonObject();

0 commit comments

Comments
 (0)