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

(draft) feat: onchain #161

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

(draft) feat: onchain #161

wants to merge 1 commit into from

Conversation

reez
Copy link
Owner

@reez reez commented Feb 3, 2025

Description

Onchain per lightningdevkit/ldk-node#432 and locally built bindings

Notes to the reviewers

Not doing anything like moving transaction list to the main screen, just updating code per onchain transactions being exposed in ldk-node now.

I'm also going to add some additional comments below of interesting things I saw as of my local build's newest commit b0f4443

Simulator Screenshot - iPhone 16 Pro - 2025-02-03 at 13 02 05
Simulator Screenshot - iPhone 16 Pro - 2025-02-03 at 13 06 44

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I have formatted my code with swift-format per .swift-format file

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

Walkthrough

This pull request updates the LDKNodeMonday Xcode project configuration and dependency management. The project file’s object version and framework references have been revised, and a remote Swift package dependency (“ldk-node”) has been replaced with a local reference. Several Swift source files are modified: the Event enum now features updated case signatures and a new case; methods in the LightningNodeService and JITInvoiceViewModel now require a refined invoice description type; and a new error case is added for “InvalidCustomTlvs.” Additionally, new properties have been introduced in the channel detail view.

Changes

File(s) Change Summary
LDKNodeMonday.xcodeproj/…/project.pbxproj
LDKNodeMonday.xcodeproj/…/Package.resolved
- Incremented objectVersion from 56 to 60.
- Updated build and product references for LDKNode.
- Replaced remote Swift package reference (XCRemoteSwiftPackageReference "ldk-node") with a local one and removed the corresponding dependency entry.
LDKNodeMonday/Extensions/Event+Extensions.swift - Modified enum cases: Added extra parameters to paymentSuccessful, paymentReceived, and paymentClaimable.
- Introduced a new case: paymentForwarded.
LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift
LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift
LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift
- Changed description parameter type from String to Bolt11InvoiceDescription in service and view model methods.
- Updated the UI call to pass a structured description (.direct(description: "Monday Wallet")).
- Commented out logging configuration settings in the service file.
LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift - Added a new switch case to handle the InvalidCustomTlvs error by returning a MondayError with corresponding title and message.
LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift - Added new UInt64 properties (shortChannelId, outboundScidAlias, and inboundScidAlias) to the ChannelDetails structure, each initialized with 1_000_000.

Sequence Diagram(s)

sequenceDiagram
    participant V as JITInvoiceView
    participant VM as JITInvoiceViewModel
    participant LS as LightningNodeService
    V ->> VM: initiate receivePaymentViaJitChannel(description: .direct("Monday Wallet"))
    VM ->> LS: call receiveViaJitChannel(..., Bolt11InvoiceDescription, ...)
    LS -->> VM: return Bolt11Invoice
    VM -->> V: update UI with Bolt11Invoice
Loading

Possibly related PRs

Poem

I’m a clever rabbit, hopping through the code,
Tweaking project files on a bright new node.
Dependencies now live right by my side,
Cases and errors in a joyful ride.
With each update, my carrot dreams all glow,
Celebrating changes as through the code I go!


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>, please review it.
    • Generate unit testing code 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@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.

Actionable comments posted: 1

🧹 Nitpick comments (3)
LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift (1)

167-169: LGTM! Consider adding documentation for the new error case.

The implementation of the InvalidCustomTlvs error case follows the established pattern and maintains consistency with other error cases.

Consider adding a documentation comment explaining what constitutes invalid TLV records to help developers better understand and handle this error case.

+    /// Represents an error that occurs when custom TLV (Type-Length-Value) records are invalid.
+    /// This could happen when the TLV records don't conform to the Lightning Network specifications.
     case .InvalidCustomTlvs(let message):
         return .init(title: "InvalidCustomTlvs", detail: message)
LDKNodeMonday/Extensions/Event+Extensions.swift (1)

39-52: Enhance the payment forwarded description with relevant details.

The case contains rich information about the forwarded payment (fees, amounts, channels) but returns a simple static string. Consider enhancing the description to include key details that would be valuable for users or debugging.

Example enhancement:

