public final class ClientV2 extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
banPeer(InetAddress ipToBan)
Ban a specific peer
Note this will ban all peers located behind the specified IP even though they are using different ports
|
void |
close()
Closes the underlying grpc channel
|
void |
dumpStart(DumpRequest dumpRequest)
Start dumping packages into the specified
File
Only enabled if the node was built with the 'network_dump' feature enabled |
void |
dumpStop()
Stop dumping packages
Only enabled if the node was built with the 'network_dump' feature enabled
|
Optional<FindAccountResponse> |
findAccountCreation(AccountAddress address)
Find a block in which the
AccountAddress was created, if it exists and is finalized. |
Optional<FindAccountResponse> |
findAccountCreation(Range<AbsoluteBlockHeight> range,
AccountAddress address)
Find a block in which the
AccountAddress was created, if it exists and is finalized. |
<T> Optional<T> |
findAtLowestHeight(BiFunction<ClientV2,BlockQuery,Optional<T>> test)
Find a finalized block with the lowest height that satisfies the given condition.
|
<T> Optional<T> |
findAtLowestHeight(Range<AbsoluteBlockHeight> range,
BiFunction<ClientV2,BlockQuery,Optional<T>> test)
Find a finalized block with the lowest height that satisfies the given condition.
|
static ClientV2 |
from(Connection connection) |
AccountInfo |
getAccountInfo(BlockQuery input,
AccountQuery accountIdentifier)
Retrieve the information about the given account in the given block.
|
Iterator<AccountAddress> |
getAccountList(BlockQuery input)
Retrieve the list of accounts that exist at the end of the given block.
|
Iterator<Hash> |
getAccountNonFinalizedTransactions(AccountAddress address)
Get the list of transactions hashes for transactions from the given account,
but which are not yet finalized.
|
Iterator<Hash> |
getAncestors(BlockQuery blockQuery,
long num)
Gets Block Ancestor Blocks.
|
Iterator<AnonymityRevokerInfo> |
getAnonymityRevokers(BlockQuery input)
Gets all the Anonymity Revokers at the end of the block pointed by
BlockQuery. |
Timestamp |
getBakerEarliestWinTime(BakerId bakerId)
Get the projected earliest time at which a particular baker will be required to bake a block.
|
Iterator<BakerId> |
getBakerList(BlockQuery blockQuery)
Get the IDs of the bakers registered in the given block.
|
com.google.common.collect.ImmutableList<BakerRewardPeriodInfo> |
getBakersRewardPeriod(BlockQuery input)
Get all bakers in the reward period of a block.
|
com.google.common.collect.ImmutableList<InetAddress> |
getBannedPeers()
Get a list of banned peers
|
BlockCertificates |
getBlockCertificates(BlockQuery block)
Retrieves the
BlockCertificates for a given block. |
Optional<FinalizationData> |
getBlockFinalizationSummary(BlockQuery blockQuery)
Retrieves the
FinalizationData of a given block BlockQuery
Note. |
BlockInfo |
getBlockInfo(BlockQuery blockQuery)
Retrieves a
BlockInfo |
Iterator<BlockItem> |
getBlockItems(BlockQuery input)
Gets the transactions of a Block.
|
BlockItemStatus |
getBlockItemStatus(Hash transactionHash)
Retrieves the
BlockItemStatus for a given transaction Hash |
Iterator<PendingUpdateV2> |
getBlockPendingUpdates(BlockQuery input) |
Iterator<BlockIdentifier> |
getBlocks(int timeoutMillis)
Gets an
Iterator of Blocks Arriving at the node. |
com.google.common.collect.ImmutableList<Hash> |
getBlocksAtHeight(BlocksAtHeightRequest height)
Get a
ImmutableList of live blocks at a given height. |
com.google.common.collect.ImmutableList<SpecialOutcome> |
getBlockSpecialEvents(BlockQuery blockQuery)
Retrieves a list of
SpecialOutcomes in a given block BlockQuery
These are events generated by the protocol, such as minting and reward payouts. |
Iterator<Summary> |
getBlockTransactionEvents(BlockQuery input)
Retrieve a stream of transaction events in the specified block.
|
Branch |
getBranches()
Get the branches of the node's tree.
|
ChainParameters |
getChainParameters(BlockQuery blockQuery)
Get the blockchain parameters
|
ConsensusDetailedStatus |
getConsensusDetailedStatus(ConsensusDetailedStatusQuery query)
Get the detailed status of the consensus.
|
ConsensusStatus |
getConsensusInfo()
Retrieve the Consensus Info that contains the summary of the current state
of the chain from the perspective of the node.
|
Iterator<AccountPending> |
getCooldownAccounts(BlockQuery input)
Get all accounts that have stake in cooldown, with the timestamp of the first pending
cooldown expiry for each account.
|
CryptographicParameters |
getCryptographicParameters(BlockQuery blockHash)
Get the
CryptographicParameters at a given block. |
ElectionInfo |
getElectionInfo(BlockQuery input)
Get information related to the baker election for a particular block.
|
Iterator<BlockIdentifier> |
getFinalizedBlocks()
Gets an
Iterator of Finalized Blocks from the time request is made and onwards. |
Iterator<BlockIdentifier> |
getFinalizedBlocks(int timeoutMillis)
Gets an
Iterator of Finalized Blocks with specified timeout from the time request is made and onwards. |
FinalizedBlockItemIterator |
getFinalizedBlocksFrom(AbsoluteBlockHeight startHeight)
Get a
FinalizedBlockItemIterator of BlockIdentifier of finalized blocks starting from a given height. |
Hash |
getFirstBlockEpoch(EpochQuery epochQuery)
Get the block hash of the first finalized block in a specified epoch.
|
Iterator<IdentityProviderInfo> |
getIdentityProviders(BlockQuery input)
Gets all the Identity Providers at the end of the block pointed by
BlockQuery. |
InstanceInfo |
getInstanceInfo(BlockQuery input,
ContractAddress contractAddress)
Get info about a smart contract instance as it appears at the end of the given block.
|
Iterator<ContractAddress> |
getInstanceList(BlockQuery blockQuery)
Get the list of contract addresses in the given block.
|
Iterator<KeyValurPair> |
getInstanceState(BlockQuery input,
ContractAddress contractAddress)
Get the exact state of a specific contract instance, streamed as a list of key-value pairs.
|
Iterator<ModuleRef> |
getModuleList(BlockQuery input)
Get list of Smart Contract modules at the end of the given block.
|
WasmModule |
getModuleSource(BlockQuery query,
ModuleRef moduleRef)
Get the source of a smart contract module from
the perspective of the last finalized block.
|
Nonce |
getNextAccountSequenceNumber(AccountAddress address)
Retrieves the next
Nonce for an account. |
NextUpdateSequenceNumbers |
getNextUpdateSequenceNumbers(BlockQuery input)
Get next available sequence numbers for updating chain parameters after a given block.
|
NodeInfo |
getNodeInfo()
Retrieves valious information about the node
|
PassiveDelegationInfo |
getPassiveDelegationInfo(BlockQuery input)
Get information about the passive delegators at the end of a given block.
|
Iterator<DelegatorInfo> |
getPassiveDelegators(BlockQuery input)
Get information about the passive delegators at the end of a given block.
|
Iterator<DelegatorRewardPeriodInfo> |
getPassiveDelegatorsRewardPeriod(BlockQuery input)
Get the fixed passive delegators for the reward period of the given block.
|
com.google.common.collect.ImmutableList<PeerInfo> |
getPeersInfo()
Returns a
ImmutableList of PeerInfo containing information about the nodes' peers |
Iterator<DelegatorInfo> |
getPoolDelegators(BlockQuery input,
AccountIndex bakerId)
Get the registered delegators of a given pool at the end of a given block.
|
Iterator<DelegatorRewardPeriodInfo> |
getPoolDelegatorsRewardPeriod(BlockQuery input,
BakerId bakerId)
Get the fixed delegators of a given pool for the reward period of the given block.
|
BakerPoolStatus |
getPoolInfo(BlockQuery input,
BakerId bakerId)
Get information about a given pool at the end of a given block.
|
Iterator<AccountIndex> |
getPreCooldownAccounts(BlockQuery input)
Get all accounts that have stake in pre-cooldown.
|
Iterator<AccountIndex> |
getPrePreCooldownAccounts(BlockQuery input)
Get all accounts that have stake in pre-pre-cooldown.
|
RewardsOverview |
getRewardStatus(BlockQuery blockHash)
Get the information about total amount of CCD and the state of valious special accounts in the provided block.
|
Iterator<AccountPending> |
getScheduledReleaseAccounts(BlockQuery input)
Get all accounts that have scheduled releases, with the timestamp of the first pending
scheduled release for that account.
|
com.google.common.collect.ImmutableList<WinningBaker> |
getWinningBakersEpoch(EpochQuery epochQuery)
Get the list of bakers that won the lottery in a particular historical epoch (i.e.
|
byte[] |
instanceStateLookup(BlockQuery input,
ContractAddress contractAddress,
byte[] key)
Get the value at a specific key of a contract state.
|
InvokeInstanceResult |
invokeInstance(InvokeInstanceRequest request)
This function can be used to either
1.
|
void |
peerConnect(InetSocketAddress socketAddress)
Tries to connect to a peer with the submitted
InetSocketAddress. |
void |
peerDisconnect(InetSocketAddress socketAddress)
Disconnect from the peer with the submitted
InetSocketAddress and remove them from
the address list if they are on it. |
Hash |
sendCredentialDeploymentTransaction(CredentialDeploymentTransaction credentialDeploymentTransaction)
Sends a credential deployment transaction to the Concordium Node.
|
Hash |
sendTransaction(AccountTransaction accountTransaction)
Sends an Account Transaction to the Concordium Node.
|
void |
shutdown()
Shut down the node.
|
void |
unbanPeer(InetAddress ipToUnban)
Unban a specific peer
|
Optional<FinalizedBlockItem> |
waitUntilFinalized(Hash transactionHash,
int timeoutMillis)
Waits until a given transaction is finalized and returns the corresponding
Optional. |
public static ClientV2 from(Connection connection) throws ClientInitializationException
ClientInitializationExceptionpublic Iterator<AnonymityRevokerInfo> getAnonymityRevokers(BlockQuery input)
BlockQuery.input - Pointer to the Block.Iterator of AnonymityRevokerInfopublic Iterator<BlockIdentifier> getBlocks(int timeoutMillis)
Iterator of Blocks Arriving at the node.
With Specified Timeout.
Form the time request is made and onwards.
This can be used to listen for incoming blocks.timeoutMillis - Timeout for the request in Milliseconds.Iteratorpublic Iterator<BlockIdentifier> getFinalizedBlocks(int timeoutMillis)
Iterator of Finalized Blocks with specified timeout from the time request is made and onwards.
This can be used to listen for blocks being Finalized.timeoutMillis - Timeout for the request in Milliseconds.Iteratorpublic Iterator<BlockIdentifier> getFinalizedBlocks()
Iterator of Finalized Blocks from the time request is made and onwards.
This can be used to listen for blocks being Finalized.
Note, may block indefinitely. Use getFinalizedBlocks(int) to specify a timeout.
Iteratorpublic AccountInfo getAccountInfo(BlockQuery input, AccountQuery accountIdentifier)
input - Pointer to the Block.accountIdentifier - Identifier of the Account.AccountInfo)public Iterator<AccountAddress> getAccountList(BlockQuery input)
input - Pointer to the Block.Iterator.public Iterator<Summary> getBlockTransactionEvents(BlockQuery input)
input - the block to query.public Iterator<BlockItem> getBlockItems(BlockQuery input)
BlockItemType.ACCOUNT_TRANSACTION
BlockItemType.CREDENTIAL_DEPLOYMENT
BlockItemType.UPDATE_INSTRUCTIONinput - Pointer to the Block.Iteratorpublic ConsensusStatus getConsensusInfo()
ConsensusStatus)getConsensusDetailedStatus(ConsensusDetailedStatusQuery)public ConsensusDetailedStatus getConsensusDetailedStatus(ConsensusDetailedStatusQuery query)
query - ConsensusDetailedStatusQuery representing the genesis index to get status for.io.grpc.StatusRuntimeException - with Status.Code: Status.NOT_FOUND if the query specifies an unknown genesis indexStatus.INVALID_ARGUMENT if the query specifies a genesis index at consensus version 0Status.UNIMPLEMENTED if the endpoint is disabled on the nodegetConsensusInfo()public Iterator<AccountPending> getScheduledReleaseAccounts(BlockQuery input)
public Iterator<AccountPending> getCooldownAccounts(BlockQuery input)
public Iterator<AccountIndex> getPreCooldownAccounts(BlockQuery input)
public Iterator<AccountIndex> getPrePreCooldownAccounts(BlockQuery input)
public Hash sendTransaction(AccountTransaction accountTransaction)
accountTransaction - Account Transaction to send.Hash.public Hash sendCredentialDeploymentTransaction(CredentialDeploymentTransaction credentialDeploymentTransaction)
credentialDeploymentTransaction - the credential deployment to send.Hash.public Iterator<IdentityProviderInfo> getIdentityProviders(BlockQuery input)
BlockQuery.input - Pointer to the Block.Iterator of IdentityProviderInfopublic CryptographicParameters getCryptographicParameters(BlockQuery blockHash)
CryptographicParameters at a given block.blockHash - the hash of the blockpublic RewardsOverview getRewardStatus(BlockQuery blockHash)
blockHash - Block at which the reward status is to be retrieved.RewardsOverview.public BlockInfo getBlockInfo(BlockQuery blockQuery)
BlockInfoblockQuery - the block BlockQuery to query.BlockInfo for the blockpublic ChainParameters getChainParameters(BlockQuery blockQuery)
blockQuery - block to query.ChainParameterspublic Nonce getNextAccountSequenceNumber(AccountAddress address)
Nonce for an account.
This is the Nonce to use for future transactions
E.g. when using sendTransaction(AccountTransaction)
When this function is queried with a non-existent account it will report the next available account nonce to be 1 and all transactions as finalized.address - The AccountAddressNoncepublic BlockItemStatus getBlockItemStatus(Hash transactionHash)
BlockItemStatus for a given transaction HashtransactionHash - The transaction HashBlockItemStatusio.grpc.StatusRuntimeException - with Status.Code: Status.NOT_FOUND if the transaction is not known to the node.
public Iterator<Hash> getAccountNonFinalizedTransactions(AccountAddress address)
address - AccountAddressIterator of Transaction Hashpublic void dumpStart(DumpRequest dumpRequest)
File
Only enabled if the node was built with the 'network_dump' feature enableddumpRequest - DumpRequest specifying the file and if raw packages should be dumped{@link - io.grpc.StatusRuntimeException} if the network dump failed to start or if the node was not built with the 'network_dump' featurepublic void dumpStop()
io.grpc.StatusRuntimeException - if the network dump failed to be stopped or if the node was not built with the 'network_dump' featurepublic Optional<FinalizationData> getBlockFinalizationSummary(BlockQuery blockQuery)
FinalizationData of a given block BlockQuery
Note. Returns NULL if there is no finalization data in the blockblockQuery - the block BlockQuery to queryFinalizationData of the blockpublic ElectionInfo getElectionInfo(BlockQuery input)
input - BlockQueryElectionInfopublic com.google.common.collect.ImmutableList<SpecialOutcome> getBlockSpecialEvents(BlockQuery blockQuery)
SpecialOutcomes in a given block BlockQuery
These are events generated by the protocol, such as minting and reward payouts.
They are not directly generated by any transaction.blockQuery - the block BlockQuery to queryImmutableList of SpecialOutcomes not directly caused by a transactionpublic Iterator<Hash> getAncestors(BlockQuery blockQuery, long num)
blockQuery - BlockQuery of the block.num - Total no of Ancestor blocks to get.Iterator of Hashpublic Iterator<BakerId> getBakerList(BlockQuery blockQuery)
blockQuery - BlockQuery of the block bakers are to be retrieved.Iterator of BakerIdpublic Iterator<ContractAddress> getInstanceList(BlockQuery blockQuery)
blockQuery - BlockQuery of the block bakers are to be retrieved.Iterator of ContractAddresspublic InstanceInfo getInstanceInfo(BlockQuery input, ContractAddress contractAddress)
input - BlockQuerycontractAddress - ContractAddress of the contract instance.InstanceInfo Information about the contract instance.public Iterator<DelegatorRewardPeriodInfo> getPoolDelegatorsRewardPeriod(BlockQuery input, BakerId bakerId)
input - BlockQuery.bakerId - BakerId.Iterator.public Iterator<DelegatorRewardPeriodInfo> getPassiveDelegatorsRewardPeriod(BlockQuery input)
input - BlockQuery.Iterator.public Branch getBranches()
Branchpublic Iterator<DelegatorInfo> getPassiveDelegators(BlockQuery input)
input - BlockQuery.Iterator of DelegatorInfo.public Iterator<DelegatorInfo> getPoolDelegators(BlockQuery input, AccountIndex bakerId)
input - BlockQuerybakerId - AccountIndexIterator of DelegatorInfo. List of delegators that are registered in the block.public PassiveDelegationInfo getPassiveDelegationInfo(BlockQuery input)
input - BlockQuerypublic NextUpdateSequenceNumbers getNextUpdateSequenceNumbers(BlockQuery input)
input - BlockQuery.NextUpdateSequenceNumbers.public Iterator<PendingUpdateV2> getBlockPendingUpdates(BlockQuery input)
public Iterator<KeyValurPair> getInstanceState(BlockQuery input, ContractAddress contractAddress)
input - BlockQuery.contractAddress - ContractAddress.Iterator of KeyValurPair.public byte[] instanceStateLookup(BlockQuery input, ContractAddress contractAddress, byte[] key)
getInstanceState(BlockQuery, ContractAddress) this is more efficient,
but requires the user to know the specific key to look for.input - BlockQuery.contractAddress - ContractAddress.key - Instance State Key to Lookup.public void close()
public NodeInfo getNodeInfo()
NodeInfo containing valious information about the nodepublic com.google.common.collect.ImmutableList<PeerInfo> getPeersInfo() throws UnknownHostException
ImmutableList of PeerInfo containing information about the nodes' peersImmutableList of PeerInfoUnknownHostException - When the returned IP address of Peer is Invalidpublic BakerPoolStatus getPoolInfo(BlockQuery input, BakerId bakerId)
input - BlockQuery.bakerId - BakerId.BakerPoolStatus.public Iterator<ModuleRef> getModuleList(BlockQuery input)
input - BlockQuery.Iterator.public void shutdown()
public void peerConnect(InetSocketAddress socketAddress)
InetSocketAddress.
If successful, adds the peer to the list of given addresses.
Note. The peer might not be connected instantly, in that case the node will
try to establish the connection in near future. In this case Status.OK is returnedsocketAddress - InetSocketAddress of the peer to connect to{@link - io.grpc.StatusRuntimeException} if unsuccessfulpublic void peerDisconnect(InetSocketAddress socketAddress)
InetSocketAddress and remove them from
the address list if they are on it.socketAddress - InetSocketAddress of the peer to disconnect from{@link - io.grpc.StatusRuntimeException} if unsuccessfulpublic void banPeer(InetAddress ipToBan)
ipToBan - ip of the node to ban{@link - io.grpc.StatusRuntimeException} If the action failedpublic void unbanPeer(InetAddress ipToUnban)
ipToUnban - ip of the node to unban{@link - io.grpc.StatusRuntimeException} If the action failedpublic com.google.common.collect.ImmutableList<InetAddress> getBannedPeers() throws UnknownHostException
ImmutableList of InetAddress of banned peersUnknownHostException - When the returned IP address of a peer is invalidpublic WasmModule getModuleSource(BlockQuery query, ModuleRef moduleRef)
query - The query is at the end of the block specified.moduleRef - the reference of the module.WasmModule.io.grpc.StatusRuntimeException - if the module could not be looked up on the chain.public InvokeInstanceResult invokeInstance(InvokeInstanceRequest request)
request - InvokeInstanceRequestInvokeInstanceResultpublic com.google.common.collect.ImmutableList<BakerRewardPeriodInfo> getBakersRewardPeriod(BlockQuery input)
input - The block to query.ImmutableList with the BakerRewardPeriodInfo of all the bakers in the block.io.grpc.StatusRuntimeException - with Status.Code:
Status.Code.UNIMPLEMENTED if the protocol does not support the endpoint.public BlockCertificates getBlockCertificates(BlockQuery block)
BlockCertificates for a given block.block - The block to queryBlockCertificates of the block.io.grpc.StatusRuntimeException - with Status.Code:Status.Code.UNIMPLEMENTED if the endpoint is not enabled by the node.
Status.Code.INVALID_ARGUMENT if the block being pointed to is not a product of ConcordiumBFT, i.e. created before protocol version 6.
public Timestamp getBakerEarliestWinTime(BakerId bakerId)
If the baker is not a baker for the current reward period, this returns a timestamp at the start of the next reward period.
If the baker is a baker for the current reward period, the earliest win time is projected from the current round forward, assuming that each round after the last finalized round will take the minimum block time. (If blocks take longer, or timeouts occur, the actual time may be later, and the reported time in subsequent queries may reflect this.)
At the end of an epoch (or if the baker is not projected to bake before the end of the epoch) the earliest win time for a (current) baker will be projected as the start of the next epoch. This is because the seed for the leader election is updated at the epoch boundary, and so the winners cannot be predicted beyond that.
Note that in some circumstances the returned timestamp can be in the past, especially at the end of an epoch.
bakerId - id of the baker to query.Timestamp as described in the method documentation.io.grpc.StatusRuntimeException - with Status.Code:
Status.Code.UNIMPLEMENTED if the current consensus version is 0, as the endpoint is only supported by consensus version 1.public Hash getFirstBlockEpoch(EpochQuery epochQuery)
epochQuery - EpochQuery representing the specific epoch to query.Hash of the first finalized block in the epoch.io.grpc.StatusRuntimeException - with Status.Code: Status.NOT_FOUND if the query specifies an unknown block.
Status.UNAVAILABLE if the query is for an epoch that is not finalized in the current genesis index, or is for a future genesis index.
Status.INVALID_ARGUMENT if the query is for an epoch with no finalized blocks for a past genesis index.
Status.INVALID_ARGUMENT if the input EpochQuery is malformed.
Status.UNIMPLEMENTED if the endpoint is disabled on the node.
public com.google.common.collect.ImmutableList<WinningBaker> getWinningBakersEpoch(EpochQuery epochQuery)
This lists the winners for each round in the epoch, starting from the round after the last block in the previous epoch, running to the round before the first block in the next epoch.
It also indicates if a block in each round was included in the finalized chain.
epochQuery - EpochQuery representing the specific epoch to query.ImmutableList of bakers that won the lottery in the specified epoch.io.grpc.StatusRuntimeException - with Status.Code: Status.NOT_FOUND if the query specifies an unknown block.
Status.UNAVAILABLE if the query is for an epoch that is not finalized in the current genesis index, or is for a future genesis index.
Status.INVALID_ARGUMENT if the query is for an epoch that is not finalized for a past genesis index.
Status.INVALID_ARGUMENT if the query is for a genesis index at consensus version 0.
Status.INVALID_ARGUMENT if the input EpochQuery is malformed.
Status.UNIMPLEMENTED if the endpoint is disabled on the node.
public Optional<FinalizedBlockItem> waitUntilFinalized(Hash transactionHash, int timeoutMillis)
Optional.
If the transaction is unknown to the node or not finalized, the client starts listening for newly finalized blocks,
and returns the corresponding Optional once the transaction is finalized.transactionHash - the Hash of the transaction to wait for.timeoutMillis - the number of milliseconds to listen for newly finalized blocks.Optional of the transaction if it was finalized before exceeding the timeout, Empty otherwise.public <T> Optional<T> findAtLowestHeight(BiFunction<ClientV2,BlockQuery,Optional<T>> test)
Optional.empty().
The provided `test` method should, given a ClientV2 and a BlockQuery,
return Optional#of(T) if the object is found in the block, and Optional.empty() otherwise.
It can also throw exceptions which will terminate the search immediately and pass on the exception.
The precondition for this method is that the `test` method is monotone, i.e. if a block at height `h` satisfies the test then also a block at height `h+1` does. If this precondition does not hold then the return value from this method is unspecified.
Note, this searches the entire chain. Use findAtLowestHeight(Range, BiFunction) to only search a given range.
T - The type to be returned if the search is successful.test - BiFunction satisfying the conditions described above.Optional#of(T) if the search was successful, Optional.empty() otherwise.public <T> Optional<T> findAtLowestHeight(Range<AbsoluteBlockHeight> range, BiFunction<ClientV2,BlockQuery,Optional<T>> test)
Optional.empty().
The provided `test` method should, given a ClientV2 and a BlockQuery,
return Optional#of(T) if the object is found in the block, and Optional.empty() otherwise.
It can also throw exceptions which will terminate the search immediately and pass on the exception.
The precondition for this method is that the `test` method is monotone, i.e. if a block at height `h` satisfies the test then also a block at height `h+1` does. If this precondition does not hold then the return value from this method is unspecified.
The search is limited to at most the given range, the upper bound is always at most the last finalized block at the time of the call. If the lower bound is not provided it defaults to 0, if the upper bound is not provided it defaults to the last finalized block at the time of the call.
T - The type to be returned if the search is successful.range - Range optionally specifying upper and lower bounds of the search.test - BiFunction satisfying the conditions described above.Optional#of(T) if the search was successful, Optional.empty() otherwise.public Optional<FindAccountResponse> findAccountCreation(Range<AbsoluteBlockHeight> range, AccountAddress address)
AccountAddress was created, if it exists and is finalized.
The returned FindAccountResponse, if present, contains the absolute block height, corresponding Hash and the AccountInfo at the end of the block.
The block is the first block in which the account appears.
Note that this is not necessarily the initial state of the account since there can be transactions updating it in the same block that it is created.
The search is limited to at most the given range, the upper bound is always at most the last finalized block at the time of the call. If the lower bound is not provided it defaults to 0, if the upper bound is not provided it defaults to the last finalized block at the time of the call.
If the account is not found, Optional.empty() is returned.
range - Range optionally specifying upper and lower bounds of the search.address - The AccountAddress to search for.Optional containing FindAccountResponse if the search was successful, Optional.empty() otherwise.public Optional<FindAccountResponse> findAccountCreation(AccountAddress address)
AccountAddress was created, if it exists and is finalized.
The returned FindAccountResponse, if present, contains the absolute block height, corresponding Hash and the AccountInfo at the end of the block.
The block is the first block in which the account appears.
Note that this is not necessarily the initial state of the account since there can be transactions updating it in the same block that it is created.
If the account is not found, Optional.empty() is returned.
Note, this searches the entire chain. Use findAccountCreation(Range, AccountAddress) to only search a given range.
address - The AccountAddress to search for.Optional containing FindAccountResponse if the search was successful, Optional.empty() otherwise.public com.google.common.collect.ImmutableList<Hash> getBlocksAtHeight(BlocksAtHeightRequest height)
ImmutableList of live blocks at a given height.height - BlocksAtHeightRequest with the height to query at.ImmutableList of Hash of live blocks at the specified height.public FinalizedBlockItemIterator getFinalizedBlocksFrom(AbsoluteBlockHeight startHeight)
FinalizedBlockItemIterator of BlockIdentifier of finalized blocks starting from a given height.
This function starts a Thread that listens for new finalized blocks.
This Thread is killed when the FinalizedBlockItemIterator dropped with FinalizedBlockItemIterator.drop()startHeight - AbsoluteBlockHeight to start at.FinalizedBlockItemIterator containing BlockIdentifiers of finalized blocks.Copyright © 2025. All rights reserved.