Conversation
Ports the shielded token purchase from SwiftExampleApp (#6090) to the Kotlin SDK and KotlinExampleApp. - rs-unified-sdk-jni: ShieldedTokenPurchaseNative exports for the purchase and for whether a token can be bought that way, each one call into platform-wallet-ffi. - kotlin-sdk: PlatformWalletManager.shieldedTokenPurchaseFromPool and shieldedTokenPurchaseAvailability, ShieldedTokenPurchaseAvailability and ShieldedProver.FeeKind.TokenPurchaseFromPool (fee kind 5). - KotlinExampleApp: the Direct Purchase form offers "Pay with: Shielded pool" only on Rust's availability answer, reports an accepted purchase as submitted (a shielded sync confirms it once it lands), and Shielded Activity lists the Token Purchase row, saying the tokens were minted only once it is Confirmed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 19 minutes. View limit details
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. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🔍 Review in progress (commit a149ef8) · live progress |
thepastaclaw
left a comment
There was a problem hiding this comment.
⚠️ DEGRADED — Final validation — Phase 1 + Phase 2
⚠️ DEGRADED review. The primary review models were unavailable (gpt-6.2-solunavailable: Request rejected (429) · All credentials for model gpt-6.2-sol are cooling down (last error: usage_limit_reached: The us), so this review ran on stand-in models:gpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor. Both review phases and the independent verifiers still ran, but on weaker models, with Phase 1 capped athigheffort. Treat the verdict as provisional; a full-strength re-review will run on the next push once the primary models are back.
Nothing blocks: no blocking finding stands on this head.
Kotlin parity port of Swift #6090 for Type 28 shielded token purchases via two marshal-only JNI exports, thin Kotlin wrappers, and a Direct Purchase Pay-with flow. CI is still running (Kotlin SDK build + tests and Rust workspace tests in progress) with no failed checks reported on this head.
🟡 2 suggestion(s) | 💬 1 nitpick(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: general); reviewer 3: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: architecture-layering); reviewer 4: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: general); reviewer 6: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: architecture-layering); reviewer 7: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: ffi-engineer); final verifier: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: sol-verifier, role: final-verifier)
- Degraded mode:
gpt-6.2-solunavailable: Request rejected (429) · All credentials for model gpt-6.2-sol are cooling down (last error: usage_limit_reached: The us (detected by probe, since 2026-11-23T09:07:27Z); stand-insgpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor; Phase 1 effort capped athigh - Triage:
normalbymuse-spark-1.3-contributor(standing in forgpt-6.2-sol) (effort low) — Adds a new Kotlin UI purchase path plus JNI marshaling wrappers with tests, a cross-cutting but non-consensus change reusing existing Rust logic. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 0% left) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — final-verifier; agentsol-verifier - Phase 2 reviewers:
muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — general (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — architecture-layering (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — ffi-engineer (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — general (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — architecture-layering (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — ffi-engineer (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/tokens/TokenActionScreens.kt`:
- [SUGGESTION] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/tokens/TokenActionScreens.kt:861-934: Backing out during the minute-long shielded proof discards the submitted / do-not-retry notice
Impact: A buyer who presses back while the shielded purchase is proving never sees the submitted dialog and may pay for the same tokens twice.
The consequence is a lost safety-critical instruction, not just a lost spinner. The shielded purchase proves for a minute or more, and the whole do-not-retry contract depends on the notice dialog held in TokenActionViewModel and shown after the blocking call returns. Nothing blocks removal while viewModel.isSubmitting: TokenActionScaffold's top-app-bar back button at TokenActionScaffold.kt pops unconditionally and there is no BackHandler in PurchaseForm. On pop the entry-scoped ViewModel is cleared (documented in TokenActionScaffold.kt), so when the blocking FFI call returns the notice/completed state lands on a discarded ViewModel and the buyer never learns the purchase was submitted and must not be retried. Re-entering the form and buying again is then one deliberate tap away. Follow the existing DecisionProposalsScreen/MultipleChoiceProposalsScreen pattern: block system back while submitting and disable the toolbar back for the same reason.
- [NITPICK] packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/tokens/TokenActionScreens.kt:725-756: Funding choice persisted as an enum ordinal breaks if the enum is reordered
Impact: If PurchaseFundingSource ever gains or reorders entries, a saved ordinal from a rotated or restored form could reselect the wrong funding source or crash on entries[fundingOrdinal].
The consequence is only a wrong preselected Pay-with option (or an out-of-bounds crash) after process recreation plus an app update. fundingOrdinal stores PurchaseFundingSource.ordinal via rememberSaveable and restores with entries[fundingOrdinal] with no bounds check, only a takeIf fallback for disallowed sources. Persist the name (or a boolean isShielded) instead of the ordinal.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- [SUGGESTION] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2324-2375: Token position outside 0..65535 reaches JNI instead of failing fast in Kotlin
Impact: A caller passing a negative or >65535 tokenPosition to the new shielded purchase wrappers gets a native DashSDKException instead of the IllegalArgumentException every other token entry point raises.
The consequence is an inconsistent error surface for the same bad input. Tokens.kt centralizes this in validateSelectors (0..0xFFFF), and the new JNI layer re-validates with u16::try_from via read_token_position, so the value is safe but the failure mode differs: shieldedTokenPurchaseFromPool and shieldedTokenPurchaseAvailability check account and 32-byte ids with require but have no tokenPosition require, leaving the u16 range enforced only across the JNI boundary. Add the same require to both wrappers before mapNativeErrors.
|
Bots are done — your move: post |
…result is read Review of the shielded token purchase port. - The purchase form blocks system Back and disables the toolbar Back while a purchase is being submitted. Leaving popped the entry and cleared its view model, so the message a shielded purchase ends with (submitted, do not buy again) was never shown. - The funding choice is saved as the enum value, not its ordinal. - `shieldedTokenPurchaseFromPool` and `shieldedTokenPurchaseAvailability` refuse a token position outside 0..65535 before the native call, with the error `Tokens` raises for it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
⚠️ DEGRADED — Re-review — Final validation — Phase 1 + Phase 2
⚠️ DEGRADED review. The primary review models were unavailable (gpt-6.2-solunavailable: All credentials for model gpt-6.2-sol are cooling down (last error: usage_limit_reached: The usage limit has been reache), so this review ran on stand-in models:gpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor. Both review phases and the independent verifiers still ran, but on weaker models, with Phase 1 capped athigheffort. Treat the verdict as provisional; a full-strength re-review will run on the next push once the primary models are back.
Nothing blocks: no blocking finding stands on this head.
New on this head: Head bee8363 keeps the Direct Purchase form open until its submitted/do-not-retry notice is dismissed and adds fail-fast token-position checks. Kotlin SDK build plus x86_64 emulator tests pass; Rust workspace tests are still pending with no failure attributed to this change.
💬 2 nitpick(s)
1 finding(s) not shown inline (the lines are not part of this PR's diff)
💬 Nitpick: Activity entity KDoc still lists kind tags 0-9 after kind 10 was added
Impact: A reader of the persistence entity misses that a shielded token purchase is stored as kindTag 10 with the token id as counterparty.
packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/entities/ShieldedActivityEntity.kt:29-33
The consequence is stale documentation only. The KDoc enumerates tags 0-9, but this change stores token purchases as kindTag 10 (Rust ShieldedActivityKind::TokenPurchase, matched by KIND_TOKEN_PURCHASE = 10 in the activity screen), with the token id as counterparty. Update the comment to name tag 10.
/**
* `ShieldedActivityKind::tag`: 0 Shield, 1 ShieldFromAssetLock,
* 2 Received, 3 Sent, 4 Unshield, 5 Withdrawal, 6 IdentityCreate,
* 7 ShieldedSpend, 8 ShieldFromIdentity, 9 IdentityTopUpFromPool,
* 10 TokenPurchase.
*/
source: muse-spark-1.3-contributor (phase2-reviewer: general)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: general); reviewer 3: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: architecture-layering); reviewer 4: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: ffi-engineer); reviewer 5: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: general); reviewer 6: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: architecture-layering); reviewer 7: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: phase2-reviewer, role: ffi-engineer); final verifier: muse-spark-1.3-contributor (standing in for gpt-6.2-sol) (agent: sol-verifier, role: final-verifier)
- Degraded mode:
gpt-6.2-solunavailable: All credentials for model gpt-6.2-sol are cooling down (last error: usage_limit_reached: The usage limit has been reache (detected by probe, since 2026-11-23T09:07:27Z); stand-insgpt-5.6-luna→muse-spark-1.3-contributor,gpt-5.6-sol→muse-spark-1.3-contributor,gpt-5.6-terra→muse-spark-1.3-contributor,gpt-6-astra→muse-spark-1.3-contributor,gpt-6.1-sol→muse-spark-1.3-contributor,gpt-6.2-astra→muse-spark-1.3-contributor,gpt-6.2-sol→muse-spark-1.3-contributor; Phase 1 effort capped athigh - Triage:
normalbymuse-spark-1.3-contributor(standing in forgpt-6.2-sol) (effort low) — Large UI plus JNI wiring change that reuses existing Rust purchase logic without changing consensus, crypto, or funds-selection rules itself. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 0% left) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — final-verifier; agentsol-verifier - Phase 2 reviewers:
muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — general (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — architecture-layering (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — ffi-engineer (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — general (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — architecture-layering (completed, effort high); agentphase2-reviewer,muse-spark-1.3-contributor(standing in forgpt-6.2-sol) — ffi-engineer (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/entities/ShieldedActivityEntity.kt`:
- [NITPICK] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/persistence/entities/ShieldedActivityEntity.kt:29-33: Activity entity KDoc still lists kind tags 0-9 after kind 10 was added
Impact: A reader of the persistence entity misses that a shielded token purchase is stored as kindTag 10 with the token id as counterparty.
The consequence is stale documentation only. The KDoc enumerates tags 0-9, but this change stores token purchases as kindTag 10 (Rust ShieldedActivityKind::TokenPurchase, matched by KIND_TOKEN_PURCHASE = 10 in the activity screen), with the token id as counterparty. Update the comment to name tag 10.
In `packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt`:
- [NITPICK] packages/kotlin-sdk/sdk/src/main/kotlin/org/dashfoundation/dashsdk/wallet/PlatformWalletManager.kt:2310-2313: Purchase KDoc names only one of the do-not-retry errors
Impact: A caller reading only the purchase KDoc could retry on TransactionBroadcastUnconfirmed or StateTransitionResultUnconfirmed, which also mean the purchase may have reached a node.
The consequence is a misleading retry contract in docs only. The KDoc says ShieldedSpendUnconfirmed means do-not-retry and every other error means nothing was sent, but the example app correctly treats TransactionBroadcastUnconfirmed and StateTransitionResultUnconfirmed the same way through shieldedOperationMayHaveGoneThrough, and the FFI test distinguishes a zero-count refusal from either unconfirmed error. Broaden the KDoc to name all three may-have-gone-through errors.
…ase caller must not retry on Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…le-shielded-token-purchase Conflicts: the read-only tag list in the Kotlin TEST_PLAN.md keeps both DOC-17 and SH-25; PARITY_SUMMARY.md is regenerated from the merged manifest. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
…le-shielded-token-purchase Conflicts: the tier counts of the Kotlin TEST_PLAN.md add both sides' rows (SH-24 here, DPNS-09..13 from the base); PARITY_SUMMARY.md is regenerated from the merged manifest. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…le-shielded-token-purchase Conflicts: the read-only tag list of the Kotlin TEST_PLAN.md keeps both sides' rows (SH-25 here, ADDR-10 and ADDR-11 from the base), and PARITY_SUMMARY.md is regenerated from the merged manifest. Both sides had raised the Common tier count from 29 to 30 for a different row, which merged as one change; it is 31. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…le-shielded-token-purchase Conflicts: an import beside the identity removal one in PlatformWalletManager.kt (both kept); the tag lists of the Kotlin TEST_PLAN.md keep both sides' rows (SH-25 here, ID-18 from the base); PARITY_SUMMARY.md is regenerated from the merged manifest. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…le-shielded-max-drain Conflicts with the shielded token purchase port (#6131) in the Kotlin TEST_PLAN.md: both sides' rows are kept (SH-18..20 here, SH-24 and SH-25 from the base) and the counts add both. Both sides had raised the Common tier count from 30 to 31 for a different row, which merged as one change; it is 32. PARITY_SUMMARY.md is regenerated from the merged manifest. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Basic explanation
What this does: KotlinExampleApp's Direct Purchase screen can now pay from the wallet's shielded balance instead of the identity's credits, using
TokenPurchaseFromShieldedPool(state transition type 28). This is the Android side of what SwiftExampleApp got in #6090. The wallet's shielded notes pay the price and a fee; the tokens are minted as a note to the wallet's own address in the token's shielded pool. No identity is involved.Before: the form's only option was to debit the identity's credits.
After: when Rust reports that the token has a shielded pool, a Pay with control offers Identity credits (unchanged) or Shielded pool. The shielded option shows the shielded balance, the pool fee estimate and price plus fee. A purchase that Platform accepts is reported as submitted, and a shielded sync confirms it once it lands.
Risks: Low. No Rust wallet, FFI, Drive or DPP change: the Rust side from #6090 is used as it is, through two new JNI exports that only marshal. The identity-credit purchase path is unchanged apart from its Buy button's test tag (see Public interface changes).
The figures illustrate the layout; they are not from a run.
Not yet verified
partialwith restartrequired.DecisionProposalsScreenalready uses.Issue being fixed or feature implemented
docs/sdk/sdk-parity-manifest.jsonlistedshielded.token_purchase_from_poolasunsupportedfor both the Kotlin SDK and KotlinExampleApp: "No JNI wrapper or KotlinExampleApp flow for the shielded token purchase yet." Swift reference: #6090 (TEST_PLAN SH-24).No open PR or issue covers the Kotlin side.
What was done?
Every conclusion of #6090's review carries over, because the decisions live in the Rust code this calls and Kotlin adds none of its own:
ShieldedTokenPurchaseOutcome::Submittedand keeps the purchase pending until the credit pool scan finds the fee bundle's change note. Kotlin shows exactly that: the dialog says submitted, the activity row stays Pending, and the row says the tokens were minted only once its stored status is Confirmed.shieldedTokenPurchaseAvailabilityreturns available. No shielded pool and configuration unreadable are shown apart, the second with Retry.rs-unified-sdk-jnishielded_token_purchase.rswith two exports, each one call intoplatform-wallet-ffi.kotlin-sdkPlatformWalletManager.shieldedTokenPurchaseFromPool(...)andshieldedTokenPurchaseAvailability(...),ShieldedTokenPurchaseAvailability, andShieldedProver.FeeKind.TokenPurchaseFromPool(fee kind 5).KotlinExampleApp
PurchaseForm(TokenActionScreens.kt) gains the Pay with choice, the shielded section and the shielded submit; the new pieces are inShieldedTokenPurchase.kt.TokenActionViewModel, so it survives a rotation and the form closes only when it is dismissed.tokenPurchase.fundingSource,tokenPurchase.buyButton,tokenPurchase.shieldedBalance,tokenPurchase.shieldedTokensNote,tokenPurchase.shieldedUnavailable.Docs: Kotlin
TEST_PLAN.mdrows SH-24 (mirrors Swift SH-24) and SH-25 (mirrors Swift SH-25: shielded token balances, not implemented); the manifest entry and regeneratedPARITY_SUMMARY.md.Not included: showing or spending the bought tokens. The wallet syncs only the credit shielded pool, so the tokens are on chain but not shown, and the form and the test plan say so. Token pool note sync is being built separately. Types 26 and 27 are not ported, as on iOS.
Public interface changes
JNI:
org.dashfoundation.dashsdk.ffi.ShieldedTokenPurchaseNative(new, internal)purchaseFromPool(managerHandle, walletId, resolverHandle, account, dataContractId, tokenPosition, tokenCount, totalAgreedPrice)platform_wallet_manager_shielded_token_purchase_from_pool. Returning means submitted. Throws as the other note-spending exports do.availability(managerHandle, dataContractId, tokenPosition): Intplatform_wallet_manager_shielded_token_purchase_availability: 0 available, 1 no shielded pool, 2 configuration unreadable. Throws when the question could not be asked.tokenCountandtotalAgreedPriceare unsigned 64-bit values passed as their two's-complementLong. A wallet or contract id that is not 32 bytes, a negative account and a token position outside 0 to 65535 are refused before any wallet code runs. No callback slot is added.Kotlin API
suspend fun PlatformWalletManager.shieldedTokenPurchaseFromPool(walletId, contractId, tokenPosition, tokenCount: ULong, totalAgreedPrice: ULong, account = 0). Returns when Platform accepted the purchase, which means submitted, not confirmed. ThrowsDashSdkError.PlatformWallet.ShieldedSpendUnconfirmedonce the purchase may have reached a node (do not retry); every other error means nothing was sent.suspend fun PlatformWalletManager.shieldedTokenPurchaseAvailability(contractId, tokenPosition): ShieldedTokenPurchaseAvailability.tokenPositionoutside 0..65535 with anIllegalArgumentExceptionbefore the native call, asTokensdoes.enum class ShieldedTokenPurchaseAvailability { Available, NoShieldedPool, ConfigurationUnreadable }. A byte this build does not know is read asConfigurationUnreadable, never asAvailable.ShieldedProver.FeeKind.TokenPurchaseFromPool(raw 5) forestimateShieldedFee.KotlinExampleApp
TokenActionScaffoldgainssubmitTestTag: String = "tokenAction.submitButton". The Direct Purchase form passestokenPurchase.buyButton, Swift's identifier, for both funding sources, so the Buy button's test tag on that one form changes fromtokenAction.submitButton. Every other token action keeps the old tag.TokenActionViewModelgainsnotice,showNoticeUntilDismissed(message)anddismissNotice().TokenActionScaffoldgainsbackBlocked: Boolean = false, which blocks system Back and disables the toolbar Back. The Direct Purchase form sets it while a purchase is being submitted and until its outcome message is dismissed, for both funding sources: leaving would clear the view model that shows the "submitted, do not buy again" message. Every other token action is unchanged.Room
No table, column or version change. A token purchase is a
shielded_activitiesrow withkindTag = 10and the token's id ascounterparty, both of which the existing columns and callbacks already carry.How Has This Been Tested?
cargo fmt --all: clean.cargo clippy -p rs-unified-sdk-jni --all-targets --all-features --locked -- --no-deps -D warnings: clean.cargo test -p rs-unified-sdk-jni --all-features --lib: 86 passed../gradlew :sdk:testDebugUnitTestforShieldedTokenPurchaseAvailabilityTest(3),ShieldedTokenPurchaseActivityPersistenceTest(2) andPlatformWalletPersistenceHandlerTest: all passed. They cover each availability byte, an unknown byte never reading as available, fee kind 5, a pending purchase row (kind 10, token id as counterparty, change note and reserved nullifiers) restored by a new handler over the same database, and a later status replacing that row../gradlew :app:testDebugUnitTestforShieldedTokenPurchaseTest(8) andTokenDirectPurchasePricingTest(17): all passed. They cover the shielded payment offered only on Rust's available answer, the reason shown for each other answer and when Retry is offered, when Buy is enabled, an accepted purchase reported as submitted and never as complete, a purchase that may have reached a node reported without a retry, an error that sent nothing passed on to the error dialog, and the activity row saying the tokens were minted only when Confirmed../build_android.sh --abi arm64: built; the library exports the twoShieldedTokenPurchaseNativesymbols../gradlew :sdk:connectedDebugAndroidTestfiltered toFfiSmokeTestandShieldedTokenPurchaseFfiTest: 14 of 14 passed, re-run on the review commit with a rebuilt library. The new ones show that both exports bind, that an invalid manager handle throws the mapped error, that arguments of the wrong size or range are refused before any wallet code runs, and, through a real manager and an unfunded wallet, that the fee estimate for kind 5 is a positive number, both wrappers refuse a token position of -1 or 65536 with anIllegalArgumentException, and a purchase of zero tokens is refused as "nothing sent" (not as a spend that may have gone through) with no activity row left behind.python3 scripts/check_sdk_parity_manifest.py --write-summary: OK.See "Not yet verified" for what has not run.
Breaking Changes
None. No protocol, consensus, C ABI, Room or persisted-format change. The one visible change is the Direct Purchase form's Buy button test tag (see Public interface changes).
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
5a34be9/skip-botsproceeds without the ones not yet reported/self-reviewedsdk-parity— you own itkotlin-sdk(packages/kotlin-sdk/KotlinExampleApp/TEST_PLAN.md,packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/shielded/ShieldedActivityScreen.kt,packages/kotlin-sdk/KotlinExampleApp/app/src/main/java/org/dashfoundation/example/ui/tokens/ShieldedTokenPurchase.ktand 15 more) — HashEngineeringWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.