Skip to content

feat(sdk): strict variant of get_contested_non_resolved_usernames for the active-contests listing #5872

Open

Description

@romchornyi

Expected Behavior

A client listing the open DPNS username contests can tell a complete listing from one with contests missing, so it can show "Couldn't load all contests — Try again" instead of a quietly shorter list.

Current Behavior

Sdk::get_contested_non_resolved_usernames (packages/rs-sdk/src/platform/dpns_usernames/contested_queries.rs) calls non_resolved_dpns_contests(limit, skip_failed: true): a contest whose vote state cannot be read is left out of the result, and the call still returns Ok.

The FFI dash_sdk_dpns_get_contested_non_resolved_usernames (packages/rs-sdk-ffi/src/dpns/queries/contested.rs) and the Swift SDK.dpnsActiveContests(limit:) (packages/swift-sdk/Sources/SwiftDashSDK/Voting/SDK+DPNSContests.swift) pass that through. A wallet's username-voting list therefore treats a partial or empty listing as a successful load: contests silently disappear and the user is not offered "Try again".

The identity-scoped query already has both shapes (get_non_resolved_dpns_contests_for_identity and get_non_resolved_dpns_contests_for_identity_strict); the network-wide listing has only the lenient one.

Possible Solution

Add get_contested_non_resolved_usernames_strict, failing with the first vote-state error like the identity _strict variant, and expose it through a new FFI entry point and a Swift wrapper.

Alternatives Considered

Return the names whose vote state could not be read next to the listing (e.g. skipped: Vec<String>), so a client can show the list and say it is incomplete. This keeps the list usable when one contest's read fails, at the cost of a wider API change.

Additional Context

Found in review of dashpay/dashwallet-ios#1328 (username voting redesign); the wallet side is deferred until the SDK can report it.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions