Skip to content

Commit a6ee9bf

Browse files
committed
chore: removed main net
chore: back to bip86 wallet
1 parent d46e6f3 commit a6ee9bf

File tree

12 files changed

+28
-21
lines changed

12 files changed

+28
-21
lines changed

BDKSwiftExampleWallet/Extensions/BDK+Extensions/Network+Extensions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension Network {
2121

2222
init?(stringValue: String) {
2323
switch stringValue {
24-
case "bitcoin": self = .bitcoin
24+
case "bitcoin": self = .signet
2525
case "testnet": self = .testnet
2626
case "testnet4": self = .testnet4
2727
case "signet": self = .signet

BDKSwiftExampleWallet/Resources/Localizable.xcstrings

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,9 +409,6 @@
409409
}
410410
}
411411
}
412-
},
413-
"Bitcoin" : {
414-
415412
},
416413
"Bitcoin Balance" : {
417414
"localizations" : {

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import Foundation
1111
private class BDKService {
1212
static var shared: BDKService = BDKService()
1313

14-
private let service: BDKSyncService = KyotoService.live
15-
// private let service: BDKSyncService = EsploraService.live
14+
// private let service: BDKSyncService = KyotoService.live
15+
private let service: BDKSyncService = EsploraService.live
1616
private let keyClient: KeyClient
1717
private var needsFullScan: Bool = false
1818
private(set) var network: Network

BDKSwiftExampleWallet/Service/BDKSyncService/BDKSyncService.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ extension BDKSyncService {
6666
if isXPub(params) {
6767
let descriptorPublicKey = try DescriptorPublicKey.fromString(publicKey: params)
6868
let fingerprint = descriptorPublicKey.masterFingerprint()
69-
let descriptor = Descriptor.newBip84Public(
69+
let descriptor = Descriptor.newBip86Public(
7070
publicKey: descriptorPublicKey,
7171
fingerprint: fingerprint,
7272
keychain: .external,
7373
network: network
7474
)
75-
let changeDescriptor = Descriptor.newBip84Public(
75+
let changeDescriptor = Descriptor.newBip86Public(
7676
publicKey: descriptorPublicKey,
7777
fingerprint: fingerprint,
7878
keychain: .internal,
@@ -125,12 +125,12 @@ extension BDKSyncService {
125125
mnemonic: mnemonic,
126126
password: nil
127127
)
128-
let descriptor = Descriptor.newBip84(
128+
let descriptor = Descriptor.newBip86(
129129
secretKey: secretKey,
130130
keychain: .external,
131131
network: network
132132
)
133-
let changeDescriptor = Descriptor.newBip84(
133+
let changeDescriptor = Descriptor.newBip86(
134134
secretKey: secretKey,
135135
keychain: .internal,
136136
network: network

BDKSwiftExampleWallet/Service/BDKSyncService/EsploraService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class EsploraService: BDKSyncService {
2525

2626
init(
2727
keyClient: KeyClient = .live,
28-
network: Network = .bitcoin,
28+
network: Network = .signet,
2929
connection: Connection? = nil
3030
) {
3131
self.connection = connection

BDKSwiftExampleWallet/Service/BDKSyncService/KyotoService.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ final class KyotoService: BDKSyncService {
3434

3535
init(
3636
keyClient: KeyClient = .live,
37-
network: Network = .bitcoin,
37+
network: Network = .signet,
3838
connection: Connection? = nil
3939
) {
4040
self.connection = connection
@@ -74,8 +74,9 @@ final class KyotoService: BDKSyncService {
7474
throw WalletError.walletNotFound
7575
}
7676
let nodeComponents = try buildNode(
77-
from: wallet, scanType: .recovery(fromHeight: KyotoService.nodeHeight)
77+
from: wallet, scanType: .recovery(fromHeight: network.taprootHeight)
7878
)
79+
7980
self.fullScanProgress = progress
8081
self.client = nodeComponents.client
8182
self.node = nodeComponents.node

BDKSwiftExampleWallet/Service/Key Service/KeyService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ extension KeyClient {
137137
mnemonic: mnemonic,
138138
password: nil
139139
)
140-
let descriptor = Descriptor.newBip84(
140+
let descriptor = Descriptor.newBip86(
141141
secretKey: secretKey,
142142
keychain: .external,
143143
network: mockKeyClientNetwork
144144
)
145-
let changeDescriptor = Descriptor.newBip84(
145+
let changeDescriptor = Descriptor.newBip86(
146146
secretKey: secretKey,
147147
keychain: .internal,
148148
network: mockKeyClientNetwork

BDKSwiftExampleWallet/Utilities/Constants.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ struct Constants {
3131
static let mutiny = "https://mutinynet.com/api"
3232
static let mempoolspace = "https://mempool.space/signet/api"
3333
static let allValues = [
34+
mempoolspace,
3435
mutiny,
3536
bdk,
36-
mempoolspace,
3737
]
3838
}
3939
struct Testnet {
@@ -95,4 +95,13 @@ extension Network {
9595
Constants.Config.EsploraServerURLNetwork.Testnet4.allValues.first ?? ""
9696
}
9797
}
98+
99+
var taprootHeight: UInt32 {
100+
switch self {
101+
case .bitcoin:
102+
return 700_000
103+
default:
104+
return 250_000
105+
}
106+
}
98107
}

BDKSwiftExampleWallet/View Model/OnboardingViewModel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class OnboardingViewModel: ObservableObject {
2626
}
2727
@Published var networkColor = Color.gray
2828
@Published var onboardingViewError: AppError?
29-
@Published var selectedNetwork: Network = .bitcoin {
29+
@Published var selectedNetwork: Network = .signet {
3030
didSet {
3131
bdkClient.updateNetwork(selectedNetwork)
3232
selectedURL = availableURLs.first ?? ""

BDKSwiftExampleWallet/View/Activity/TransactionListView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ struct TransactionListView: View {
3636
.font(.subheadline)
3737

3838
let mutinyFaucetURL = URL(string: "https://faucet.mutinynet.com")
39-
let signetFaucetURL = URL(string: "https://signetfaucet.com")
39+
// let signetFaucetURL = URL(string: "https://signetfaucet.com")
40+
let signetFaucetURL = URL(string: "https://signet25.bublina.eu.org/")
4041

4142
if let mutinyFaucetURL,
4243
let signetFaucetURL,

0 commit comments

Comments
 (0)