Some cleanup.

This commit is contained in:
Satraj Bambra 2018-03-27 21:32:39 -04:00
parent 070fc7ef78
commit 3df5e57f99
6 changed files with 50 additions and 3 deletions

View File

@ -50,6 +50,7 @@
EC367C24205ABF52008FF479 /* PinView.xib in Resources */ = {isa = PBXBuildFile; fileRef = EC367C1A205ABF52008FF479 /* PinView.xib */; };
EC367C28205ABFD4008FF479 /* UIColor+Gradient.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC367C26205ABFD4008FF479 /* UIColor+Gradient.swift */; };
EC367C29205ABFD4008FF479 /* UIView+Shake.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC367C27205ABFD4008FF479 /* UIView+Shake.swift */; };
EC38ED172067445D00ECF138 /* ElectrumRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC38ED162067445D00ECF138 /* ElectrumRequest.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -125,6 +126,7 @@
EC367C1A205ABF52008FF479 /* PinView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PinView.xib; sourceTree = "<group>"; };
EC367C26205ABFD4008FF479 /* UIColor+Gradient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Gradient.swift"; sourceTree = "<group>"; };
EC367C27205ABFD4008FF479 /* UIView+Shake.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIView+Shake.swift"; sourceTree = "<group>"; };
EC38ED162067445D00ECF138 /* ElectrumRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ElectrumRequest.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -274,6 +276,7 @@
EC367C07205ABF48008FF479 /* Constants.swift */,
EC367C09205ABF48008FF479 /* AppNavigationController.swift */,
EC367C0A205ABF48008FF479 /* NibLoader.swift */,
EC38ED162067445D00ECF138 /* ElectrumRequest.swift */,
);
path = Utils;
sourceTree = "<group>";
@ -567,10 +570,14 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Bitcoin Private/Pods-Bitcoin Private-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/JSONRPCKit/JSONRPCKit.framework",
"${BUILT_PRODUCTS_DIR}/Result/Result.framework",
"${BUILT_PRODUCTS_DIR}/Socket.swift/SocketSwift.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JSONRPCKit.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Result.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketSwift.framework",
);
runOnlyForDeploymentPostprocessing = 0;
@ -627,6 +634,7 @@
EC367C1E205ABF52008FF479 /* TransactionHistoryCell.swift in Sources */,
EC367C29205ABFD4008FF479 /* UIView+Shake.swift in Sources */,
EC367C20205ABF52008FF479 /* WalletCell.swift in Sources */,
EC38ED172067445D00ECF138 /* ElectrumRequest.swift in Sources */,
EC367C23205ABF52008FF479 /* PinView.swift in Sources */,
EC367BF7205ABD7F008FF479 /* VerificationViewController.swift in Sources */,
EC367BFC205ABD7F008FF479 /* ReceiveViewController.swift in Sources */,

View File

@ -7,7 +7,7 @@
<key>Bitcoin Private.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
<integer>6</integer>
</dict>
</dict>
</dict>

View File

@ -0,0 +1,31 @@
//
// ElectrumRequest.swift
// Bitcoin Private
//
// Created by Satraj Bambra on 2018-03-24.
// Copyright © 2018 Satraj Bambra. All rights reserved.
//
import JSONRPCKit
struct ElectrumRequest: JSONRPCKit.Request {
typealias Response = String
let type: String
let params: String
var method: String {
return type
}
var parameters: Any? {
return [params]
}
func response(from resultObject: Any) throws -> Response {
if let response = resultObject as? Response {
return response
}
return ""
}
}

View File

@ -6,6 +6,7 @@
// Copyright © 2018 Satraj Bambra. All rights reserved.
//
import JSONRPCKit
import SocketSwift
import UIKit
@ -101,7 +102,7 @@ class LaunchViewController: UIViewController {
let addr = try! socket.addresses(for: "electrum.btcprivate.org", port: 5222).first!
try! socket.connect(address: addr)
try! socket.startTls(TLS.Configuration(peer: "electrum.btcprivate.org"))
// Get Balance
let balance = write(message: String.init(format: "{\"method\": \"blockchain.address.get_balance\", \"params\": [\"\(address)\"], \"id\": 1}\n"), socket: socket)

View File

@ -7,6 +7,7 @@ target 'Bitcoin Private' do
# Pods for Bitcoin Private
pod 'Socket.swift'
pod 'JSONRPCKit'
target 'Bitcoin PrivateTests' do
inherit! :search_paths

View File

@ -1,12 +1,18 @@
PODS:
- JSONRPCKit (3.0.0):
- Result (~> 3.2.0)
- Result (3.2.4)
- Socket.swift (2.2.0)
DEPENDENCIES:
- JSONRPCKit
- Socket.swift
SPEC CHECKSUMS:
JSONRPCKit: 50e0dc5e7f873e87f81562feb8836b7d1974da6d
Result: d2d07204ce72856f1fd9130bbe42c35a7b0fea10
Socket.swift: 5fb2c79f327a061b68d33a946256b9fd7a1e1a41
PODFILE CHECKSUM: 2c3e3dc3c0243d4369cf08082395bfa86f4adf36
PODFILE CHECKSUM: 36e89b4d40395f29ee85fb5b9ccb3eda74146a40
COCOAPODS: 1.3.1