fix(swaps): Allow redeem flow for restored reverse swaps in transaction.claimed#3707
fix(swaps): Allow redeem flow for restored reverse swaps in transaction.claimed#3707a-khushal wants to merge 1 commit intoZeusLN:masterfrom
Conversation
Summary of ChangesHello @a-khushal, 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 addresses a bug where users were unable to redeem funds for reverse swaps that had been restored and were in a claimed state. It introduces the necessary backend logic and UI components to facilitate the redemption process for these specific reverse swaps, improving the overall user experience and reliability of swap operations. Highlights
Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements a bug fix to allow redeeming restored reverse swaps that are in the transaction.claimed state. The changes introduce a "Redeem" button in the swap details view, which leads to a new flow within the existing RefundSwap component. New helper methods are added to facilitate the creation of a reverse claim transaction. The logic appears sound and correctly handles both the existing refund flow and the new redeem flow. I've kept the suggestion to improve code robustness by replacing non-null assertions with explicit checks, which will make the code safer and more maintainable.
c046bac to
22d9e2a
Compare
22d9e2a to
9234b16
Compare
9dd68d7 to
0ede049
Compare
|
@gemini-code-assist /review |
There was a problem hiding this comment.
Code Review
This pull request introduces the functionality to redeem funds from restored reverse swaps, which is a great addition for improving user fund recovery. The changes are well-structured, introducing new helper functions to handle key derivation and data fetching for restored swaps, and reusing the RefundSwap screen for the new redemption flow. The logic in SwapDetails.tsx to show the redeem button at the correct swap state is also sound.
I've found one critical issue that needs to be addressed and one suggestion for improving code quality. The critical issue is a missing await which will cause the redemption flow to fail. Please see my detailed comments below.
0ede049 to
9dea230
Compare
|
@gemini-code-assist /review |
There was a problem hiding this comment.
Code Review
The pull request introduces support for reverse swaps, including updates to the Swap model for flexible preimage types and new methods in Refund.tsx to handle reverse claim transactions, such as deriving private keys, fetching transaction hex, and deriving preimage hex. The UI in Refund.tsx and SwapDetails.tsx has been updated to conditionally display options and actions relevant to reverse swaps, such as a "Redeem" button and dynamic button titles, and to use a consistent status variable for displaying swap progress. Review comments suggest simplifying the private key reconstruction logic in Refund.tsx for better readability and replacing the magic number 2 for the default fee rate with a named constant.
9dea230 to
026ee49
Compare
026ee49 to
17e6355
Compare
Description
Relates to issue: ZEUS-3701
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: