Package foundation.omni.netapi.omnicore
Class OmniCoreClient
java.lang.Object
foundation.omni.netapi.omnicore.OmniCoreClient
- All Implemented Interfaces:
ConsensusService,OmniBalanceService,ConsensusFetcher,AutoCloseable,RichListService<OmniValue,,CurrencyID> ChainTipService
- Direct Known Subclasses:
OmniCoreConsensusTool
public class OmniCoreClient
extends Object
implements ConsensusService, RichListService<OmniValue,CurrencyID>, AutoCloseable
Omni Core "REST" client that implements same interfaces as Omniwallet REST client
-
Nested Class Summary
Nested classes/interfaces inherited from interface foundation.omni.rpc.ConsensusFetcher
ConsensusFetcher.IndeterminateSnapshotException -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOmniCoreClient(OmniClient client) Constructor that takes an existing RxOmniClientOmniCoreClient(SSLContext sslContext, org.bitcoinj.base.Network network, URI coreURI, String user, String pass) OmniCoreClient(SSLContext sslContext, org.bitcoinj.base.Network network, URI coreURI, String user, String pass, boolean useZmq, boolean isOmniProxy) OmniCoreClient(org.bitcoinj.base.Network network, URI coreURI, String user, String pass) -
Method Summary
Modifier and TypeMethodDescriptionbalancesForAddressAsync(org.bitcoinj.base.Address address) Get balances for a single addresses asynchronouslybalancesForAddressesAsync(List<org.bitcoinj.base.Address> addresses) Get balances for multiple addresses asynchronouslyvoidclose()createSnapshot(CurrencyID id, int blockHeight, SortedMap<org.bitcoinj.base.Address, BalanceEntry> entries) Create a ConsensusSnapshot record.Fetch the current block heightReturn current ChainTipCompletableFuture<SortedMap<org.bitcoinj.base.Address, BalanceEntry>> getConsensusForCurrencyAsync(CurrencyID currencyID) Asynchronously get a sorted address-balance map for currencyprotected static SSLContextReturn the defaultSSLContextwithout declaring a checked exceptionDeprecated.use getRxOmniClientList<org.bitcoinj.base.Address> Get all addresses in a wallet Requires wallet support to be activeGet a list of smart properties asynchronously.io.reactivex.rxjava3.core.Single<TokenRichList<OmniValue, CurrencyID>> richList(CurrencyID id, int n) org.reactivestreams.Publisher<TokenRichList<OmniValue, CurrencyID>> richListUpdates(CurrencyID id, int n) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface foundation.omni.rpc.ConsensusFetcher
attemptConsensusSnapshotAsync, completeOrRetryConsensusSnapshot, getConsensusForCurrency, getConsensusSnapshot, getConsensusSnapshotAsyncMethods inherited from interface foundation.omni.netapi.OmniBalanceService
balancesForAddress, balancesForAddresses
-
Field Details
-
client
-
-
Constructor Details
-
OmniCoreClient
Constructor that takes an existing RxOmniClient- Parameters:
client- An existing client instance
-
OmniCoreClient
public OmniCoreClient(SSLContext sslContext, org.bitcoinj.base.Network network, URI coreURI, String user, String pass, boolean useZmq, boolean isOmniProxy) -
OmniCoreClient
public OmniCoreClient(SSLContext sslContext, org.bitcoinj.base.Network network, URI coreURI, String user, String pass) -
OmniCoreClient
-
-
Method Details
-
getDefaultSSLContext
Return the defaultSSLContextwithout declaring a checked exception- Returns:
- The default
SSLContext
-
currentBlockHeightAsync
Description copied from interface:ConsensusFetcherFetch the current block height- Specified by:
currentBlockHeightAsyncin interfaceConsensusFetcher- Returns:
- A future for the current block height of the remote consensus server
-
listSmartProperties
Description copied from interface:ConsensusFetcherGet a list of smart properties asynchronously.- Specified by:
listSmartPropertiesin interfaceConsensusFetcher- Returns:
- List of OmniPropertyInfo including an entry for Bitcoin
-
getConsensusForCurrencyAsync
public CompletableFuture<SortedMap<org.bitcoinj.base.Address,BalanceEntry>> getConsensusForCurrencyAsync(CurrencyID currencyID) Description copied from interface:ConsensusFetcherAsynchronously get a sorted address-balance map for currency- Specified by:
getConsensusForCurrencyAsyncin interfaceConsensusFetcher- Parameters:
currencyID- the currency.- Returns:
- a future for the address-balance map.
-
balancesForAddressesAsync
public CompletableFuture<OmniJBalances> balancesForAddressesAsync(List<org.bitcoinj.base.Address> addresses) Description copied from interface:OmniBalanceServiceGet balances for multiple addresses asynchronously- Specified by:
balancesForAddressesAsyncin interfaceOmniBalanceService- Parameters:
addresses- List of addresses to query- Returns:
- A future, for a map of maps containing each property balance for each address
-
createSnapshot
public ConsensusSnapshot createSnapshot(CurrencyID id, int blockHeight, SortedMap<org.bitcoinj.base.Address, BalanceEntry> entries) Description copied from interface:ConsensusFetcherCreate a ConsensusSnapshot record. Fills in client-specific information.- Specified by:
createSnapshotin interfaceConsensusFetcher- Parameters:
id- Currency IDblockHeight- blockheightentries- a map of BalanceEntry objects- Returns:
- ConsensusSnapshot
-
balancesForAddressAsync
public CompletableFuture<WalletAddressBalance> balancesForAddressAsync(org.bitcoinj.base.Address address) Description copied from interface:OmniBalanceServiceGet balances for a single addresses asynchronously- Specified by:
balancesForAddressAsyncin interfaceOmniBalanceService- Parameters:
address- Single address to query- Returns:
- a future for a map of currency IDs to balances
-
getActiveChainTip
Description copied from interface:OmniBalanceServiceReturn current ChainTip- Specified by:
getActiveChainTipin interfaceOmniBalanceService- Returns:
- "active" ChainTip
-
getOmniClient
Deprecated.use getRxOmniClient -
getRxOmniClient
-
richList
public io.reactivex.rxjava3.core.Single<TokenRichList<OmniValue,CurrencyID>> richList(CurrencyID id, int n) - Specified by:
richListin interfaceRichListService<OmniValue,CurrencyID>
-
richListUpdates
public org.reactivestreams.Publisher<TokenRichList<OmniValue,CurrencyID>> richListUpdates(CurrencyID id, int n) - Specified by:
richListUpdatesin interfaceRichListService<OmniValue,CurrencyID>
-
chainTipPublisher
- Specified by:
chainTipPublisherin interfaceChainTipService
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
getWalletAddresses
public List<org.bitcoinj.base.Address> getWalletAddresses() throws JsonRpcStatusException, IOExceptionGet all addresses in a wallet Requires wallet support to be active- Returns:
- A list of addresses
- Throws:
JsonRpcStatusException- JSON HTTP status was not 200IOException- Exception at lower-level
-