public class QueryApiImpl extends java.lang.Object implements QueryApi, ClientInjectable
Modifier and Type | Field and Description |
---|---|
protected @NonNull AergoClient |
client |
protected ExceptionConverter<WalletException> |
converter |
Constructor and Description |
---|
QueryApiImpl() |
Modifier and Type | Method and Description |
---|---|
AccountState |
getAccountState(AccountAddress accountAddress)
Get account state by account.
|
BlockHash |
getBestBlockHash()
Get best block hash.
|
long |
getBestBlockHeight()
Get best block height.
|
Block |
getBlock(BlockHash blockHash)
Get block by hash.
|
Block |
getBlock(long height)
Get block by height.
|
BlockchainStatus |
getBlockchainStatus()
Get blockchain status.
|
BlockMetadata |
getBlockMetadata(BlockHash blockHash)
Get block metadata by hash.
|
BlockMetadata |
getBlockMetadata(long height)
Get block metadata by height.
|
ChainIdHash |
getChainIdHash()
Get chain id hash.
|
ChainInfo |
getChainInfo()
Get chain info of current node.
|
ChainStats |
getChainStats()
Get chain stats of current node.
|
protected AergoClient |
getClient() |
ContractInterface |
getContractInterface(ContractAddress contractAddress)
Get smart contract interface corresponding to contract address.
|
AccountAddress |
getNameOwner(java.lang.String name)
Get owner of an account name.
|
AccountAddress |
getNameOwner(java.lang.String name,
long blockNumber)
Get owner of an account name at block number
blockNumber . |
NodeStatus |
getNodeStatus()
Get status of current node.
|
ContractTxReceipt |
getReceipt(ContractTxHash contractTxHash)
Get receipt of transaction.
|
ServerInfo |
getServerInfo(java.util.List<java.lang.String> categories)
Get server info of current node.
|
StakeInfo |
getStakingInfo(AccountAddress accountAddress)
Get staking information of
accountAddress . |
Transaction |
getTransaction(TxHash txHash)
Get transaction.
|
AccountTotalVote |
getVotesOf(AccountAddress accountAddress)
Get votes which
accountAddress votes for. |
java.util.List<BlockMetadata> |
listBlockMetadatas(BlockHash blockHash,
int size)
Get block metadatas of
size backward starting from block for provided hash. |
java.util.List<BlockMetadata> |
listBlockMetadatas(long height,
int size)
Get block metadatas of
size backward starting from block for provided height. |
java.util.List<ElectedCandidate> |
listElected(java.lang.String voteId,
int showCount)
Get elected candidates per
voteId for current round. |
java.util.List<ElectedCandidate> |
listElectedBps(int showCount)
Get elected block producers for current round.
|
java.util.List<Event> |
listEvents(EventFilter filter)
List events corresponding with event filter.
|
java.util.List<PeerMetric> |
listPeerMetrics()
Get metrics of peers.
|
java.util.List<Peer> |
listPeers()
Get blockchain peer addresses filtering hidden peers and itself.
|
java.util.List<Peer> |
listPeers(boolean showHidden,
boolean showSelf)
Get blockchain peer addresses.
|
java.util.List<AccountAddress> |
listServerKeyStoreAccounts()
Get account list on a server key store.
|
ContractResult |
query(ContractInvocation contractInvocation)
Query the smart contract state by calling smart contract function.
|
Subscription<Event> |
subscribeEvent(EventFilter filter,
StreamObserver<Event> observer)
Subscribe event corresponding with event filter.
|
Subscription<Block> |
subscribeNewBlock(StreamObserver<Block> observer)
Subscribe block stream which is triggered everytime new block is generated.
|
Subscription<BlockMetadata> |
subscribeNewBlockMetadata(StreamObserver<BlockMetadata> observer)
Subscribe block metadata stream which is triggered everytime new block is generated.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setClient
@NonNull protected @NonNull AergoClient client
protected final ExceptionConverter<WalletException> converter
public AccountState getAccountState(AccountAddress accountAddress)
QueryApi
getAccountState
in interface QueryApi
accountAddress
- account addresspublic AccountAddress getNameOwner(java.lang.String name)
QueryApi
getNameOwner
in interface QueryApi
name
- an name of accountpublic AccountAddress getNameOwner(java.lang.String name, long blockNumber)
QueryApi
blockNumber
.getNameOwner
in interface QueryApi
name
- an name of accountblockNumber
- a block numberpublic StakeInfo getStakingInfo(AccountAddress accountAddress)
QueryApi
accountAddress
.getStakingInfo
in interface QueryApi
accountAddress
- an account address to check staking informationpublic java.util.List<ElectedCandidate> listElectedBps(int showCount)
QueryApi
listElectedBps
in interface QueryApi
showCount
- a show countpublic java.util.List<ElectedCandidate> listElected(java.lang.String voteId, int showCount)
QueryApi
voteId
for current round.listElected
in interface QueryApi
voteId
- a vote idshowCount
- a show countpublic AccountTotalVote getVotesOf(AccountAddress accountAddress)
QueryApi
accountAddress
votes for.getVotesOf
in interface QueryApi
accountAddress
- an account addresspublic java.util.List<AccountAddress> listServerKeyStoreAccounts()
QueryApi
listServerKeyStoreAccounts
in interface QueryApi
public BlockHash getBestBlockHash()
QueryApi
getBestBlockHash
in interface QueryApi
public long getBestBlockHeight()
QueryApi
getBestBlockHeight
in interface QueryApi
public ChainIdHash getChainIdHash()
QueryApi
getChainIdHash
in interface QueryApi
public BlockchainStatus getBlockchainStatus()
QueryApi
getBlockchainStatus
in interface QueryApi
public ChainInfo getChainInfo()
QueryApi
getChainInfo
in interface QueryApi
public ChainStats getChainStats()
QueryApi
getChainStats
in interface QueryApi
public java.util.List<Peer> listPeers()
QueryApi
public java.util.List<Peer> listPeers(boolean showHidden, boolean showSelf)
QueryApi
public java.util.List<PeerMetric> listPeerMetrics()
QueryApi
listPeerMetrics
in interface QueryApi
public ServerInfo getServerInfo(java.util.List<java.lang.String> categories)
QueryApi
getServerInfo
in interface QueryApi
categories
- a categoriespublic NodeStatus getNodeStatus()
QueryApi
getNodeStatus
in interface QueryApi
public BlockMetadata getBlockMetadata(BlockHash blockHash)
QueryApi
getBlockMetadata
in interface QueryApi
blockHash
- block hashpublic BlockMetadata getBlockMetadata(long height)
QueryApi
getBlockMetadata
in interface QueryApi
height
- block's heightpublic java.util.List<BlockMetadata> listBlockMetadatas(BlockHash blockHash, int size)
QueryApi
size
backward starting from block for provided hash.listBlockMetadatas
in interface QueryApi
blockHash
- block hashsize
- block list size whose upper bound is 1000public java.util.List<BlockMetadata> listBlockMetadatas(long height, int size)
QueryApi
size
backward starting from block for provided height.listBlockMetadatas
in interface QueryApi
height
- block's heightsize
- block list size whose upper bound is 1000public Block getBlock(BlockHash blockHash)
QueryApi
public Block getBlock(long height)
QueryApi
public Subscription<BlockMetadata> subscribeNewBlockMetadata(StreamObserver<BlockMetadata> observer)
QueryApi
subscribeNewBlockMetadata
in interface QueryApi
observer
- a stream observer which is invoked on new block metadatapublic Subscription<Block> subscribeNewBlock(StreamObserver<Block> observer)
QueryApi
subscribeNewBlock
in interface QueryApi
observer
- a stream observer which is invoked on new blockpublic Transaction getTransaction(TxHash txHash)
QueryApi
getTransaction
in interface QueryApi
txHash
- transaction's hashpublic ContractTxReceipt getReceipt(ContractTxHash contractTxHash)
QueryApi
getReceipt
in interface QueryApi
contractTxHash
- contract transaction hashpublic ContractInterface getContractInterface(ContractAddress contractAddress)
QueryApi
getContractInterface
in interface QueryApi
contractAddress
- contract addresspublic ContractResult query(ContractInvocation contractInvocation)
QueryApi
public java.util.List<Event> listEvents(EventFilter filter)
QueryApi
listEvents
in interface QueryApi
filter
- an event filterpublic Subscription<Event> subscribeEvent(EventFilter filter, StreamObserver<Event> observer)
QueryApi
subscribeEvent
in interface QueryApi
filter
- an event filterobserver
- a stream observer which is invoked on eventprotected AergoClient getClient()