fix(wallet): adopt instance estimateShieldedFee from platform #4470 - #1063
Conversation
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 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 2 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
romchornyi
left a comment
There was a problem hiding this comment.
Reviewed and built this. Exactly the split-out I asked for on #1062, and it holds up — one non-blocking note.
Build
fix/shielded-fee-instance-api on develop, against platform v4.2-dev @ 1e26927c61. Only local modification is the SwiftDashSDK package path; no source patches.
0 compile errors
0 linker errors
Ld .../dashpay.app/dashpay.debug.dylib
Ld .../dashpay.app/dashpay
** BUILD SUCCEEDED **
The warnings in these six files (InternalTransferConfirmSheet.swift:75, ShieldedTransferCoordinator.swift:689/1435/1460, SendScreenViewController.swift:45) are all on untouched lines and pre-existing — this PR adds none.
Verified
It is a clean split-out. git diff between this branch and the dcbc78ef6 commit carried inside #1062 is empty, so what I already reviewed there is exactly what lands here — no extras rode along.
The migration is complete. All 15 sites across the 6 files, and no static call survives anywhere in the code (the only remaining mention is a line in the historical ARCH_REVIEW_2026-07-03.md).
Nil-manager behavior is preserved at 14 of the 15 sites — they return UInt64? upward and their callers already treat nil as unavailable (InternalTransferViewModel.swift:63 guards and returns nil; ShieldedTransferCoordinator.swift:378 hands the optional out of its closure).
The branch is level with develop and merges clean.
One note
SDKIdentityProfileSheet.swift:445 is the single site that coerces:
unshieldFee = (try? SwiftDashSDKHost.shared.manager?.estimateShieldedFee(kind: .unshield, numActions: 2)) ?? 0The static call could not fail for "no manager"; the instance call can, and ?? 0 turns that into a zero fee. I traced where it goes — estimatedFeeCredits feeds estimatedFeeText, the "~X DASH (≈ Y)" label, and does not gate the Top Up button (effectiveDuffs is computed independently). The window where manager is nil while the DashPay profile sheet is on screen is also narrow, since the sheet needs an identity and that needs a live runtime. So this is tidiness, not a funds risk.
What is worth a line, though, is the doc comment right above it:
/// ... (shielded route only, via the pure `estimateShieldedFee` FFI) ..."pure" is no longer true — computing the estimate at the manager's active protocol version is the whole point of #4470. That sentence is what tells the next reader why there is an optional here at all.
Approving — the migration is mechanical, complete, and builds.
Conflict: InternalTransferConfirmSheet.swift — this branch moved the fee-resolution switch into InternalTransferViewModel (sheet only formats), while develop migrated the same switch's shielded estimates to the instance API (SwiftDashSDKHost.shared.manager, app #1063 / platform #4470). Resolved by keeping the ViewModel structure and applying develop's instance-API migration to the moved switch in confirmNetworkFeeCredits; its doc now names the network-active protocol version rather than latest(). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Issue being fixed or feature implemented
Prerequisite for #1062, split out per review there: platform
v4.2-devmerged dashpay/platform#4470 (bea4122858), which turnedPlatformWalletManager.estimateShieldedFeefrom astatic funcinto an instance method computed at the manager's network-tracked platform version. The app still called it statically in six files, so no platform revision could satisfy both this API and the merged shutdown API from dashpay/platform#4469 (1e26927c61, whose ancestor #4470 is).What was done?
Migrated all 15 call sites (SendViewModel/SendScreen, InternalTransferViewModel/ConfirmSheet, ShieldedTransferCoordinator, SDKIdentityProfileSheet) from
PlatformWalletManager.estimateShieldedFee(...)toSwiftDashSDKHost.shared.manager?.estimateShieldedFee(...)— the live host manager, sametry?fallbacks as before. Mechanical; no behavior change beyond the fee now being computed at the connected network's active protocol version (the point of #4470).How Has This Been Tested?
v4.2-dev@1e26927c61(rebuiltDashSDKFFI.xcframework, both slices): BUILD SUCCEEDED.Breaking Changes
None.
Checklist:
For repository code-owners and collaborators only
🤖 Generated with Claude Code