@@ -25,16 +25,26 @@ class BuildTransactionViewModel {
2525 }
2626
2727 func buildTransaction( address: String , amount: UInt64 , feeRate: UInt64 ) {
28+ print ( " [BuildTransactionViewModel.buildTransaction] Called with: " )
29+ print ( " - Address: \( address) " )
30+ print ( " - Amount: \( amount) sats " )
31+ print ( " - FeeRate: \( feeRate) sat/vB " )
32+
2833 do {
2934 let txBuilderResult = try bdkClient. buildTransaction ( address, amount, feeRate)
3035 self . psbt = txBuilderResult
36+ print ( " [BuildTransactionViewModel.buildTransaction] PSBT created successfully " )
3137 } catch let error as WalletError {
38+ print ( " [BuildTransactionViewModel.buildTransaction] WalletError: \( error. localizedDescription) " )
3239 self . buildTransactionViewError = . generic( message: error. localizedDescription)
3340 self . showingBuildTransactionViewErrorAlert = true
3441 } catch let error as AddressParseError {
42+ print ( " [BuildTransactionViewModel.buildTransaction] AddressParseError: \( error. localizedDescription) " )
3543 self . buildTransactionViewError = . generic( message: error. localizedDescription)
3644 self . showingBuildTransactionViewErrorAlert = true
3745 } catch {
46+ print ( " [BuildTransactionViewModel.buildTransaction] Unknown error: \( error. localizedDescription) " )
47+ print ( " [BuildTransactionViewModel.buildTransaction] Error type: \( type ( of: error) ) " )
3848 self . buildTransactionViewError = . generic( message: error. localizedDescription)
3949 self . showingBuildTransactionViewErrorAlert = true
4050 }
@@ -69,22 +79,33 @@ class BuildTransactionViewModel {
6979 }
7080
7181 func send( address: String , amount: UInt64 , feeRate: UInt64 ) {
82+ print ( " [BuildTransactionViewModel.send] Called with: " )
83+ print ( " - Address: \( address) " )
84+ print ( " - Amount: \( amount) sats " )
85+ print ( " - FeeRate: \( feeRate) sat/vB " )
86+
7287 do {
7388 try bdkClient. send ( address, amount, feeRate)
89+ print ( " [BuildTransactionViewModel.send] Transaction sent successfully! " )
7490 NotificationCenter . default. post (
7591 name: Notification . Name ( " TransactionSent " ) ,
7692 object: nil
7793 )
7894 } catch let error as EsploraError {
95+ print ( " [BuildTransactionViewModel.send] EsploraError: \( error. localizedDescription) " )
7996 self . buildTransactionViewError = . generic( message: error. localizedDescription)
8097 self . showingBuildTransactionViewErrorAlert = true
8198 } catch let error as SignerError {
99+ print ( " [BuildTransactionViewModel.send] SignerError: \( error. localizedDescription) " )
82100 self . buildTransactionViewError = . generic( message: error. localizedDescription)
83101 self . showingBuildTransactionViewErrorAlert = true
84102 } catch let error as WalletError {
103+ print ( " [BuildTransactionViewModel.send] WalletError: \( error. localizedDescription) " )
85104 self . buildTransactionViewError = . generic( message: error. localizedDescription)
86105 self . showingBuildTransactionViewErrorAlert = true
87106 } catch {
107+ print ( " [BuildTransactionViewModel.send] Unknown error: \( error. localizedDescription) " )
108+ print ( " [BuildTransactionViewModel.send] Error type: \( type ( of: error) ) " )
88109 self . buildTransactionViewError = . generic( message: error. localizedDescription)
89110 self . showingBuildTransactionViewErrorAlert = true
90111 }
0 commit comments