diff --git a/Example/ZcashLightClientSample/ZcashLightClientSample/Get Address/GetAddressViewController.swift b/Example/ZcashLightClientSample/ZcashLightClientSample/Get Address/GetAddressViewController.swift index 7a65aa14..8e426daf 100644 --- a/Example/ZcashLightClientSample/ZcashLightClientSample/Get Address/GetAddressViewController.swift +++ b/Example/ZcashLightClientSample/ZcashLightClientSample/Get Address/GetAddressViewController.swift @@ -18,42 +18,44 @@ class GetAddressViewController: UIViewController { let synchronizer = SDKSynchronizer.shared - guard let uAddress = synchronizer.getUnifiedAddress(accountIndex: 0) else { - unifiedAddressLabel.text = "could not derive UA" - tAddressLabel.text = "could not derive tAddress" - saplingAddress.text = "could not derive zAddress" - return + Task { @MainActor in + guard let uAddress = await synchronizer.getUnifiedAddress(accountIndex: 0) else { + unifiedAddressLabel.text = "could not derive UA" + tAddressLabel.text = "could not derive tAddress" + saplingAddress.text = "could not derive zAddress" + return + } + + // you can either try to extract receivers from the UA itself or request the Synchronizer to do it for you. Certain UAs might not contain all the receivers you expect. + unifiedAddressLabel.text = uAddress.stringEncoded + + tAddressLabel.text = uAddress.transparentReceiver()?.stringEncoded ?? "could not extract transparent receiver from UA" + saplingAddress.text = uAddress.saplingReceiver()?.stringEncoded ?? "could not extract sapling receiver from UA" + + unifiedAddressLabel.addGestureRecognizer( + UITapGestureRecognizer( + target: self, + action: #selector(addressTapped(_:)) + ) + ) + unifiedAddressLabel.isUserInteractionEnabled = true + + tAddressLabel.isUserInteractionEnabled = true + tAddressLabel.addGestureRecognizer( + UITapGestureRecognizer( + target: self, + action: #selector(tAddressTapped(_:)) + ) + ) + saplingAddress.addGestureRecognizer( + UITapGestureRecognizer( + target: self, + action: #selector(spendingKeyTapped(_:)) + ) + ) + saplingAddress.isUserInteractionEnabled = true + loggerProxy.info("Address: \(String(describing: uAddress))") } - - // you can either try to extract receivers from the UA itself or request the Synchronizer to do it for you. Certain UAs might not contain all the receivers you expect. - unifiedAddressLabel.text = uAddress.stringEncoded - - tAddressLabel.text = uAddress.transparentReceiver()?.stringEncoded ?? "could not extract transparent receiver from UA" - saplingAddress.text = uAddress.saplingReceiver()?.stringEncoded ?? "could not extract sapling receiver from UA" - - unifiedAddressLabel.addGestureRecognizer( - UITapGestureRecognizer( - target: self, - action: #selector(addressTapped(_:)) - ) - ) - unifiedAddressLabel.isUserInteractionEnabled = true - - tAddressLabel.isUserInteractionEnabled = true - tAddressLabel.addGestureRecognizer( - UITapGestureRecognizer( - target: self, - action: #selector(tAddressTapped(_:)) - ) - ) - saplingAddress.addGestureRecognizer( - UITapGestureRecognizer( - target: self, - action: #selector(spendingKeyTapped(_:)) - ) - ) - saplingAddress.isUserInteractionEnabled = true - loggerProxy.info("Address: \(String(describing: uAddress))") } @IBAction func spendingKeyTapped(_ gesture: UIGestureRecognizer) { diff --git a/Example/ZcashLightClientSample/ZcashLightClientSample/Get UTXOs/GetUTXOsViewController.swift b/Example/ZcashLightClientSample/ZcashLightClientSample/Get UTXOs/GetUTXOsViewController.swift index 38bb94fa..2e4bf38c 100644 --- a/Example/ZcashLightClientSample/ZcashLightClientSample/Get UTXOs/GetUTXOsViewController.swift +++ b/Example/ZcashLightClientSample/ZcashLightClientSample/Get UTXOs/GetUTXOsViewController.swift @@ -24,11 +24,12 @@ class GetUTXOsViewController: UIViewController { func updateUI() { let synchronizer = SDKSynchronizer.shared - let tAddress = synchronizer.getTransparentAddress(accountIndex: 0)?.stringEncoded ?? "no t-address found" - - self.transparentAddressLabel.text = tAddress Task { @MainActor in + let tAddress = await synchronizer.getTransparentAddress(accountIndex: 0)?.stringEncoded ?? "no t-address found" + + self.transparentAddressLabel.text = tAddress + // swiftlint:disable:next force_try let balance = try! await AppDelegate.shared.sharedSynchronizer.getTransparentBalance(accountIndex: 0) diff --git a/Example/ZcashLightClientSample/ZcashLightClientSample/Send/SendViewController.swift b/Example/ZcashLightClientSample/ZcashLightClientSample/Send/SendViewController.swift index 9768db81..bc8d53d1 100644 --- a/Example/ZcashLightClientSample/ZcashLightClientSample/Send/SendViewController.swift +++ b/Example/ZcashLightClientSample/ZcashLightClientSample/Send/SendViewController.swift @@ -38,7 +38,7 @@ class SendViewController: UIViewController { setUp() Task { @MainActor in // swiftlint:disable:next force_try - try! await synchronizer.prepare() + try! await synchronizer.prepare(with: DemoAppConfig.seed) } }