Skip to content

fix(wallet): adopt instance estimateShieldedFee from platform #4470 - #1063

Merged
llbartekll merged 1 commit into
developfrom
fix/shielded-fee-instance-api
Aug 25, 2026
Merged

fix(wallet): adopt instance estimateShieldedFee from platform #4470#1063
llbartekll merged 1 commit into
developfrom
fix/shielded-fee-instance-api

Conversation

@llbartekll

Copy link
Copy Markdown
Contributor

Issue being fixed or feature implemented

Prerequisite for #1062, split out per review there: platform v4.2-dev merged dashpay/platform#4470 (bea4122858), which turned PlatformWalletManager.estimateShieldedFee from a static func into 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(...) to SwiftDashSDKHost.shared.manager?.estimateShieldedFee(...) — the live host manager, same try? 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?

  • DashPay Debug build for a generic iOS Simulator against platform v4.2-dev @ 1e26927c61 (rebuilt DashSDKFFI.xcframework, both slices): BUILD SUCCEEDED.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 2 minutes.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b3d6e54f-d38b-4aba-9475-340210ce745c

📥 Commits

Reviewing files that changed from the base of the PR and between 53bb20d and dcbc78e.

📒 Files selected for processing (6)
  • DashWallet/Sources/UI/DashPay/Profile/SDKIdentityProfileSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferConfirmSheet.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/InternalTransferViewModel.swift
  • DashWallet/Sources/UI/Payments/InternalTransfer/ShieldedTransferCoordinator.swift
  • DashWallet/Sources/UI/Payments/Pay/SendScreen.swift
  • DashWallet/Sources/UI/Payments/Pay/SendViewModel.swift

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@romchornyi romchornyi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)) ?? 0

The 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.

@llbartekll
llbartekll merged commit 9a30093 into develop Aug 25, 2026
2 checks passed
@llbartekll
llbartekll deleted the fix/shielded-fee-instance-api branch August 25, 2026 17:01
@llbartekll
llbartekll restored the fix/shielded-fee-instance-api branch August 25, 2026 17:02
@llbartekll
llbartekll deleted the fix/shielded-fee-instance-api branch August 25, 2026 17:06
llbartekll added a commit that referenced this pull request Aug 26, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants