Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#207 resolve core update issue missing labels #211

Merged
merged 9 commits into from
Nov 4, 2023
70 changes: 52 additions & 18 deletions loafwallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,15 @@
C3D783A72565EA4B0004FF70 /* UnstoppableDomainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783A62565EA4A0004FF70 /* UnstoppableDomainView.swift */; };
C3D783B72565EA6B0004FF70 /* UnstoppableDomainViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783B62565EA6B0004FF70 /* UnstoppableDomainViewModel.swift */; };
C3D783C02565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D783BF2565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift */; };
C3E751C22AF689BA005571CA /* BRKeyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C12AF689BA005571CA /* BRKeyExtension.swift */; };
C3E751C42AF68A50005571CA /* BRAddressExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C32AF68A50005571CA /* BRAddressExtension.swift */; };
C3E751C62AF68A8E005571CA /* BRTxInputExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C52AF68A8E005571CA /* BRTxInputExtension.swift */; };
C3E751C82AF68AEB005571CA /* UnsafeMutablePointerExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C72AF68AEB005571CA /* UnsafeMutablePointerExtension.swift */; };
C3E751CB2AF68B47005571CA /* BRPeerManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751CA2AF68B47005571CA /* BRPeerManager.swift */; };
C3E751CD2AF68B93005571CA /* BRWallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751CC2AF68B93005571CA /* BRWallet.swift */; };
C3E751CF2AF68C18005571CA /* BRCalculationExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751CE2AF68C18005571CA /* BRCalculationExtension.swift */; };
C3E751D12AF68C84005571CA /* BRMasterKeyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751D02AF68C84005571CA /* BRMasterKeyExtension.swift */; };
C3E751D32AF68CD1005571CA /* BRTxOutputExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751D22AF68CD1005571CA /* BRTxOutputExtension.swift */; };
C3EFA9A12650807B005C59B5 /* LockScreenHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3EFA9A02650807B005C59B5 /* LockScreenHeaderView.swift */; };
C3EFA9A3265080FF005C59B5 /* LockScreenHeaderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3EFA9A2265080FF005C59B5 /* LockScreenHeaderViewModel.swift */; };
C3EFA9A62651A808005C59B5 /* LockScreenTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3EFA9A52651A808005C59B5 /* LockScreenTests.swift */; };
Expand Down Expand Up @@ -1453,6 +1462,15 @@
C3D783A62565EA4A0004FF70 /* UnstoppableDomainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainView.swift; sourceTree = "<group>"; };
C3D783B62565EA6B0004FF70 /* UnstoppableDomainViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainViewModel.swift; sourceTree = "<group>"; };
C3D783BF2565ECF60004FF70 /* UnstoppableDomainViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnstoppableDomainViewModelTests.swift; sourceTree = "<group>"; };
C3E751C12AF689BA005571CA /* BRKeyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRKeyExtension.swift; sourceTree = "<group>"; };
C3E751C32AF68A50005571CA /* BRAddressExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRAddressExtension.swift; sourceTree = "<group>"; };
C3E751C52AF68A8E005571CA /* BRTxInputExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRTxInputExtension.swift; sourceTree = "<group>"; };
C3E751C72AF68AEB005571CA /* UnsafeMutablePointerExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsafeMutablePointerExtension.swift; sourceTree = "<group>"; };
C3E751CA2AF68B47005571CA /* BRPeerManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRPeerManager.swift; sourceTree = "<group>"; };
C3E751CC2AF68B93005571CA /* BRWallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRWallet.swift; sourceTree = "<group>"; };
C3E751CE2AF68C18005571CA /* BRCalculationExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRCalculationExtension.swift; sourceTree = "<group>"; };
C3E751D02AF68C84005571CA /* BRMasterKeyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRMasterKeyExtension.swift; sourceTree = "<group>"; };
C3E751D22AF68CD1005571CA /* BRTxOutputExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRTxOutputExtension.swift; sourceTree = "<group>"; };
C3EFA9A02650807B005C59B5 /* LockScreenHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockScreenHeaderView.swift; sourceTree = "<group>"; };
C3EFA9A2265080FF005C59B5 /* LockScreenHeaderViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockScreenHeaderViewModel.swift; sourceTree = "<group>"; };
C3EFA9A52651A808005C59B5 /* LockScreenTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LockScreenTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2932,6 +2950,8 @@
75A2A7931DA5934300A983D8 /* AppDelegate.swift */,
CE20C8F11DBAF71500C8397A /* ApplicationController.swift */,
754AE0BB1DFE8A46007FD001 /* BRCore.swift */,
C3E751C92AF68B2F005571CA /* BRCoreClasses */,
C3E751C02AF689A0005571CA /* BRExtensions */,
75519F331DC7D20500EDF66C /* WalletManager.swift */,
7503773C1DF57428005EB8AE /* WalletManager+Auth.swift */,
CE4B6C191E219CA600CF935B /* WalletCoordinator.swift */,
Expand Down Expand Up @@ -3111,6 +3131,29 @@
name = Unstoppable;
sourceTree = "<group>";
};
C3E751C02AF689A0005571CA /* BRExtensions */ = {
isa = PBXGroup;
children = (
C3E751C12AF689BA005571CA /* BRKeyExtension.swift */,
C3E751C32AF68A50005571CA /* BRAddressExtension.swift */,
C3E751C52AF68A8E005571CA /* BRTxInputExtension.swift */,
C3E751C72AF68AEB005571CA /* UnsafeMutablePointerExtension.swift */,
C3E751CE2AF68C18005571CA /* BRCalculationExtension.swift */,
C3E751D02AF68C84005571CA /* BRMasterKeyExtension.swift */,
C3E751D22AF68CD1005571CA /* BRTxOutputExtension.swift */,
);
name = BRExtensions;
sourceTree = "<group>";
};
C3E751C92AF68B2F005571CA /* BRCoreClasses */ = {
isa = PBXGroup;
children = (
C3E751CA2AF68B47005571CA /* BRPeerManager.swift */,
C3E751CC2AF68B93005571CA /* BRWallet.swift */,
);
name = BRCoreClasses;
sourceTree = "<group>";
};
C3EFA9A42651A7C4005C59B5 /* Lock Screen Tests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3886,24 +3929,6 @@
shellPath = /bin/sh;
shellScript = "cd BuildTools\nSDKROOT=(xcrun --sdk macosx --show-sdk-path)\n#swift package update #Uncomment this line temporarily to update the version used to the latest matching your BuildTools/Package.swift file\nswift run -c release swiftformat \"$SRCROOT\"\n";
};
583FE8702927ED5A009A6384 /* Run SwiftFormat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run SwiftFormat";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "cd BuildTools\nSDKROOT=(xcrun --sdk macosx --show-sdk-path)\n#swift package update #Uncomment this line temporarily to update the version used to the latest matching your BuildTools/Package.swift file\nswift run -c release swiftformat \"$SRCROOT\"\n";
};
58A9FE4829191E4700B75825 /* Check for unused code */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down Expand Up @@ -4126,6 +4151,7 @@
C3D783B72565EA6B0004FF70 /* UnstoppableDomainViewModel.swift in Sources */,
CEC6AA3B1DEE4EB000EE5AFD /* CGRect+Additions.swift in Sources */,
CE45C1FB1E74F89C002C3847 /* WalletInfo.swift in Sources */,
C3E751D12AF68C84005571CA /* BRMasterKeyExtension.swift in Sources */,
C3FF4D5F28AC5A5800713139 /* SendAddressCellView.swift in Sources */,
C36375A328BD38A500CFB3D8 /* SendButtonHostingController.swift in Sources */,
CEE659E71F65A936001FF29D /* RetryTimer.swift in Sources */,
Expand All @@ -4148,6 +4174,7 @@
CEE1F5631DF13E5A00D733AD /* ModalHeaderView.swift in Sources */,
CE5F21DB1E4A93A500C47B8E /* LoginTransitionDelegate.swift in Sources */,
584E24FA2951D43A005E0E8B /* LanguageSelectionViewModel.swift in Sources */,
C3E751CB2AF68B47005571CA /* BRPeerManager.swift in Sources */,
CEE659E91F664C73001FF29D /* WelcomeViewController.swift in Sources */,
24313C8723821B8C00A83F69 /* PromptTableViewCell.swift in Sources */,
2228734F1E916FC30044BA15 /* BRAPIClient+Wallet.swift in Sources */,
Expand Down Expand Up @@ -4282,6 +4309,8 @@
CE6D0F991DE8B75900BD4BCF /* DismissModalAnimator.swift in Sources */,
C39443F9269DDAD3002703E9 /* LitewalletIconView.swift in Sources */,
CE4C1CC61ED65D830063E184 /* DrawableCircle.swift in Sources */,
C3E751CD2AF68B93005571CA /* BRWallet.swift in Sources */,
C3E751D32AF68CD1005571CA /* BRTxOutputExtension.swift in Sources */,
CE8CD8E31E31978100785E02 /* LoginBackgroundTriangle.swift in Sources */,
C35ABD332574073F002BB9BB /* PartnersViewModel.swift in Sources */,
CEEC708C1E95461A00EF788E /* AboutViewController.swift in Sources */,
Expand All @@ -4305,6 +4334,7 @@
CEF61B121ECF52C700C7EA6A /* AmountViewController.swift in Sources */,
CECCE5B21E04B00D00D99448 /* SendCell.swift in Sources */,
24B8FAD22162B10200A155B1 /* BuyCenterWebViewController.swift in Sources */,
C3E751C62AF68A8E005571CA /* BRTxInputExtension.swift in Sources */,
CE6DCC301E6666470044257B /* NonScrollingCollectionView.swift in Sources */,
CE20C9011DBBFFF800C8397A /* Actions.swift in Sources */,
CE20C9191DBE7B8200C8397A /* ReduxState.swift in Sources */,
Expand All @@ -4318,6 +4348,7 @@
C3D783A72565EA4B0004FF70 /* UnstoppableDomainView.swift in Sources */,
CE3D4C571EF5D5740016B1C8 /* ReachabilityMonitor.swift in Sources */,
C32142FA25C988C800BECCD0 /* TransactionCellViewModel.swift in Sources */,
C3E751C22AF689BA005571CA /* BRKeyExtension.swift in Sources */,
CE4DFB2E1E9C26DA0014009E /* ShareDataViewController.swift in Sources */,
CE1E5F261EF083A600BD0F72 /* StartImportViewController.swift in Sources */,
CE25BF931DFDA7A600BC67B6 /* MessageUIPresenter.swift in Sources */,
Expand All @@ -4332,16 +4363,19 @@
CE5F21D91E4A922700C47B8E /* DismissLoginAnimator.swift in Sources */,
CECCE5A51E02408300D99448 /* UIView+FrameChangeBlocking.swift in Sources */,
CE6DCC271E6108D50044257B /* EnterPhraseCell.swift in Sources */,
C3E751CF2AF68C18005571CA /* BRCalculationExtension.swift in Sources */,
C3EFA9A3265080FF005C59B5 /* LockScreenHeaderViewModel.swift in Sources */,
CE760EDD1E561DF900EFAC2B /* UpdatePinViewController.swift in Sources */,
584E24F82951D412005E0E8B /* LanguageSelectionViewController.swift in Sources */,
24BA90C62410129E001E3825 /* FeeSelectorView.swift in Sources */,
CE9057181DFF0FA8006BA848 /* String+Additions.swift in Sources */,
CED341331EF5A5C00014912A /* InAppAlert.swift in Sources */,
C3E751C42AF68A50005571CA /* BRAddressExtension.swift in Sources */,
CE47A8E01F7DA54000FF35BA /* UIScreen+Additions.swift in Sources */,
222C42521E904C5000078EB5 /* AssociatedObject.swift in Sources */,
CEB909F51E5FE63D001804DC /* EnterPhraseViewController.swift in Sources */,
CE6D0F971DE8B73A00BD4BCF /* ModalTransitionDelegate.swift in Sources */,
C3E751C82AF68AEB005571CA /* UnsafeMutablePointerExtension.swift in Sources */,
C3BD4A5325975C6000D97079 /* View+Extension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
1 change: 0 additions & 1 deletion loafwallet/BRAPIClient+Wallet.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ extension BRAPIClient {
func exchangeRates(isFallback: Bool = false, _ handler: @escaping (_ rates: [Rate], _ error: String?) -> Void)
{
let request = isFallback ? URLRequest(url: URL(string: fallbackRatesURL)!) : URLRequest(url: URL(string: APIServer.baseUrl + "v1/rates")!)
print("::: request: \(request.debugDescription)")
_ = dataTaskWithRequest(request) { data, _, error in
if error == nil, let data = data,
let parsedData = try? JSONSerialization.jsonObject(with: data, options: .allowFragments)
Expand Down
60 changes: 60 additions & 0 deletions loafwallet/BRAddressExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
//
// BRAddressExtension.swift
// loafwallet
//
// Created by Kerry Washington on 11/4/23.
// Copyright © 2023 Litecoin Foundation. All rights reserved.
//
import BRCore
import Foundation

extension BRAddress: CustomStringConvertible, Hashable {
init?(string: String) {
self.init()
let cStr = [CChar](string.utf8CString)
guard cStr.count <= MemoryLayout<BRAddress>.size else { return nil }
UnsafeMutableRawPointer(mutating: &s).assumingMemoryBound(to: CChar.self).assign(from: cStr,
count: cStr.count)
}

init?(scriptPubKey: [UInt8]) {
self.init()
guard BRAddressFromScriptPubKey(UnsafeMutableRawPointer(mutating: &s).assumingMemoryBound(to: CChar.self),
MemoryLayout<BRAddress>.size, scriptPubKey, scriptPubKey.count) > 0
else { return nil }
}

init?(scriptSig: [UInt8]) {
self.init()
guard BRAddressFromScriptSig(UnsafeMutableRawPointer(mutating: &s).assumingMemoryBound(to: CChar.self),
MemoryLayout<BRAddress>.size, scriptSig, scriptSig.count) > 0 else { return nil }
}

var scriptPubKey: [UInt8]? {
var script = [UInt8](repeating: 0, count: 25)
let count = BRAddressScriptPubKey(&script, script.count,
UnsafeRawPointer([s]).assumingMemoryBound(to: CChar.self))
guard count > 0 else { return nil }
if count < script.count { script.removeSubrange(count...) }
return script
}

var hash160: UInt160? {
var hash = UInt160()
guard BRAddressHash160(&hash, UnsafeRawPointer([s]).assumingMemoryBound(to: CChar.self)) != 0
else { return nil }
return hash
}

public var description: String {
return String(cString: UnsafeRawPointer([s]).assumingMemoryBound(to: CChar.self))
}

public var hashValue: Int {
return BRAddressHash([s])
}

public static func == (l: BRAddress, r: BRAddress) -> Bool {
return BRAddressEq([l.s], [r.s]) != 0
}
}
60 changes: 60 additions & 0 deletions loafwallet/BRCalculationExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import BRCore
import Foundation

extension UInt256: CustomStringConvertible {
public var description: String {
return String(format: "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" +
"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
u8.31, u8.30, u8.29, u8.28, u8.27, u8.26, u8.25, u8.24,
u8.23, u8.22, u8.21, u8.20, u8.19, u8.18, u8.17, u8.16,
u8.15, u8.14, u8.13, u8.12, u8.11, u8.10, u8.9, u8.8,
u8.7, u8.6, u8.5, u8.4, u8.3, u8.2, u8.1, u8.0)
}
}

extension UInt128: Equatable {
public static func == (l: UInt128, r: UInt128) -> Bool {
return l.u64 == r.u64
}

public static func != (l: UInt128, r: UInt128) -> Bool {
return l.u64 != r.u64
}
}

extension UInt160: Equatable {
public static func == (l: UInt160, r: UInt160) -> Bool {
return l.u32 == r.u32
}

public static func != (l: UInt160, r: UInt160) -> Bool {
return l.u32 != r.u32
}
}

extension UInt256: Equatable {
public static func == (l: UInt256, r: UInt256) -> Bool {
return l.u64 == r.u64
}

public static func != (l: UInt256, r: UInt256) -> Bool {
return l.u64 != r.u64
}

var hexString: String {
var u = self
return withUnsafePointer(to: &u) { p in
Data(bytes: p, count: MemoryLayout<UInt256>.stride).hexString
}
}
}

extension UInt512: Equatable {
public static func == (l: UInt512, r: UInt512) -> Bool {
return l.u64 == r.u64
}

public static func != (l: UInt512, r: UInt512) -> Bool {
return l.u64 != r.u64
}
}
Loading