Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cln: Boltz auto-send #1366

Merged
merged 2 commits into from
Apr 4, 2024
Merged

cln: Boltz auto-send #1366

merged 2 commits into from
Apr 4, 2024

Conversation

ShahanaFarooqui
Copy link
Collaborator

@ShahanaFarooqui ShahanaFarooqui commented Mar 13, 2024

  • Bug fix: Hide claim tx id and routing fee with zero conf reverse swap
  • Added auto send feature for swap in

Summary by CodeRabbit

  • New Features
    • Introduced an "Auto Send" option for swaps, enhancing user control over transaction processes.
    • Display of QR codes for transactions, improving user experience in swap status updates.
  • Enhancements
    • Optimized data fetching for swap operations, ensuring a smoother user experience.
    • Improved user interface styling for better visibility and accessibility, particularly in dark mode.
  • Refactor
    • Streamlined swap-related components for efficiency and maintainability.
  • Documentation
    • Added new models and services documentation to support the Boltz swap functionality.

Copy link

coderabbitai bot commented Mar 13, 2024

Important

Auto Review Skipped

Auto reviews are disabled on base/target branches other than the default branch. Please add the base/target branch pattern to the list of additional branches to be reviewed in the settings.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The recent updates primarily enhance the functionality and user interface of the Boltz swap feature within an application. Key improvements include the introduction of an "Auto Send" option, concurrent data fetching for efficiency, UI adjustments for better layout and information display, including QR codes, and the addition of necessary models and service methods to support these features. These changes aim to streamline the swap process and improve the overall user experience.

Changes

Files Change Summary
.../shared/boltz.js, .../shared/boltz.ts Added logic for auto_send and address in createSwap.
.../boltz-root.component.ts Refactored onSwap to use forkJoin for fetching boltzInfo and serviceInfo.
.../swap-modal/swap-modal.component.html, .../swap-modal/swap-modal.component.ts Added mat-slide-toggle for "Auto Send", updated related properties.
.../swap-status/swap-status.component.html, .../swap-status/swap-status.component.ts Updated layout, added QR code logic, conditional rendering.
.../side-navigation/side-navigation.component.html Layout attribute adjustments.
.../models/alertData.ts, .../models/boltzModels.ts Added interfaces for Boltz info and swap details.
.../services/boltz.service.ts Enhanced with new properties, methods for Boltz info and operations.
.../services/consts-enums-functions.ts Added UI message constant for Boltz info retrieval.
.../theme-mode-dark.scss Styling adjustments for .boltz-icon.

🐇✨
In a world of code and light,
Changes come, both bold and bright.
Swaps and toggles, sleek designs,
Through the code, a purpose finds.
QR gleams, the dark theme dreams,
A rabbit hops, and softly beams.
🌌🚀🐰

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@ShahanaFarooqui ShahanaFarooqui changed the title cln: Boltz accept-zero-conf cln: Boltz auto-send Mar 14, 2024
@saubyk
Copy link
Collaborator

saubyk commented Mar 14, 2024

@coderabbitai review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 2

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8d7f6e0 and c4934f5.
Files selected for processing (14)
  • backend/controllers/shared/boltz.js (1 hunks)
  • frontend/index.html (1 hunks)
  • server/controllers/shared/boltz.ts (1 hunks)
  • src/app/shared/components/ln-services/boltz/boltz-root.component.ts (2 hunks)
  • src/app/shared/components/ln-services/boltz/swap-modal/swap-modal.component.html (2 hunks)
  • src/app/shared/components/ln-services/boltz/swap-modal/swap-modal.component.ts (7 hunks)
  • src/app/shared/components/ln-services/boltz/swap-status/swap-status.component.html (1 hunks)
  • src/app/shared/components/ln-services/boltz/swap-status/swap-status.component.ts (1 hunks)
  • src/app/shared/components/navigation/side-navigation/side-navigation.component.html (1 hunks)
  • src/app/shared/models/alertData.ts (2 hunks)
  • src/app/shared/models/boltzModels.ts (1 hunks)
  • src/app/shared/services/boltz.service.ts (4 hunks)
  • src/app/shared/services/consts-enums-functions.ts (1 hunks)
  • src/app/shared/theme/styles/theme-mode-dark.scss (1 hunks)
Files not summarized due to errors (1)
  • frontend/index.html: Error: Message exceeds token limit
Files skipped from review due to trivial changes (1)
  • src/app/shared/services/consts-enums-functions.ts
Additional comments: 14
src/app/shared/components/ln-services/boltz/swap-status/swap-status.component.ts (1)
  • 15-18: The introduction of acceptZeroConf, qrWidth, screenSize, and screenSizeEnum properties, along with the implementation of OnInit, are well-aligned with the PR's objectives to enhance the Boltz swap feature. The logic to adjust qrWidth based on screen size is a thoughtful addition for improving UI responsiveness.
src/app/shared/models/boltzModels.ts (1)
  • 1-18: The addition of BlockHeight and BoltzInfo interfaces is crucial for supporting the new auto send feature and enhancing the application's data handling capabilities for Boltz swaps. These interfaces are well-defined and align with the PR's objectives.
src/app/shared/components/ln-services/boltz/swap-status/swap-status.component.html (1)
  • 10-68: The adjustments made to the layout and the conditional rendering based on acceptZeroConf are well-implemented. These changes enhance the user interface by providing a more dynamic display of swap details and improving the QR code display logic based on screen size and address availability. This aligns with the PR's goal to improve the Boltz swap feature's user experience.
src/app/shared/components/ln-services/boltz/boltz-root.component.ts (1)
  • 72-90: Refactoring the onSwap method to use forkJoin for concurrent fetching of boltzInfo and serviceInfo is a significant improvement. This approach enhances performance by reducing waiting time for sequential HTTP requests. The error handling and dispatching of alerts are correctly implemented, ensuring that users are informed of any issues during the swap process. This change aligns with the PR's objectives to enhance the Boltz functionality.
src/app/shared/components/navigation/side-navigation/side-navigation.component.html (1)
  • 13-15: Adding fxLayout="row" fxFlex="100" fxLayoutAlign="start center" to the <span> element within the side navigation component is a minor but effective change. It ensures consistent alignment and spacing for the navigation icons and text, contributing to a more polished and user-friendly interface.
src/app/shared/services/boltz.service.ts (2)
  • 18-27: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [11-24]

The addition of BoltzInfo to imports, the new boltzInfo property, and the boltzInfoChanged BehaviorSubject are well-implemented. These changes are essential for managing and broadcasting Boltz information throughout the application, supporting the new features introduced in this PR.

  • 48-59: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [51-66]

The introduction of the getBoltzInfo method and the simplification of the serviceInfo method are significant improvements. These methods enhance the service's ability to fetch and manage Boltz-related information efficiently. The modification of the swapIn method signature to include the autoSend parameter aligns with the PR's objective to introduce an auto send feature for swaps, ensuring that the application's backend can handle this new functionality correctly.

src/app/shared/models/alertData.ts (1)
  • 4-10: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [7-185]

The addition of BoltzInfo to the imports and its inclusion in the SwapAlert interface are crucial for supporting the new features related to Boltz swaps. These changes enable the application to handle and display alerts related to Boltz information more effectively, enhancing the user experience and aligning with the PR's objectives.

src/app/shared/components/ln-services/boltz/swap-modal/swap-modal.component.ts (1)
  • 49-64: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [28-195]

The addition of the boltzInfo property, the introduction of the isAutoSendCompatible boolean property, and the inclusion of an autoSend control in the form are significant enhancements to the SwapModalComponent. These changes effectively integrate the auto send feature into the swap modal, allowing users to automatically send swapped assets to a predefined address. The logic to determine compatibility with the auto send feature based on the Boltz version is a thoughtful detail that ensures backward compatibility. These modifications align well with the PR's objectives to streamline the swap process and improve the user experience.

src/app/shared/components/ln-services/boltz/swap-modal/swap-modal.component.html (2)
  • 35-40: The addition of the mat-slide-toggle for the "Auto Send" feature is correctly implemented and follows Angular and Material Design best practices. The conditional rendering based on direction and isAutoSendCompatible ensures that the feature is displayed only when applicable, enhancing the user experience.
  • 96-96: The update to the rtl-boltz-swap-status component to bind [acceptZeroConf] to inputFormGroup?.controls?.acceptZeroConf.value is correctly implemented. This ensures that the component receives the correct value for acceptZeroConf, allowing for accurate display and functionality within the swap modal.
src/app/shared/theme/styles/theme-mode-dark.scss (1)
  • 226-228: The addition of a stroke property to the .boltz-icon class with the value of $primary-darker is a good practice for maintaining consistency and ease of theme management. Ensure that the $primary-darker variable is consistently used across the theme for similar purposes.
frontend/index.html (2)
  • 15-15: The addition of the CSS block introduces a comprehensive set of custom properties for styling. Ensure these styles are consistent with the existing design language of the application and test the UI across different browsers and devices for compatibility.
  • 18-18: The inclusion of script tags for runtime, polyfills, and main JavaScript modules is standard for Angular applications. Ensure that the main.js module contains the necessary logic for the new auto-send feature and the bug fix implementation.

server/controllers/shared/boltz.ts Outdated Show resolved Hide resolved
backend/controllers/shared/boltz.js Outdated Show resolved Hide resolved
@ShahanaFarooqui ShahanaFarooqui force-pushed the cln-boltz branch 2 times, most recently from 0e53a04 to 0429b9e Compare March 14, 2024 18:56
@saubyk saubyk requested a review from jackstar12 March 14, 2024 21:08
@ShahanaFarooqui ShahanaFarooqui force-pushed the cln-boltz branch 2 times, most recently from c4340a1 to f0293c0 Compare March 14, 2024 22:22
Copy link
Contributor

@jackstar12 jackstar12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address is still shown if the swap is being paid internally, which makes the user think the swap still needs to be paid. Only show the lockup transaction in this case, which is included in the response:

- Added auto send option for Swap In
- Checking compatiblity with v2.0.0 and above
@ShahanaFarooqui
Copy link
Collaborator Author

The address is still shown if the swap is being paid internally, which makes the user think the swap still needs to be paid. Only show the lockup transaction in this case, which is included in the response:

Updated the code accordingly with commit .

@ShahanaFarooqui ShahanaFarooqui merged commit ba36aa8 into Release-0.15.1 Apr 4, 2024
@ShahanaFarooqui ShahanaFarooqui deleted the cln-boltz branch June 10, 2024 18:43
ShahanaFarooqui added a commit that referenced this pull request Jun 10, 2024
* rm .DS_Store

* Add watchfrontenddev command for npm

* Fix toggle issues in sidenav (pinning and on page refresh)

* Add copy-to-clipboard fallback if navigator.clipboard is not available (#1336)

* add copy-to-clipboard fallback if navigator.clipboard is not available

* amend copy fallback

* clipboard copy lint fixes and frontend build

* fix: add missing boltz state `transaction.lockupFailed` (#1349)

* fix: boltzd docs link (#1354)

* exit gracefully (#1356)

* allow for eclair updated relayed audit format (#1363)

* feat: add boltz service to cln (#1352)

* lint fix

* Request Params Cleanup

* cln: Boltz auto-send (#1366)

* Bug-fix (CLN Boltz): Hide claim tx id and routing fee for non-zero conf reverse swap

* cln: Boltz auto-send

- Added auto send option for Swap In
- Checking compatiblity with v2.0.0 and above

* Test import fixes

* Update help.component.ts (#1379)

Fixed broken link under "Help" -> "Node Settings"

* Backend config fix (#1382)

* Updating Common Application Configuration

* Fixed get RTL Conf

* Update Application Settings

* application and settings case change

* Unified config models

* Default node update

* 2FA and Password reset

* Final application settings update

* Config Settings and Authentication case fixed

* Node Setting Fix

* Fiat currency Symbol fix

* CLN: Fiat symbol fix

* All: Fiat symbol fix

* Update node settings

* Services UI fix

* CLN: Removed child node settings

* All: Removed child node settings

* Test fixes

* mempool links for onchain information (#1383)

* Tests fix

Tests fix

* UI for Block Explorer Configuration (#1385)

* Bump fee with mempool information (#1386)

* Mempool openchannel minfee (#1388)

Open channel model block if min fee is higher

* Show error on login screen if rune is incorrect and getinfo throws error (#1391)

* cln: Removed channel lookup call for update policy (#1392)

* ECL: On-chain Transactions, Invoice and Payments pagination (#1393)

Done most of the UI changes to accommodate pagination on transactions, payments and invoices tables but true pagination cannot be implemented till total number of records are missing from the API response.

Once the issue ACINQ/eclair#2855 is fixed, I will uncomment pagination changes in the frontend.

* lnd: Onchain CPFP (#1394)

- UTXO label bug fix
- Warning on utxo label for "sweep" in text.

* Bug fixes after testing

* Testing bug fixes (#1401)

* Bug fix 2: lnd: Link channel point to explorer and show fee on close channel too

* lnd: explorer link on pending channels

* Node lookup link on view channel peer pubkey

* Testing bug fixes (#1402)

* Bug fix 2: lnd: Link channel point to explorer and show fee on close channel too

* lnd: explorer link on pending channels

* Node lookup link on view channel peer pubkey

* test fixes

* ng update to v18.0.x

* Updating install with  --legacy-peer-deps

---------

Co-authored-by: Grzegorz Kućmierz <[email protected]>
Co-authored-by: lacksfish <[email protected]>
Co-authored-by: jackstar12 <[email protected]>
Co-authored-by: Kilian <[email protected]>
Co-authored-by: Taylor King <[email protected]>
Co-authored-by: Fishcake <[email protected]>
Co-authored-by: Ant <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants