Skip to content

Expose asset-lock drain (send-all) through the identity top-up FFI, and return the L1 funding txid #4252

Description

@HashEngineering

Problem. IdentityCredits.topUpFromCore / topUpIdentityFromCore is exact-amount only, so a wallet cannot offer "Max" (empty-wallet) identity top-ups through the SDK. The Rust builder work already exists — rust-dashcore #915 (9c87ccb3) added drain mode to the asset-lock builders — but it is unreachable from the SDK:

  1. The platform workspace pins rust-dashcore rev 70d4bf8e (root Cargo.toml:55-62), which is 5 commits older than 9c87ccb3 and predates the feature entirely (git merge-base --is-ancestor verified).
  2. Even at rust-dashcore tip, the single key-wallet FFI entry point serving registration AND top-up — wallet_build_and_sign_asset_lock_transaction (key-wallet-ffi/src/transaction.rs:770) — deliberately pins the old behavior: it passes AssetLockFundingAccount::Bip44 { account_index } and drain = false (transaction.rs:841-849; the feat(rs-drive-abci)!: commit and vote extensions signature verification #915 commit message says so explicitly).

Ask.

  • Bump the platform rust-dashcore pin past 9c87ccb3.
  • Extend the key-wallet FFI (new entry point or versioned signature) with drain: bool and the funding-account family selector, honoring feat(rs-drive-abci)!: commit and vote extensions signature verification #915's invariants (drain requires exactly one credit output; fee deducted from the locked amount; CoinJoin funding is drain-only).
  • Plumb through rs-platform-wallet-ffitopUpIdentityFromCore → Kotlin IdentityCredits.topUpFromCore (and the Swift equivalent) as e.g. sendAll: Boolean (drain ⇒ amountDuffs ignored/0).

While touching this FFI: return the L1 funding txid. topUpIdentityFromCore returns only the post-transition credit balance. The host wallet needs the asset-lock txid to show the transaction (result screen, tx list) — today it must diff the asset_locks persistence table around the call, which is heuristic under concurrency. A (balance, outpoint) return (or out-param) removes that. Same applies to the registration/invite variants for consistency.

Wallet impact. dash-wallet gates Max top-ups off on the SDK route until this lands (SdkTopUpService KDoc references this issue); exact-amount top-ups are unaffected.



Context: dashpay/dash-wallet#1520 (SDK cutover Phase 1B, asset-lock sends) / MO-998. Findings verified against integration/kotlin-sdk-stack + rust-dashcore dev @ 9c87ccb3.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions