dec4f0f62e | ||
---|---|---|
.. | ||
README.md | ||
active-transactions.md | ||
all-transactions.md | ||
balance.md | ||
cancel-send.md | ||
get-address.md | ||
index.md | ||
is-first-run.md | ||
is-stale.md | ||
on-synchronizer-error-listener.md | ||
progress.md | ||
send-to-address.md | ||
start.md | ||
stop.md |
README.md
zcash-android-wallet-sdk / cash.z.wallet.sdk.data / Synchronizer
Synchronizer
interface Synchronizer
Primary interface for interacting with the SDK. Defines the contract that specific implementations like MockSynchronizer and SdkSynchronizer fulfill. Given the language-level support for coroutines, we favor their use in the SDK and incorporate that choice into this contract.
Properties
Name | Summary |
---|---|
onSynchronizerErrorListener | abstract var onSynchronizerErrorListener: (( Throwable ?) -> Boolean )? Gets or sets a global error listener. This is a useful hook for handling unexpected critical errors. |
Functions
Name | Summary |
---|---|
activeTransactions | abstract fun activeTransactions(): ReceiveChannel< Map < ActiveTransaction , TransactionState >> A stream of all the active transactions. |
allTransactions | abstract fun allTransactions(): ReceiveChannel< List < WalletTransaction >> A stream of all the wallet transactions. |
balance | abstract fun balance(): ReceiveChannel< Wallet.WalletBalance > A stream of balance values. |
cancelSend | abstract fun cancelSend(transaction: ActiveSendTransaction ): Boolean Attempts to cancel a previously sent transaction. Typically, cancellation is only an option if the transaction has not yet been submitted to the server. |
getAddress | abstract fun getAddress(accountId: Int = 0): String Gets the address for the given account. |
isFirstRun | abstract suspend fun isFirstRun(): Boolean A flag to indicate that this is the first run of this Synchronizer on this device. This is useful for knowing whether to initialize databases or other required resourcews, as well as whether to show walk-throughs. |
isStale | abstract suspend fun isStale(): Boolean A flag to indicate that this Synchronizer is significantly out of sync with it's server. Typically, this means that the balance and other data cannot be completely trusted because a significant amount of data has not been processed. This is intended for showing progress indicators when the user returns to the app after having not used it for days. Typically, this means minor sync issues should be ignored and this should be leveraged in order to alert a user that the balance information is stale. |
progress | abstract fun progress(): ReceiveChannel< Int > A stream of progress values, typically corresponding to this Synchronizer downloading blocks. Typically, any non- zero value below 100 indicates that progress indicators can be shown and a value of 100 signals that progress is complete and any progress indicators can be hidden. |
sendToAddress | abstract suspend fun sendToAddress(zatoshi: Long , toAddress: String , memo: String = "", fromAccountId: Int = 0): Unit Sends zatoshi. |
start | abstract fun start(parentScope: CoroutineScope): Synchronizer Starts this synchronizer within the given scope. |
stop | abstract fun stop(): Unit Stop this synchronizer. |
Inheritors
Name | Summary |
---|---|
MockSynchronizer | open class MockSynchronizer : Synchronizer , CoroutineScope Utility for building UIs. It does the best it can to mock the synchronizer so that it can be dropped right into any project and drive the UI. It generates active transactions in response to funds being sent and generates random received transactions periodically. |
SdkSynchronizer | class SdkSynchronizer : Synchronizer The glue. Downloads compact blocks to the database and then scans them for transactions. In order to serve that purpose, this class glues together a variety of key components. Each component contributes to the team effort of providing a simple source of truth to interact with. |