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

DefaultBirthdayStore

class DefaultBirthdayStore : WalletBirthdayStore

Default implementation of the WalletBirthdayStore interface that loads checkpoints from the assets directory, in JSON format and stores the current birthday in shared preferences.

Constructors

<init>

Default implementation of the WalletBirthdayStore interface that loads checkpoints from the assets directory, in JSON format and stores the current birthday in shared preferences.

DefaultBirthdayStore(appContext: Context, importedBirthdayHeight: Int? = null, alias: String = DEFAULT_ALIAS)

Properties

alias

val alias: String

newWalletBirthday

Birthday that helps new wallets not have to scan from the beginning, which saves significant amounts of startup time. This value is created using the context passed into the constructor.

val newWalletBirthday: WalletBirthday

Functions

getBirthday

Get the birthday of the wallet, saved in this store.

fun getBirthday(): WalletBirthday

hasExistingBirthday

Return true when a birthday has been stored in this instance.

fun hasExistingBirthday(): Boolean

hasImportedBirthday

Return true when a birthday was imported into this instance.

fun hasImportedBirthday(): Boolean

loadBirthday

Load a birthday matching the given height. This is most commonly used during import to find the first available checkpoint that is lower than the requested height.

fun loadBirthday(birthdayHeight: Int): WalletBirthday

setBirthday

Set the birthday of the wallet to be saved in this store.

fun setBirthday(value: WalletBirthday): Unit

Companion Object Properties

DEFAULT_ALIAS

The default alias to use for naming the preference file used for storage.

const val DEFAULT_ALIAS: String

Companion Object Functions

ImportedWalletBirthdayStore

A convenience constructor function for creating an instance of this class to use for imported wallets. It sets the stored birthday to match the given importedBirthdayHeight by finding the highest checkpoint that is below that height.

fun ImportedWalletBirthdayStore(appContext: Context, importedBirthdayHeight: Int?, alias: String = DEFAULT_ALIAS): WalletBirthdayStore

loadBirthdayFromAssets

Load the given birthday file from the assets of the given context. When no height is specified, we default to the file with the greatest name.

fun loadBirthdayFromAssets(context: Context, birthdayHeight: Int? = null): WalletBirthday

NewWalletBirthdayStore

A convenience constructor function for creating an instance of this class to use for new wallets. It sets the stored birthday to match the newWalletBirthday checkpoint which is typically the most recent checkpoint available.

fun NewWalletBirthdayStore(appContext: Context, alias: String = DEFAULT_ALIAS): WalletBirthdayStore