getAccountResource
Query the resource information of an account(bandwidth,energy,etc).
getAccountResource(address)
PARAMS
- address(String)*
address, default hexString.
RETURN
AccountResourceMessage object.
EXAMPLE
wrapper.getAccountResource("TMmbeRPnFhXC7BPLaF2M1HCsoE4jwZNB7b");
The result is:
freeNetLimit: 5000
assetNetUsed {
key: "1000203"
value: 0
}
assetNetLimit {
key: "1000203"
value: 100000
}
TotalNetLimit: 43200000000
TotalNetWeight: 30001829306
EnergyLimit: 13348
TotalEnergyLimit: 90000000000
TotalEnergyWeight: 13485132
getAccountNet
Query bandwidth information.
getAccountNet(address)
PARAMS
- address(String)*
address, default hexString.
RETURN
AccountNetMessage object.
EXAMPLE
wrapper.getAccountNet("TMmbeRPnFhXC7BPLaF2M1HCsoE4jwZNB7b");
The result is:
freeNetLimit: 5000
assetNetUsed {
key: "1000203"
value: 0
}
assetNetLimit {
key: "1000203"
value: 100000
}
TotalNetLimit: 43200000000
TotalNetWeight: 30001829306
freezeBalance
Stake balance to get votes and energy or bandwidth, default for 3 days.
freezeBalance(ownerAddress, frozenBalance, frozenDuration, resourceCode, receiveAddress)
PARAMS
- ownerAddress(String)*
owner address, default hexString.
- frozenBalance(long)*
TRX stake amount, the unit is sun.
- frozenDuration(long)*
TRX stake duration, only be specified as 3 days.
- resourceCode(int)*
resource type, can be "ENERGY" or "BANDWIDTH"
- receiveAddress(String)
optional, the address that will receive the resource, default hexString
RETURN
TransactionExtention, including execution results.
THROWS
IllegalException, if fail to stake balance.
EXAMPLE
TransactionExtention transaction = wrapper.freezeBalance("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm", 1_000_000L, 3L,1,"TMmbeRPnFhXC7BPLaF2M1HCsoE4jwZNB7b");
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);
The result is:
557c9975c5db33d33c634c307a3ce05477c56cb124df94f1cbd8af247d6dd017
unfreezeBalance
Unstake the staked TRX.
unfreezeBalance(ownerAddress, resourceCode, receiveAddress)
PARAMS
- ownerAddress(String)*
owner address, default hexString.
- resourceCode(int)*
resource type, can be "ENERGY" or "BANDWIDTH"
- receiveAddress(String)
optional, the address that will receive the resource, default hexString
RETURN
TransactionExtention, including execution results.
THROWS
IllegalException, if fail to unfreeze balance.
EXAMPLE
TransactionExtention transaction = wrapper.unfreezeBalance("TFRgpvvNTe8bwC666D6orYhEkCcYsbax8U", 0);
Transaction signedTxn = wrapper.signTransaction(transaction);
String ret = wrapper.broadcastTransaction(signedTxn);
The result is:
48f7cd24b548de95d58a65b74aeeb5413e4d8a4638e40ec1fbfb212aeded7419
getDelegatedResource
Returns all resources delegations from an account to another account. The fromAddress can be retrieved from the GetDelegatedResourceAccountIndex API.
getDelegatedResource(fromAddress, toAddress)
PARAMS
- fromAddress(String)*
energy from address, default hexString.
- toAddress(String)*
energy delegation information, default hexString.
RETURN
DelegatedResourceList object.
EXAMPLE
wrapper.getDelegatedResource("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm","TMmbeRPnFhXC7BPLaF2M1HCsoE4jwZNB7b");
The result is:
delegatedResource {
from: "Aw\326^\303g\274`\360\216\276\327\302k\023\274\226\232S\364\217"
to: "A\201ok\226\373\273*C\253\307py\242c\312\315\215kSz"
frozen_balance_for_energy: 2000000
expire_time_for_energy: 1615020525000
}
getDelegatedResourceAccountIndex
Query the energy delegation by an account. i.e. list all addresses that have delegated resources to an account.
getDelegatedResourceAccountIndex(address)
PARAMS
- address(String)*
address, default hexString.
RETURN
DelegatedResourceAccountIndex object.
EXAMPLE
DelegatedResourceAccountIndex accountIndex = wrapper.getDelegatedResourceAccountIndex("TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm");
ByteString account = accountIndex.getAccount();
int fromAccountsCount = accountIndex.getFromAccountsCount();
for(int i =0;i<fromAccountsCount;i++){
ByteString fromAccounts = accountIndex.getFromAccounts(i);
}
int toAccountsCount = accountIndex.getToAccountsCount();
for(int i =0;i<toAccountsCount;i++){
ByteString toAccounts = accountIndex.getToAccounts(i);
}
The result is:
Accounts: TLtrDb1udekjDumnrf3EVeke3Q6pHkZxjm
toAccounts: TMmbeRPnFhXC7BPLaF2M1HCsoE4jwZNB7b