Skip to content

platform-wallet: keep the document id on a synced ContactRequest #5597

Open

Description

@Claudius-Maginificent

TL;DR: When the wallet syncs a DashPay contact request it drops the request document's id, so apps fetch the request from the network again whenever they need to point at that document.

User story

As a wallet app developer, I want each contact request the wallet holds to carry the id of its document, so that I can refer to it (in logs, local records or follow-up actions) without querying Platform again.

Scenario

Base flow

  1. The background DashPay sync fetches the contact requests sent to and by an identity and stores them in the identity's DashPay state.
  2. The user acts on one of them, for example declines or withdraws it, and the app needs that request's document.

Actual behavior

The stored request has the sender, recipient, key indexes, account reference, payloads and timestamps, but not the document id. The app has to re-query Platform by owner and recipient to find the document.

Expected behavior

The stored request includes its document id, so the app can address the document directly.

Detailed discussion

On v5.1-dev @ 575d961fe0:

Downstream: Dash Evo Tool re-keyed its Accept / Decline / Cancel actions from the document id to the counterparty, and now re-fetches the request document by ($ownerId, toUserId) before each action. It still needs the document id to clear progress records older versions stored per document.

Proposed change

pub struct ContactRequest {
    // … existing fields …
    /// Id of the `contactRequest` document this entry was parsed from.
    /// `None` for entries built locally before the document was confirmed.
    pub document_id: Option<Identifier>,
}

Fill it in from the (doc_id, doc) pairs at the parse sites above, and carry it through persistence (changeset and SQLite schema), defaulting to None for stored rows. A send path that already knows the id after broadcast can set it there too.

Prior work

Attribution

🤖 Co-authored by Claudius the Magnificent AI Agent

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