shield funds demo
This commit is contained in:
parent
45fa30838f
commit
d1a099b26f
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17700" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ewq-Xy-xHb">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ewq-Xy-xHb">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
|
@ -1414,7 +1414,7 @@
|
|||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="ZXk-2m-Kua">
|
||||
<rect key="frame" x="65.5" y="225.5" width="283" height="100"/>
|
||||
<rect key="frame" x="65.5" y="225.5" width="283" height="150"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1h3-3y-iS9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="283" height="50"/>
|
||||
|
@ -1438,16 +1438,27 @@
|
|||
<action selector="getFromCacheTapped:" destination="Ugl-B2-O3O" eventType="touchUpInside" id="3Pl-RP-4qg"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rFx-Kk-dDU" userLabel="Shield these funds!">
|
||||
<rect key="frame" x="0.0" y="100" width="283" height="50"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="50" id="tRE-yf-7sR"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="29"/>
|
||||
<state key="normal" title="Shield these funds!"/>
|
||||
<connections>
|
||||
<action selector="shieldFunds:" destination="Ugl-B2-O3O" eventType="touchUpInside" id="XTV-L4-ZQ0"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
</stackView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Mv9-ye-VIn">
|
||||
<rect key="frame" x="16" y="365.5" width="382" height="0.0"/>
|
||||
<rect key="frame" x="16" y="415.5" width="382" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pcE-rS-DWU">
|
||||
<rect key="frame" x="0.0" y="405.5" width="414" height="368.5"/>
|
||||
<rect key="frame" x="0.0" y="455.5" width="414" height="318.5"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</view>
|
||||
</subviews>
|
||||
|
|
|
@ -13,6 +13,7 @@ class GetUTXOsViewController: UIViewController {
|
|||
@IBOutlet weak var tAddressField: UITextField!
|
||||
@IBOutlet weak var getButton: UIButton!
|
||||
@IBOutlet weak var getFromCache: UIButton!
|
||||
@IBOutlet weak var shieldFundsButton: UIButton!
|
||||
@IBOutlet weak var validAddressLabel: UILabel!
|
||||
@IBOutlet weak var messageLabel: UILabel!
|
||||
|
||||
|
@ -73,6 +74,29 @@ class GetUTXOsViewController: UIViewController {
|
|||
@IBAction func viewTapped(_ recognizer: UITapGestureRecognizer) {
|
||||
self.tAddressField.resignFirstResponder()
|
||||
}
|
||||
|
||||
@IBAction func shieldFunds(_ sender: Any) {
|
||||
do {
|
||||
let seed = DemoAppConfig.seed
|
||||
let sk = try DerivationTool.default.deriveSpendingKeys(seed: seed, numberOfAccounts: 1).first!
|
||||
|
||||
let tsk = try DerivationTool.default.deriveTransparentPrivateKey(seed: seed)
|
||||
KRProgressHUD.showMessage("🛡 Shielding 🛡")
|
||||
AppDelegate.shared.sharedSynchronizer.shieldFunds(spendingKey: sk, transparentSecretKey: tsk, memo: "shielding is fun!", from: 0) { (result) in
|
||||
DispatchQueue.main.async {
|
||||
KRProgressHUD.dismiss()
|
||||
switch result{
|
||||
case .success(let tx):
|
||||
self.messageLabel.text = "funds shielded \(tx)"
|
||||
case .failure(let error):
|
||||
self.messageLabel.text = "Shielding failed: \(error)"
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
self.messageLabel.text = "Error \(error)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension GetUTXOsViewController: UITextFieldDelegate {
|
||||
|
|
Loading…
Reference in New Issue