Skip to content

Consume imported note files immediately #123

@krwang

Description

@krwang

Feature description

Currently, the import private note feature only adds the note file to the web client db. The consumption of the note is handled separately. This leads to a few observable behaviors:

  • The note file being added to the client db does not guarantee that the note will appear in the wallet as claimable. The wallet polls the getClaimableNotes endpoint for the note and marks the note file as "verified".
  • If a note is not claimable by the account, the getClaimableNotes polling will timeout after 20 seconds and a "failed import" screen is shown
  • Malformed .mno files or other file types are properly rejected, and an console error is logged with a detailed error from the web client

For the adapter importPrivateNote endpoint:

  • The error for malformed .mno files or other file types is not propagated through the adapter endpoint, which shows a generic error message (see Wallet adapter discards private note import errors #109)
  • importPrivateNote currently only adds the note to the client db. It then relies on the wallet to handle the consumption
  • Therefore, the adapter will return a success response as long as the note is accepted into the client db, regardless of claimability
  • I think this is a major point of confusion, as users likely expect importPrivateNote to consume the note

If the wallet attempts to claim the note before returning a response, I believe most of these issues will be resolved. Specifically, the import private note flow can do the following:

  • add the note file to the client db
  • (if necessary) poll for the note to appear as claimable
  • create/execute/prove the consume transaction (we can check whether the note is consumable here)
  • submit and apply the transaction

The adapter endpoint can wait for at least the prove step before returning a response, so that the user receives a response that more accurately portrays the consumability of the imported note, rather than the current indication of it being added to the client db.

As an extension, the adapter could provide controls over whether the consume transaction is automatically submitted to the node, but that is out of scope.

Why is this feature needed?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions