Initial commit

This commit is contained in:
fekt
2022-06-30 01:53:12 -04:00
commit 0131016214
703 changed files with 33394 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [<init>](./-init-.md)
# <init>
`SdkSynchronizer(wallet: `[`Wallet`](../../cash.z.ecc.android.sdk.secure/-wallet/index.md)`, ledger: `[`TransactionRepository`](../-transaction-repository/index.md)`, sender: `[`TransactionSender`](../-transaction-sender/index.md)`, processor: `[`CompactBlockProcessor`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/index.md)`, encoder: `[`TransactionEncoder`](../-transaction-encoder/index.md)`)`
A synchronizer that attempts to remain operational, despite any number of errors that can occur. It acts as the glue
that ties all the pieces of the SDK together. Each component of the SDK is designed for the potential of stand-alone
usage but coordinating all the interactions is non-trivial. So the synchronizer facilitates this, acting as reference
that demonstrates how all the pieces can be tied together. Its goal is to allow a developer to focus on their app
rather than the nuances of how Zcash works.
### Parameters
`wallet` - the component that wraps the JNI layer that interacts with the rust backend and manages wallet config.
`repository` - the component that exposes streams of wallet transaction information.
`sender` - the component responsible for sending transactions to lightwalletd in order to spend funds.
`processor` - the component that saves the downloaded compact blocks to the cache and then scans those blocks for
data related to this wallet.
`encoder` - the component that creates a signed transaction, used for spending funds.

View File

@@ -0,0 +1,14 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [CacheOnly](index.md) / [<init>](./-init-.md)
# <init>
`CacheOnly(startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = Int.MAX_VALUE)`
State for when compact blocks have been downloaded but not scanned. This state is typically achieved when the
app was previously started but killed before the first scan took place. In this case, we do not need to
download compact blocks that we already have.
### Parameters
`startingBlockHeight` - the last block that has been downloaded into the cache. We do not need to download
any blocks before this height because we already have them.

View File

@@ -0,0 +1,26 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [CacheOnly](./index.md)
# CacheOnly
`class CacheOnly : `[`SdkSynchronizer.SyncState`](../index.md)
State for when compact blocks have been downloaded but not scanned. This state is typically achieved when the
app was previously started but killed before the first scan took place. In this case, we do not need to
download compact blocks that we already have.
### Parameters
`startingBlockHeight` - the last block that has been downloaded into the cache. We do not need to download
any blocks before this height because we already have them.
### Constructors
| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `CacheOnly(startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = Int.MAX_VALUE)`<br>State for when compact blocks have been downloaded but not scanned. This state is typically achieved when the app was previously started but killed before the first scan took place. In this case, we do not need to download compact blocks that we already have. |
### Properties
| Name | Summary |
|---|---|
| [startingBlockHeight](starting-block-height.md) | `val startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)<br>the last block that has been downloaded into the cache. We do not need to download any blocks before this height because we already have them. |

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [CacheOnly](index.md) / [startingBlockHeight](./starting-block-height.md)
# startingBlockHeight
`val startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)
the last block that has been downloaded into the cache. We do not need to download
any blocks before this height because we already have them.

View File

@@ -0,0 +1,8 @@
[zcash-android-wallet-sdk](../../../index.md) / [cash.z.ecc.android.sdk.data](../../index.md) / [SdkSynchronizer](../index.md) / [SyncState](index.md) / [FirstRun](./-first-run.md)
# FirstRun
`object FirstRun : `[`SdkSynchronizer.SyncState`](index.md)
State for the first run of the Synchronizer, when the database has not been initialized.

View File

@@ -0,0 +1,12 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [ReadyToProcess](index.md) / [&lt;init&gt;](./-init-.md)
# &lt;init&gt;
`ReadyToProcess(startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = Int.MAX_VALUE)`
The final state of the Synchronizer, when all initialization is complete and the starting block is known.
### Parameters
`startingBlockHeight` - the height that will be fed to the downloader. In most cases, it will represent
either the wallet birthday or the last block that was processed in the previous session.

View File

