新增字段
This commit is contained in:
1 parent
ffbacce650
commit
b2ab430eb6
5 files changed
+82
-1
No files matched your search
@@ -104,6 +104,19 @@ public interface ITronService {
|
||||
*/
|
||||
BigDecimal stakedTrxBalance(ApiWrapper api,String ownerAddr, int resourceCode);
|
||||
|
||||
/**
|
||||
* 查询 Stake 2.0 质押中当前仍可代理的 TRX 数量。
|
||||
* 链上 getCanDelegatedMaxSize 返回 SUN,本方法统一换算为 TRX。
|
||||
*/
|
||||
default BigDecimal availableDelegatedStakedTrxBalance(ApiWrapper api, String ownerAddr,
|
||||
int resourceCode) {
|
||||
if (resourceCode != 0 && resourceCode != 1) {
|
||||
throw new IllegalArgumentException("resourceCode只能为0(带宽)或1(能量)");
|
||||
}
|
||||
long availableSun = Math.max(0L, api.getCanDelegatedMaxSize(ownerAddr, resourceCode));
|
||||
return BigDecimal.valueOf(availableSun).movePointLeft(6);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取别人质押的trx的数量-代理的
|
||||
* @param ownerAddr
|
||||
|
||||
Reference in new issue
Block a user