@@ -9,24 +9,6 @@ import BitcoinDevKit
9
9
import Foundation
10
10
import SwiftUI
11
11
12
- struct TimeoutError : Error { }
13
-
14
- func withTimeout< T> ( seconds: TimeInterval , operation: @escaping ( ) throws -> T ) async throws -> T {
15
- try await withThrowingTaskGroup ( of: T . self) { group in
16
- group. addTask {
17
- return try operation ( )
18
- }
19
-
20
- group. addTask {
21
- try await Task . sleep ( nanoseconds: UInt64 ( seconds * 1_000_000_000 ) )
22
- throw TimeoutError ( )
23
- }
24
-
25
- let result = try await group. next ( ) !
26
- group. cancelAll ( )
27
- return result
28
- }
29
- }
30
12
31
13
// Can't make @Observable yet
32
14
// https://developer.apple.com/forums/thread/731187
@@ -128,14 +110,12 @@ class OnboardingViewModel: ObservableObject {
128
110
129
111
Task {
130
112
do {
131
- try await withTimeout ( seconds: 30 ) {
132
- if self . isDescriptor {
133
- try self . bdkClient. createWalletFromDescriptor ( self . words)
134
- } else if self . isXPub {
135
- try self . bdkClient. createWalletFromXPub ( self . words)
136
- } else {
137
- try self . bdkClient. createWalletFromSeed ( self . words)
138
- }
113
+ if self . isDescriptor {
114
+ try self . bdkClient. createWalletFromDescriptor ( self . words)
115
+ } else if self . isXPub {
116
+ try self . bdkClient. createWalletFromXPub ( self . words)
117
+ } else {
118
+ try self . bdkClient. createWalletFromSeed ( self . words)
139
119
}
140
120
DispatchQueue . main. async {
141
121
self . isCreatingWallet = false
@@ -147,13 +127,6 @@ class OnboardingViewModel: ObservableObject {
147
127
self . isCreatingWallet = false
148
128
self . createWithPersistError = error
149
129
}
150
- } catch is TimeoutError {
151
- DispatchQueue . main. async {
152
- self . isCreatingWallet = false
153
- self . onboardingViewError = . generic(
154
- message: " Wallet creation timed out. Please try again. "
155
- )
156
- }
157
130
} catch {
158
131
DispatchQueue . main. async {
159
132
self . isCreatingWallet = false
0 commit comments