Class RxBitcoinClient
java.lang.Object
org.consensusj.jsonrpc.DefaultRpcClient
org.consensusj.bitcoin.jsonrpc.BitcoinClient
org.consensusj.bitcoin.jsonrpc.BitcoinExtendedClient
org.consensusj.bitcoin.rx.jsonrpc.RxBitcoinClient
- All Implemented Interfaces:
AutoCloseable
,ChainTipClient
,ChainTipService
,AsyncSupport
,JsonRpcClient<JavaType>
,JsonRpcTransport<JavaType>
,RxJsonRpcClient
public class RxBitcoinClient
extends BitcoinExtendedClient
implements ChainTipService, RxJsonRpcClient
A
BitcoinClient
enhanced with Reactive features. Can use either ZeroMQ or polling
to implement ChainTipService
.
TODO: answer the below questions
Should this class eventually implement RxBlockchainService
or RxBlockchainBinaryService
?
Should this class be renamed to RxBitcoinJsonRpcClient
and the RxBitcoinClient
interface be moved
to cj-btc-rx?
-
Nested Class Summary
Nested classes/interfaces inherited from class org.consensusj.jsonrpc.DefaultRpcClient
DefaultRpcClient.TransientErrorMapper<T>, DefaultRpcClient.TransportFactory
Nested classes/interfaces inherited from interface org.consensusj.jsonrpc.AsyncSupport
AsyncSupport.ThrowingSupplier<T>, AsyncSupport.TransientErrorFilter
-
Field Summary
Fields inherited from class org.consensusj.bitcoin.jsonrpc.BitcoinExtendedClient
DEFAULT_REGTEST_MINING_ADDRESS, defaultMaxConf, REGTEST_WALLET_NAME, stdRelayTxFee, stdTxFee, stdTxFeeSatoshis
Fields inherited from class org.consensusj.bitcoin.jsonrpc.BitcoinClient
BITCOIN_CORE_VERSION_DESC_DEFAULT, BITCOIN_CORE_VERSION_MIN
Fields inherited from class org.consensusj.jsonrpc.DefaultRpcClient
jsonRpcVersion, mapper
Fields inherited from interface org.consensusj.rx.jsonrpc.RxJsonRpcClient
log
-
Constructor Summary
ConstructorDescriptionRxBitcoinClient
(SSLContext sslContext, org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq) RxBitcoinClient
(org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword) RxBitcoinClient
(org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq) -
Method Summary
Modifier and TypeMethodDescriptionThe BitcoinClient must have "connected once" before this is called.<RSLT> org.reactivestreams.Publisher
<RSLT> pollOnNewBlockAsync
(Supplier<CompletionStage<RSLT>> supplier) Repeatedly once-per-new-block poll an async methodMethods inherited from class org.consensusj.bitcoin.jsonrpc.BitcoinExtendedClient
clearMemPool, createRawTransaction, createRawTransaction, createSignedTransaction, createSignedTransaction, generateBlocks, getBitcoinBalance, getBitcoinBalance, getBitcoinBalance, getBlock, getBlockSubsidy, getDefaultMaxConf, getRegTestMiningAddress, getStdRelayTxFee, getStdTxFee, initRegTestWallet, listUnspentJ, listUnspentOutPoints, sendBitcoin, sendBitcoin, withWallet
Methods inherited from class org.consensusj.bitcoin.jsonrpc.BitcoinClient
addNode, close, commandExists, connectToServer, createRawTransaction, createWallet, createWallet, createWallet, dumpPrivKey, generateToAddress, generateToAddress, getAddedNodeInfo, getAddedNodeInfo, getAddressBalance, getAddressBalance, getAddressInfo, getAddressUtxos, getAddressUtxos, getBalance, getBalance, getBalance, getBestBlock, getBlock, getBlockAsync, getBlockChainInfo, getBlockChainInfoAsync, getBlockCount, getBlockHash, getBlockInfo, getChainTips, getChainTipsAsync, getCommands, getDefaultAsyncExecutor, getNetwork, getNetworkInfo, getNewAddress, getNewAddress, getRawTransaction, getRawTransactionInfo, getReceivedByAddress, getReceivedByAddress, getTransaction, getTransaction, getTxOut, getTxOut, getTxOutSetInfo, getZmqNotifications, getZmqNotificationsAsync, help, help, helpAsLines, helpAsMethodEntries, helpAsStream, importPrivKey, invalidateBlock, isAddressIndexEnabled, listAddressGroupings, listReceivedByAddress, listTransactions, listTransactions, listTransactions, listUnspent, listUnspent, listUnspent, listUnspent, listUnspent, listWallets, mapBitcoinTransientErrors, reconsiderBlock, sendFrom, sendMany, sendRawTransaction, sendRawTransaction, sendRawTransaction, sendRawTransaction, sendToAddress, sendToAddress, setTxFee, signRawTransactionWithWallet, stop, unloadWallet, unloadWallet, waitForBlock, waitForBlockchainInfoAsync, waitForConnected, waitForConnected, waitForServer, waitForServer, waitForServerAsync
Methods inherited from class org.consensusj.jsonrpc.DefaultRpcClient
collectionTypeForClasses, collectionTypeForClasses, defaultType, getJsonRpcVersion, getMapper, getServerURI, identityTransientErrorMapper, pollOnce, responseTypeFor, responseTypeFor, sendRequestForResponseAsync, sendRequestForResponseAsync, statusFromErrorResponse, temporarilyUnavailableResponse, typeForClass, waitForServer, waitForServer
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.consensusj.jsonrpc.AsyncSupport
getDefaultAsyncExecutor, supplyAsync, supplyAsync
Methods inherited from interface org.consensusj.jsonrpc.JsonRpcClient
buildJsonRequest, buildJsonRequest, send, send, send, send, send, send, sendAsync, sendAsync, sendAsync, sendAsync, sendAsync
Methods inherited from interface org.consensusj.jsonrpc.JsonRpcTransport
sendRequestForResponse, syncGet
Methods inherited from interface org.consensusj.rx.jsonrpc.RxJsonRpcClient
call, callAsync, pollOnce, pollOnceAsPublisher, pollOnceAsPublisher, pollOnceAsync
-
Constructor Details
-
RxBitcoinClient
public RxBitcoinClient(org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword) -
RxBitcoinClient
public RxBitcoinClient(org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq) -
RxBitcoinClient
public RxBitcoinClient(SSLContext sslContext, org.bitcoinj.base.Network network, URI server, String rpcuser, String rpcpassword, boolean useZmq)
-
-
Method Details
-
pollOnNewBlockAsync
public <RSLT> org.reactivestreams.Publisher<RSLT> pollOnNewBlockAsync(Supplier<CompletionStage<RSLT>> supplier) Repeatedly once-per-new-block poll an async method- Type Parameters:
RSLT
- The type of the expected result- Parameters:
supplier
- A supplier (should be an RPC Method) of a CompletionStage- Returns:
- An Observable for the expected result type, so we can expect one call to
onNext
per block.
-
chainTipPublisher
The BitcoinClient must have "connected once" before this is called. This means something else needs to have called something to do that.- Specified by:
chainTipPublisher
in interfaceChainTipService
- Returns:
- a publisher of Chain Tips
-