Skip to content

Commit

Permalink
WIP: Cannot unwrap ltc1 addresses to retain them in the UILabel
Browse files Browse the repository at this point in the history
- ltc1 addresses are present but not unwrapping properly
@Iferencak this is the disappearing error you saw when we updated the loafwallet-core.
- Not able to figure this out yet.
- All ideas are welcome
  • Loading branch information
kcw-grunt committed May 29, 2023
1 parent c701d35 commit 08811b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 22 deletions.
3 changes: 2 additions & 1 deletion loafwallet/TransactionCellViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class TransactionCellViewModel: ObservableObject {

feeText = transaction.amountDetails(isLtcSwapped: isLtcSwapped, rate: rate, rates: [rate], maxDigits: maxDigits)

addressText = String(format: transaction.direction.addressTextFormat, transaction.toAddress ?? "")
addressText = String(format: transaction.direction.addressTextFormat, transaction.toAddress ?? "DEBUG-UPDATED-ADDRESS")
print("::: toAddress: \(transaction.toAddress) raw : \(transaction.rawTransaction)")

if transaction.direction == .sent {
directionImageText = "arrowtriangle.up.circle.fill"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class SendViewController: UIViewController, Subscriber, ModalPresentable, Tracka
guard let firstOutput = protoReq.details.outputs.first else { return }
guard let wallet = walletManager.wallet else { return }

let address = firstOutput.swiftAddress
let address = firstOutput.updatedSwiftAddress
let isValid = protoReq.isValid()
var isOutputTooSmall = false

Expand Down
28 changes: 8 additions & 20 deletions loafwallet/src/ViewModels/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,50 +159,38 @@ class Transaction {
case .sent:

guard let output = self
.tx
.outputs
.filter({ output in

.tx.outputs.filter({ output in
!self.wallet.containsAddress(output.updatedSwiftAddress)
})
.first

else {
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR)
return nil
}

return output.updatedSwiftAddress

case .received:

/// ltc1
/// 108 116 99 49 13 10
//
// guard let output = self.tx.outputs.filter({ output in
// self.wallet.containsAddress(output.updatedSwiftAddress)
// }).first else {
// return nil
// }
//
// return output.updatedSwiftAddress

guard let output = self
.tx
.outputs
.filter({ output in

self.wallet.containsAddress(output.updatedSwiftAddress)
})
.first
}).first

else {
LWAnalytics.logEventWithParameters(itemName: ._20200112_ERR)
return nil
}
return output.updatedSwiftAddress

case .moved:
guard let output = self.tx.outputs.filter({ output in
self.wallet.containsAddress(output.swiftAddress)
self.wallet.containsAddress(output.updatedSwiftAddress)
}).first else { return nil }
return output.swiftAddress
return output.updatedSwiftAddress
}
}()

Expand Down

0 comments on commit 08811b1

Please sign in to comment.