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
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.
appContext
- the application context. This is mostly used for finding databases and params
files within the apps secure storage area.
lightwalletdHost
- the lightwalletd host to use for connections.
lightwalletdPort
- the lightwalletd port to use for connections.
seed
- the seed to use for this wallet, when importing. Null when creating a new wallet.
birthdayStore
- the place to store the birthday of this wallet for future reference, which
allows something else to manage the state on behalf of the initializer.
fun Synchronizer(appContext: Context, initializer: Initializer): 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.
appContext
- the application context. This is mostly used for finding databases and params
files within the apps secure storage area.
initializer
- the helper that is leveraged for creating all the components that the
Synchronizer requires. It is mainly responsible for initializing the databases associated with
this synchronizer.
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
Constructor function for building a Synchronizer in the most flexible way possible. This allows a wallet maker to customize any subcomponent of the Synchronzer.
appContext
- the application context. This is mostly used for finding databases and params
files within the apps secure storage area.
lightwalletdHost
- the lightwalletd host to use for connections.
lightwalletdPort
- the lightwalletd port to use for connections.
ledger
- repository of wallet transactions, providing an agnostic interface to the
underlying information.
blockStore
- component responsible for storing compact blocks downloaded from lightwalletd.
service
- the lightwalletd service that can provide compact blocks and submit transactions.
encoder
- the component responsible for encoding transactions.
downloader
- the component responsible for downloading ranges of compact blocks.
manager
- the component that manages outbound transactions in order to report which ones are
still pending, particularly after failed attempts or dropped connectivity. The intent is to help
monitor outbound transactions status through to completion.
processor
- the component responsible for processing compact blocks. This is effectively the
brains of the synchronizer that implements most of the high-level business logic and determines
the current state of the wallet.