fix: Cashu payment notes not showing in Activity and stale note state on success view#3856
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves critical issues affecting the visibility and state management of Cashu payments within the application. It ensures that all Cashu transactions are correctly displayed in the activity feed and that the user interface for creating new notes behaves as expected, preventing misleading 'Update note' prompts on initial creation. The changes enhance the reliability and user experience of Cashu functionalities. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses an issue where Cashu payment notes were not appearing in the Activity view and fixes a stale note state on the success view. The changes involve modifying the CashuPayment model to resolve the original invoice payment hash, updating the CashuStore to reset the note key, and adjusting the CashuSendingLightning view to handle cases where the note key is missing. Overall, the changes improve the reliability and user experience of Cashu payments.
aac2a6e to
11e857f
Compare
shubhamkmr04
left a comment
There was a problem hiding this comment.
I still can't see the notes created on CashuSendingLightning in the activity.
43767bd to
2a7d373
Compare
2a7d373 to
c8868ce
Compare
Description
Relates to issue: ZEUS-3838
Root Cause
After the migration from
cashu-tsto CDK (Cashu Dev Kit), the Activity view was sourcing outgoing Cashu payments fromcdkPayments— transaction objects returned by CDK's nativelistTransactions()API. CDK assigns its own internal transaction IDs (64-char hex hashes), which are completely unrelated to the invoice'spayment_hashthat the note was saved under.The flow was:
note-<invoice_payment_hash>(e.g.,note-5300bdf4...)payment_hash(e.g.,208227c3...)note-208227c3...— doesn't match the saved noteThe mint's quote IDs (base64url strings like
JPYH0VzsApUnqy_DiA7a0Z0ZYKznjqht53RcCf-p) and CDK's internal transaction IDs (hex hashes like208227c3e4dcfef1521c613fb3829c619371bf23f11c0e882e89b0d4154e6644) are two entirely different ID systems — there is no way to match between them.Fix
The Activity view now uses
this.payments(the app's own stored payment records) for outgoing Cashu payments instead ofcdkPayments(CDK's transaction history). We already persist aCashuPaymentto local storage after each successful payment inpayLnInvoiceFromEcash, carrying thebolt11invoice andpayment_hashfrom the original decoded invoice. These are loaded back on startup. Since the stored payments have the real invoicepayment_hash,getNoteKeyresolves to the same key that was used when saving the note.Note:
cdkInvoicesis still used for incoming (receive) transactions, since completed incoming invoices are only available from CDK's transaction history — unlike outgoing payments, which we store ourselves.This eliminated the need for
cdkPayments, thefromCDKTransactionfactory method onCashuPayment, all CDK transaction fields on the model (fromCDK,cdkTimestamp,cdkAmount,cdkMemo,cdkState), and the CDK-specific branches in the model's computed getters — a net simplification.The stale "Update Note" issue is fixed by resetting
noteKeyinresetPaymentStateand clearingstoredNotesin theCashuSendingLightningfocus listener whennoteKeyis absent.PR Type
This pull request is categorized as a:
Checklist
yarn run tscand made sure my code compiles correctlyyarn run lintand made sure my code didn’t contain any problematic patternsyarn run prettierand made sure my code is formatted correctlyyarn run testand made sure all of the tests passTesting
If you modified or added a utility file, did you add new unit tests?
I have tested this PR on the following platforms (please specify OS version and phone model/VM):
I have tested this PR with the following types of nodes (please specify node version and API version where appropriate):
Locales
Third Party Dependencies and Packages
yarnafter this PR is merged inpackage.jsonandyarn.lockhave been properly updatedOther: