From 64c53cb5a57e3d6dd886e4a4f03dcd2c895c5527 Mon Sep 17 00:00:00 2001 From: Simon McLoughlin Date: Wed, 19 Jun 2024 11:28:59 +0100 Subject: [PATCH] - add finalise unstake to list of supported activity items - add some number formatting for large amount display --- .../xcshareddata/swiftpm/Package.resolved | 2 +- .../Modules/Activity/Cells/ActivityItemCell.swift | 11 +++++++++-- Kukai Mobile/Services/ActivityService.swift | 3 +++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 8eb44ee9..a81c4c7e 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -70,7 +70,7 @@ "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { "branch" : "develop", - "revision" : "8ad6dac35574b37170d2aaa05d536e8787c72c0e" + "revision" : "7342af3601139f45da065c67ca71aa060ecccb8f" } }, { diff --git a/Kukai Mobile/Modules/Activity/Cells/ActivityItemCell.swift b/Kukai Mobile/Modules/Activity/Cells/ActivityItemCell.swift index dac909e8..93a6ef57 100644 --- a/Kukai Mobile/Modules/Activity/Cells/ActivityItemCell.swift +++ b/Kukai Mobile/Modules/Activity/Cells/ActivityItemCell.swift @@ -115,12 +115,19 @@ class ActivityItemCell: UITableViewCell, UITableViewCellContainerView, UITableVi iconView.backgroundColor = .white iconView.customCornerRadius = 20 + let token = data.primaryToken + let balanceDsiplay = DependencyManager.shared.coinGeckoService.formatLargeTokenDisplay(token?.balance.toNormalisedDecimal() ?? 0, decimalPlaces: token?.decimalPlaces ?? 6) + if data.subType == .stake { - titleLabel.text = "Stake: \( (data.primaryToken?.balance ?? .zero()).normalisedRepresentation) XTZ" + titleLabel.text = "Stake: \(balanceDsiplay) XTZ" toLabel.text = "To: " } else if data.subType == .unstake { - titleLabel.text = "Unstake: \( (data.primaryToken?.balance ?? .zero()).normalisedRepresentation) XTZ" + titleLabel.text = "Unstake: \(balanceDsiplay) XTZ" + toLabel.text = "From: " + + } else if data.subType == .finaliseUnstake { + titleLabel.text = "Finalise Unstake: \(balanceDsiplay) XTZ" toLabel.text = "From: " } diff --git a/Kukai Mobile/Services/ActivityService.swift b/Kukai Mobile/Services/ActivityService.swift index 1c83eed1..b680f5a5 100644 --- a/Kukai Mobile/Services/ActivityService.swift +++ b/Kukai Mobile/Services/ActivityService.swift @@ -119,6 +119,9 @@ public class ActivityService { } else if parameters?["entrypoint"] == "unstake" && destinationAddress == fromWallet.address { kind = "unstake" + + } else if parameters?["entrypoint"] == "finalize_unstake" && destinationAddress == fromWallet.address { + kind = "finalize" } var transaction = TzKTTransaction.placeholder(withStatus: .unconfirmed, id: previousId + 1, opHash: opHash, type: type, counter: counter, fromWallet: fromWallet, destination: destination, xtzAmount: xtzAmount, parameters: parameters, primaryToken: primaryToken, baker: nil, kind: kind)