代码格式化

This commit is contained in:
lu7213 committed 2026-10-16 22:37:43 -04:00
1 parent 43f7decaa5
commit d2abfd88af
1 file changed
+17 -17
@@ -9,11 +9,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity; import org.springframework.http.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@@ -24,13 +20,7 @@ import org.springframework.web.util.UriComponentsBuilder;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/** /**
* TRON HTTP 链上数据统一入口。 * TRON HTTP 链上数据统一入口。
@@ -49,7 +39,9 @@ public class TronChainDataClient {
private final String apiKey; private final String apiKey;
private String tronscanApiKey = "47fae50b-b5e8-4d1b-8329-501a422a3169"; private String tronscanApiKey = "47fae50b-b5e8-4d1b-8329-501a422a3169";
/** TronScan 与 TronGrid 是不同平台,凭证必须分别配置,禁止跨平台发送。 */ /**
* TronScan 与 TronGrid 是不同平台,凭证必须分别配置,禁止跨平台发送。
*/
@Value("${tron.chain-data.tronscan-api-key:}") @Value("${tron.chain-data.tronscan-api-key:}")
public void setTronscanApiKey(String key) { public void setTronscanApiKey(String key) {
this.tronscanApiKey = key == null ? "" : key.trim(); this.tronscanApiKey = key == null ? "" : key.trim();
@@ -77,7 +69,9 @@ public class TronChainDataClient {
this.apiKey = apiKey == null ? "" : apiKey.trim(); this.apiKey = apiKey == null ? "" : apiKey.trim();
} }
/** 查询已确认的 TRC20 交易,返回结构与 TronGrid v1 的 data 数组保持一致。 */ /**
* 查询已确认的 TRC20 交易,返回结构与 TronGrid v1 的 data 数组保持一致。
*/
public JSONArray queryConfirmedTrc20Transactions(ITronService tronService, String address, int limit) { public JSONArray queryConfirmedTrc20Transactions(ITronService tronService, String address, int limit) {
return queryConfirmedTrc20Transactions(tronService.type(), address, return queryConfirmedTrc20Transactions(tronService.type(), address,
tronService.contractAddress(), tronService.tronscanApiKey(), limit); tronService.contractAddress(), tronService.tronscanApiKey(), limit);
@@ -155,7 +149,9 @@ public class TronChainDataClient {
return emptyDelegatedResourceSummary(); return emptyDelegatedResourceSummary();
} }
/** 提供给 Trident 主网客户端使用,配置值禁止写入日志。 */ /**
* 提供给 Trident 主网客户端使用,配置值禁止写入日志。
*/
public String getApiKey() { public String getApiKey() {
return apiKey; return apiKey;
} }
@@ -183,7 +179,9 @@ public class TronChainDataClient {
} }
} }
/** 自定义代理地址可通过 tronscan|URL 显式指定协议,普通历史配置按域名识别。 */ /**
* 自定义代理地址可通过 tronscan|URL 显式指定协议,普通历史配置按域名识别。
*/
private boolean isTronscan(String endpoint) { private boolean isTronscan(String endpoint) {
if (endpoint.startsWith("tronscan|")) return true; if (endpoint.startsWith("tronscan|")) return true;
if (endpoint.startsWith("trongrid|")) return false; if (endpoint.startsWith("trongrid|")) return false;
@@ -192,7 +190,9 @@ public class TronChainDataClient {
|| host.endsWith(".tronscanapi.com")); || host.endsWith(".tronscanapi.com"));
} }
/** 只接受已确认、执行成功且合约匹配的转账,金额保留原始最小单位字符串。 */ /**
* 只接受已确认、执行成功且合约匹配的转账,金额保留原始最小单位字符串。
*/
private JSONArray normalizeTronscanTransfers(JSONObject body, String contract) { private JSONArray normalizeTronscanTransfers(JSONObject body, String contract) {
JSONArray transfers = body.getJSONArray("token_transfers"); JSONArray transfers = body.getJSONArray("token_transfers");
if (transfers == null) throw new IllegalStateException("响应缺少 token_transfers 数组"); if (transfers == null) throw new IllegalStateException("响应缺少 token_transfers 数组");