Skip to content

Commit 5b9eaf8

Browse files
author
chaozhu
committed
query api not need check login
1 parent 31bed1f commit 5b9eaf8

File tree

3 files changed

+16
-49
lines changed

3 files changed

+16
-49
lines changed

src/main/java/org/tron/walletcli/Client.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public class Client {
9090
"CreateAccount",
9191
"CreateProposal",
9292
"CreateWitness",
93+
"DelegateResource",
9394
"DeleteProposal",
9495
"DeployContract contractName ABI byteCode constructor params isHex fee_limit consume_user_resource_percent origin_energy_limit value token_value token_id <library:address,library:address,...> <lib_compiler_version(e.g:v5)>",
9596
"ExchangeCreate",
@@ -198,6 +199,7 @@ public class Client {
198199
"TransferAsset",
199200
"TriggerConstantContract contractAddress method args isHex",
200201
"TriggerContract contractAddress method args isHex fee_limit value",
202+
"UnDelegateResource",
201203
"UnfreezeAsset",
202204
"UnfreezeBalance",
203205
"UnfreezeBalanceV2",
@@ -211,8 +213,6 @@ public class Client {
211213
"VoteWitness",
212214
"WithdrawBalance",
213215
"WithdrawExpireUnfreeze",
214-
"DelegateResource",
215-
"UnDelegateResource",
216216
};
217217

218218
// note: this is sorted by alpha
@@ -231,13 +231,15 @@ public class Client {
231231
"CreateAccount",
232232
"CreateProposal",
233233
"CreateWitness",
234+
"DelegateResource",
234235
"DeleteProposal",
235236
"DeployContract",
236237
"ExchangeCreate",
237238
"ExchangeInject",
238239
"ExchangeTransaction",
239240
"ExchangeWithdraw",
240241
"FreezeBalance",
242+
"FreezeBalanceV2",
241243
"GenerateAddress",
242244
// "GenerateShieldedAddress",
243245
"GenerateShieldedTRC20Address",
@@ -338,8 +340,10 @@ public class Client {
338340
"TransferAsset",
339341
"TriggerConstantContract",
340342
"TriggerContract",
343+
"UnDelegateResource",
341344
"UnfreezeAsset",
342345
"UnfreezeBalance",
346+
"UnfreezeBalanceV2",
343347
"UpdateAccount",
344348
"UpdateAccountPermission",
345349
"UpdateAsset",
@@ -349,6 +353,7 @@ public class Client {
349353
"UpdateWitness",
350354
"VoteWitness",
351355
"WithdrawBalance",
356+
"WithdrawExpireUnfreeze",
352357
};
353358

354359
private byte[] inputPrivateKey() throws IOException {
@@ -1727,8 +1732,8 @@ private void getCanWithdrawUnfreezeAmount(String[] parameters) throws CipherExce
17271732
return;
17281733
}
17291734

1730-
Optional<CanWithdrawUnfreezeAmountResponseMessage> result = walletApiWrapper.
1731-
getCanWithdrawUnfreezeAmount(ownerAddress, timestamp);
1735+
Optional<CanWithdrawUnfreezeAmountResponseMessage> result = WalletApi.getCanWithdrawUnfreezeAmount(
1736+
ownerAddress, timestamp);
17321737
if (result.isPresent()) {
17331738
CanWithdrawUnfreezeAmountResponseMessage canWithdrawUnfreezeAmountResponseMessage = result.get();
17341739
System.out.println(Utils.formatMessageString(canWithdrawUnfreezeAmountResponseMessage));
@@ -1762,7 +1767,7 @@ private void getCanDelegatedMaxSize(String[] parameters) throws CipherException,
17621767
return;
17631768
}
17641769

1765-
Optional<CanDelegatedMaxSizeResponseMessage> result = walletApiWrapper.getCanDelegatedMaxSize(ownerAddress, type);
1770+
Optional<CanDelegatedMaxSizeResponseMessage> result = WalletApi.getCanDelegatedMaxSize(ownerAddress, type);
17661771
if (result.isPresent()) {
17671772
CanDelegatedMaxSizeResponseMessage canDelegatedMaxSizeResponseMessage = result.get();
17681773
System.out.println(Utils.formatMessageString(canDelegatedMaxSizeResponseMessage));
@@ -1782,11 +1787,13 @@ private void getAvailableUnfreezeCount(String[] parameters) throws CipherExcepti
17821787
if (parameters.length == 1) {
17831788
ownerAddress = getAddressBytes(parameters[index]);
17841789
if (ownerAddress == null) {
1790+
System.out.println("Using getavailableunfreezecount command needs 1 parameters like: ");
1791+
System.out.println("getavailableunfreezecount [owner_address] ");
17851792
return ;
17861793
}
17871794
}
17881795

1789-
Optional<GetAvailableUnfreezeCountResponseMessage> result = walletApiWrapper.getAvailableUnfreezeCount(ownerAddress);
1796+
Optional<GetAvailableUnfreezeCountResponseMessage> result = WalletApi.getAvailableUnfreezeCount(ownerAddress);
17901797
if (result.isPresent()) {
17911798
GetAvailableUnfreezeCountResponseMessage getAvailableUnfreezeCountResponseMessage = result.get();
17921799
System.out.println(Utils.formatMessageString(getAvailableUnfreezeCountResponseMessage));

src/main/java/org/tron/walletcli/WalletApiWrapper.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -577,37 +577,6 @@ public boolean undelegateresource(byte[] ownerAddress, long balance
577577

578578
return wallet.unDelegateResource(ownerAddress, balance, resourceCode, receiverAddress);
579579
}
580-
581-
public Optional<GrpcAPI.CanWithdrawUnfreezeAmountResponseMessage> getCanWithdrawUnfreezeAmount(
582-
byte[] ownerAddress, long timestamp)
583-
throws CipherException, IOException, CancelException {
584-
if (wallet == null || !wallet.isLoginState()) {
585-
System.out.println("Warning: getCanWithdrawUnfreezeAmount failed, Please login first !!");
586-
return Optional.empty();
587-
}
588-
589-
return wallet.getCanWithdrawUnfreezeAmount(ownerAddress, timestamp);
590-
}
591-
592-
public Optional<GrpcAPI.CanDelegatedMaxSizeResponseMessage> getCanDelegatedMaxSize(byte[] ownerAddress, int type)
593-
throws CipherException, IOException, CancelException {
594-
if (wallet == null || !wallet.isLoginState()) {
595-
System.out.println("Warning: getCanDelegatedMaxSize failed, Please login first !!");
596-
return Optional.empty();
597-
}
598-
599-
return wallet.getCanDelegatedMaxSize(ownerAddress, type);
600-
}
601-
602-
public Optional<GrpcAPI.GetAvailableUnfreezeCountResponseMessage> getAvailableUnfreezeCount(byte[] ownerAddress)
603-
throws CipherException, IOException, CancelException {
604-
if (wallet == null || !wallet.isLoginState()) {
605-
System.out.println("Warning: getAvailableUnfreezeCount failed, Please login first !!");
606-
return Optional.empty();
607-
}
608-
609-
return wallet.getAvailableUnfreezeCount(ownerAddress);
610-
}
611580

612581
public boolean unfreezeAsset(byte[] ownerAddress)
613582
throws CipherException, IOException, CancelException {

src/main/java/org/tron/walletserver/WalletApi.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1657,27 +1657,18 @@ public static Optional<Protocol.DelegatedResourceAccountIndex> getDelegatedResou
16571657
return rpcCli.getDelegatedResourceAccountIndexV2(ownerAddress);
16581658
}
16591659

1660-
public Optional<GrpcAPI.CanWithdrawUnfreezeAmountResponseMessage> getCanWithdrawUnfreezeAmount(
1660+
public static Optional<GrpcAPI.CanWithdrawUnfreezeAmountResponseMessage> getCanWithdrawUnfreezeAmount(
16611661
byte[] ownerAddress, long timestamp) {
1662-
if (ownerAddress == null) {
1663-
ownerAddress = this.getAddress();
1664-
}
16651662
return rpcCli.getCanWithdrawUnfreezeAmount(ownerAddress, timestamp);
16661663
}
16671664

1668-
public Optional<GrpcAPI.CanDelegatedMaxSizeResponseMessage> getCanDelegatedMaxSize(
1665+
public static Optional<GrpcAPI.CanDelegatedMaxSizeResponseMessage> getCanDelegatedMaxSize(
16691666
byte[] ownerAddress, int type) {
1670-
if (ownerAddress == null) {
1671-
ownerAddress = this.getAddress();
1672-
}
16731667
return rpcCli.getCanDelegatedMaxSize(ownerAddress, type);
16741668
}
16751669

1676-
public Optional<GrpcAPI.GetAvailableUnfreezeCountResponseMessage> getAvailableUnfreezeCount(
1670+
public static Optional<GrpcAPI.GetAvailableUnfreezeCountResponseMessage> getAvailableUnfreezeCount(
16771671
byte[] ownerAddress) {
1678-
if (ownerAddress == null) {
1679-
ownerAddress = this.getAddress();
1680-
}
16811672
return rpcCli.getAvailableUnfreezeCount(ownerAddress);
16821673
}
16831674

0 commit comments

Comments
 (0)