Skip to content

Commit

Permalink
Merge pull request #1 from Fonta1n3/v0.0.1
Browse files Browse the repository at this point in the history
feat: create and pay standard bip21 invoices, improved UI/UX
  • Loading branch information
Fonta1n3 authored Jul 22, 2024
2 parents 4de796e + 4ba5f64 commit 03dbdc4
Show file tree
Hide file tree
Showing 16 changed files with 394 additions and 169 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ A [BIP78 over Nostr Payjoin](https://github.com/Kukks/BTCPayServer.BIP78/tree/no


## Limitations
- Does not create/import/recover a new wallet, you must use an existing BIP84 wallet via Bitcoin Core.
- Only works with a local node (for now).
- Native segwit inputs and outputs only.
- Must have a BIP39 signer that can sign for your inputs.
- Tor is not currently used for nostr traffic, a VPN is recommended, your messages will not be identifiable as bitcoin transactions to the relay.
Expand All @@ -51,7 +49,6 @@ A [BIP78 over Nostr Payjoin](https://github.com/Kukks/BTCPayServer.BIP78/tree/no

## TODO
- Watch-only capability, add ability to export each psbt for signing and paste back in.
- Tor for Bitcoin Core node connection (currently `localhost` only).
- Allow sender to add additional inputs/outputs.
- Submit PR to BIP78 nostr addendum to include a `txid` message when either party broadcasts the transaction.

Expand Down
22 changes: 16 additions & 6 deletions UnifyWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = UnifyWallet/UnifyWallet.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"UnifyWallet/Preview Content\"";
DEVELOPMENT_TEAM = 8JHDU5M9KD;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -932,6 +932,9 @@
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = UnifyWallet/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Unify Wallet";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_NSCameraUsageDescription = "To scan QR codes.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand All @@ -947,7 +950,7 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=iphoneos*]" = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.dentonllc.UnifyWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand All @@ -968,7 +971,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = UnifyWallet/UnifyWallet.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_ASSET_PATHS = "\"UnifyWallet/Preview Content\"";
DEVELOPMENT_TEAM = 8JHDU5M9KD;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -978,6 +981,9 @@
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = UnifyWallet/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "Unify Wallet";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
INFOPLIST_KEY_NSCameraUsageDescription = "To scan QR codes.";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand All @@ -992,7 +998,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.dentonllc.UnifyWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -1023,6 +1029,8 @@
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "UnifyWalletmacOS-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Unify Wallet";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand All @@ -1038,7 +1046,7 @@
"LD_RUNPATH_SEARCH_PATHS[sdk=iphoneos*]" = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.dentonllc.UnifyWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down Expand Up @@ -1068,6 +1076,8 @@
"FRAMEWORK_SEARCH_PATHS[arch=*]" = "$(inherited)";
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "UnifyWalletmacOS-Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "Unify Wallet";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.utilities";
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphoneos*]" = YES;
"INFOPLIST_KEY_UIApplicationSceneManifest_Generation[sdk=iphonesimulator*]" = YES;
"INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents[sdk=iphoneos*]" = YES;
Expand All @@ -1082,7 +1092,7 @@
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = com.dentonllc.UnifyWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
Expand Down
6 changes: 3 additions & 3 deletions UnifyWallet/BitcoinCore/BitcoinCoreRPC.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class BitcoinCoreRPC {
completion((nil, "Unable to get rpc user."))
return
}
guard let rpcPort = UserDefaults.standard.object(forKey: "rpcPort") as? String else {
completion((nil, "No rpcport specified."))

guard let rpcPort = credentials["rpcPort"] as? String else {
completion((nil, "Unable to get rpcPort."))
return
}

Expand Down
1 change: 1 addition & 0 deletions UnifyWallet/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public extension Double {

var btcBalanceWithSpaces: String {
var btcBalance = abs(self.rounded(toPlaces: 8)).avoidNotation
btcBalance = btcBalance.replacingOccurrences(of: ",", with: "")
if !btcBalance.contains(".") {
btcBalance += ".0"
}
Expand Down
13 changes: 1 addition & 12 deletions UnifyWallet/TorClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,8 @@ class TorClient: NSObject, URLSessionDelegate {
state = .started

var proxyPort = 19786
//var dnsPort = 19946
#if targetEnvironment(simulator)
proxyPort = 19058
dnsPort = 12349
#endif

sessionConfiguration.connectionProxyDictionary = [kCFProxyTypeKey: kCFProxyTypeSOCKS,
Expand Down Expand Up @@ -96,7 +94,7 @@ class TorClient: NSObject, URLSessionDelegate {
"LearnCircuitBuildTimeout": "1",
"NumEntryGuards": "8",
"SafeSocks": "1",
"LongLivedPorts": "80,443",
//"LongLivedPorts": "80,443",
"NumCPUs": "2",
"DisableDebuggerAttachment": "1",
"SafeLogging": "1"
Expand Down Expand Up @@ -146,8 +144,6 @@ class TorClient: NSObject, URLSessionDelegate {
if arguments != nil {
if arguments!["PROGRESS"] != nil {
let progress = Int(arguments!["PROGRESS"]!)!
//weakDelegate?.torConnProgress(progress)
//self.progress = progress
self.showProgress?((progress))
if progress >= 100 {
self.controller?.removeObserver(progressObs)
Expand All @@ -163,23 +159,16 @@ class TorClient: NSObject, URLSessionDelegate {
if established {
self.state = .connected
self.torConnected?((true))
//self.torrConnFinished = true
//weakDelegate?.torConnFinished()
self.controller?.removeObserver(observer)

} else if self.state == .refreshing {
self.state = .connected
self.torConnected?((true))
//self.torrConnFinished = true
//weakDelegate?.torConnFinished()
self.controller?.removeObserver(observer)
}
})
}
} catch {
//weakDelegate?.torConnDifficulties()
//self.torrConnFinished = false
//self.torConnDifficulties = true
self.torConnected?((false))
self.state = .none
}
Expand Down
18 changes: 6 additions & 12 deletions UnifyWallet/UnifyWalletApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import SwiftUI

@main
struct UnifyWalletApp: App {
//@StateObject private var manager: DataManager = DataManager()
@State private var showNotSavedAlert = false


Expand All @@ -22,8 +21,6 @@ struct UnifyWalletApp: App {
var body: some Scene {
WindowGroup {
HomeView()
//.environmentObject(manager)
//.environment(\.managedObjectContext, manager.container.viewContext)
}
}

Expand All @@ -34,6 +31,9 @@ struct UnifyWalletApp: App {
// }
// DataManager.deleteAllData(entityName: "BIP39Signer") { deleted in
// print("deleted signers: \(deleted)")
// }
// DataManager.deleteAllData(entityName: "TorCredentials") { deleted in
// print("deleted tor credentials: \(deleted)")
// }


Expand All @@ -55,17 +55,10 @@ struct UnifyWalletApp: App {
return
}

guard let rpcauthcreds = RPCAuth().generateCreds(username: "Unify", password: nil) else {
showNotSavedAlert = true
return
}

UserDefaults.standard.setValue("38332", forKey: "rpcPort")
UserDefaults.standard.setValue("Signet", forKey: "network")

let rpcpass = rpcauthcreds.password

guard let encRpcPass = Crypto.encrypt(rpcpass.data(using: .utf8)!) else {

guard let encRpcPass = Crypto.encrypt(Crypto.privKeyData()) else {
showNotSavedAlert = true
return
}
Expand All @@ -78,6 +71,7 @@ struct UnifyWalletApp: App {
]

saveCreds(entityName: "RPCCredentials", dict: dict)

createDefaultTorCreds()

return
Expand Down
Loading

0 comments on commit 03dbdc4

Please sign in to comment.