public class AElfClient extends Object
| 构造器和说明 |
|---|
AElfClient(String url)
Object construction through the url path.
|
AElfClient(String url,
String version)
Object construction through the url path.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Boolean |
addPeer(AddPeerInput input)
Attempts to add a node to the connected network nodes wa:/api/net/peer.
|
CreateRawTransactionOutput |
createRawTransaction(CreateRawTransactionInput input)
Creates an unsigned serialized transaction wa:/api/blockChain/rawTransaction.
|
String |
executeRawTransaction(ExecuteRawTransactionDto input)
Call a method of a contract by given serialized str wa:/api/blockChain/executeRawTransaction.
|
String |
executeTransaction(ExecuteTransactionDto input)
Call a read-only method of a contract. wa:/api/blockChain/executeTransaction
|
KeyPairInfo |
generateKeyPairInfo()
new generateKeyPairInfo;
|
Core.Transaction.Builder |
generateTransaction(String from,
String to,
String methodName,
byte[] params)
Build a transaction from the input parameters.
|
String |
getAddressFromPrivateKey(String privateKey)
Get address of a contract by given contractNameHash.
|
String |
getAddressFromPubKey(String pubKey)
Get the account address through the public key.
|
BlockDto |
getBlockByHash(String blockHash)
Get information of a block by given block hash.
|
BlockDto |
getBlockByHash(String blockHash,
boolean includeTransactions)
Get information about a given block by block hash.
|
BlockDto |
getBlockByHeight(long blockHeight)
Get information of a block by specified height.
|
BlockDto |
getBlockByHeight(long blockHeight,
boolean includeTransactions)
Get information of a block by specified height.
|
long |
getBlockHeight()
Get the height of the current chain. wa:/api/blockChain/blockHeight
|
int |
getChainId()
Get id of the chain.
|
ChainstatusDto |
getChainStatus()
Get the current status of the block chain. wa:/api/blockChain/chainStatus
|
String |
getContractAddressByName(String privateKey,
byte[] contractNameHash)
Get address of a contract by given contractNameHash.
|
byte[] |
getContractFileDescriptorSet(String address)
Get the protobuf definitions related to a contract /api/blockChain/contractFileDescriptorSet.
|
String |
getFormattedAddress(String privateKey,
String address)
Convert the Address to the displayed string:symbol_base58-string_base58-string-chain-id.
|
String |
getGenesisContractAddress()
Get the address of genesis contract.
|
MerklePathDto |
getMerklePathByTransactionId(String transactionId)
Get merkle path of a transaction. wa:/api/blockChain/merklePathByTransactionId
|
NetworkInfoOutput |
getNetworkInfo()
Get information about the node’s connection to the network. wa:/api/net/networkInfo
|
List<PeerDto> |
getPeers(Boolean withMetrics)
Gets information about the peer nodes of the current node.Optional whether to include metrics.
|
String |
getSignatureWithPrivateKey(String privateKey,
byte[] txData)
Get the private sha256 signature.
|
List<TaskQueueInfoDto> |
getTaskQueueStatus()
Gets the status information of the task queue wa:/api/blockChain/taskQueueStatus.
|
TransactionPoolStatusOutput |
getTransactionPoolStatus()
Gets information about the current transaction pool.wa:/api/blockChain/transactionPoolStatus
|
TransactionResultDto |
getTransactionResult(String transactionId)
Get the current status of a transaction wa:/api/blockChain/transactionResult.
|
List<TransactionResultDto> |
getTransactionResults(String blockHash)
Get results of multiple transactions by specified blockHash and the offset.
|
List<TransactionResultDto> |
getTransactionResults(String blockHash,
int offset,
int limit)
Get multiple transaction results. wa:/api/blockChain/transactionResults
|
boolean |
isConnected()
Verify whether this sdk successfully connects the chain.
|
Boolean |
removePeer(String address)
Attempts to remove a node from the connected network nodes wa:/api/net/peer.
|
SendRawTransactionOutput |
sendRawTransaction(SendRawTransactionInput input)
Broadcast a serialized transaction. wa:/api/blockChain/sendRawTransaction
|
SendTransactionOutput |
sendTransaction(SendTransactionInput input)
Broadcast a transaction wa:/api/blockChain/sendTransaction.
|
List<String> |
sendTransactions(SendTransactionsInput input)
Broadcast volume transactions wa:/api/blockChain/sendTransactions.
|
String |
signTransaction(String privateKeyHex,
Core.Transaction transaction)
Sign a transaction using private key.
|
public AElfClient(String url)
url - Http Request Url exp:(http://xxxx)public long getBlockHeight()
throws Exception
Exceptionpublic BlockDto getBlockByHash(String blockHash) throws Exception
Exceptionpublic BlockDto getBlockByHash(String blockHash, boolean includeTransactions) throws Exception
Exceptionpublic BlockDto getBlockByHeight(long blockHeight) throws Exception
Exceptionpublic BlockDto getBlockByHeight(long blockHeight, boolean includeTransactions) throws Exception
Exceptionpublic ChainstatusDto getChainStatus() throws Exception
Exceptionpublic byte[] getContractFileDescriptorSet(String address) throws Exception
Exceptionpublic List<TaskQueueInfoDto> getTaskQueueStatus() throws Exception
Exceptionpublic TransactionPoolStatusOutput getTransactionPoolStatus() throws Exception
Exceptionpublic String executeTransaction(ExecuteTransactionDto input) throws Exception
Exceptionpublic CreateRawTransactionOutput createRawTransaction(CreateRawTransactionInput input) throws Exception
Exceptionpublic String executeRawTransaction(ExecuteRawTransactionDto input) throws Exception
Exceptionpublic SendRawTransactionOutput sendRawTransaction(SendRawTransactionInput input) throws Exception
Exceptionpublic SendTransactionOutput sendTransaction(SendTransactionInput input) throws Exception
Exceptionpublic List<String> sendTransactions(SendTransactionsInput input) throws Exception
Exceptionpublic TransactionResultDto getTransactionResult(String transactionId) throws Exception
Exceptionpublic List<TransactionResultDto> getTransactionResults(String blockHash) throws Exception
Exceptionpublic List<TransactionResultDto> getTransactionResults(String blockHash, int offset, int limit) throws Exception
Exceptionpublic MerklePathDto getMerklePathByTransactionId(String transactionId)
public Boolean addPeer(AddPeerInput input) throws Exception
Exceptionpublic Boolean removePeer(String address) throws Exception
Exceptionpublic List<PeerDto> getPeers(Boolean withMetrics) throws Exception
Exceptionpublic NetworkInfoOutput getNetworkInfo() throws Exception
Exceptionpublic Core.Transaction.Builder generateTransaction(String from, String to, String methodName, byte[] params) throws Exception
Exceptionpublic String signTransaction(String privateKeyHex, Core.Transaction transaction) throws Exception
Exceptionpublic String getGenesisContractAddress() throws Exception
Exceptionpublic String getAddressFromPubKey(@Nullable String pubKey)
pubKey - pubKey hexpublic String getFormattedAddress(String privateKey, String address) throws Exception
Exceptionpublic KeyPairInfo generateKeyPairInfo() throws Exception
Exceptionpublic String getContractAddressByName(String privateKey, byte[] contractNameHash) throws Exception
Exceptionpublic String getAddressFromPrivateKey(String privateKey)
public String getSignatureWithPrivateKey(String privateKey, byte[] txData) throws Exception
Exceptionpublic boolean isConnected()
Copyright © 2020. All rights reserved.