GetBlockHeight demo app (#9)
This commit is contained in:
parent
670ec12494
commit
b1887cc1b6
|
@ -0,0 +1,59 @@
|
|||
PODS:
|
||||
- BoringSSL-GRPC (0.0.3):
|
||||
- BoringSSL-GRPC/Implementation (= 0.0.3)
|
||||
- BoringSSL-GRPC/Interface (= 0.0.3)
|
||||
- BoringSSL-GRPC/Implementation (0.0.3):
|
||||
- BoringSSL-GRPC/Interface (= 0.0.3)
|
||||
- BoringSSL-GRPC/Interface (0.0.3)
|
||||
- gRPC-Core (1.23.1):
|
||||
- gRPC-Core/Implementation (= 1.23.1)
|
||||
- gRPC-Core/Interface (= 1.23.1)
|
||||
- gRPC-Core/Implementation (1.23.1):
|
||||
- BoringSSL-GRPC (= 0.0.3)
|
||||
- gRPC-Core/Interface (= 1.23.1)
|
||||
- nanopb (~> 0.3)
|
||||
- gRPC-Core/Interface (1.23.1)
|
||||
- nanopb (0.3.9011):
|
||||
- nanopb/decode (= 0.3.9011)
|
||||
- nanopb/encode (= 0.3.9011)
|
||||
- nanopb/decode (0.3.9011)
|
||||
- nanopb/encode (0.3.9011)
|
||||
- SQLite.swift (0.12.2):
|
||||
- SQLite.swift/standard (= 0.12.2)
|
||||
- SQLite.swift/standard (0.12.2)
|
||||
- SwiftGRPC (0.10.0):
|
||||
- gRPC-Core (~> 1.23.0)
|
||||
- SwiftProtobuf (~> 1.7.0)
|
||||
- SwiftProtobuf (1.7.0)
|
||||
- ZcashLightClientKit (0.0.1):
|
||||
- SQLite.swift
|
||||
- SwiftGRPC
|
||||
|
||||
DEPENDENCIES:
|
||||
- ZcashLightClientKit (from `../../`)
|
||||
|
||||
SPEC REPOS:
|
||||
trunk:
|
||||
- BoringSSL-GRPC
|
||||
- gRPC-Core
|
||||
- nanopb
|
||||
- SQLite.swift
|
||||
- SwiftGRPC
|
||||
- SwiftProtobuf
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
ZcashLightClientKit:
|
||||
:path: "../../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
BoringSSL-GRPC: db8764df3204ccea016e1c8dd15d9a9ad63ff318
|
||||
gRPC-Core: 4b1148eb8596225178e5a154e40e35141a3cdf0f
|
||||
nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
|
||||
SQLite.swift: d2b4642190917051ce6bd1d49aab565fe794eea3
|
||||
SwiftGRPC: f8fcfecb547c96cc6913de619f95fa3cd09838ee
|
||||
SwiftProtobuf: 4fd9645e69b72cbae6ec8da5be0cdd20ca6565dd
|
||||
ZcashLightClientKit: 2adc70f65050b7940b527ce507f903c5ab7f1194
|
||||
|
||||
PODFILE CHECKSUM: 7c9d39272319433442b14024a916deb276e81da4
|
||||
|
||||
COCOAPODS: 1.8.4
|
|
@ -3,7 +3,7 @@
|
|||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
|
@ -14,6 +14,8 @@
|
|||
0D907F202322CC5B00D641FE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0D907F1E2322CC5B00D641FE /* LaunchScreen.storyboard */; };
|
||||
0D907F2B2322CC5B00D641FE /* ZcashLightClientSampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D907F2A2322CC5B00D641FE /* ZcashLightClientSampleTests.swift */; };
|
||||
0D907F362322CC5B00D641FE /* ZcashLightClientSampleUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0D907F352322CC5B00D641FE /* ZcashLightClientSampleUITests.swift */; };
|
||||
0DDFB33C236B743000AED892 /* LatestHeightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFB33B236B743000AED892 /* LatestHeightViewController.swift */; };
|
||||
0DDFB33E236B844900AED892 /* DemoAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DDFB33D236B844900AED892 /* DemoAppConfig.swift */; };
|
||||
30AB89006A2D6891F32BFBF0 /* Pods_ZcashLightClientSample.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 17A69D88CA6DB45FA9D21E75 /* Pods_ZcashLightClientSample.framework */; };
|
||||
868A42CEE1EBA7F9B0E48927 /* Pods_ZcashLightClientSampleUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E9E0B112B9AFA48C27C4BC7 /* Pods_ZcashLightClientSampleUITests.framework */; };
|
||||
F54D714D7D2CBD7882AB31D4 /* Pods_ZcashLightClientSampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EC7ACB694E10039AC19A90BE /* Pods_ZcashLightClientSampleTests.framework */; };
|
||||
|
@ -50,6 +52,8 @@
|
|||
0D907F312322CC5B00D641FE /* ZcashLightClientSampleUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZcashLightClientSampleUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0D907F352322CC5B00D641FE /* ZcashLightClientSampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ZcashLightClientSampleUITests.swift; sourceTree = "<group>"; };
|
||||
0D907F372322CC5B00D641FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
0DDFB33B236B743000AED892 /* LatestHeightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LatestHeightViewController.swift; sourceTree = "<group>"; };
|
||||
0DDFB33D236B844900AED892 /* DemoAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoAppConfig.swift; sourceTree = "<group>"; };
|
||||
17A69D88CA6DB45FA9D21E75 /* Pods_ZcashLightClientSample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ZcashLightClientSample.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
1BEB1273671D6E7883C81472 /* Pods-ZcashLightClientSample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ZcashLightClientSample.release.xcconfig"; path = "Target Support Files/Pods-ZcashLightClientSample/Pods-ZcashLightClientSample.release.xcconfig"; sourceTree = "<group>"; };
|
||||
3E9E0B112B9AFA48C27C4BC7 /* Pods_ZcashLightClientSampleUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ZcashLightClientSampleUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
@ -114,12 +118,14 @@
|
|||
0D907F142322CC5900D641FE /* ZcashLightClientSample */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0DDFB33A236B733700AED892 /* Latest Block Height */,
|
||||
0D907F152322CC5900D641FE /* AppDelegate.swift */,
|
||||
0D907F172322CC5900D641FE /* ViewController.swift */,
|
||||
0D907F192322CC5900D641FE /* Main.storyboard */,
|
||||
0D907F1C2322CC5B00D641FE /* Assets.xcassets */,
|
||||
0D907F1E2322CC5B00D641FE /* LaunchScreen.storyboard */,
|
||||
0D907F212322CC5B00D641FE /* Info.plist */,
|
||||
0DDFB33D236B844900AED892 /* DemoAppConfig.swift */,
|
||||
);
|
||||
path = ZcashLightClientSample;
|
||||
sourceTree = "<group>";
|
||||
|
@ -142,6 +148,14 @@
|
|||
path = ZcashLightClientSampleUITests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0DDFB33A236B733700AED892 /* Latest Block Height */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0DDFB33B236B743000AED892 /* LatestHeightViewController.swift */,
|
||||
);
|
||||
path = "Latest Block Height";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
66EF5A44FD6A5AC92244F054 /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -152,7 +166,6 @@
|
|||
59BA5F37462FF34F64350712 /* Pods-ZcashLightClientSampleUITests.debug.xcconfig */,
|
||||
89F6F4B8F441C9EC43B7412A /* Pods-ZcashLightClientSampleUITests.release.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -388,6 +401,8 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0D907F182322CC5900D641FE /* ViewController.swift in Sources */,
|
||||
0DDFB33C236B743000AED892 /* LatestHeightViewController.swift in Sources */,
|
||||
0DDFB33E236B844900AED892 /* DemoAppConfig.swift in Sources */,
|
||||
0D907F162322CC5900D641FE /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
|
|
@ -27,6 +27,15 @@
|
|||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0D907F112322CC5900D641FE"
|
||||
BuildableName = "ZcashLightClientSample.app"
|
||||
BlueprintName = "ZcashLightClientSample"
|
||||
ReferencedContainer = "container:ZcashLightClientSample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
@ -49,17 +58,6 @@
|
|||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "0D907F112322CC5900D641FE"
|
||||
BuildableName = "ZcashLightClientSample.app"
|
||||
BlueprintName = "ZcashLightClientSample"
|
||||
ReferencedContainer = "container:ZcashLightClientSample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
|
@ -81,8 +79,13 @@
|
|||
ReferencedContainer = "container:ZcashLightClientSample.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "OS_ACTIVITY_MODE"
|
||||
value = "disable"
|
||||
isEnabled = "YES">
|
||||
</EnvironmentVariable>
|
||||
</EnvironmentVariables>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
|
|
@ -1,24 +1,116 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" 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>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<!--Zcash Light Client Demo-->
|
||||
<scene sceneID="uN9-tq-g5F">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<tableViewController storyboardIdentifier="MainTableViewController" id="SI9-Nk-8cq" customClass="MainTableViewController" customModule="ZcashLightClientSample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="EVy-1I-VtG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<sections>
|
||||
<tableViewSection id="HAA-1f-le3">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="AMo-WC-MIN" style="IBUITableViewCellStyleDefault" id="rCB-Ax-4Nk">
|
||||
<rect key="frame" x="0.0" y="28" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="rCB-Ax-4Nk" id="ac2-bZ-mAy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Latest Block Height" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="AMo-WC-MIN">
|
||||
<rect key="frame" x="20" y="0.0" width="374" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<segue destination="tq2-zN-roj" kind="showDetail" id="9PR-VZ-Av4"/>
|
||||
</connections>
|
||||
</tableViewCell>
|
||||
</cells>
|
||||
</tableViewSection>
|
||||
</sections>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="SI9-Nk-8cq" id="xCt-5D-VOK"/>
|
||||
<outlet property="delegate" destination="SI9-Nk-8cq" id="den-Kz-QKF"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
<navigationItem key="navigationItem" title="Zcash Light Client Demo" id="rvd-yg-s1L"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="u9B-ne-NE7" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="828" y="40"/>
|
||||
</scene>
|
||||
<!--Latest Height View Controller-->
|
||||
<scene sceneID="4pw-mR-qER">
|
||||
<objects>
|
||||
<viewController id="tq2-zN-roj" customClass="LatestHeightViewController" customModule="ZcashLightClientSample" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="tie-BL-1Ip">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Hj-Jx-J3i">
|
||||
<rect key="frame" x="0.0" y="421" width="414" height="0.0"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="23"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Latest Block Height" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WKf-j9-SjN">
|
||||
<rect key="frame" x="20" y="258" width="374" height="49"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="49" id="AXS-cf-OMk"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="26"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="0Hj-Jx-J3i" firstAttribute="centerY" secondItem="tie-BL-1Ip" secondAttribute="centerY" id="6HS-U8-JHx"/>
|
||||
<constraint firstItem="WKf-j9-SjN" firstAttribute="centerX" secondItem="0Hj-Jx-J3i" secondAttribute="centerX" id="UOE-Jf-r6N"/>
|
||||
<constraint firstItem="WKf-j9-SjN" firstAttribute="leading" secondItem="tie-BL-1Ip" secondAttribute="leadingMargin" id="V4z-zJ-vIT"/>
|
||||
<constraint firstItem="WKf-j9-SjN" firstAttribute="top" secondItem="fg7-R9-l4X" secondAttribute="top" constant="258" id="VBh-xj-OhB"/>
|
||||
<constraint firstItem="0Hj-Jx-J3i" firstAttribute="leading" secondItem="fg7-R9-l4X" secondAttribute="leading" id="kAe-yR-Nr8"/>
|
||||
<constraint firstItem="0Hj-Jx-J3i" firstAttribute="centerX" secondItem="tie-BL-1Ip" secondAttribute="centerX" id="ruf-Mw-pLN"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="fg7-R9-l4X"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="blockHeightLabel" destination="0Hj-Jx-J3i" id="P2U-am-RMw"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="mVQ-br-4uP" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1528.985507246377" y="3.3482142857142856"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="0ru-sC-FRK">
|
||||
<objects>
|
||||
<navigationController id="Ewq-Xy-xHb" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="AlK-mv-yla">
|
||||
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="SI9-Nk-8cq" kind="relationship" relationship="rootViewController" id="ru0-HO-yTe"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="tfJ-Ir-11I" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-92" y="40"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
//
|
||||
// DemoAppConfig.swift
|
||||
// ZcashLightClientSample
|
||||
//
|
||||
// Created by Francisco Gindre on 10/31/19.
|
||||
// Copyright © 2019 Electric Coin Company. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import ZcashLightClientKit
|
||||
|
||||
struct DemoAppConfig {
|
||||
static var host = "34.68.177.238"
|
||||
static var port = "9067"
|
||||
static var birthdayHeight: BlockHeight = 620_000
|
||||
static var network = ZcashNetwork.testNet
|
||||
static var seed = Array("testreferencealice".utf8)
|
||||
static var address: String {
|
||||
"\(host):\(port)"
|
||||
}
|
||||
}
|
||||
|
||||
enum ZcashNetwork {
|
||||
case mainNet
|
||||
case testNet
|
||||
}
|
|
@ -41,5 +41,10 @@
|
|||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
//
|
||||
// LatestHeightViewController.swift
|
||||
// ZcashLightClientSample
|
||||
//
|
||||
// Created by Francisco Gindre on 10/31/19.
|
||||
// Copyright © 2019 Electric Coin Company. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ZcashLightClientKit
|
||||
|
||||
class LatestHeightViewController: UIViewController {
|
||||
|
||||
@IBOutlet weak var blockHeightLabel: UILabel!
|
||||
|
||||
var service: LightWalletService = LightWalletGRPCService(host: DemoAppConfig.address, secure: false)
|
||||
var model: BlockHeight? {
|
||||
didSet {
|
||||
if viewIfLoaded != nil {
|
||||
setup()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
setup()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
service.latestBlockHeight { (result) in
|
||||
switch result {
|
||||
case .success(let height):
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.model = height
|
||||
}
|
||||
case .failure(let error):
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.fail(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setup() {
|
||||
guard let model = self.model else {
|
||||
return
|
||||
}
|
||||
blockHeightLabel.text = String(model)
|
||||
}
|
||||
|
||||
func fail(_ error: LightWalletServiceError) {
|
||||
self.blockHeightLabel.text = "Error"
|
||||
|
||||
let alert = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "Ok", style: .cancel, handler: nil))
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import UIKit
|
||||
|
||||
class ViewController: UIViewController {
|
||||
class MainTableViewController: UITableViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
|
|
@ -9,18 +9,23 @@
|
|||
import Foundation
|
||||
import SwiftGRPC
|
||||
|
||||
class LightWalletGRPCService {
|
||||
public class LightWalletGRPCService {
|
||||
|
||||
var queue = DispatchQueue.init(label: "LightWalletGRPCService")
|
||||
let channel: Channel
|
||||
|
||||
let compactTxStreamer: CompactTxStreamerServiceClient
|
||||
|
||||
init(channel: Channel) {
|
||||
public init(channel: Channel) {
|
||||
self.channel = channel
|
||||
compactTxStreamer = CompactTxStreamerServiceClient(channel: self.channel)
|
||||
}
|
||||
|
||||
public convenience init(host: String, secure: Bool = true) {
|
||||
let channel = Channel(address: host, secure: secure, arguments: [])
|
||||
self.init(channel: channel)
|
||||
}
|
||||
|
||||
func blockRange(startHeight: BlockHeight, endHeight: BlockHeight? = nil, result: @escaping (CallResult) -> Void) throws -> CompactTxStreamerGetBlockRangeCall {
|
||||
try compactTxStreamer.getBlockRange(BlockRange(startHeight: startHeight, endHeight: endHeight)) { result($0) }
|
||||
}
|
||||
|
@ -43,7 +48,7 @@ class LightWalletGRPCService {
|
|||
|
||||
extension LightWalletGRPCService: LightWalletService {
|
||||
|
||||
func blockRange(_ range: CompactBlockRange) throws -> [ZcashCompactBlock] {
|
||||
public func blockRange(_ range: CompactBlockRange) throws -> [ZcashCompactBlock] {
|
||||
var blocks = [ZcashCompactBlock]()
|
||||
|
||||
let call = try compactTxStreamer.getBlockRange(range.blockRange(), completion: { statusCode in
|
||||
|
@ -62,7 +67,7 @@ extension LightWalletGRPCService: LightWalletService {
|
|||
return blocks
|
||||
}
|
||||
|
||||
func latestBlockHeight(result: @escaping (Result<BlockHeight, LightWalletServiceError>) -> Void) {
|
||||
public func latestBlockHeight(result: @escaping (Result<BlockHeight, LightWalletServiceError>) -> Void) {
|
||||
do {
|
||||
try compactTxStreamer.getLatestBlock(ChainSpec()) { (blockID, _) in
|
||||
guard let rawHeight = blockID?.height, let blockHeight = Int(exactly: rawHeight) else {
|
||||
|
@ -79,7 +84,7 @@ extension LightWalletGRPCService: LightWalletService {
|
|||
}
|
||||
|
||||
// TODO: Make cancellable
|
||||
func blockRange(_ range: CompactBlockRange, result: @escaping (Result<[ZcashCompactBlock], LightWalletServiceError>) -> Void) {
|
||||
public func blockRange(_ range: CompactBlockRange, result: @escaping (Result<[ZcashCompactBlock], LightWalletServiceError>) -> Void) {
|
||||
|
||||
queue.async {
|
||||
var blocks = [CompactBlock]()
|
||||
|
@ -124,7 +129,7 @@ extension LightWalletGRPCService: LightWalletService {
|
|||
|
||||
}
|
||||
|
||||
func latestBlockHeight() throws -> BlockHeight {
|
||||
public func latestBlockHeight() throws -> BlockHeight {
|
||||
|
||||
guard let height = try? latestBlock().compactBlockHeight() else {
|
||||
throw LightWalletServiceError.invalidBlock
|
||||
|
|
|
@ -19,7 +19,7 @@ public enum WalletError: Error {
|
|||
|
||||
public class Wallet {
|
||||
|
||||
private var rustBackend: ZcashRustBackendWelding.Type
|
||||
private var rustBackend: ZcashRustBackendWelding.Type = ZcashRustBackend.self
|
||||
private var dataDbURL: URL
|
||||
private var cacheDbURL: URL
|
||||
private var paramDestination: URL
|
||||
|
@ -28,9 +28,8 @@ public class Wallet {
|
|||
private var walletBirthday: WalletBirthday
|
||||
private var compactBlockStorage: CompactBlockStoring?
|
||||
|
||||
init(rustWelding: ZcashRustBackendWelding.Type, cacheDbURL: URL, dataDbURL: URL, paramDestination: URL, seedProvider: SeedProvider, walletBirthday: WalletBirthday, accountIDs: [Int] = [0]) {
|
||||
init(cacheDbURL: URL, dataDbURL: URL, paramDestination: URL, seedProvider: SeedProvider, walletBirthday: WalletBirthday, accountIDs: [Int] = [0]) {
|
||||
|
||||
self.rustBackend = rustWelding.self
|
||||
self.dataDbURL = dataDbURL
|
||||
self.paramDestination = paramDestination
|
||||
self.accountIDs = accountIDs
|
||||
|
|
Loading…
Reference in New Issue