-            return "Payment Forwarded"
+            let formattedFee = totalFeeEarnedMsat.formattedAmount()
+            let formattedAmount = outboundAmountForwardedMsat.formattedAmount()
+            return "Payment Forwarded: Amount \(formattedAmount) sats, Fee earned \(formattedFee) sats"
LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift (1)

47-47: Consider using a constant for the wallet description.

The hardcoded string "Monday Wallet" would be better defined as a constant to maintain consistency and ease future updates.

+private let WALLET_DESCRIPTION = "Monday Wallet"
+
 // In the view body:
-description: .direct(description: "Monday Wallet"),
+description: .direct(description: WALLET_DESCRIPTION),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e59dff5 and 079486b.

📒 Files selected for processing (8)
  • LDKNodeMonday.xcodeproj/project.pbxproj (7 hunks)
  • LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (1 hunks)
  • LDKNodeMonday/Extensions/Event+Extensions.swift (2 hunks)
  • LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift (3 hunks)
  • LDKNodeMonday/Service/Lightning Service/LightningServiceError.swift (1 hunks)
  • LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift (1 hunks)
  • LDKNodeMonday/View/Home/Receive/JITInvoiceView.swift (1 hunks)
  • LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift (1 hunks)
🧰 Additional context used
📓 Learnings (1)
LDKNodeMonday.xcodeproj/project.pbxproj (1)
Learnt from: danielnordh
PR: reez/Monday#131
File: LDKNodeMonday.xcodeproj/project.pbxproj:180-180
Timestamp: 2024-12-05T17:54:34.328Z
Learning: Multiple LDKNode framework references in `LDKNodeMonday.xcodeproj/project.pbxproj` may be intentional when using custom forks or multiple versions of LDKNode, and should not be flagged as duplicates.
🔇 Additional comments (10)
LDKNodeMonday/Extensions/Event+Extensions.swift (3)

17-18: Verify if new parameters should be included in the description.

The case now includes two additional parameters, but they are not reflected in the description string. Consider if these parameters contain relevant information that should be displayed to users.


24-26: Verify if the new parameter should be included in the description.

The case now includes an additional parameter, but it is not reflected in the description string. Consider if this parameter contains relevant information that should be displayed to users.


53-60: LGTM! Good security practice.

The description appropriately excludes the newly added customRecords parameter, which is a good practice as these records might contain sensitive data.

LDKNodeMonday.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved (1)

1-43: LGTM! Package dependencies are properly configured.

The removal of the ldk-node package from Package.resolved is consistent with switching to a local package reference. All other dependencies are properly pinned to specific versions.

LDKNodeMonday.xcodeproj/project.pbxproj (2)

6-6: Verify Xcode version compatibility.

The project's objectVersion has been updated from 56 to 60, which requires a newer version of Xcode. Please ensure all team members have compatible Xcode versions installed.


182-188: Review multiple LDKNode framework references.

There are 3 identical LDKNode framework references in the PBXBuildFile section. While multiple references may be intentional based on past feedback, having 3 identical references is unusual and could lead to linking issues.

Run the following script to check for any potential linking issues:

LDKNodeMonday/View Model/Home/Receive/JITInvoiceViewModel.swift (1)

27-27: LGTM! Type safety improvement.

The change from String to Bolt11InvoiceDescription enhances type safety and aligns with the domain model.

LDKNodeMonday/View/Settings/Channel/ChannelDetailView.swift (1)

127-129: LGTM! Preview data updated.

The new channel properties are correctly added with consistent mock values.

LDKNodeMonday/Service/Lightning Service/LightningNodeService.swift (2)

266-279: LGTM! Type safety improvement in service layer.

The change from String to Bolt11InvoiceDescription enhances type safety and is consistently applied across the service layer.


364-365: LGTM! Client interface updated.

The client interface is correctly updated to match the service layer changes.

@reez
Copy link
Owner Author

reez commented Feb 3, 2025

I have code comments in for the log stuff but i
Screenshot 2025-02-03 at 1 03 51 PM
t looks like we just need to use some options like this

@reez
Copy link
Owner Author

reez commented Feb 3, 2025

FeeRate Options

Screenshot 2025-02-03 at 1 04 02 PM

@reez reez changed the title feat: onchain (draft) feat: onchain Feb 3, 2025
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.

1 participant