From dcbc78ef692a784bef9f5a3ba02dfdea01c36eb2 Mon Sep 17 00:00:00 2001 From: Bartosz Rozwarski Date: Tue, 25 Aug 2026 15:24:11 +0200 Subject: [PATCH] fix(wallet): adopt instance estimateShieldedFee from platform #4470 platform v4.2-dev's bea4122858 turned PlatformWalletManager .estimateShieldedFee from a static func into an instance method computed at the manager's network-tracked platform version. Migrate all call sites to the live host manager so the app compiles against v4.2-dev at or past that commit (prerequisite for consuming the merged #4469 shutdown API). Co-Authored-By: Claude Fable 5 --- .../UI/DashPay/Profile/SDKIdentityProfileSheet.swift | 2 +- .../InternalTransfer/InternalTransferConfirmSheet.swift | 6 +++--- .../InternalTransfer/InternalTransferViewModel.swift | 6 +++--- .../InternalTransfer/ShieldedTransferCoordinator.swift | 2 +- DashWallet/Sources/UI/Payments/Pay/SendScreen.swift | 8 ++++---- DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift | 6 +++--- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/DashWallet/Sources/UI/DashPay/Profile/SDKIdentityProfileSheet.swift b/DashWallet/Sources/UI/DashPay/Profile/SDKIdentityProfileSheet.swift index c9f993caf3..7686c05db2 100644 --- a/DashWallet/Sources/UI/DashPay/Profile/SDKIdentityProfileSheet.swift +++ b/DashWallet/Sources/UI/DashPay/Profile/SDKIdentityProfileSheet.swift @@ -442,7 +442,7 @@ final class IdentityTopUpViewModel: ObservableObject { static func estimatedFeeCredits(source: FundingSource) -> UInt64 { let unshieldFee: UInt64 if source == .shielded { - unshieldFee = (try? PlatformWalletManager.estimateShieldedFee(kind: .unshield, numActions: 2)) ?? 0 + unshieldFee = (try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .unshield, numActions: 2)) ?? 0 } else { unshieldFee = 0 } diff --git a/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift b/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift index 4f27594dae..6623f83647 100644 --- a/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift +++ b/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift @@ -223,11 +223,11 @@ struct InternalTransferConfirmSheet: View { case .platformToShielded: // Shield (Type 15): base shielded fee. Real metered storage is // extra and only knowable on-chain, so this is a lower bound. - return try? PlatformWalletManager.estimateShieldedFee(kind: .transfer, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .transfer, numActions: 2) case .shieldedToCore: - return try? PlatformWalletManager.estimateShieldedFee(kind: .withdrawal, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .withdrawal, numActions: 2) case .shieldedToPlatform: - return try? PlatformWalletManager.estimateShieldedFee(kind: .unshield, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .unshield, numActions: 2) case .coreToPlatform: // Address-funding asset lock: the required processing balance // (the same 50k-duff base the Rust side reserves for address diff --git a/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferViewModel.swift b/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferViewModel.swift index e8642e57ad..e5f9751df6 100644 --- a/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferViewModel.swift +++ b/DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferViewModel.swift @@ -60,7 +60,7 @@ enum CoreToShieldedAmountPolicy { static let assetLockBaseCostCredits: UInt64 = 50_000_000 static var poolFeeCredits: UInt64? { - guard let shieldedFee = try? PlatformWalletManager.estimateShieldedFee( + guard let shieldedFee = try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .transfer, numActions: 2) else { return nil } @@ -886,11 +886,11 @@ final class InternalTransferViewModel: ObservableObject { // (`ShieldedActionBudget.maxActionsPerTransition`) so a fragmented // wallet can't pass the affordability check and then fail SDK note // selection. - return try? PlatformWalletManager.estimateShieldedFee( + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .withdrawal, numActions: ShieldedActionBudget.maxActionsPerTransition) case .shieldedToPlatform: - return try? PlatformWalletManager.estimateShieldedFee( + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .unshield, numActions: ShieldedActionBudget.maxActionsPerTransition) case .platformToCore: diff --git a/DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift b/DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift index 0417811508..3d3a98c0f5 100644 --- a/DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift +++ b/DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift @@ -375,7 +375,7 @@ final class ShieldedTransferCoordinator: ObservableObject { guard allCredits != UInt64.max else { return .unavailable } let feeForActions: (Int) -> UInt64? = { actionCount in - try? PlatformWalletManager.estimateShieldedFee( + try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: feeKind, numActions: actionCount) } diff --git a/DashWallet/Sources/UI/Payments/Pay/SendScreen.swift b/DashWallet/Sources/UI/Payments/Pay/SendScreen.swift index 0b926a0271..55c3150983 100644 --- a/DashWallet/Sources/UI/Payments/Pay/SendScreen.swift +++ b/DashWallet/Sources/UI/Payments/Pay/SendScreen.swift @@ -943,13 +943,13 @@ struct SendConfirmSheet: View { // The Type 15 shield is an output-only bundle padded to exactly // 2 actions, charged the flat base fee — same number the Rust // side reserves on input 0. - return try? PlatformWalletManager.estimateShieldedFee(kind: .transfer, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .transfer, numActions: 2) case .shieldedToCore: - return try? PlatformWalletManager.estimateShieldedFee(kind: .withdrawal, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .withdrawal, numActions: 2) case .shieldedToPlatform: - return try? PlatformWalletManager.estimateShieldedFee(kind: .unshield, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .unshield, numActions: 2) case .shieldedToShielded: - return try? PlatformWalletManager.estimateShieldedFee(kind: .transfer, numActions: 2) + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .transfer, numActions: 2) case .coreToCore: // Never presented here — the L1 processor shows the real fee. return nil diff --git a/DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift b/DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift index 236a72b447..b3caab6b5d 100644 --- a/DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift +++ b/DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift @@ -569,15 +569,15 @@ final class SendViewModel: ObservableObject { case .shieldedToCore: // Worst-case note selection for a bundle the size limit actually // admits — same reasoning as the internal transfer's reserve. - return try? PlatformWalletManager.estimateShieldedFee( + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .withdrawal, numActions: ShieldedActionBudget.maxActionsPerTransition) case .shieldedToPlatform: - return try? PlatformWalletManager.estimateShieldedFee( + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .unshield, numActions: ShieldedActionBudget.maxActionsPerTransition) case .shieldedToShielded: - return try? PlatformWalletManager.estimateShieldedFee( + return try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee( kind: .transfer, numActions: ShieldedActionBudget.maxActionsPerTransition) }