-
- All Implemented Interfaces:
-
cash.z.ecc.android.sdk.Synchronizer,java.io.Closeable,java.lang.AutoCloseable
public interface CloseableSynchronizer implements Synchronizer, Closeable
-
-
Method Summary
Modifier and Type Method Description abstract ZcashNetworkgetNetwork()The network to which this synchronizer is connected and from which it is processing blocks. abstract Flow<Synchronizer.Status>getStatus()A flow of values representing the Status of this Synchronizer. abstract Flow<PercentDecimal>getProgress()A flow of progress values, typically corresponding to this Synchronizer downloading blocks. abstract Flow<CompactBlockProcessor.ProcessorInfo>getProcessorInfo()A flow of processor details, updated every time blocks are processed to include the latest block height, blocks downloaded and blocks scanned. abstract StateFlow<BlockHeight>getNetworkHeight()The latest height observed on the network, which does not necessarily correspond to the latest downloaded height or scanned height. abstract StateFlow<WalletBalance>getOrchardBalances()A stream of balance values for the orchard pool. abstract StateFlow<WalletBalance>getSaplingBalances()A stream of balance values for the sapling pool. abstract StateFlow<Zatoshi>getTransparentBalance()A stream of a balance for the transparent pool. abstract StateFlow<ObserveFiatCurrencyResult>getExchangeRateUsd()The latest known USD/ZEC exchange rate, paired with the time it was queried. abstract Flow<List<TransactionOverview>>getTransactions()A flow of all the transactions that are on the blockchain. abstract BlockHeightgetLatestHeight()An in-memory reference to the latest height seen on the network. abstract BlockHeightgetLatestBirthdayHeight()An in-memory reference to the best known birthday height, which can change if the first transaction has not yet occurred. abstract Function1<Throwable, Boolean>getOnCriticalErrorHandler()Gets or sets a global error handler. abstract UnitsetOnCriticalErrorHandler(Function1<Throwable, Boolean> onCriticalErrorHandler)Gets or sets a global error handler. abstract Function1<Throwable, Boolean>getOnProcessorErrorHandler()An error handler for exceptions during processing. abstract UnitsetOnProcessorErrorHandler(Function1<Throwable, Boolean> onProcessorErrorHandler)An error handler for exceptions during processing. abstract Function1<Throwable, Boolean>getOnSubmissionErrorHandler()An error handler for exceptions while submitting transactions to lightwalletd. abstract UnitsetOnSubmissionErrorHandler(Function1<Throwable, Boolean> onSubmissionErrorHandler)An error handler for exceptions while submitting transactions to lightwalletd. abstract Function1<Throwable, Boolean>getOnSetupErrorHandler()Callback for setup errors that occur prior to processing compact blocks. abstract UnitsetOnSetupErrorHandler(Function1<Throwable, Boolean> onSetupErrorHandler)Callback for setup errors that occur prior to processing compact blocks. abstract Function2<BlockHeight, BlockHeight, Object>getOnChainErrorHandler()A callback to invoke whenever a chain error is encountered. abstract UnitsetOnChainErrorHandler(Function2<BlockHeight, BlockHeight, Object> onChainErrorHandler)A callback to invoke whenever a chain error is encountered. -
Methods inherited from class cash.z.ecc.android.sdk.CloseableSynchronizer
close, createProposedTransactions, getExistingDataDbFilePath, getFastestServers, getMemos, getNearestRewindHeight, getRecipients, getSaplingAddress, getTransparentAddress, getTransparentBalance, getUnifiedAddress, isValidShieldedAddr, isValidTexAddr, isValidTransparentAddr, isValidUnifiedAddr, proposeShielding, proposeTransfer, quickRewind, refreshExchangeRateUsd, refreshUtxos, rewindToNearestHeight, sendToAddress, shieldFunds, validateAddress, validateConsensusBranch, validateServerEndpoint -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getNetwork
abstract ZcashNetwork getNetwork()
The network to which this synchronizer is connected and from which it is processing blocks.
-
getStatus
abstract Flow<Synchronizer.Status> getStatus()
A flow of values representing the Status of this Synchronizer. As the status changes, a new value will be emitted by this flow.
-
getProgress
abstract Flow<PercentDecimal> getProgress()
A flow of progress values, typically corresponding to this Synchronizer downloading blocks. Typically, any non-zero value below
PercentDecimal.ONE_HUNDRED_PERCENTindicates that progress indicators can be shown and a value ofPercentDecimal.ONE_HUNDRED_PERCENTsignals that progress is complete and any progress indicators can be hidden.
-
getProcessorInfo
abstract Flow<CompactBlockProcessor.ProcessorInfo> getProcessorInfo()
A flow of processor details, updated every time blocks are processed to include the latest block height, blocks downloaded and blocks scanned. Similar to the progress flow but with a lot more detail.
-
getNetworkHeight
abstract StateFlow<BlockHeight> getNetworkHeight()
The latest height observed on the network, which does not necessarily correspond to the latest downloaded height or scanned height. Although this is present in processorInfo, it is such a frequently used value that it is convenient to have the real-time value by itself.
-
getOrchardBalances
abstract StateFlow<WalletBalance> getOrchardBalances()
A stream of balance values for the orchard pool.
-
getSaplingBalances
abstract StateFlow<WalletBalance> getSaplingBalances()
A stream of balance values for the sapling pool.
-
getTransparentBalance
abstract StateFlow<Zatoshi> getTransparentBalance()
A stream of a balance for the transparent pool.
-
getExchangeRateUsd
abstract StateFlow<ObserveFiatCurrencyResult> getExchangeRateUsd()
The latest known USD/ZEC exchange rate, paired with the time it was queried.
The rate can be initialized and refreshed by calling refreshExchangeRateUsd.
-
getTransactions
abstract Flow<List<TransactionOverview>> getTransactions()
A flow of all the transactions that are on the blockchain.
-
getLatestHeight
abstract BlockHeight getLatestHeight()
An in-memory reference to the latest height seen on the network.
-
getLatestBirthdayHeight
abstract BlockHeight getLatestBirthdayHeight()
An in-memory reference to the best known birthday height, which can change if the first transaction has not yet occurred.
-
getOnCriticalErrorHandler
abstract Function1<Throwable, Boolean> getOnCriticalErrorHandler()
Gets or sets a global error handler. This is a useful hook for handling unexpected critical errors.
-
setOnCriticalErrorHandler
abstract Unit setOnCriticalErrorHandler(Function1<Throwable, Boolean> onCriticalErrorHandler)
Gets or sets a global error handler. This is a useful hook for handling unexpected critical errors.
-
getOnProcessorErrorHandler
abstract Function1<Throwable, Boolean> getOnProcessorErrorHandler()
An error handler for exceptions during processing. For instance, a block might be missing or a reorg may get mishandled or the database may get corrupted.
-
setOnProcessorErrorHandler
abstract Unit setOnProcessorErrorHandler(Function1<Throwable, Boolean> onProcessorErrorHandler)
An error handler for exceptions during processing. For instance, a block might be missing or a reorg may get mishandled or the database may get corrupted.
-
getOnSubmissionErrorHandler
abstract Function1<Throwable, Boolean> getOnSubmissionErrorHandler()
An error handler for exceptions while submitting transactions to lightwalletd. For instance, a transaction may get rejected because it would be a double-spend or the user might lose their cellphone signal.
-
setOnSubmissionErrorHandler
abstract Unit setOnSubmissionErrorHandler(Function1<Throwable, Boolean> onSubmissionErrorHandler)
An error handler for exceptions while submitting transactions to lightwalletd. For instance, a transaction may get rejected because it would be a double-spend or the user might lose their cellphone signal.
-
getOnSetupErrorHandler
abstract Function1<Throwable, Boolean> getOnSetupErrorHandler()
Callback for setup errors that occur prior to processing compact blocks. Can be used to override any errors encountered during setup. When this listener is missing then all setup errors will result in the synchronizer not starting. This is particularly useful for wallets to receive a callback right before the SDK will reject a lightwalletd server because it appears not to match.
-
setOnSetupErrorHandler
abstract Unit setOnSetupErrorHandler(Function1<Throwable, Boolean> onSetupErrorHandler)
Callback for setup errors that occur prior to processing compact blocks. Can be used to override any errors encountered during setup. When this listener is missing then all setup errors will result in the synchronizer not starting. This is particularly useful for wallets to receive a callback right before the SDK will reject a lightwalletd server because it appears not to match.
-
getOnChainErrorHandler
abstract Function2<BlockHeight, BlockHeight, Object> getOnChainErrorHandler()
A callback to invoke whenever a chain error is encountered. These occur whenever the processor detects a missing or non-chain-sequential block (i.e. a reorg). At a minimum, it is best to log these errors because they are the most common source of bugs and unexpected behavior in wallets, due to the chain data mutating and wallets becoming out of sync.
-
setOnChainErrorHandler
abstract Unit setOnChainErrorHandler(Function2<BlockHeight, BlockHeight, Object> onChainErrorHandler)
A callback to invoke whenever a chain error is encountered. These occur whenever the processor detects a missing or non-chain-sequential block (i.e. a reorg). At a minimum, it is best to log these errors because they are the most common source of bugs and unexpected behavior in wallets, due to the chain data mutating and wallets becoming out of sync.
-
-
-
-