Initializer

public class Initializer

Wrapper for all the Rust backend functionality that does not involve processing blocks. This class initializes the Rust backend and the supporting data required to exercise those abilities. The [cash.z.wallet.sdk.block.CompactBlockProcessor] handles all the remaining Rust backend functionality, related to processing blocks.

  • Undocumented

    Declaration

    Swift

    private(set) public var viewingKeys: [UnifiedViewingKey] { get }
  • Undocumented

    Declaration

    Swift

    private(set) public var walletBirthday: WalletBirthday { get }
  • Constructs the Initializer

    Declaration

    Swift

    convenience public init (
        cacheDbURL: URL,
        dataDbURL: URL,
        pendingDbURL: URL,
        endpoint: LightWalletEndpoint,
        network: ZcashNetwork,
        spendParamsURL: URL,
        outputParamsURL: URL,
        viewingKeys: [UnifiedViewingKey],
        walletBirthday: BlockHeight,
        alias: String = "",
        loggerProxy: Logger? = nil
    )

    Parameters

    cacheDbURL

    location of the compact blocks cache db

    dataDbURL

    Location of the data db

    pendingDbURL

    location of the pending transactions database

    endpoint

    the endpoint representing the lightwalletd instance you want to point to

    spendParamsURL

    location of the spend parameters

    outputParamsURL

    location of the output parameters

  • Initialize the wallet with the given seed and return the related private keys for each account specified or null if the wallet was previously initialized and block data exists on disk. When this method returns null, that signals that the wallet will need to retrieve the private keys from its own secure storage. In other words, the private keys are only given out once for each set of database files. Subsequent calls to [initialize] will only load the Rust library and return null.

    ‘compactBlockCache.db’ and ‘transactionData.db’ files are created by this function (if they do not already exist). These files can be given a prefix for scenarios where multiple wallets

    Declaration

    Swift

    public func initialize() throws

    Parameters

    viewingKeys

    Extended Full Viewing Keys to initialize the DBs with

  • get address from the given account index

    Declaration

    Swift

    public func getAddress(index account: Int = 0) -> String?

    Parameters

    account

    the index of the account

  • get (unverified) balance from the given account index

    Declaration

    Swift

    public func getBalance(account index: Int = 0) -> Int64

    Parameters

    account

    the index of the account

  • get verified balance from the given account index

    Declaration

    Swift

    public func getVerifiedBalance(account index: Int = 0) -> Int64

    Parameters

    account

    the index of the account

  • checks if the provided address is a valid shielded zAddress

    Declaration

    Swift

    public func isValidShieldedAddress(_ address: String) -> Bool
  • checks if the provided address is a transparent zAddress

    Declaration

    Swift

    public func isValidTransparentAddress(_ address: String) -> Bool