Skip to content

feat(dashpay): join DashPay from the Shielded balance with readiness UX - #801

Merged
QuantumExplorer merged 2 commits into
swift-sdk-integrationfrom
feat/shielded-dashpay-join
Jul 15, 2026
Merged

QuantumExplorer merged 2 commits into
swift-sdk-integrationfrom
feat/shielded-dashpay-join

Conversation

@QuantumExplorer

Copy link
Copy Markdown
Member

What

Makes the shielded (Orchard) balance the default funding source for DashPay identity creation, with Core and Platform Payment remaining as explicit transparent options — and builds the UX around the two constraints that make private registration work:

  1. the funding notes should be hours old (timing separation between your deposit and your public username), and
  2. the shielded pool must hold ≥ 250 notes before outgoing transitions are accepted.

Funding path

  • DWIdentityFundingSource gains .shielded (raw 2, appended). The coordinator routes it through the SDK's shieldedIdentityCreateFromPool (Type 20): it spends a fixed consensus exit denomination — 0.1 DASH standard, 0.3 DASH for contested names (≥ the 0.25 requirement). The metered fee is taken from the denomination, so the new identity starts at denomination − fee; excess spent value returns to the pool as change.
  • The REQUIRED Type-20 creation-failure fallback is the wallet's lowest-indexed Platform Payment address (same [type]+hash encoding as the address-funded inputs).
  • ShieldedIdentityCreateUnconfirmedError maps to a distinct, non-immediately-retryable error. The Rust side arms a persisted redrive for the ambiguous case; if the create actually landed, the next attempt resumes past IdentityCreate via the existing lookupExistingIdentityId path.
  • DWRegistrationPhaseAdapter treats .shielded like .platformPayment (no asset-lock; .inFlight → Creating ID). Compile-ready adapter tests added for the new case.

Readiness model — ShieldedIdentityFundingReadiness

Single source of truth read by the banner, the interstitial, and the form. Priority-ordered gates:

Gate Basis Behavior
Funding unspent PersistentShieldedNote sum ≥ denomination needsFunding(shortfall)
Maturity app-side privacy policy (no protocol rule): covering notes must rest 3 h (10 min in DEBUG so the flip is QA-able) — computed oldest-first from createdAt, so readyAt is exact maturing(readyAt) + one-shot re-eval timers
Pool ≥ 250 client mirror of consensus minimum_pool_notes_for_outgoing, latched from the shielded sync's tree-progress signal (currentShieldedTreeTotal) poolTooSmall(n); unknown count fails open — Drive enforces the real rule and its error is surfaced

Restored wallets re-observe old notes as new, so the maturity gate over-waits — the safe direction for a privacy timer.

UX — start the privacy clock at first intent

  • Get-ready interstitial (JoinDashPayReadinessScreen): Join DashPay entry points route here whenever shielded isn't ready. Live checklist — add ≥ 0.1 DASH (button opens the Shielded-balance transfer screen pre-filled with the shortfall + 0.001 DASH fee headroom), let it rest a few hours (ready-at time), pool minimum (auto-met on testnet's pre-seeded pool; “Verified during registration” when the count is unknown). Continue unlocks at ready; a "Use transparent balance instead" escape (shown only when transparent funding can actually complete) preserves the old paths as an informed choice.
  • Home banner nudge: the Join DashPay callToAction subtitle tracks readiness — "Add to your Shielded balance now and register privately a few hours later" → "resting until HH:MM" → "ready". This is the deposit-hours-before-you-join prompt, visible before the user enters the flow.
  • Create Username: three-way funding picker (Shielded default whenever ready, then Platform, then Core; explicit user picks are respected), an inline readiness hint while shielded is unavailable, and a one-line privacy footnote per source ("can't be linked" vs "publicly links").
  • Join DashPay info dialog: new "Private by design" feature row sets the two-step expectation up front; Continue no longer hard-requires a transparent balance (the shielded route starts by adding funds).

Not in scope

  • No platform/SDK changes — every API used is already on v4.1-dev (no xcframework rebuild needed).
  • Invitation-funded registration (existing teardown decision) untouched.
  • The legacy ObjC shouldShowCreateUserNameButton core-balance gate is left as-is; the live entry point (banner) isn't balance-gated.

Verification

  • dashpay Debug arm64-sim build green at each phase and at the final tree (plutil -lint clean on pbxproj; en strings lint clean, additions purely additive).
  • Unit-test target remains pre-existing broken; adapter tests are compile-ready documentation-as-tests.

