-
Notifications
You must be signed in to change notification settings - Fork 0
Description
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
getClaimableNotesendpoint for the note and marks the note file as "verified". - If a note is not claimable by the account, the
getClaimableNotespolling 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)
importPrivateNotecurrently 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
importPrivateNoteto 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