zcash-android-wallet-sdk / cash.z.wallet.sdk

Package cash.z.wallet.sdk

Types

Initializer

Responsible for initialization, which can be considered as setup that must happen before synchronizing begins. This begins with one of three actions, a call to either new, import or open, where the last option is the most common case--when a user is opening a wallet they have used before on this device.

class Initializer

SdkSynchronizer

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.

class SdkSynchronizer : Synchronizer

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.

interface Synchronizer

Functions

Synchronizer

A convenience constructor that accepts the information most likely to change and uses defaults for everything else. This is useful for demos, sample apps or PoC's. Anything more complex will probably want to handle initialization, directly.

fun Synchronizer(appContext: Context, lightwalletdHost: String = ZcashSdk.DEFAULT_LIGHTWALLETD_HOST, lightwalletdPort: Int = ZcashSdk.DEFAULT_LIGHTWALLETD_PORT, seed: ByteArray? = null, birthdayStore: WalletBirthdayStore = Initializer.DefaultBirthdayStore(appContext)): Synchronizer

Constructor function to use in most cases. This is a convenience function for when a wallet has already created an initializer. Meaning, the basic flow is to call either Initializer.new or Initializer.import on the first run and then Initializer.open for all subsequent launches of the wallet. From there, the initializer is passed to this function in order to start syncing from where the wallet left off.

fun Synchronizer(appContext: Context, initializer: Initializer): Synchronizer

Constructor function for building a Synchronizer in the most flexible way possible. This allows a wallet maker to customize any subcomponent of the Synchronzer.

fun Synchronizer(appContext: Context, rustBackend: RustBackend, lightwalletdHost: String = ZcashSdk.DEFAULT_LIGHTWALLETD_HOST, lightwalletdPort: Int = ZcashSdk.DEFAULT_LIGHTWALLETD_PORT, ledger: TransactionRepository = PagedTransactionRepository(appContext, 1000, rustBackend.pathDataDb), blockStore: CompactBlockStore = CompactBlockDbStore(appContext, rustBackend.pathCacheDb), service: LightWalletService = LightWalletGrpcService(appContext, lightwalletdHost, lightwalletdPort), encoder: TransactionEncoder = WalletTransactionEncoder(rustBackend, ledger), downloader: CompactBlockDownloader = CompactBlockDownloader(service, blockStore), manager: OutboundTransactionManager = PersistentTransactionManager(appContext, encoder, service), processor: CompactBlockProcessor = CompactBlockProcessor(downloader, ledger, rustBackend, rustBackend.birthdayHeight)): Synchronizer