# 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.

- `viewingKeys`

  Undocumented

  #### Declaration

  Swift

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

- `walletBirthday`

  Undocumented

  #### Declaration

  Swift

      private(set) public var walletBirthday: WalletBirthday { get }

- `init(cacheDbURL:dataDbURL:pendingDbURL:endpoint:network:spendParamsURL:outputParamsURL:viewingKeys:walletBirthday:alias:loggerProxy:)`

  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()`

  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

- `getAddress(index:)`

  get address from the given account index

  #### Declaration

  Swift

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

  #### Parameters

  `account` | the index of the account

- `getBalance(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

- `getVerifiedBalance(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

- `isValidShieldedAddress(_:)`

  checks if the provided address is a valid shielded zAddress

  #### Declaration

  Swift

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

- `isValidTransparentAddress(_:)`

  checks if the provided address is a transparent zAddress

  #### Declaration

  Swift

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

© 2022 Francisco Gindre and Jack Grigg. All rights reserved. (Last updated: 2022-04-07)

Generated by jazzy ♪♫ v0.14.2, a Realm project.