public class ApiWrapper extends java.lang.Object implements Api
ApiWrapper object is the entry point for calling the functions.
A ApiWrapper object is bind with a private key and a full node.
broadcastTransaction(org.tron.trident.proto.Chain.Transaction), signTransaction(org.tron.trident.proto.Response.TransactionExtention, org.tron.trident.core.key.KeyPair) and other transaction related
operations can be done via a ApiWrapper object.
Contract,
Chain.Transaction,
Contract| Modifier and Type | Field and Description |
|---|---|
WalletGrpc.WalletBlockingStub |
blockingStub |
WalletSolidityGrpc.WalletSolidityBlockingStub |
blockingStubSolidity |
io.grpc.ManagedChannel |
channel |
io.grpc.ManagedChannel |
channelSolidity |
KeyPair |
keyPair |
| Constructor and Description |
|---|
ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey) |
ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
int timeout) |
ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.util.List<io.grpc.ClientInterceptor> clientInterceptors) |
ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.util.List<io.grpc.ClientInterceptor> clientInterceptors,
int timeout) |
ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.lang.String apiKey) |
| Modifier and Type | Method and Description |
|---|---|
Response.TransactionExtention |
accountPermissionUpdate(Contract.AccountPermissionUpdateContract accountPermissionUpdateContract)
Update account permissions for multiSign
|
Response.TransactionExtention |
accountPermissionUpdate(java.lang.String ownerAddress,
AccountPermissions accountPermissions)
update account permissions with new owner/witness/active permissions
|
Response.TransactionExtention |
approveProposal(java.lang.String ownerAddress,
long proposalId,
boolean isAddApproval)
ProposalApprove
Approves proposed transaction.
|
Contract.AssetIssueContract.Builder |
assetIssueContractBuilder(java.lang.String ownerAddress,
java.lang.String name,
java.lang.String abbr,
long totalSupply,
int trxNum,
int icoNum,
long startTime,
long endTime,
java.lang.String url,
long freeAssetNetLimit,
long publicFreeAssetNetLimit,
int precision,
java.lang.String description) |
java.lang.String |
broadcastTransaction(Chain.Transaction txn)
broadcast a transaction with the binding account.
|
static byte[] |
calculateTransactionHash(Chain.Transaction txn) |
Response.TransactionExtention |
cancelAllUnfreezeV2(java.lang.String ownerAddress)
Stake2.0 API
Cancel all the unstaking transactions in the waiting period
|
Response.TransactionExtention |
clearContractABI(java.lang.String ownerAddress,
java.lang.String contractAddress)
ClearABIContract
|
void |
close() |
Response.TransactionExtention |
constantCall(java.lang.String ownerAddress,
java.lang.String contractAddress,
Function function)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
Use
triggerConstantContract(String, String, Function, NodeType...) instead. |
Response.TransactionExtention |
constantCallV2(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
Use
triggerConstantContract(String, String, String, NodeType...) instead. |
Response.TransactionExtention |
createAccount(java.lang.String ownerAddress,
java.lang.String accountAddress)
Create an account.
|
static Contract.AccountCreateContract |
createAccountCreateContract(com.google.protobuf.ByteString owner,
com.google.protobuf.ByteString address) |
static Contract.AccountUpdateContract |
createAccountUpdateContract(com.google.protobuf.ByteString accountName,
com.google.protobuf.ByteString address) |
Response.TransactionExtention |
createAssetIssue(java.lang.String ownerAddress,
java.lang.String name,
java.lang.String abbr,
long totalSupply,
int trxNum,
int icoNum,
long startTime,
long endTime,
java.lang.String url,
long freeAssetNetLimit,
long publicFreeAssetNetLimit,
int precision,
java.util.HashMap<java.lang.String,java.lang.String> frozenSupply,
java.lang.String description)
Issue a token
|
Response.TransactionExtention |
createAssetIssue(java.lang.String ownerAddress,
java.lang.String name,
java.lang.String abbr,
long totalSupply,
int trxNum,
int icoNum,
long startTime,
long endTime,
java.lang.String url,
long freeAssetNetLimit,
long publicFreeAssetNetLimit,
int precision,
java.lang.String description)
Issue a token
|
static Contract.SetAccountIdContract |
createSetAccountIdContract(com.google.protobuf.ByteString accountId,
com.google.protobuf.ByteString address) |
Contract.CreateSmartContract |
createSmartContract(java.lang.String contractName,
java.lang.String address,
java.lang.String ABI,
java.lang.String code,
long callValue,
long consumeUserResourcePercent,
long originEnergyLimit,
long tokenValue,
java.lang.String tokenId) |
Contract.CreateSmartContract |
createSmartContract(java.lang.String contractName,
java.lang.String address,
java.lang.String ABI,
java.lang.String code,
long callValue,
long consumeUserResourcePercent,
long originEnergyLimit,
long tokenValue,
java.lang.String tokenId,
java.lang.String libraryAddressPair,
java.lang.String compilerVersion) |
Response.TransactionExtention |
createTransactionExtention(com.google.protobuf.Message request,
Chain.Transaction.Contract.ContractType contractType)
build Transaction Extention in local.
|
static Contract.UnfreezeAssetContract |
createUnfreezeAssetContract(com.google.protobuf.ByteString address) |
static Contract.UpdateAssetContract |
createUpdateAssetContract(com.google.protobuf.ByteString address,
com.google.protobuf.ByteString description,
com.google.protobuf.ByteString url,
long newLimit,
long newPublicLimit) |
static Contract.VoteWitnessContract |
createVoteWitnessContract(com.google.protobuf.ByteString ownerAddress,
java.util.Map<java.lang.String,java.lang.String> votes) |
Response.TransactionExtention |
createWitness(java.lang.String ownerAddress,
java.lang.String url)
CreateWitness
Apply to become a witness.
|
Response.TransactionExtention |
delegateResource(java.lang.String ownerAddress,
long balance,
int resourceCode,
java.lang.String receiverAddress,
boolean lock)
Stake2.0 API
Delegate bandwidth or energy resources to other accounts
|
Response.TransactionExtention |
delegateResourceV2(java.lang.String ownerAddress,
long balance,
int resourceCode,
java.lang.String receiverAddress,
boolean lock,
long lockPeriod)
Stake2.0 API
Delegate bandwidth or energy resources to other accounts
|
Response.TransactionExtention |
deleteProposal(java.lang.String ownerAddress,
long proposalId)
ProposalDelete
Deletes Proposal Transaction.
|
Response.TransactionExtention |
deployContract(java.lang.String contractName,
java.lang.String abiStr,
java.lang.String bytecode,
java.util.List<Type<?>> constructorParams,
long feeLimit,
long consumeUserResourcePercent,
long originEnergyLimit,
long callValue,
java.lang.String tokenId,
long tokenValue)
Deploy a smart contract - no broadcasting
|
void |
disableLocalCreate() |
void |
enableLocalCreate(BlockId blockId,
long expireTime)
enable local create transaction.
|
long |
estimateBandwidth(Chain.Transaction txn)
Estimate the bandwidth consumption of the transaction.
|
Response.EstimateEnergyMessage |
estimateEnergy(java.lang.String ownerAddress,
java.lang.String contractAddress,
Function function,
NodeType... nodeType)
Estimate the energy required for the successful execution of smart contract transactions
This API is closed by default in tron node.
|
Response.EstimateEnergyMessage |
estimateEnergy(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData,
long callValue,
long tokenValue,
java.lang.String tokenId,
NodeType... nodeType)
Estimate the energy required for the successful execution of smart contract transactions
This API is closed by default in tron node.
|
Response.EstimateEnergyMessage |
estimateEnergyV2(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
Use
estimateEnergy(String, String, String, long, long, String, NodeType...) instead. |
Response.TransactionExtention |
exchangeCreate(java.lang.String ownerAddress,
java.lang.String firstToken,
long firstBalance,
java.lang.String secondToken,
long secondBalance)
exchangeCreate
|
Response.TransactionExtention |
exchangeInject(java.lang.String ownerAddress,
long exchangeId,
java.lang.String tokenId,
long amount)
exchangeInject
|
Response.TransactionExtention |
exchangeTransaction(java.lang.String ownerAddress,
long exchangeId,
java.lang.String tokenId,
long amount,
long expected)
create exchangeTransaction.
|
Response.TransactionExtention |
exchangeWithdraw(java.lang.String ownerAddress,
long exchangeId,
java.lang.String tokenId,
long quant)
create ExchangeWithdrawContract with parameters
|
Response.TransactionExtention |
freezeBalance(java.lang.String ownerAddress,
long frozenBalance,
int frozenDuration,
int resourceCode)
Freeze balance to get energy or bandwidth, for 3 days
|
Response.TransactionExtention |
freezeBalance(java.lang.String ownerAddress,
long frozenBalance,
int frozenDuration,
int resourceCode,
java.lang.String receiveAddress)
Freeze balance to get energy or bandwidth, for 3 days
|
Response.TransactionExtention |
freezeBalanceV2(java.lang.String ownerAddress,
long frozenBalance,
int resourceCode)
Stake2.0 API
Stake an amount of TRX to obtain bandwidth or energy, and obtain equivalent TRON Power(TP) according to the staked amount
|
static KeyPair |
generateAddress()
Generate random address
|
Response.Account |
getAccount(java.lang.String address,
NodeType... nodeType)
Get account info by address
|
long |
getAccountBalance(java.lang.String address) |
Response.Account |
getAccountById(java.lang.String id,
NodeType... nodeType) |
Response.AccountNetMessage |
getAccountNet(java.lang.String address)
Query bandwidth information
|
AccountPermissions |
getAccountPermissions(java.lang.String address,
NodeType... nodeType)
Retrieves the permissions of a TRON account.
|
Response.AccountResourceMessage |
getAccountResource(java.lang.String address)
Query the resource information of an account(bandwidth,energy,etc)
|
Response.Account |
getAccountSolidity(java.lang.String address)
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getAccount(String, NodeType...) instead |
Response.AssetIssueList |
getAssetIssueByAccount(java.lang.String address)
Query the TRC10 token information issued by an account
|
Contract.AssetIssueContract |
getAssetIssueById(java.lang.String assetId,
NodeType... nodeType)
Query a token by token id
|
Contract.AssetIssueContract |
getAssetIssueByName(java.lang.String name,
NodeType... nodeType)
Query a token by token name
|
Response.AssetIssueList |
getAssetIssueList(NodeType... nodeType)
Query the list of all the TRC10 tokens
|
Response.AssetIssueList |
getAssetIssueListByName(java.lang.String name,
NodeType... nodeType)
Query the list of all the TRC10 tokens by token name
|
long |
getAvailableUnfreezeCount(java.lang.String ownerAddress,
NodeType... nodeType)
Stake2.0 API
query remaining times of executing unstake operation
|
Response.PricesResponseMessage |
getBandwidthPrices(NodeType... nodeType)
GetBandwidthPrices
Query historical bandwidth unit price.
|
Response.PricesResponseMessage |
getBandwidthPricesOnSolidity()
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getBandwidthPrices(NodeType...) instead |
Response.BlockExtention |
getBlock(boolean detail,
NodeType... nodeType)
get latest block extension
|
Response.BlockExtention |
getBlock(java.lang.String blockIDOrNum,
boolean detail,
NodeType... nodeType)
get block of one specified block
|
Response.BlockBalanceTrace |
getBlockBalance(java.lang.String blockId,
long blockNum)
GetBlockBalance
Get all balance change operations in a block(Note: At present, the interface data can only be queried through the following official nodes
47.241.20.47; 161.117.85.97; 161.117.224.116; 161.117.83.38)
|
Chain.Block |
getBlockById(java.lang.String blockID)
GetBlockById
Query block by ID(block hash).
|
Chain.Block |
getBlockByIdOrNum(java.lang.String blockIDOrNum)
GetBlockByIdOrNum
|
Response.BlockListExtention |
getBlockByLatestNum(long num)
Get some latest blocks
|
Response.BlockListExtention |
getBlockByLimitNext(long startNum,
long endNum)
Returns the list of Block Objects included in the 'Block Height' range specified
|
Response.BlockExtention |
getBlockByNum(long blockNum,
NodeType... nodeType)
Query block information by block height, it called getBlockByNum2 rpc
|
long |
getBrokerageInfo(java.lang.String address,
NodeType... nodeType)
Query the ratio of brokerage of the witness.
|
long |
getBurnTRX(NodeType... nodeType)
GetBurnTRX
Query the amount of TRX burned due to on-chain transaction fees since No.
|
long |
getCanDelegatedMaxSize(java.lang.String ownerAddress,
int type,
NodeType... nodeType)
Stake2.0 API
query the amount of delegatable resources share of the specified resource type for an address, unit is sun.
|
long |
getCanWithdrawUnfreezeAmount(java.lang.String ownerAddress,
long timestamp,
NodeType... nodeType)
Stake2.0 API
query the withdrawable balance at the specified timestamp
|
long |
getCanWithdrawUnfreezeAmount(java.lang.String ownerAddress,
NodeType... nodeType)
Stake2.0 API
query the withdrawable balance at the latest block timestamp
|
Response.ChainParameters |
getChainParameters()
All parameters that the blockchain committee can set
|
Contract |
getContract(java.lang.String contractAddress)
Obtain a
Contract object via an address |
Response.SmartContractDataWrapper |
getContractInfo(java.lang.String contractAddress)
getContractInfo
|
Response.DelegatedResourceList |
getDelegatedResource(java.lang.String fromAddress,
java.lang.String toAddress,
NodeType... nodeType)
Returns all resources delegations from an account to another account.
|
Response.DelegatedResourceAccountIndex |
getDelegatedResourceAccountIndex(java.lang.String address,
NodeType... nodeType)
Query the energy delegation by an account.
|
Response.DelegatedResourceAccountIndex |
getDelegatedResourceAccountIndexV2(java.lang.String address,
NodeType... nodeType)
Stake2.0 API
query the delegated resource index of an account.
|
Response.DelegatedResourceList |
getDelegatedResourceV2(java.lang.String fromAddress,
java.lang.String toAddress,
NodeType... nodeType)
Stake2.0 API
query the detail of resource share delegated from fromAddress to toAddress
|
Response.PricesResponseMessage |
getEnergyPrices(NodeType... nodeType)
GetEnergyPrices
Query historical energy unit price.
|
Response.PricesResponseMessage |
getEnergyPricesOnSolidity()
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getEnergyPrices(NodeType...) instead |
Response.Exchange |
getExchangeById(java.lang.String id,
NodeType... nodeType)
Query exchange pair based on id
|
Response.MarketOrderList |
getMarketOrderByAccount(java.lang.String address,
NodeType... nodeType)
getMarketOrderByAccount
|
Response.MarketOrder |
getMarketOrderById(java.lang.String txn,
NodeType... nodeType)
getMarketOrderById
|
Response.MarketOrderList |
getMarketOrderListByPair(java.lang.String sellTokenId,
java.lang.String buyTokenId,
NodeType... nodeType)
getMarketOrderListByPair
|
Response.MarketOrderPairList |
getMarketPairList(NodeType... nodeType)
getMarketPairList
|
Response.MarketPriceList |
getMarketPriceByPair(java.lang.String sellTokenId,
java.lang.String buyTokenId,
NodeType... nodeType)
getMarketPriceByPair
|
Response.PricesResponseMessage |
getMemoFee()
GetMemoFee
Query historical memo fee.
|
long |
getNextMaintenanceTime()
GetNextMaintenanceTime
Returns the timestamp of the next voting time in milliseconds.
|
Response.NodeInfo |
getNodeInfo()
Get current API node info
|
Chain.Block |
getNowBlock(NodeType... nodeType)
Query the latest block information
|
Response.BlockExtention |
getNowBlock2(NodeType... nodeType)
Query the latest block information
|
Response.BlockExtention |
getNowBlockSolidity()
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getNowBlock2(NodeType...) instead |
Response.AssetIssueList |
getPaginatedAssetIssueList(long offset,
long limit,
NodeType... nodeType)
Query the list of all the tokens by pagination.
|
Response.ExchangeList |
getPaginatedExchangeList(long offset,
long limit)
get paginated exchange list
|
Response.WitnessList |
getPaginatedNowWitnessList(long offset,
long limit,
NodeType... nodeType)
Get a paginated list of real-time witnesses ordered by vote count
Note: This method may throw an exception when FullNode is in the maintenance period.
|
Response.ProposalList |
getPaginatedProposalList(long offset,
long limit)
get paginated proposal list
|
long |
getPendingSize()
GetPendingSize
Get the size of the pending pool queue
|
Response.Proposal |
getProposalById(java.lang.String id)
Query proposal based on ID
|
GrpcAPI.NumberMessage |
getRewardInfo(java.lang.String address,
NodeType... nodeType)
Get the rewards that the voter has not received
|
GrpcAPI.NumberMessage |
getRewardSolidity(java.lang.String address)
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getRewardInfo(String, NodeType...) instead |
Common.SmartContract |
getSmartContract(java.lang.String contractAddress) |
Response.TransactionApprovedList |
getTransactionApprovedList(Chain.Transaction trx)
Query transaction approvedList
|
Chain.Transaction |
getTransactionById(java.lang.String txID,
NodeType... nodeType)
Query transaction information by transaction id
|
Chain.Transaction |
getTransactionByIdSolidity(java.lang.String txID)
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getTransactionById(String, NodeType...) instead |
long |
getTransactionCountByBlockNum(long blockNum,
NodeType... nodeType)
getTransactionCountByBlockNum
|
Chain.Transaction |
getTransactionFromPending(java.lang.String txId)
GetTransactionFromPending
Get transaction details from the pending pool
|
Response.TransactionInfoList |
getTransactionInfoByBlockNum(long blockNum,
NodeType... nodeType)
Get transactionInfo from block number
|
Response.TransactionInfoList |
getTransactionInfoByBlockNumSolidity(long blockNum)
Deprecated.
Since 0.10.0, scheduled for removal in future versions.
use
getTransactionInfoByBlockNum(long, NodeType...) instead |
Response.TransactionInfo |
getTransactionInfoById(java.lang.String txID,
NodeType... nodeType)
Query the transactionInfo by transaction id
|
GrpcAPI.TransactionIdList |
getTransactionListFromPending()
GetTransactionListFromPending
Get transaction list information from pending pool
|
Response.TransactionSignWeight |
getTransactionSignWeight(Chain.Transaction trx)
Query transaction sign weight
|
Response.ExchangeList |
listExchanges(NodeType... nodeType)
List all exchange pairs
|
Response.NodeList |
listNodes()
List all nodes that current API node is connected to
|
Response.ProposalList |
listProposals()
List all proposals
|
Response.WitnessList |
listWitnesses(NodeType... nodeType)
List all witnesses that current API node is connected to
|
Response.TransactionExtention |
marketCancelOrder(java.lang.String ownerAddress,
java.lang.String orderId)
crete MarketCancelOrderContract with parameters
|
Response.TransactionExtention |
marketSellAsset(java.lang.String ownerAddress,
java.lang.String sellTokenId,
long sellTokenQuantity,
java.lang.String buyTokenId,
long buyTokenQuantity)
create MarketSellAssetContract with parameters
|
static ApiWrapper |
ofMainnet(java.lang.String hexPrivateKey)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
This method will only be available before TronGrid prohibits the use without API key
|
static ApiWrapper |
ofMainnet(java.lang.String hexPrivateKey,
java.lang.String apiKey)
The constructor for main net.
|
static ApiWrapper |
ofNile(java.lang.String hexPrivateKey)
The constructor for Nile test net.
|
static ApiWrapper |
ofShasta(java.lang.String hexPrivateKey)
The constructor for Shasta test net.
|
static com.google.protobuf.ByteString |
parseAddress(java.lang.String address)
The function receives addresses in any formats.
|
static com.google.protobuf.ByteString |
parseHex(java.lang.String hexString) |
Response.TransactionExtention |
participateAssetIssue(java.lang.String toAddress,
java.lang.String ownerAddress,
java.lang.String assertName,
long amount)
Participate a token
|
Response.TransactionExtention |
proposalCreate(java.lang.String ownerAddress,
java.util.Map<java.lang.Long,java.lang.Long> parameters)
ProposalCreate
Creates a proposal transaction.
|
Chain.Transaction |
setAccountId(java.lang.String id,
java.lang.String address) |
Response.TransactionExtention |
setAccountId2(java.lang.String id,
java.lang.String address) |
void |
setExpireTimeStamp(long expireTime) |
void |
setReferHeadBlockId(BlockId blockId) |
Chain.Transaction |
signTransaction(Chain.Transaction txn) |
Chain.Transaction |
signTransaction(Chain.Transaction txn,
KeyPair keyPair) |
Chain.Transaction |
signTransaction(Response.TransactionExtention txnExt) |
Chain.Transaction |
signTransaction(Response.TransactionExtention txnExt,
KeyPair keyPair) |
static java.lang.String |
toHex(byte[] raw) |
static java.lang.String |
toHex(com.google.protobuf.ByteString raw) |
Response.TransactionExtention |
transfer(java.lang.String fromAddress,
java.lang.String toAddress,
long amount)
Transfer TRX.
|
Response.TransactionExtention |
transferTrc10(java.lang.String fromAddress,
java.lang.String toAddress,
int tokenId,
long amount)
Transfers TRC10 Asset
|
TransactionBuilder |
triggerCall(java.lang.String ownerAddress,
java.lang.String contractAddress,
Function function)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
Use
triggerConstantContract(String, String, Function, NodeType...) instead. |
TransactionBuilder |
triggerCallV2(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData)
Deprecated.
Since 0.9.2, scheduled for removal in future versions.
Use
triggerConstantContract(String, String, String, NodeType...) instead. |
Response.TransactionExtention |
triggerConstantContract(java.lang.String ownerAddress,
java.lang.String contractAddress,
Function function,
NodeType... nodeType) |
Response.TransactionExtention |
triggerConstantContract(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData,
long callValue,
long tokenValue,
java.lang.String tokenId,
NodeType... nodeType)
make a constant call - no broadcasting, no need to broadcast
|
Response.TransactionExtention |
triggerConstantContract(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData,
NodeType... nodeType) |
Response.TransactionExtention |
triggerContract(java.lang.String ownerAddress,
java.lang.String contractAddress,
java.lang.String callData,
long callValue,
long tokenValue,
java.lang.String tokenId,
long feeLimit)
make a TriggerSmartContract, - no broadcasting.
|
Response.TransactionExtention |
undelegateResource(java.lang.String ownerAddress,
long balance,
int resourceCode,
java.lang.String receiverAddress)
Stake2.0 API
unDelegate resource
|
Response.TransactionExtention |
unfreezeAsset(java.lang.String ownerAddress)
Unfreeze a token that has passed the minimum freeze duration
|
Response.TransactionExtention |
unfreezeBalance(java.lang.String ownerAddress,
int resourceCode)
Unfreeze balance to get TRX back
|
Response.TransactionExtention |
unfreezeBalance(java.lang.String ownerAddress,
int resourceCode,
java.lang.String receiveAddress)
Unfreeze balance to get TRX back
|
Response.TransactionExtention |
unfreezeBalanceV2(java.lang.String ownerAddress,
long unfreezeBalance,
int resourceCode)
Stake2.0 API
Unstake some TRX, release the corresponding amount of bandwidth or energy, and voting rights (TP)
|
Response.TransactionExtention |
updateAccount(java.lang.String address,
java.lang.String accountName)
Modify account name
|
Response.TransactionExtention |
updateAsset(java.lang.String ownerAddress,
java.lang.String description,
java.lang.String url,
long newLimit,
long newPublicLimit)
Update basic TRC10 token information
|
Response.TransactionExtention |
updateBrokerage(java.lang.String address,
int brokerage) |
Response.TransactionExtention |
updateEnergyLimit(java.lang.String ownerAddress,
java.lang.String contractAddress,
long originEnergyLimit)
create UpdateEnergyLimitContract with parameters
|
Response.TransactionExtention |
updateSetting(java.lang.String ownerAddress,
java.lang.String contractAddress,
long consumeUserResourcePercent)
create UpdateSettingContract with parameters
|
Response.TransactionExtention |
updateWitness(java.lang.String ownerAddress,
java.lang.String updateUrl)
UpdateWitness
Edit the URL of the witness's official website.
|
Response.TransactionExtention |
voteWitness(java.lang.String ownerAddress,
java.util.HashMap<java.lang.String,java.lang.String> votes)
Vote for witnesses
|
Response.TransactionExtention |
withdrawBalance(java.lang.String ownerAddress)
WithdrawBalance
Super Representative or user withdraw rewards, usable every 24 hours.
|
Response.TransactionExtention |
withdrawExpireUnfreeze(java.lang.String ownerAddress)
Stake2.0 API
withdraw unfrozen balance
|
public final WalletGrpc.WalletBlockingStub blockingStub
public final WalletSolidityGrpc.WalletSolidityBlockingStub blockingStubSolidity
public final KeyPair keyPair
public final io.grpc.ManagedChannel channel
public final io.grpc.ManagedChannel channelSolidity
public ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey)
public ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.lang.String apiKey)
public ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.util.List<io.grpc.ClientInterceptor> clientInterceptors)
public ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
int timeout)
public ApiWrapper(java.lang.String grpcEndpoint,
java.lang.String grpcEndpointSolidity,
java.lang.String hexPrivateKey,
java.util.List<io.grpc.ClientInterceptor> clientInterceptors,
int timeout)
public static ApiWrapper ofMainnet(java.lang.String hexPrivateKey, java.lang.String apiKey)
hexPrivateKey - the binding private key. Operations require private key will all use this unless the private key is specified elsewhere.apiKey - this function works with TronGrid, an API key is required.@Deprecated public static ApiWrapper ofMainnet(java.lang.String hexPrivateKey)
hexPrivateKey - the binding private key. Operations require private key will all use this unless the private key is specified elsewhere.public static ApiWrapper ofShasta(java.lang.String hexPrivateKey)
hexPrivateKey - the binding private key. Operations require private key will all use this unless the private key is specified elsewhere.public static ApiWrapper ofNile(java.lang.String hexPrivateKey)
hexPrivateKey - the binding private key. Operations require private key will all use this unless the private key is specified elsewhere.public void enableLocalCreate(BlockId blockId, long expireTime)
blockId - refer blockId used in createTransaction. It will be invalid after 65535 blocks
so remember to update it timely.expireTime - transaction's absolute expire timestamp in createTransaction, milliseconds.public void disableLocalCreate()
public void setReferHeadBlockId(BlockId blockId)
public void setExpireTimeStamp(long expireTime)
public static KeyPair generateAddress()
public static com.google.protobuf.ByteString parseAddress(java.lang.String address)
address - account or contract address in any allowed formats.public static byte[] calculateTransactionHash(Chain.Transaction txn)
public static com.google.protobuf.ByteString parseHex(java.lang.String hexString)
public static java.lang.String toHex(byte[] raw)
public static java.lang.String toHex(com.google.protobuf.ByteString raw)
public static Contract.VoteWitnessContract createVoteWitnessContract(com.google.protobuf.ByteString ownerAddress, java.util.Map<java.lang.String,java.lang.String> votes)
public static Contract.AccountUpdateContract createAccountUpdateContract(com.google.protobuf.ByteString accountName, com.google.protobuf.ByteString address)
public static Contract.AccountCreateContract createAccountCreateContract(com.google.protobuf.ByteString owner, com.google.protobuf.ByteString address)
public static Contract.SetAccountIdContract createSetAccountIdContract(com.google.protobuf.ByteString accountId, com.google.protobuf.ByteString address)
public static Contract.UpdateAssetContract createUpdateAssetContract(com.google.protobuf.ByteString address, com.google.protobuf.ByteString description, com.google.protobuf.ByteString url, long newLimit, long newPublicLimit)
public static Contract.UnfreezeAssetContract createUnfreezeAssetContract(com.google.protobuf.ByteString address)
public void close()
public Chain.Transaction signTransaction(Response.TransactionExtention txnExt, KeyPair keyPair)
signTransaction in interface Apipublic Chain.Transaction signTransaction(Chain.Transaction txn, KeyPair keyPair)
signTransaction in interface Apipublic Chain.Transaction signTransaction(Response.TransactionExtention txnExt)
signTransaction in interface Apipublic Chain.Transaction signTransaction(Chain.Transaction txn)
signTransaction in interface Apipublic Response.TransactionExtention createTransactionExtention(com.google.protobuf.Message request, Chain.Transaction.Contract.ContractType contractType) throws IllegalException
createTransactionExtention in interface ApicontractType - transaction type.request - transaction message object.IllegalExceptionpublic long estimateBandwidth(Chain.Transaction txn)
estimateBandwidth in interface Apitxn - the transaction to be estimated.public java.lang.String broadcastTransaction(Chain.Transaction txn) throws java.lang.RuntimeException
broadcastTransaction in interface Apitxn - a signed transaction ready to be broadcastedjava.lang.RuntimeException - if broadcastin failspublic Response.TransactionExtention transfer(java.lang.String fromAddress, java.lang.String toAddress, long amount) throws IllegalException
transfer in interface ApifromAddress - owner addresstoAddress - receive balanceamount - transfer amountIllegalException - if fail to transferpublic Response.TransactionExtention transferTrc10(java.lang.String fromAddress, java.lang.String toAddress, int tokenId, long amount) throws IllegalException
transferTrc10 in interface ApifromAddress - owner addresstoAddress - receive balancetokenId - asset nameamount - transfer amountIllegalException - if fail to transfer trc10public Response.TransactionExtention freezeBalance(java.lang.String ownerAddress, long frozenBalance, int frozenDuration, int resourceCode) throws IllegalException
freezeBalance in interface ApiownerAddress - owner addressfrozenBalance - frozen balancefrozenDuration - frozen durationresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")IllegalException - if fail to freeze balancepublic Response.TransactionExtention freezeBalance(java.lang.String ownerAddress, long frozenBalance, int frozenDuration, int resourceCode, java.lang.String receiveAddress) throws IllegalException
freezeBalance in interface ApiownerAddress - owner addressfrozenBalance - frozen balancefrozenDuration - frozen durationresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")receiveAddress - the address that will receive the resource, default hexStringIllegalException - if fail to freeze balancepublic Response.TransactionExtention freezeBalanceV2(java.lang.String ownerAddress, long frozenBalance, int resourceCode) throws IllegalException
freezeBalanceV2 in interface ApiownerAddress - owner addressfrozenBalance - TRX stake amount, the unit is sunresourceCode - resource type, can be 0("BANDWIDTH") or 1("ENERGY")IllegalException - if fail to freeze balancepublic Response.TransactionExtention unfreezeBalance(java.lang.String ownerAddress, int resourceCode) throws IllegalException
unfreezeBalance in interface ApiownerAddress - owner addressresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")IllegalException - if fail to unfreeze balancepublic Response.TransactionExtention unfreezeBalance(java.lang.String ownerAddress, int resourceCode, java.lang.String receiveAddress) throws IllegalException
unfreezeBalance in interface ApiownerAddress - owner addressresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")receiveAddress - the address that will lose the resource, default hexStringIllegalException - if fail to unfreeze balancepublic Response.TransactionExtention unfreezeBalanceV2(java.lang.String ownerAddress, long unfreezeBalance, int resourceCode) throws IllegalException
unfreezeBalanceV2 in interface ApiownerAddress - owner addressunfreezeBalance - the amount of TRX to unstake, in sunresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")IllegalException - if fail to unfreeze balancepublic Response.TransactionExtention cancelAllUnfreezeV2(java.lang.String ownerAddress) throws IllegalException
cancelAllUnfreezeV2 in interface ApiownerAddress - owner addressIllegalException - if fail to delegate resourcepublic Response.TransactionExtention delegateResource(java.lang.String ownerAddress, long balance, int resourceCode, java.lang.String receiverAddress, boolean lock) throws IllegalException
delegateResource in interface ApiownerAddress - owner addressbalance - Amount of TRX staked for resources to be delegated, unit is sunresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")receiverAddress - Resource receiver addresslock - Whether it is locked, if it is set to true,
the delegated resources cannot be undelegated within 3 days.
When the lock time is not over, if the owner delegates the same type of resources using the lock to the same address,
the lock time will be reset to 3 daysIllegalException - if fail to delegate resourcepublic Response.TransactionExtention delegateResourceV2(java.lang.String ownerAddress, long balance, int resourceCode, java.lang.String receiverAddress, boolean lock, long lockPeriod) throws IllegalException
delegateResourceV2 in interface ApiownerAddress - owner addressbalance - Amount of TRX staked for resources to be delegated, unit is sunresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")receiverAddress - Resource receiver addresslock - Whether it is locked, if it is set to true,
the delegated resources cannot be undelegated within 3 days.
When the lock time is not over, if the owner delegates the same type of resources using the lock to the same address,
the lock time will be reset to 3 dayslockPeriod - The lockup period, unit is blocks, data type is int256,
It indicates how many blocks the resource delegating is locked before it can be undelegated.IllegalException - if fail to delegate resourcepublic Response.TransactionExtention undelegateResource(java.lang.String ownerAddress, long balance, int resourceCode, java.lang.String receiverAddress) throws IllegalException
undelegateResource in interface ApiownerAddress - owner addressbalance - Amount of TRX staked for resources to be delegated, unit is sunresourceCode - Resource type, can be 0("BANDWIDTH") or 1("ENERGY")receiverAddress - Resource receiver addressIllegalException - if fail to undelegate resourcepublic Response.TransactionExtention withdrawExpireUnfreeze(java.lang.String ownerAddress) throws IllegalException
withdrawExpireUnfreeze in interface ApiownerAddress - owner addressIllegalException - if fail to withdrawpublic long getAvailableUnfreezeCount(java.lang.String ownerAddress,
NodeType... nodeType)
getAvailableUnfreezeCount in interface ApiownerAddress - owner addressnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public long getCanWithdrawUnfreezeAmount(java.lang.String ownerAddress,
NodeType... nodeType)
getCanWithdrawUnfreezeAmount in interface ApiownerAddress - owner addressnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public long getCanWithdrawUnfreezeAmount(java.lang.String ownerAddress,
long timestamp,
NodeType... nodeType)
getCanWithdrawUnfreezeAmount in interface ApiownerAddress - owner addresstimestamp - specified timestamp, millisecondsnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public long getCanDelegatedMaxSize(java.lang.String ownerAddress,
int type,
NodeType... nodeType)
getCanDelegatedMaxSize in interface ApiownerAddress - owner addresstype - resource type, 0 is bandwidth, 1 is energynodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.DelegatedResourceList getDelegatedResourceV2(java.lang.String fromAddress, java.lang.String toAddress, NodeType... nodeType)
getDelegatedResourceV2 in interface ApifromAddress - from addresstoAddress - to addressnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.DelegatedResourceAccountIndex getDelegatedResourceAccountIndexV2(java.lang.String address, NodeType... nodeType) throws IllegalException
getDelegatedResourceAccountIndexV2 in interface Apiaddress - owner addressnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if fail to get resourcepublic Response.TransactionExtention voteWitness(java.lang.String ownerAddress, java.util.HashMap<java.lang.String,java.lang.String> votes) throws IllegalException
voteWitness in interface ApiownerAddress - owner addressvotes - map of vote address -> vote countIllegalExceptionpublic Response.TransactionExtention createAccount(java.lang.String ownerAddress, java.lang.String accountAddress) throws IllegalException
createAccount in interface ApiownerAddress - owner address, an activated accountaccountAddress - the address of the new accountIllegalExceptionpublic Response.TransactionExtention updateAccount(java.lang.String address, java.lang.String accountName) throws IllegalException
updateAccount in interface Apiaddress - owner addressaccountName - the name of the accountIllegalExceptionpublic Chain.Block getNowBlock(NodeType... nodeType) throws IllegalException
getNowBlock in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if fail to get now blockpublic Response.BlockExtention getNowBlock2(NodeType... nodeType) throws IllegalException
getNowBlock2 in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if fail to get now blockpublic Response.BlockExtention getBlockByNum(long blockNum, NodeType... nodeType) throws IllegalException
getBlockByNum in interface ApiblockNum - The block heightnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if fail to get blockpublic Response.BlockListExtention getBlockByLatestNum(long num) throws IllegalException
getBlockByLatestNum in interface Apinum - Number of latest blocksIllegalException - if the parameters are not correctpublic Response.BlockListExtention getBlockByLimitNext(long startNum, long endNum) throws IllegalException
getBlockByLimitNext in interface ApistartNum - Number of start block height, including this blockendNum - Number of end block height, excluding this blockIllegalException - if the blockList Not Found.public Response.NodeInfo getNodeInfo() throws IllegalException
getNodeInfo in interface ApiIllegalException - if fail to get nodeInfopublic Response.NodeList listNodes() throws IllegalException
listNodes in interface ApiIllegalException - if fail to get node listpublic Response.TransactionInfoList getTransactionInfoByBlockNum(long blockNum, NodeType... nodeType) throws IllegalException
getTransactionInfoByBlockNum in interface ApiblockNum - The block heightnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - no transactions or the blockNum is incorrectpublic Response.TransactionInfo getTransactionInfoById(java.lang.String txID, NodeType... nodeType) throws IllegalException
getTransactionInfoById in interface ApitxID - Transaction hash, i.e. transaction idnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if the transactionInfo not foundpublic Chain.Transaction getTransactionById(java.lang.String txID, NodeType... nodeType) throws IllegalException
getTransactionById in interface ApitxID - Transaction hash, i.e. transaction idnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if the transaction not foundpublic Response.Account getAccount(java.lang.String address, NodeType... nodeType)
getAccount in interface Apiaddress - address, default hexStringnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.AccountResourceMessage getAccountResource(java.lang.String address)
getAccountResource in interface Apiaddress - address, default hexStringpublic Response.AccountNetMessage getAccountNet(java.lang.String address)
getAccountNet in interface Apiaddress - address, default hexStringpublic long getAccountBalance(java.lang.String address)
getAccountBalance in interface Apipublic Response.Account getAccountById(java.lang.String id, NodeType... nodeType)
getAccountById in interface Apipublic Chain.Transaction setAccountId(java.lang.String id, java.lang.String address) throws IllegalException
setAccountId in interface ApiIllegalExceptionpublic Response.TransactionExtention setAccountId2(java.lang.String id, java.lang.String address) throws IllegalException
setAccountId2 in interface ApiIllegalExceptionpublic Response.ChainParameters getChainParameters() throws IllegalException
getChainParameters in interface ApiIllegalException - if fail to get chain parameterspublic Response.DelegatedResourceList getDelegatedResource(java.lang.String fromAddress, java.lang.String toAddress, NodeType... nodeType)
getDelegatedResource in interface ApifromAddress - energy from address, default hexStringtoAddress - energy delegation information, default hexStringnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.DelegatedResourceAccountIndex getDelegatedResourceAccountIndex(java.lang.String address, NodeType... nodeType)
getDelegatedResourceAccountIndex in interface Apiaddress - address,, default hexStringnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.AssetIssueList getAssetIssueList(NodeType... nodeType)
getAssetIssueList in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.AssetIssueList getPaginatedAssetIssueList(long offset, long limit, NodeType... nodeType)
getPaginatedAssetIssueList in interface Apioffset - the index of the start tokenlimit - the amount of tokens per pagenodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.AssetIssueList getAssetIssueByAccount(java.lang.String address)
getAssetIssueByAccount in interface Apiaddress - the Token Issuer account addresspublic Contract.AssetIssueContract getAssetIssueById(java.lang.String assetId, NodeType... nodeType)
getAssetIssueById in interface ApiassetId - the ID of the TRC10 tokennodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Contract.AssetIssueContract getAssetIssueByName(java.lang.String name, NodeType... nodeType)
getAssetIssueByName in interface Apiname - the name of the TRC10 tokennodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.AssetIssueList getAssetIssueListByName(java.lang.String name, NodeType... nodeType)
getAssetIssueListByName in interface Apiname - the name of the TRC10 tokennodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.TransactionExtention participateAssetIssue(java.lang.String toAddress, java.lang.String ownerAddress, java.lang.String assertName, long amount) throws IllegalException
participateAssetIssue in interface ApitoAddress - the issuer address of the token, default hexStringownerAddress - the participant address, default hexStringassertName - token id, default hexStringamount - participate token amountIllegalException - if fail to participate AssetIssuepublic Response.ProposalList listProposals()
listProposals in interface Apipublic Response.Proposal getProposalById(java.lang.String id)
getProposalById in interface Apiid - proposal idpublic Response.WitnessList listWitnesses(NodeType... nodeType)
listWitnesses in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.WitnessList getPaginatedNowWitnessList(long offset, long limit, NodeType... nodeType)
getPaginatedNowWitnessList in interface Apioffset - the pagination offset, specifying the starting index of witnesses to return (0-based)limit - the number of witnesses to returnnodeType - Optional parameter to specify which node to query.
If not provided, use full node default.
If NodeType.SOLIDITY_NODE, use solidity node.public Response.ExchangeList listExchanges(NodeType... nodeType)
listExchanges in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.Exchange getExchangeById(java.lang.String id, NodeType... nodeType) throws IllegalException
getExchangeById in interface Apiid - transaction pair idnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.IllegalException - if fail to get exchange pairpublic Response.TransactionExtention createAssetIssue(java.lang.String ownerAddress, java.lang.String name, java.lang.String abbr, long totalSupply, int trxNum, int icoNum, long startTime, long endTime, java.lang.String url, long freeAssetNetLimit, long publicFreeAssetNetLimit, int precision, java.util.HashMap<java.lang.String,java.lang.String> frozenSupply, java.lang.String description) throws IllegalException
createAssetIssue in interface ApiownerAddress - Owner address, default hexStringname - Token name, default hexStringabbr - Token name abbreviation, default hexStringtotalSupply - Token total supplytrxNum - Define the price by the ratio of trx_num/numicoNum - Define the price by the ratio of trx_num/numstartTime - ICO start timeendTime - ICO end timeurl - Token official website url, default hexStringfreeAssetNetLimit - Token free asset net limitpublicFreeAssetNetLimit - Token public free asset net limitfrozenSupply - HashMap of frozenDay -> frozenAmountdescription - Token description, default hexStringIllegalException - if fail to create AssetIssuepublic Response.TransactionExtention createAssetIssue(java.lang.String ownerAddress, java.lang.String name, java.lang.String abbr, long totalSupply, int trxNum, int icoNum, long startTime, long endTime, java.lang.String url, long freeAssetNetLimit, long publicFreeAssetNetLimit, int precision, java.lang.String description) throws IllegalException
createAssetIssue in interface ApiownerAddress - Owner address, default hexStringname - Token name, default hexStringabbr - Token name abbreviation, default hexStringtotalSupply - Token total supplytrxNum - Define the price by the ratio of trx_num/numicoNum - Define the price by the ratio of trx_num/numstartTime - ICO start timeendTime - ICO end timeurl - Token official website url, default hexStringfreeAssetNetLimit - Token free asset net limitpublicFreeAssetNetLimit - Token public free asset net limitdescription - Token description, default hexStringIllegalException - if fail to create AssetIssuepublic Contract.AssetIssueContract.Builder assetIssueContractBuilder(java.lang.String ownerAddress, java.lang.String name, java.lang.String abbr, long totalSupply, int trxNum, int icoNum, long startTime, long endTime, java.lang.String url, long freeAssetNetLimit, long publicFreeAssetNetLimit, int precision, java.lang.String description)
assetIssueContractBuilder in interface Apipublic Response.TransactionExtention updateAsset(java.lang.String ownerAddress, java.lang.String description, java.lang.String url, long newLimit, long newPublicLimit) throws IllegalException
updateAsset in interface ApiownerAddress - Owner address, default hexStringdescription - The description of token, default hexStringurl - The token's website url, default hexStringnewLimit - Each token holder's free bandwidthnewPublicLimit - The total free bandwidth of the tokenIllegalException - if fail to update assetpublic Response.TransactionExtention unfreezeAsset(java.lang.String ownerAddress) throws IllegalException
unfreezeAsset in interface ApiownerAddress - Owner address, default hexStringIllegalException - if fail to unfreeze assetpublic Response.TransactionExtention accountPermissionUpdate(Contract.AccountPermissionUpdateContract accountPermissionUpdateContract) throws IllegalException
accountPermissionUpdate in interface ApiaccountPermissionUpdateContract - AccountPermissionUpdateContractIllegalException - if fail to update account permissionpublic Response.TransactionExtention accountPermissionUpdate(java.lang.String ownerAddress, AccountPermissions accountPermissions) throws IllegalException
accountPermissionUpdate in interface ApiownerAddress - Owner addressaccountPermissions - New AccountPermission (containing owner/witness/active permissions)IllegalException - if newOwnerPermission or newActivePermissions is nullpublic AccountPermissions getAccountPermissions(java.lang.String address, NodeType... nodeType)
It queries the account using getAccount(String, NodeType...) and
wraps the result into an AccountPermissions object.
getAccountPermissions in interface Apiaddress - account, in any allowed formats.nodeType - Optional parameter to specify which node to query.
If not provided, use full node default.
If NodeType.SOLIDITY_NODE, use solidity node.public Response.TransactionSignWeight getTransactionSignWeight(Chain.Transaction trx)
getTransactionSignWeight in interface Apitrx - transaction objectpublic Response.TransactionApprovedList getTransactionApprovedList(Chain.Transaction trx)
getTransactionApprovedList in interface Apitrx - transaction object@Deprecated public Response.Account getAccountSolidity(java.lang.String address)
getAccount(String, NodeType...) insteadgetAccountSolidity in interface Apiaddress - address, default hexString@Deprecated public Response.TransactionInfoList getTransactionInfoByBlockNumSolidity(long blockNum) throws IllegalException
getTransactionInfoByBlockNum(long, NodeType...) insteadgetTransactionInfoByBlockNumSolidity in interface ApiblockNum - The block heightIllegalException - no transactions or the blockNum is incorrect@Deprecated public Response.BlockExtention getNowBlockSolidity() throws IllegalException
getNowBlock2(NodeType...) insteadgetNowBlockSolidity in interface ApiIllegalException - if fail to get now block@Deprecated public Chain.Transaction getTransactionByIdSolidity(java.lang.String txID) throws IllegalException
getTransactionById(String, NodeType...) insteadgetTransactionByIdSolidity in interface ApitxID - Transaction hash, i.e. transaction idIllegalException - if the transaction not foundpublic GrpcAPI.NumberMessage getRewardInfo(java.lang.String address, NodeType... nodeType)
getRewardInfo in interface Apiaddress - address, default hexStringnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.@Deprecated public GrpcAPI.NumberMessage getRewardSolidity(java.lang.String address)
getRewardInfo(String, NodeType...) insteadgetRewardSolidity in interface Apiaddress - address, default hexStringpublic Response.TransactionExtention updateBrokerage(java.lang.String address, int brokerage) throws IllegalException
updateBrokerage in interface ApiIllegalExceptionpublic long getBrokerageInfo(java.lang.String address,
NodeType... nodeType)
getBrokerageInfo in interface Apiaddress - the address of the witness's accountnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Contract getContract(java.lang.String contractAddress)
Contract object via an addressgetContract in interface ApicontractAddress - smart contract addresspublic Common.SmartContract getSmartContract(java.lang.String contractAddress)
getSmartContract in interface Api@Deprecated public Response.TransactionExtention constantCall(java.lang.String ownerAddress, java.lang.String contractAddress, Function function)
triggerConstantContract(String, String, Function, NodeType...) instead.constantCall in interface ApiownerAddress - the current caller.contractAddress - smart contract address.function - contract function.@Deprecated public Response.TransactionExtention constantCallV2(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData)
triggerConstantContract(String, String, String, NodeType...) instead.constantCallV2 in interface ApiownerAddress - the current caller.contractAddress - smart contract address.callData - The data passed along with a transaction that allows us to interact with smart contracts.public Response.TransactionExtention triggerConstantContract(java.lang.String ownerAddress, java.lang.String contractAddress, Function function, NodeType... nodeType)
triggerConstantContract in interface ApitriggerConstantContract(String, String, String, NodeType...)public Response.TransactionExtention triggerConstantContract(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData, NodeType... nodeType)
triggerConstantContract in interface ApitriggerConstantContract(String, String, String, long, long, String, NodeType...)public Response.TransactionExtention triggerConstantContract(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData, long callValue, long tokenValue, java.lang.String tokenId, NodeType... nodeType)
triggerConstantContract in interface ApiownerAddress - the current caller.contractAddress - smart contract address.callData - The data passed along with a transaction that allows us to interact with smart
contracts. It can be obtained by using FunctionEncoder.encode(org.tron.trident.abi.datatypes.Function).callValue - call Value. If TRX not used, use 0.tokenValue - token Value, If token10 not used, use 0.tokenId - token10 ID, If token10 not used, use null.nodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.@Deprecated public TransactionBuilder triggerCall(java.lang.String ownerAddress, java.lang.String contractAddress, Function function)
triggerConstantContract(String, String, Function, NodeType...) instead.triggerCall in interface ApiownerAddress - the current callercontractAddress - smart contract addressfunction - contract function@Deprecated public TransactionBuilder triggerCallV2(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData)
triggerConstantContract(String, String, String, NodeType...) instead.triggerCallV2 in interface ApiownerAddress - the current callercontractAddress - smart contract addresscallData - The data passed along with a transaction that allows us to interact with smart contracts.public Response.TransactionExtention triggerContract(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData, long callValue, long tokenValue, java.lang.String tokenId, long feeLimit) throws java.lang.Exception
triggerContract in interface ApiownerAddress - the current callercontractAddress - smart contract addresscallData - the encoded function call datacallValue - the amount of sun send to contract. If not used, set 0tokenValue - the amount of tokenId. If not used, set 0tokenId - tokenId. If not used, set nullfeeLimit - fee unit:SUNjava.lang.Exception - if failpublic Response.BlockBalanceTrace getBlockBalance(java.lang.String blockId, long blockNum)
getBlockBalance in interface ApiblockId - tx Id.eg:"000000000309c3c40be03c04615856fc6672b08af6d2cdbbf500a7cf9920fbdb"blockNum - block numberpublic long getBurnTRX(NodeType... nodeType)
getBurnTRX in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.TransactionExtention createWitness(java.lang.String ownerAddress, java.lang.String url) throws IllegalException
createWitness in interface ApiownerAddress - owner addressurl - The website URL of the SR nodeIllegalException - if fail to create witnesspublic Response.TransactionExtention updateWitness(java.lang.String ownerAddress, java.lang.String updateUrl) throws IllegalException
updateWitness in interface ApiownerAddress - owner addressupdateUrl - Updated URLIllegalException - if fail to update witnesspublic Response.TransactionExtention withdrawBalance(java.lang.String ownerAddress) throws IllegalException
withdrawBalance in interface ApiownerAddress - owner addressIllegalException - if fail to withdraw balancepublic long getNextMaintenanceTime()
getNextMaintenanceTime in interface Apipublic Response.TransactionExtention proposalCreate(java.lang.String ownerAddress, java.util.Map<java.lang.Long,java.lang.Long> parameters) throws IllegalException
proposalCreate in interface ApiownerAddress - owner addressparameters - Parameters proposed to be modified and their valuesIllegalException - if fail to proposal createpublic Response.TransactionExtention approveProposal(java.lang.String ownerAddress, long proposalId, boolean isAddApproval) throws IllegalException
approveProposal in interface ApiownerAddress - owner addressproposalId - Proposal idisAddApproval - Whether to agree with the proposalIllegalException - if fail to approve proposalpublic Response.TransactionExtention deleteProposal(java.lang.String ownerAddress, long proposalId) throws IllegalException
deleteProposal in interface ApiownerAddress - owner addressproposalId - Proposal idIllegalException - if fail to delete proposalpublic GrpcAPI.TransactionIdList getTransactionListFromPending()
getTransactionListFromPending in interface Apipublic long getPendingSize()
getPendingSize in interface Apipublic Chain.Transaction getTransactionFromPending(java.lang.String txId) throws IllegalException
getTransactionFromPending in interface ApitxId - Transaction IDIllegalException - if fail to get transaction from pendingpublic Chain.Block getBlockById(java.lang.String blockID)
getBlockById in interface ApiblockID - block hash.eg:"00000000000f424013e51b18e0782a32fa079ddafdb2f4c343468cf8896dc887"public Response.EstimateEnergyMessage estimateEnergy(java.lang.String ownerAddress, java.lang.String contractAddress, Function function, NodeType... nodeType)
estimateEnergy in interface ApiownerAddress - Owner address that triggers the contract. If visible=true, use base58check
format, otherwise use hex format. For constant call you can use the all-zero address.contractAddress - Smart contract address.function - contract functionnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.EstimateEnergyMessage estimateEnergy(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData, long callValue, long tokenValue, java.lang.String tokenId, NodeType... nodeType)
estimateEnergy in interface ApiownerAddress - Owner address that triggers the contract. If visible=true, use base58check
format, otherwise use hex format. For constant call you can use the all-zero address.contractAddress - Smart contract address.callData - The data passed along with a transaction that allows us to interact with smart contracts.callValue - call Value. If TRX not used, use 0.tokenValue - token Value, If token10 not used, use 0.tokenId - token10 ID, If token10 not used, use null.nodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.@Deprecated public Response.EstimateEnergyMessage estimateEnergyV2(java.lang.String ownerAddress, java.lang.String contractAddress, java.lang.String callData)
estimateEnergy(String, String, String, long, long, String, NodeType...) instead.estimateEnergyV2 in interface ApiownerAddress - Owner address that triggers the contract. If visible=true, use base58check
format, otherwise use hex format.
For constant call you can use the all-zero address.contractAddress - Smart contract address.callData - The data passed along with a transaction that allows us to interact with smart contracts.public Response.PricesResponseMessage getBandwidthPrices(NodeType... nodeType)
getBandwidthPrices in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.PricesResponseMessage getEnergyPrices(NodeType... nodeType)
getEnergyPrices in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.PricesResponseMessage getMemoFee()
getMemoFee in interface Api@Deprecated public Response.PricesResponseMessage getBandwidthPricesOnSolidity()
getBandwidthPrices(NodeType...) insteadgetBandwidthPricesOnSolidity in interface Api@Deprecated public Response.PricesResponseMessage getEnergyPricesOnSolidity()
getEnergyPrices(NodeType...) insteadgetEnergyPricesOnSolidity in interface Apipublic Response.TransactionExtention clearContractABI(java.lang.String ownerAddress, java.lang.String contractAddress) throws IllegalException
clearContractABI in interface ApiownerAddress - owner addresscontractAddress - contract addressIllegalExceptionpublic Response.ExchangeList getPaginatedExchangeList(long offset, long limit)
getPaginatedExchangeList in interface Apioffset - offsetlimit - limitpublic Response.ProposalList getPaginatedProposalList(long offset, long limit)
getPaginatedProposalList in interface Apioffset - offsetlimit - limitpublic Response.BlockExtention getBlock(java.lang.String blockIDOrNum, boolean detail, NodeType... nodeType)
getBlock in interface ApiblockIDOrNum - block Id or block numdetail - if false, no transactions are contained.nodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.BlockExtention getBlock(boolean detail, NodeType... nodeType)
public Chain.Block getBlockByIdOrNum(java.lang.String blockIDOrNum)
getBlockByIdOrNum in interface ApiblockIDOrNum - block Id with hex or block num with longpublic Response.SmartContractDataWrapper getContractInfo(java.lang.String contractAddress)
getContractInfo in interface ApicontractAddress - contract addresspublic Response.MarketOrderList getMarketOrderByAccount(java.lang.String address, NodeType... nodeType)
getMarketOrderByAccount in interface Apiaddress - account addressnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.MarketOrder getMarketOrderById(java.lang.String txn, NodeType... nodeType)
getMarketOrderById in interface Apitxn - market transactionIdnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.MarketOrderList getMarketOrderListByPair(java.lang.String sellTokenId, java.lang.String buyTokenId, NodeType... nodeType)
getMarketOrderListByPair in interface ApisellTokenId - market sell token idbuyTokenId - market buy token idnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.MarketOrderPairList getMarketPairList(NodeType... nodeType)
getMarketPairList in interface ApinodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.MarketPriceList getMarketPriceByPair(java.lang.String sellTokenId, java.lang.String buyTokenId, NodeType... nodeType)
getMarketPriceByPair in interface ApisellTokenId - market sell token idbuyTokenId - market buy token idnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.TransactionExtention exchangeCreate(java.lang.String ownerAddress, java.lang.String firstToken, long firstBalance, java.lang.String secondToken, long secondBalance) throws IllegalException
exchangeCreate in interface ApiownerAddress - addressfirstToken - first token id. TRX is "_", else token10 IDfirstBalance - first token id balancesecondToken - second token id. TRX is "_", else token10 IDsecondBalance - second token id balanceIllegalExceptionpublic Response.TransactionExtention exchangeInject(java.lang.String ownerAddress, long exchangeId, java.lang.String tokenId, long amount) throws IllegalException
exchangeInject in interface ApiownerAddress - ownerexchangeId - exchange idtokenId - token idamount - inject the amount of tokenId to exchangeIdIllegalExceptionpublic Response.TransactionExtention exchangeTransaction(java.lang.String ownerAddress, long exchangeId, java.lang.String tokenId, long amount, long expected) throws IllegalException
exchangeTransaction in interface ApiownerAddress - ownerexchangeId - exchange idtokenId - sell token idamount - inject the amount of tokenId to exchangeIdexpected - amount of buyTokenIdIllegalExceptionpublic Response.TransactionExtention exchangeWithdraw(java.lang.String ownerAddress, long exchangeId, java.lang.String tokenId, long quant) throws IllegalException
exchangeWithdraw in interface ApiownerAddress - owner addressexchangeId - exchangeIdtokenId - tokenIdquant - quantIllegalExceptionpublic long getTransactionCountByBlockNum(long blockNum,
NodeType... nodeType)
getTransactionCountByBlockNum in interface ApiblockNum - block numnodeType - Optional parameter to specify which node to query.
If not provided, uses full node default.
If NodeType.SOLIDITY_NODE, uses solidity node.public Response.TransactionExtention marketCancelOrder(java.lang.String ownerAddress, java.lang.String orderId) throws IllegalException
marketCancelOrder in interface ApiownerAddress - owner addressorderId - existing order IdIllegalExceptionpublic Response.TransactionExtention marketSellAsset(java.lang.String ownerAddress, java.lang.String sellTokenId, long sellTokenQuantity, java.lang.String buyTokenId, long buyTokenQuantity) throws IllegalException
marketSellAsset in interface ApiownerAddress - owner addresssellTokenId - sell token Id, "_" or all digit with 0~9sellTokenQuantity - sell token quantitybuyTokenId - buy token Id, "_" or all digit with 0~9buyTokenQuantity - buy token quantityIllegalExceptionpublic Response.TransactionExtention updateEnergyLimit(java.lang.String ownerAddress, java.lang.String contractAddress, long originEnergyLimit) throws IllegalException
updateEnergyLimit in interface ApiownerAddress - owner addresscontractAddress - contract addressoriginEnergyLimit - origin energy limit, must gt 0IllegalException - if originEnergyLimit is invalidpublic Response.TransactionExtention updateSetting(java.lang.String ownerAddress, java.lang.String contractAddress, long consumeUserResourcePercent) throws IllegalException
updateSetting in interface ApiownerAddress - owner addresscontractAddress - contract addressconsumeUserResourcePercent - consume user resource percent if user trigger this contract, must be [0,100]IllegalException - if consumeUserResourcePercent is invalidpublic Contract.CreateSmartContract createSmartContract(java.lang.String contractName, java.lang.String address, java.lang.String ABI, java.lang.String code, long callValue, long consumeUserResourcePercent, long originEnergyLimit, long tokenValue, java.lang.String tokenId) throws java.lang.Exception
createSmartContract in interface ApicontractName - contractNameaddress - ownerAddressABI - abiStringcode - bytecodecallValue - the amount of deposit TRX(unit sun), default is 0consumeUserResourcePercent - consumeUserResourcePercent,range 0-100originEnergyLimit - originEnergyLimittokenValue - the amount of deposit token 10, default is 0tokenId - the ID of token 10java.lang.Exception - exceptionpublic Contract.CreateSmartContract createSmartContract(java.lang.String contractName, java.lang.String address, java.lang.String ABI, java.lang.String code, long callValue, long consumeUserResourcePercent, long originEnergyLimit, long tokenValue, java.lang.String tokenId, java.lang.String libraryAddressPair, java.lang.String compilerVersion) throws java.lang.Exception
createSmartContract in interface ApicontractName - contractNameaddress - ownerAddressABI - abiStringcode - bytecodecallValue - the amount of deposit TRX(unit sun), default is 0consumeUserResourcePercent - consumeUserResourcePercent,range 0-100originEnergyLimit - originEnergyLimittokenValue - the amount of deposit token 10, default is 0tokenId - the ID of token 10libraryAddressPair - walletCli compatiblecompilerVersion - walletCli compatiblejava.lang.Exception - exceptionpublic Response.TransactionExtention deployContract(java.lang.String contractName, java.lang.String abiStr, java.lang.String bytecode, java.util.List<Type<?>> constructorParams, long feeLimit, long consumeUserResourcePercent, long originEnergyLimit, long callValue, java.lang.String tokenId, long tokenValue) throws java.lang.Exception
deployContract in interface ApicontractName - contract nameabiStr - abibytecode - bytecodeconstructorParams - constructorParams, no Params set null or empty listfeeLimit - feeLimitconsumeUserResourcePercent - consumeUserResourcePercent,range 0-100originEnergyLimit - originEnergyLimitcallValue - TRX valuetokenValue - token value of token10tokenId - token10 ID, no use set null or ""java.lang.Exception - exception if fail