@@ -0,0 +1,24 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [ReadyToProcess](./index.md)
# ReadyToProcess
`class ReadyToProcess : `[`SdkSynchronizer.SyncState`](../index.md)
The final state of the Synchronizer, when all initialization is complete and the starting block is known.
### Parameters
`startingBlockHeight` - the height that will be fed to the downloader. In most cases, it will represent
either the wallet birthday or the last block that was processed in the previous session.
### Constructors
| Name | Summary |
|---|---|
| [&lt;init&gt;](-init-.md) | `ReadyToProcess(startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` = Int.MAX_VALUE)`<br>The final state of the Synchronizer, when all initialization is complete and the starting block is known. |
### Properties
| Name | Summary |
|---|---|
| [startingBlockHeight](starting-block-height.md) | `val startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)<br>the height that will be fed to the downloader. In most cases, it will represent either the wallet birthday or the last block that was processed in the previous session. |

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../../../index.md) / [cash.z.ecc.android.sdk.data](../../../index.md) / [SdkSynchronizer](../../index.md) / [SyncState](../index.md) / [ReadyToProcess](index.md) / [startingBlockHeight](./starting-block-height.md)
# startingBlockHeight
`val startingBlockHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)
the height that will be fed to the downloader. In most cases, it will represent
either the wallet birthday or the last block that was processed in the previous session.

View File

@@ -0,0 +1,23 @@
[zcash-android-wallet-sdk](../../../index.md) / [cash.z.ecc.android.sdk.data](../../index.md) / [SdkSynchronizer](../index.md) / [SyncState](./index.md)
# SyncState
`sealed class SyncState`
Represents the initial state of the Synchronizer.
### Types
| Name | Summary |
|---|---|
| [CacheOnly](-cache-only/index.md) | `class CacheOnly : `[`SdkSynchronizer.SyncState`](./index.md)<br>State for when compact blocks have been downloaded but not scanned. This state is typically achieved when the app was previously started but killed before the first scan took place. In this case, we do not need to download compact blocks that we already have. |
| [FirstRun](-first-run.md) | `object FirstRun : `[`SdkSynchronizer.SyncState`](./index.md)<br>State for the first run of the Synchronizer, when the database has not been initialized. |
| [ReadyToProcess](-ready-to-process/index.md) | `class ReadyToProcess : `[`SdkSynchronizer.SyncState`](./index.md)<br>The final state of the Synchronizer, when all initialization is complete and the starting block is known. |
### Inheritors
| Name | Summary |
|---|---|
| [CacheOnly](-cache-only/index.md) | `class CacheOnly : `[`SdkSynchronizer.SyncState`](./index.md)<br>State for when compact blocks have been downloaded but not scanned. This state is typically achieved when the app was previously started but killed before the first scan took place. In this case, we do not need to download compact blocks that we already have. |
| [FirstRun](-first-run.md) | `object FirstRun : `[`SdkSynchronizer.SyncState`](./index.md)<br>State for the first run of the Synchronizer, when the database has not been initialized. |
| [ReadyToProcess](-ready-to-process/index.md) | `class ReadyToProcess : `[`SdkSynchronizer.SyncState`](./index.md)<br>The final state of the Synchronizer, when all initialization is complete and the starting block is known. |

View File

@@ -0,0 +1,53 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.wallet.sdk](../index.md) / [SdkSynchronizer](./index.md)
# SdkSynchronizer
`@ExperimentalCoroutinesApi class SdkSynchronizer : `[`Synchronizer`](../-synchronizer/index.md)
A Synchronizer that attempts to remain operational, despite any number of errors that can occur.
It acts as the glue that ties all the pieces of the SDK together. Each component of the SDK is
designed for the potential of stand-alone usage but coordinating all the interactions is non-
trivial. So the Synchronizer facilitates this, acting as reference that demonstrates how all the
pieces can be tied together. Its goal is to allow a developer to focus on their app rather than
the nuances of how Zcash works.
### Parameters
`ledger` - exposes flows of wallet transaction information.
`manager` - manages and tracks outbound transactions.
`processor` - saves the downloaded compact blocks to the cache and then scans those blocks for
data related to this wallet.
### Properties
| Name | Summary |
|---|---|
| [balances](balances.md) | `val balances: Flow<`[`CompactBlockProcessor.WalletBalance`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/-wallet-balance/index.md)`>`<br>A stream of balance values, separately reflecting both the available and total balance. |
| [clearedTransactions](cleared-transactions.md) | `val clearedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.entity/-confirmed-transaction/index.md)`>>`<br>A flow of all the transactions that are on the blockchain. |
| [coroutineScope](coroutine-scope.md) | `lateinit var coroutineScope: CoroutineScope`<br>The lifespan of this Synchronizer. This scope is initialized once the Synchronizer starts because it will be a child of the parentScope that gets passed into the [start](start.md) function. Everything launched by this Synchronizer will be cancelled once the Synchronizer or its parentScope stops. This is a lateinit rather than nullable property so that it fails early rather than silently, whenever the scope is used before the Synchronizer has been started. |
| [onCriticalErrorHandler](on-critical-error-handler.md) | `var onCriticalErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`<br>A callback to invoke whenever an uncaught error is encountered. By definition, the return value of the function is ignored because this error is unrecoverable. The only reason the function has a return value is so that all error handlers work with the same signature which allows one function to handle all errors in simple apps. This callback is not called on the main thread so any UI work would need to switch context to the main thread. |
| [onProcessorErrorHandler](on-processor-error-handler.md) | `var onProcessorErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`<br>A callback to invoke whenever a processor error is encountered. Returning true signals that the error was handled and a retry attempt should be made, if possible. This callback is not called on the main thread so any UI work would need to switch context to the main thread. |
| [onSubmissionErrorHandler](on-submission-error-handler.md) | `var onSubmissionErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`<br>A callback to invoke whenever a server error is encountered while submitting a transaction to lightwalletd. Returning true signals that the error was handled and a retry attempt should be made, if possible. This callback is not called on the main thread so any UI work would need to switch context to the main thread. |
| [pendingTransactions](pending-transactions.md) | `val pendingTransactions: Flow<`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.entity/-pending-transaction/index.md)`>>`<br>A flow of all the outbound pending transaction that have been sent but are awaiting confirmations. |
| [processor](processor.md) | `val processor: `[`CompactBlockProcessor`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/index.md)<br>saves the downloaded compact blocks to the cache and then scans those blocks for data related to this wallet. |
| [processorInfo](processor-info.md) | `val processorInfo: Flow<`[`CompactBlockProcessor.ProcessorInfo`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/-processor-info/index.md)`>`<br>Indicates the latest information about the blocks that have been processed by the SDK. This is very helpful for conveying detailed progress and status to the user. |
| [progress](progress.md) | `val progress: Flow<`[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`>`<br>Indicates the download progress of the Synchronizer. When progress reaches 100, that signals that the Synchronizer is in sync with the network. Balances should be considered inaccurate and outbound transactions should be prevented until this sync is complete. It is a simplified version of [processorInfo](processor-info.md). |
| [receivedTransactions](received-transactions.md) | `val receivedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.entity/-confirmed-transaction/index.md)`>>`<br>A flow of all transactions related to receiving funds. |
| [sentTransactions](sent-transactions.md) | `val sentTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.entity/-confirmed-transaction/index.md)`>>`<br>A flow of all transactions related to sending funds. |
| [status](status.md) | `val status: Flow<`[`Synchronizer.Status`](../-synchronizer/-status/index.md)`>`<br>Indicates the status of this Synchronizer. This implementation basically simplifies the status of the processor to focus only on the high level states that matter most. Whenever the processor is finished scanning, the synchronizer updates transaction and balance info and then emits a [SYNCED](../-synchronizer/-status/-s-y-n-c-e-d.md) status. |
### Functions
| Name | Summary |
|---|---|
| [cancelSpend](cancel-spend.md) | `suspend fun cancelSpend(transaction: `[`PendingTransaction`](../../cash.z.ecc.android.sdk.entity/-pending-transaction/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only an option if the transaction has not yet been submitted to the server. |
| [getAddress](get-address.md) | `suspend fun getAddress(accountId: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)<br>Gets the address for the given account. |
| [isValidShieldedAddr](is-valid-shielded-addr.md) | `suspend fun isValidShieldedAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>Returns true when the given address is a valid z-addr. Invalid addresses will throw an exception. Valid z-addresses have these characteristics: //TODO |
| [isValidTransparentAddr](is-valid-transparent-addr.md) | `suspend fun isValidTransparentAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)<br>Returns true when the given address is a valid t-addr. Invalid addresses will throw an exception. Valid t-addresses have these characteristics: //TODO |
| [refreshBalance](refresh-balance.md) | `suspend fun refreshBalance(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |
| [sendToAddress](send-to-address.md) | `fun sendToAddress(spendingKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, zatoshi: `[`Long`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, toAddress: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, memo: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, fromAccountIndex: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): Flow<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.entity/-pending-transaction/index.md)`>`<br>Sends zatoshi. |
| [start](start.md) | `fun start(parentScope: CoroutineScope?): `[`Synchronizer`](../-synchronizer/index.md)<br>Starts this synchronizer within the given scope. For simplicity, attempting to start an instance that has already been started will throw a [SynchronizerException.FalseStart](../../cash.z.ecc.android.sdk.exception/-synchronizer-exception/-false-start.md) exception. This reduces the complexity of managing resources that must be recycled. Instead, each synchronizer is designed to have a long lifespan and should be started from an activity, application or session. |
| [stop](stop.md) | `fun stop(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)<br>Stop this synchronizer and all of its child jobs. Once a synchronizer has been stopped it should not be restarted and attempting to do so will result in an error. Also, this function will throw an exception if the synchronizer was never previously started. |
| [validateAddress](validate-address.md) | `suspend fun validateAddress(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Synchronizer.AddressType`](../-synchronizer/-address-type/index.md)<br>Validates the given address, returning information about why it is invalid. |

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [activeTransactions](./active-transactions.md)
# activeTransactions
`fun activeTransactions(): ReceiveChannel<`[`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html)`<`[`ActiveTransaction`](../-active-transaction/index.md)`, `[`TransactionState`](../-transaction-state/index.md)`>>`
Overrides [Synchronizer.activeTransactions](../-synchronizer/active-transactions.md)
A stream of all the wallet transactions, delegated to the [activeTransactionManager](#).

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [allTransactions](./all-transactions.md)
# allTransactions
`fun allTransactions(): ReceiveChannel<`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`WalletTransaction`](../../cash.z.ecc.android.sdk.dao/-wallet-transaction/index.md)`>>`
Overrides [Synchronizer.allTransactions](../-synchronizer/all-transactions.md)
A stream of all the wallet transactions, delegated to the [repository](#).

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [balance](./balance.md)
# balance
`fun balance(): ReceiveChannel<`[`Wallet.WalletBalance`](../../cash.z.ecc.android.sdk.secure/-wallet/-wallet-balance/index.md)`>`
Overrides [Synchronizer.balance](../-synchronizer/balance.md)
A stream of balance values, delegated to the [wallet](#).

View File

@@ -0,0 +1,8 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [balances](./balances.md)
# balances
`val balances: Flow<WalletBalance>`
A stream of balance values, separately reflecting both the available and total balance.

View File

@@ -0,0 +1,18 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [cancelSend](./cancel-send.md)
# cancelSend
`fun cancelSend(transaction: `[`SentTransaction`](../../cash.z.ecc.android.sdk.entity/-sent-transaction/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.cancelSend](../-synchronizer/cancel-send.md)
Attempts to cancel a previously sent transaction. Typically, cancellation is only an option if the transaction
has not yet been submitted to the server.
### Parameters
`transaction` - the transaction to cancel.
**Return**
true when the cancellation request was successful. False when it is too late to cancel.

View File

@@ -0,0 +1,16 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [cancelSpend](./cancel-spend.md)
# cancelSpend
`suspend fun cancelSpend(transaction: `[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only
an option if the transaction has not yet been submitted to the server.
### Parameters
`transaction` - the transaction to cancel.
**Return**
true when the cancellation request was successful. False when it is too late.

View File

@@ -0,0 +1,12 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [channel](./channel.md)
# channel
`val channel: ManagedChannel`
The channel that this Synchronizer uses to communicate with lightwalletd. In most cases, this
should not be needed or used. Instead, APIs should be added to the synchronizer to
enable the desired behavior. In the rare case, such as testing, it can be helpful to share
the underlying channel to connect to the same service, and use other APIs
(such as darksidewalletd) because channels are heavyweight.

View File

@@ -0,0 +1,8 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [clearedTransactions](./cleared-transactions.md)
# clearedTransactions
`val clearedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>`
A flow of all the transactions that are on the blockchain.

View File

@@ -0,0 +1,12 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [coroutineScope](./coroutine-scope.md)
# coroutineScope
`var coroutineScope: CoroutineScope`
The lifespan of this Synchronizer. This scope is initialized once the Synchronizer starts
because it will be a child of the parentScope that gets passed into the [start](start.md) function.
Everything launched by this Synchronizer will be cancelled once the Synchronizer or its
parentScope stops. This coordinates with [isStarted](is-started.md) so that it fails early
rather than silently, whenever the scope is used before the Synchronizer has been started.

View File

@@ -0,0 +1,5 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [findBlockHashAsHex](./find-block-hash-as-hex.md)
# findBlockHashAsHex
`fun findBlockHashAsHex(height: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?`

View File

@@ -0,0 +1,5 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [findBlockHash](./find-block-hash.md)
# findBlockHash
`fun findBlockHash(height: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`ByteArray`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`?`

View File

@@ -0,0 +1,16 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [getAddress](./get-address.md)
# getAddress
`suspend fun getAddress(accountId: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)
Gets the address for the given account.
### Parameters
`accountId` - the optional accountId whose address is of interest. By default, the first
account is used.
**Return**
the address for the given account.

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [getServerInfo](./get-server-info.md)
# getServerInfo
`suspend fun getServerInfo(): <ERROR CLASS>`
Convenience function that exposes the underlying server information, like its name and
consensus branch id. Most wallets should already have a different source of truth for the
server(s) with which they operate.

View File

@@ -0,0 +1,5 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [getTransactionCount](./get-transaction-count.md)
# getTransactionCount
`fun getTransactionCount(): `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)

View File

@@ -0,0 +1,54 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](./index.md)
# SdkSynchronizer
`@ExperimentalCoroutinesApi class SdkSynchronizer : `[`Synchronizer`](../-synchronizer/index.md)
A Synchronizer that attempts to remain operational, despite any number of errors that can occur.
It acts as the glue that ties all the pieces of the SDK together. Each component of the SDK is
designed for the potential of stand-alone usage but coordinating all the interactions is non-
trivial. So the Synchronizer facilitates this, acting as reference that demonstrates how all the
pieces can be tied together. Its goal is to allow a developer to focus on their app rather than
the nuances of how Zcash works.
### Properties
| Name | Summary |
|---|---|
| [balances](balances.md) | A stream of balance values, separately reflecting both the available and total balance.`val balances: Flow<WalletBalance>` |
| [channel](channel.md) | The channel that this Synchronizer uses to communicate with lightwalletd. In most cases, this should not be needed or used. Instead, APIs should be added to the synchronizer to enable the desired behavior. In the rare case, such as testing, it can be helpful to share the underlying channel to connect to the same service, and use other APIs (such as darksidewalletd) because channels are heavyweight.`val channel: ManagedChannel` |
| [clearedTransactions](cleared-transactions.md) | A flow of all the transactions that are on the blockchain.`val clearedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>` |
| [coroutineScope](coroutine-scope.md) | The lifespan of this Synchronizer. This scope is initialized once the Synchronizer starts because it will be a child of the parentScope that gets passed into the [start](start.md) function. Everything launched by this Synchronizer will be cancelled once the Synchronizer or its parentScope stops. This coordinates with [isStarted](is-started.md) so that it fails early rather than silently, whenever the scope is used before the Synchronizer has been started.`var coroutineScope: CoroutineScope` |
| [isStarted](is-started.md) | `var isStarted: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [latestBalance](latest-balance.md) | Convenience function for the latest balance. Instead of using this, a wallet will more likely want to consume the flow of balances using [balances](balances.md).`val latestBalance: WalletBalance` |
| [latestHeight](latest-height.md) | Convenience function for the latest height. Specifically, this value represents the last height that the synchronizer has observed from the lightwalletd server. Instead of using this, a wallet will more likely want to consume the flow of processor info using [processorInfo](processor-info.md).`val latestHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) |
| [onChainErrorHandler](on-chain-error-handler.md) | 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).`var onChainErrorHandler: ((errorHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, rewindHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`) -> `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`)?` |
| [onCriticalErrorHandler](on-critical-error-handler.md) | A callback to invoke whenever an uncaught error is encountered. By definition, the return value of the function is ignored because this error is unrecoverable. The only reason the function has a return value is so that all error handlers work with the same signature which allows one function to handle all errors in simple apps. This callback is not called on the main thread so any UI work would need to switch context to the main thread.`var onCriticalErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?` |
| [onProcessorErrorHandler](on-processor-error-handler.md) | A callback to invoke whenever a processor error is encountered. Returning true signals that the error was handled and a retry attempt should be made, if possible. This callback is not called on the main thread so any UI work would need to switch context to the main thread.`var onProcessorErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?` |
| [onSubmissionErrorHandler](on-submission-error-handler.md) | A callback to invoke whenever a server error is encountered while submitting a transaction to lightwalletd. Returning true signals that the error was handled and a retry attempt should be made, if possible. This callback is not called on the main thread so any UI work would need to switch context to the main thread.`var onSubmissionErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?` |
| [pendingTransactions](pending-transactions.md) | A flow of all the outbound pending transaction that have been sent but are awaiting confirmations.`val pendingTransactions: Flow<`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`>>` |
| [processor](processor.md) | saves the downloaded compact blocks to the cache and then scans those blocks for data related to this wallet.`val processor: `[`CompactBlockProcessor`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/index.md) |
| [processorInfo](processor-info.md) | Indicates the latest information about the blocks that have been processed by the SDK. This is very helpful for conveying detailed progress and status to the user.`val processorInfo: Flow<ProcessorInfo>` |
| [progress](progress.md) | Indicates the download progress of the Synchronizer. When progress reaches 100, that signals that the Synchronizer is in sync with the network. Balances should be considered inaccurate and outbound transactions should be prevented until this sync is complete. It is a simplified version of [processorInfo](processor-info.md).`val progress: Flow<`[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`>` |
| [receivedTransactions](received-transactions.md) | A flow of all transactions related to receiving funds.`val receivedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>` |
| [sentTransactions](sent-transactions.md) | A flow of all transactions related to sending funds.`val sentTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>` |
| [status](status.md) | Indicates the status of this Synchronizer. This implementation basically simplifies the status of the processor to focus only on the high level states that matter most. Whenever the processor is finished scanning, the synchronizer updates transaction and balance info and then emits a [SYNCED](../-synchronizer/-status/-s-y-n-c-e-d.md) status.`val status: Flow<Status>` |
### Functions
| Name | Summary |
|---|---|
| [cancelSpend](cancel-spend.md) | Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only an option if the transaction has not yet been submitted to the server.`suspend fun cancelSpend(transaction: `[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [findBlockHash](find-block-hash.md) | `fun findBlockHash(height: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`ByteArray`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)`?` |
| [findBlockHashAsHex](find-block-hash-as-hex.md) | `fun findBlockHashAsHex(height: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`?` |
| [getAddress](get-address.md) | Gets the address for the given account.`suspend fun getAddress(accountId: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) |
| [getServerInfo](get-server-info.md) | Convenience function that exposes the underlying server information, like its name and consensus branch id. Most wallets should already have a different source of truth for the server(s) with which they operate.`suspend fun getServerInfo(): <ERROR CLASS>` |
| [getTransactionCount](get-transaction-count.md) | `fun getTransactionCount(): `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) |
| [isValidShieldedAddr](is-valid-shielded-addr.md) | Returns true when the given address is a valid z-addr. Invalid addresses will throw an exception. Valid z-addresses have these characteristics: //TODO copy info from related ZIP`suspend fun isValidShieldedAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [isValidTransparentAddr](is-valid-transparent-addr.md) | Returns true when the given address is a valid t-addr. Invalid addresses will throw an exception. Valid t-addresses have these characteristics: //TODO copy info from related ZIP`suspend fun isValidTransparentAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) |
| [refreshBalance](refresh-balance.md) | Calculate the latest balance, based on the blocks that have been scanned and transmit this information into the flow of [balances](balances.md).`suspend fun refreshBalance(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |
| [sendToAddress](send-to-address.md) | Sends zatoshi.`fun sendToAddress(spendingKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, zatoshi: `[`Long`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, toAddress: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, memo: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, fromAccountIndex: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): Flow<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`>` |
| [start](start.md) | Starts this synchronizer within the given scope. For simplicity, attempting to start an instance that has already been started will throw a [SynchronizerException.FalseStart](../../cash.z.ecc.android.sdk.exception/-synchronizer-exception/-false-start.md) exception. This reduces the complexity of managing resources that must be recycled. Instead, each synchronizer is designed to have a long lifespan and should be started from an activity, application or session.`fun start(parentScope: CoroutineScope?): `[`Synchronizer`](../-synchronizer/index.md) |
| [stop](stop.md) | Stop this synchronizer and all of its child jobs. Once a synchronizer has been stopped it should not be restarted and attempting to do so will result in an error. Also, this function will throw an exception if the synchronizer was never previously started.`fun stop(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) |
| [validateAddress](validate-address.md) | Validates the given address, returning information about why it is invalid. This is a convenience method that combines the behavior of [isValidShieldedAddr](../-synchronizer/is-valid-shielded-addr.md) and [isValidTransparentAddr](../-synchronizer/is-valid-transparent-addr.md) into one call so that the developer doesn't have to worry about handling the exceptions that they throw. Rather, exceptions are converted to [AddressType.Invalid](../../cash.z.ecc.android.sdk.validate/-address-type/-invalid/index.md) which has a `reason` property describing why it is invalid.`suspend fun validateAddress(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`AddressType`](../../cash.z.ecc.android.sdk.validate/-address-type/index.md) |
| [validateConsensusBranch](validate-consensus-branch.md) | Validate whether the server and this SDK share the same consensus branch. This is particularly important to check around network updates so that any wallet that's connected to an incompatible server can surface that information effectively. For the SDK, the consensus branch is used when creating transactions as each one needs to target a specific branch. This function compares the server's branch id to this SDK's and returns information that helps determine whether they match.`suspend fun validateConsensusBranch(): `[`ConsensusMatchType`](../../cash.z.ecc.android.sdk.validate/-consensus-match-type/index.md) |

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [isConnected](./is-connected.md)
# isConnected
`val isConnected: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.isConnected](../-synchronizer/is-connected.md)
A property that is true while a connection to the lightwalletd server exists.

View File

@@ -0,0 +1,15 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [isFirstRun](./is-first-run.md)
# isFirstRun
`suspend fun isFirstRun(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.isFirstRun](../-synchronizer/is-first-run.md)
A flag to indicate that the initial state of this synchronizer was firstRun. This is useful for knowing whether
initializing the database is required and whether to show things like"first run walk-throughs."
**Return**
true when this synchronizer has not been run before on this device or when cache has been cleared since
the last run.

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [isScanning](./is-scanning.md)
# isScanning
`val isScanning: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.isScanning](../-synchronizer/is-scanning.md)
A property that is true while actively scanning the cache of compact blocks for transactions.

View File

@@ -0,0 +1,18 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [isStale](./is-stale.md)
# isStale
`suspend fun isStale(): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.isStale](../-synchronizer/is-stale.md)
A flag to indicate that this Synchronizer is significantly out of sync with it's server. This is determined by
the delta between the current block height reported by the server and the latest block we have stored in cache.
Whenever this delta is greater than the [staleTolerance](#), this function returns true. This is intended for
showing progress indicators when the user returns to the app after having not used it for a long period.
Typically, this means the user may have to wait for downloading to occur and the current balance and transaction
information cannot be trusted as 100% accurate.
**Return**
true when the local data is significantly out of sync with the remote server and the app data is stale.

View File

@@ -0,0 +1,5 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [isStarted](./is-started.md)
# isStarted
`var isStarted: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [isSyncing](./is-syncing.md)
# isSyncing
`val isSyncing: `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Overrides [Synchronizer.isSyncing](../-synchronizer/is-syncing.md)
A property that is true while actively downloading blocks from lightwalletd.

View File

@@ -0,0 +1,20 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [isValidShieldedAddr](./is-valid-shielded-addr.md)
# isValidShieldedAddr
`suspend fun isValidShieldedAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Returns true when the given address is a valid z-addr. Invalid addresses will throw an
exception. Valid z-addresses have these characteristics: //TODO copy info from related ZIP
### Parameters
`address` - the address to validate.
### Exceptions
`RuntimeException` - when the address is invalid.
**Return**
true when the given address is a valid z-addr.

View File

@@ -0,0 +1,20 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [isValidTransparentAddr](./is-valid-transparent-addr.md)
# isValidTransparentAddr
`suspend fun isValidTransparentAddr(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)
Returns true when the given address is a valid t-addr. Invalid addresses will throw an
exception. Valid t-addresses have these characteristics: //TODO copy info from related ZIP
### Parameters
`address` - the address to validate.
### Exceptions
`RuntimeException` - when the address is invalid.
**Return**
true when the given address is a valid t-addr.

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [lastBalance](./last-balance.md)
# lastBalance
`fun lastBalance(): `[`Wallet.WalletBalance`](../../cash.z.ecc.android.sdk.secure/-wallet/-wallet-balance/index.md)
Overrides [Synchronizer.lastBalance](../-synchronizer/last-balance.md)
Holds the most recent value that was transmitted through the [balances](../-synchronizer/balances.md) channel. Typically, if the
underlying channel is a BroadcastChannel (and it should be), then this value is simply [balanceChannel.value](#)

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [lastCleared](./last-cleared.md)
# lastCleared
`fun lastCleared(): `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`ClearedTransaction`](../../cash.z.ecc.android.sdk.entity/-cleared-transaction/index.md)`>`
Overrides [Synchronizer.lastCleared](../-synchronizer/last-cleared.md)
Holds the most recent value that was transmitted through the [clearedTransactions](../-synchronizer/cleared-transactions.md) channel. Typically, if the
underlying channel is a BroadcastChannel (and it should be), then this value is simply [clearedChannel.value](#)

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [lastPending](./last-pending.md)
# lastPending
`fun lastPending(): `[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.entity/-pending-transaction/index.md)`>`
Overrides [Synchronizer.lastPending](../-synchronizer/last-pending.md)
Holds the most recent value that was transmitted through the [pendingTransactions](../-synchronizer/pending-transactions.md) channel. Typically, if the
underlying channel is a BroadcastChannel (and it should be),then this value is simply [pendingChannel.value](#)

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [latestBalance](./latest-balance.md)
# latestBalance
`val latestBalance: WalletBalance`
Convenience function for the latest balance. Instead of using this, a wallet will more likely
want to consume the flow of balances using [balances](balances.md).

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [latestHeight](./latest-height.md)
# latestHeight
`val latestHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)
Convenience function for the latest height. Specifically, this value represents the last
height that the synchronizer has observed from the lightwalletd server. Instead of using
this, a wallet will more likely want to consume the flow of processor info using
[processorInfo](processor-info.md).

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [onChainErrorHandler](./on-chain-error-handler.md)
# onChainErrorHandler
`var onChainErrorHandler: ((errorHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, rewindHeight: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`) -> `[`Any`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)`)?`
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).

View File

@@ -0,0 +1,12 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [onCriticalErrorHandler](./on-critical-error-handler.md)
# onCriticalErrorHandler
`var onCriticalErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`
A callback to invoke whenever an uncaught error is encountered. By definition, the return
value of the function is ignored because this error is unrecoverable. The only reason the
function has a return value is so that all error handlers work with the same signature which
allows one function to handle all errors in simple apps. This callback is not called on the
main thread so any UI work would need to switch context to the main thread.

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [onProcessorErrorHandler](./on-processor-error-handler.md)
# onProcessorErrorHandler
`var onProcessorErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`
A callback to invoke whenever a processor error is encountered. Returning true signals that
the error was handled and a retry attempt should be made, if possible. This callback is not
called on the main thread so any UI work would need to switch context to the main thread.

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [onSubmissionErrorHandler](./on-submission-error-handler.md)
# onSubmissionErrorHandler
`var onSubmissionErrorHandler: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`
A callback to invoke whenever a server error is encountered while submitting a transaction to
lightwalletd. Returning true signals that the error was handled and a retry attempt should be
made, if possible. This callback is not called on the main thread so any UI work would need
to switch context to the main thread.

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [onSynchronizerErrorListener](./on-synchronizer-error-listener.md)
# onSynchronizerErrorListener
`var onSynchronizerErrorListener: ((`[`Throwable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-throwable/index.html)`?) -> `[`Boolean`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)?`
Overrides [Synchronizer.onSynchronizerErrorListener](../-synchronizer/on-synchronizer-error-listener.md)
Sets a listener to be notified of uncaught Synchronizer errors. When null, errors will only be logged.

View File

@@ -0,0 +1,5 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk.data](../index.md) / [SdkSynchronizer](index.md) / [onTransactionsChanged](./on-transactions-changed.md)
# onTransactionsChanged
`fun onTransactionsChanged(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [pendingTransactions](./pending-transactions.md)
# pendingTransactions
`val pendingTransactions: Flow<`[`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)`<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`>>`
A flow of all the outbound pending transaction that have been sent but are awaiting
confirmations.

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [processorInfo](./processor-info.md)
# processorInfo
`val processorInfo: Flow<ProcessorInfo>`
Indicates the latest information about the blocks that have been processed by the SDK. This
is very helpful for conveying detailed progress and status to the user.

View File

@@ -0,0 +1,13 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [processor](./processor.md)
# processor
`val processor: `[`CompactBlockProcessor`](../../cash.z.ecc.android.sdk.block/-compact-block-processor/index.md)
saves the downloaded compact blocks to the cache and then scans those blocks for
data related to this wallet.
### Property
`processor` - saves the downloaded compact blocks to the cache and then scans those blocks for
data related to this wallet.

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [progress](./progress.md)
# progress
`val progress: Flow<`[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`>`
Indicates the download progress of the Synchronizer. When progress reaches 100, that
signals that the Synchronizer is in sync with the network. Balances should be considered
inaccurate and outbound transactions should be prevented until this sync is complete. It is
a simplified version of [processorInfo](processor-info.md).

View File

@@ -0,0 +1,8 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [receivedTransactions](./received-transactions.md)
# receivedTransactions
`val receivedTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>`
A flow of all transactions related to receiving funds.

View File

@@ -0,0 +1,9 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [refreshBalance](./refresh-balance.md)
# refreshBalance
`suspend fun refreshBalance(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)
Calculate the latest balance, based on the blocks that have been scanned and transmit this
information into the flow of [balances](balances.md).

View File

@@ -0,0 +1,26 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [sendToAddress](./send-to-address.md)
# sendToAddress
`fun sendToAddress(spendingKey: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, zatoshi: `[`Long`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, toAddress: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, memo: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, fromAccountIndex: `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`): Flow<`[`PendingTransaction`](../../cash.z.ecc.android.sdk.db.entity/-pending-transaction/index.md)`>`
Sends zatoshi.
### Parameters
`spendingKey` - the key associated with the notes that will be spent.
`zatoshi` - the amount of zatoshi to send.
`toAddress` - the recipient's address.
`memo` - the optional memo to include as part of the transaction.
`fromAccountIndex` - the optional account id to use. By default, the first account is used.
**Return**
a flow of PendingTransaction objects representing changes to the state of the
transaction. Any time the state changes a new instance will be emitted by this flow. This is
useful for updating the UI without needing to poll. Of course, polling is always an option
for any wallet that wants to ignore this return value.

View File

@@ -0,0 +1,8 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [sentTransactions](./sent-transactions.md)
# sentTransactions
`val sentTransactions: Flow<PagedList<`[`ConfirmedTransaction`](../../cash.z.ecc.android.sdk.db.entity/-confirmed-transaction/index.md)`>>`
A flow of all transactions related to sending funds.

View File

@@ -0,0 +1,23 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [start](./start.md)
# start
`fun start(parentScope: CoroutineScope?): `[`Synchronizer`](../-synchronizer/index.md)
Starts this synchronizer within the given scope. For simplicity, attempting to start an
instance that has already been started will throw a [SynchronizerException.FalseStart](../../cash.z.ecc.android.sdk.exception/-synchronizer-exception/-false-start.md)
exception. This reduces the complexity of managing resources that must be recycled. Instead,
each synchronizer is designed to have a long lifespan and should be started from an activity,
application or session.
### Parameters
`parentScope` - the scope to use for this synchronizer, typically something with a
lifecycle such as an Activity for single-activity apps or a logged in user session. This
scope is only used for launching this synchronizer's job as a child. If no scope is provided,
then this synchronizer and all of its coroutines will run until stop is called, which is not
recommended since it can leak resources. That type of behavior is more useful for tests.
**Return**
an instance of this class so that this function can be used fluidly.

View File

@@ -0,0 +1,11 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [status](./status.md)
# status
`val status: Flow<Status>`
Indicates the status of this Synchronizer. This implementation basically simplifies the
status of the processor to focus only on the high level states that matter most. Whenever the
processor is finished scanning, the synchronizer updates transaction and balance info and
then emits a [SYNCED](../-synchronizer/-status/-s-y-n-c-e-d.md) status.

View File

@@ -0,0 +1,10 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [stop](./stop.md)
# stop
`fun stop(): `[`Unit`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)
Stop this synchronizer and all of its child jobs. Once a synchronizer has been stopped it
should not be restarted and attempting to do so will result in an error. Also, this function
will throw an exception if the synchronizer was never previously started.

View File

@@ -0,0 +1,19 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [validateAddress](./validate-address.md)
# validateAddress
`suspend fun validateAddress(address: `[`String`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`): `[`AddressType`](../../cash.z.ecc.android.sdk.validate/-address-type/index.md)
Validates the given address, returning information about why it is invalid. This is a
convenience method that combines the behavior of [isValidShieldedAddr](../-synchronizer/is-valid-shielded-addr.md) and
[isValidTransparentAddr](../-synchronizer/is-valid-transparent-addr.md) into one call so that the developer doesn't have to worry about
handling the exceptions that they throw. Rather, exceptions are converted to
[AddressType.Invalid](../../cash.z.ecc.android.sdk.validate/-address-type/-invalid/index.md) which has a `reason` property describing why it is invalid.
### Parameters
`address` - the address to validate.
**Return**
an instance of [AddressType](../../cash.z.ecc.android.sdk.validate/-address-type/index.md) providing validation info regarding the given address.

View File

@@ -0,0 +1,17 @@
[zcash-android-wallet-sdk](../../index.md) / [cash.z.ecc.android.sdk](../index.md) / [SdkSynchronizer](index.md) / [validateConsensusBranch](./validate-consensus-branch.md)
# validateConsensusBranch
`suspend fun validateConsensusBranch(): `[`ConsensusMatchType`](../../cash.z.ecc.android.sdk.validate/-consensus-match-type/index.md)
Validate whether the server and this SDK share the same consensus branch. This is
particularly important to check around network updates so that any wallet that's connected to
an incompatible server can surface that information effectively. For the SDK, the consensus
branch is used when creating transactions as each one needs to target a specific branch. This
function compares the server's branch id to this SDK's and returns information that helps
determine whether they match.
**Return**
an instance of [ConsensusMatchType](../../cash.z.ecc.android.sdk.validate/-consensus-match-type/index.md) that is essentially a wrapper for both branch ids
and provides helper functions for communicating detailed errors to the user.