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

new

fun new(seed: ByteArray, newWalletBirthday: WalletBirthday, numberOfAccounts: Int = 1, clearCacheDb: Boolean = false, clearDataDb: Boolean = false): Array<String>

Initialize a new wallet with the given seed and birthday. It creates the required database tables and loads and configures the rustBackend property for use by all other components.

Parameters

seed - the seed to use for the newly created wallet.

newWalletBirthday - the birthday to use for the newly created wallet. Typically, this corresponds to the most recent checkpoint available since new wallets should not have any transactions prior to their creation.

numberOfAccounts - the number of accounts to create for this wallet. This is not fully supported so the default value of 1 is recommended.

clearCacheDb - when true, this will delete cacheDb, if it exists, resulting in the fresh download of all compact blocks. Otherwise, downloading resumes from the last fetched block.

clearDataDb - when true, this will delete the dataDb, if it exists, resulting in the fresh scan of all blocks. Otherwise, initialization crashes when previous wallet data exists to prevent accidental overwrites.

Exceptions

InitializerException.AlreadyInitializedException - when the blocks table already exists and clearDataDb is false.

Return
the account spending keys, corresponding to the accounts that get initialized in the DB.

Return
the spending key(s) associated with this wallet, for convenience.