QA smokes (PIN-gated — need a driver)

  1. Fresh testnet wallet with 0 shielded: Join DashPay banner → interstitial shows shortfall → Add → transfer screen pre-filled → after deposit lands, row 1 ✓ and row 2 shows ready-at (10 min on DEBUG).
  2. After maturity: banner flips to "ready", interstitial Continue unlocks, Create Username picker defaults to Shielded; register a username and confirm the identity + DPNS name land (identity starts at ~0.1 DASH minus fee).
  3. Transparent escape: with core balance ≥ 0.03 and no shielded, "Use transparent balance instead" → form pins to Core; registration behaves as before.
  4. Contested name (≤19 chars): requirement flips to 0.3 DASH — hint/denomination follow.

🤖 Generated with Claude Code

Make the shielded (Orchard) balance the default funding source for
DashPay identity creation, with Core and Platform Payment remaining as
explicit transparent options.

Funding path:
- DWIdentityFundingSource gains .shielded; the coordinator routes it
  through shieldedIdentityCreateFromPool (Type 20), spending a fixed
  consensus exit denomination (0.1 DASH standard, 0.3 DASH contested —
  the fee is metered FROM the denomination). The Type-20 fallback
  address is the wallet's lowest-indexed Platform Payment address, and
  the broadcast-unconfirmed outcome maps to a distinct non-retryable
  error (the SDK arms a sync-time redrive; a landed identity resumes
  past IdentityCreate on retry).

Readiness gates (ShieldedIdentityFundingReadiness, single source of
truth for banner + interstitial + form):
1. funding — unspent notes >= denomination;
2. maturity — app-side privacy policy: the covering notes must rest
   for 3 h (10 min in DEBUG for QA) so the deposit and the public
   identity creation are separated in time;
3. pool size — client mirror of the consensus minimum
   (minimum_pool_notes_for_outgoing = 250), latched from the shielded
   sync's tree-progress signal; unknown count fails open with Drive as
   the enforcing backstop.

UX ("start the privacy clock at first intent"):
- Join DashPay entry points route through a new get-ready interstitial
  whenever shielded isn't ready: live checklist (fund → rest → pool),
  an Add button that opens the Shielded-balance transfer screen
  pre-filled with the shortfall (+0.001 DASH fee headroom), and a
  transparent-balance escape hatch.
- The home banner subtitle tracks readiness (add now / resting until
  HH:MM / ready), so the "deposit hours before you join" step is
  visible before the user ever enters the flow.
- Create Username gets a three-way funding picker (Shielded default
  when ready) with an inline readiness hint and a one-line privacy
  footnote per source.

Co-Authored-By: Claude Fable 5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jul 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a23c8693-2a46-4518-9dcd-52b6e1a08dc8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/shielded-dashpay-join

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.

The feature branch builds green against today's origin/v4.1-dev tip
(five commits past the previous verified pin, including the breaking
managed-identity-top-up #4093, which removed only legacy SDK.identityTopUp
surfaces the app never called). Xcframework sim slice rebuilt and
freshness-checked before the verification build.

