-
- 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()Indicates the download progress of the Synchronizer. abstract Flow<Boolean>getAreFundsSpendable()Indicates whether are the shielded wallet balances spendable or not during the block synchronization process. 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<Map<AccountUuid, AccountBalance>>getWalletBalances()A stream of wallet balances abstract StateFlow<ObserveFiatCurrencyResult>getExchangeRateUsd()The latest known USD/ZEC exchange rate, paired with the time it was queried. abstract Flow<List<TransactionOverview>>getAllTransactions()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 Flow<List<Account>>getAccountsFlow()Returns all the wallet accounts or throws InitializeException.GetAccountsExceptionIt's a Flow version of getAccounts abstract Synchronizer.InitializationErrorgetInitializationError()Emits error states of the synchronizer. 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 Function0<Unit>getOnProcessorErrorResolved()abstract UnitsetOnProcessorErrorResolved(Function0<Unit> onProcessorErrorResolved)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
addProofsToPczt, checkSingleUseTransparentAddress, close, createPcztFromProposal, createProposedTransactions, createTransactionFromPczt, debugQuery, enhanceTransaction, fetchUtxosByAddress, getAccounts, getCustomUnifiedAddress, getExistingDataDbFilePath, getFastestServers, getMemos, getRecipients, getSaplingAddress, getSingleUseTransparentAddress, getTorHttpClient, getTransactionOutputs, getTransactions, getTransactionsByMemoSubstring, getTransparentAddress, getTransparentBalance, getUnifiedAddress, importAccountByUfvk, isValidShieldedAddr, isValidTexAddr, isValidTransparentAddr, isValidUnifiedAddr, onBackground, onForeground, pcztRequiresSaplingProofs, proposeFulfillingPaymentUri, proposeShielding, proposeTransfer, redactPcztForSigner, refreshExchangeRateUsd, refreshUtxos, rewindToNearestHeight, 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()
Indicates the download progress of the Synchronizer.
When progress reaches
PercentDecimal.ONE_HUNDRED_PERCENT, it signals that the Synchronizer is up-to-date with the network's current chain tip. Balances should be considered inaccurate and outbound transactions should be prevented until this sync is complete.
-
getAreFundsSpendable
abstract Flow<Boolean> getAreFundsSpendable()
Indicates whether are the shielded wallet balances spendable or not during the block synchronization process.
-
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.
-
getWalletBalances
abstract StateFlow<Map<AccountUuid, AccountBalance>> getWalletBalances()
A stream of wallet balances
-
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.
-
getAllTransactions
abstract Flow<List<TransactionOverview>> getAllTransactions()
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.
-
getAccountsFlow
abstract Flow<List<Account>> getAccountsFlow()
Returns all the wallet accounts or throws InitializeException.GetAccountsException
It's a Flow version of getAccounts
-
getInitializationError
abstract Synchronizer.InitializationError getInitializationError()
Emits error states of the synchronizer.
-
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.
-
getOnProcessorErrorResolved
abstract Function0<Unit> getOnProcessorErrorResolved()
-
setOnProcessorErrorResolved
abstract Unit setOnProcessorErrorResolved(Function0<Unit> onProcessorErrorResolved)
-
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.
-
-
-
-