Co-Authored-By: Claude Fable 5 <[email protected]>
@QuantumExplorer
QuantumExplorer merged commit e0b150a into swift-sdk-integration Jul 15, 2026
1 check passed
QuantumExplorer added a commit that referenced this pull request Jul 16, 2026
… merge-dropped l10n (#808)

* fix(l10n): restore en source strings dropped by the release-8.7.0 merge

The merge commit 1ca07eb resolved DashWallet/en.lproj/Localizable.strings
mostly to master's side, silently dropping 203 integration-branch entries.
English UI kept rendering via the NSLocalizedString key fallback, but the
Transifex source lost the strings.

This restores the 34 dropped entries that are still referenced by an exact
NSLocalizedString key in the current tree (shielded-DashPay Usernames
strings from #801, Log export strings from #802, and DashPay registration
strings), inserted in the file's case-insensitive key order with their
original comment blocks. The file stays UTF-8.

Deliberately not restored:
- 160 dropped keys with no remaining NSLocalizedString reference (their
  call sites no longer exist on this branch)
- the SPV-diagnostics entries from #804: fix/birth-height-chain-resync
  restores/rewords that screen's strings, and re-adding the old wordings
  here would only orphan them when that PR lands

Co-Authored-By: Claude Fable 5 <[email protected]>

* fix(l10n): restore DashPay contacts/invitations source strings

Restores the 37 contacts- and invitations-flow entries that the
release-8.7.0 merge (1ca07eb) dropped from the en source file. Their
call sites were deleted when the contacts subsystem was rebuilt on
SwiftDashSDK (#787), but the flows are about to be redone now that
invitations live in the Dash SDK — keeping the entries preserves the
Transifex source (and existing translations) for that rework.

Selection rule: dropped keys whose last call site lived under
DashWallet/Sources/UI/DashPay/{Contacts,Notifications,Items,Profile}
or in a DWDP* contact view, as of the tree before the #787 rebuild.
Inserted in the file's case-insensitive key order with their original
comment blocks; file stays UTF-8.

Co-Authored-By: Claude Fable 5 <[email protected]>

* feat(invitations): rebuild the DashPay invitation claim on SwiftDashSDK

Resolves teardown item T1's accept arm as PORT (INVITATIONS_REBUILD_PLAN.md
is the full plan; the create/history/reclaim side follows). Invitations are
DIP-13 vouchers, cross-platform-compatible with Android's shipping
implementation (dashpay://invite?du/assetlocktx/pk/islock).

Distribution is paste/scan-first with no third-party services: the invitee
installs the app, then redeems by QR scan or paste ("Have an invitation?"
in the Join DashPay dialog), or via a dashpay:// / applink deep link when
the app is already installed. No AppsFlyer, no hosted link infrastructure.

New:
- DWInvitationLinkNormalizer — canonicalizes dashpay://invite, legacy
  invitations.dashpay.io/applink, and Android OneLink long-URLs (af_dp
  unwrap; keys tried in Android's order) down to the URI the SDK parser
  accepts. Obj-C-visible for the AppDelegate routing gate.
- DWInvitationService — protocol-seamed facade: normalize, parse/preview,
  local-identity gate, post-claim contact request to the du inviter (DPNS
  resolve + SwiftDashSDKContactsService, which owns the PIN gate and the
  lazy DashPay-key upgrade).
- ClaimInvitationScreen (+ ClaimInvitationFlow push glue) — paste field,
  QR scan sheet (GenericQRScannerView), inviter preview, inline invalid /
  already-registered states.
- DWIdentityRegistrationCoordinator.startClaimInvitation — fourth funding
  path (.invitation): same PIN gate, key pre-persist, DPNS register, phase
  reporting and identity-resume semantics; the claim consumes the INVITER's
  asset lock via wallet.claimInvitation (no local PersistentAssetLock).
- CreateUsernameView(Model) invitation mode: voucher funds the registration,
  so the balance cost rule and funding-source picker don't apply; success
  offers the inviter contact request; failures surface the SDK's typed
  claim errors.

Rewired / deleted:
- AppDelegate: dead FIRDynamicLinks handling removed (service shut down in
  2025 — it silently swallowed universal links); invitation URLs route
  directly. dashpay:// added to CFBundleURLSchemes.
- DashSync accept arm deleted: DWDashPayModel verifyDeeplink /
  createUsername:invitation: invitation branch / inviter friend-request via
  DSIdentitiesManager / invitationSteps; DWHomeModel deeplink passthrough;
  protocol surface narrowed to createUsername:.
- DashUIKit package retargeted import/final → master @ 046f0875 (matches
  release-8.7.0; the stale pin's tip no longer resolves).

Verified: clean dashpay arm64-sim builds under Xcode 26.3/Swift 6.2.4 and
Xcode 26.6/Swift 6.3.3; fresh-wallet simulator smoke of the full invitee
flow — menu entry → paste → parse/preview ("Invitation from …") → username
form (zero balance, live DPNS availability) → PIN gate → SDK claim against
testnet DAPI → typed funding-tx-not-found failure surfaced. Companion
platform change (invitation cap 0.05 → 0.25 DASH for Android's contested
tier) rides separately in dashpay/platform.

Co-Authored-By: Claude Fable 5 <[email protected]>

* docs(dashpay): record the translation-reuse audit in the invitations plan

All 42 lproj files carry translations for the legacy claim-flow strings
(already-claimed / invalid-invitation / invited-by-share copy) — the
claim error mapping and the create-side share sheet must reuse those keys
instead of minting new copy. The 37 restored contacts/invitations keys
turn out to be English source only (no repo translations survive).

Co-Authored-By: Claude Fable 5 <[email protected]>

---------

Co-authored-by: Claude Fable 5 <[email protected]>
@QuantumExplorer
QuantumExplorer deleted the feat/shielded-dashpay-join branch August 7, 2026 08:23
aliblik pushed a commit to aliblik/dashwallet-ios that referenced this pull request Nov 28, 2026
Brings the 4 new swift-sdk-integration commits (dashpay#799, dashpay#801, dashpay#802, dashpay#804:
shielded-spend resolver adaptation, Join DashPay from Shielded, in-app
diagnostic log export, imported-wallet genesis scan) onto the branch.

- 2 conflicts (project.pbxproj, en.lproj/Localizable.strings); the rest
  auto-merged. en.strings kept ours (release-8.7.0 strings); the 4 features'
  new keys are re-extracted by bartycrouch on build.
- Added the 3 new source files to targets: DiagnosticLogExporter (both),
  JoinDashPayReadinessScreen + ShieldedIdentityFundingReadiness (dashpay).
- Requires platform pinned at v4.1-dev tip dc1d645df4 (#4131 adds
  LoggingPreferences.logsRootDirectory); local ../platform bumped and the
  DashSDKFFI sim xcframework rebuilt.

Builds clean via the dashwallet-dashpay scheme (ARCHS=arm64).
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.

1 participant