Skip to content

feat: ldk-node serializable types#434

Merged
ovitrif merged 22 commits into
masterfrom
feat/ldk-node-serializable
Oct 17, 2025
Merged

feat: ldk-node serializable types#434
ovitrif merged 22 commits into
masterfrom
feat/ldk-node-serializable

Conversation

@ovitrif
Copy link
Copy Markdown
Collaborator

@ovitrif ovitrif commented Oct 10, 2025

This PR uses the new serializable types generated in ldk-node PR:

Preview

Transfer Bolt11 Peers
regtest.mp4

QA Notes

Since this PR changes the balance calculation to use the ldk-node types directly instead of the previous setup with mapping them to a domain model, a regression test for transfer-to-spending & back to savings is recommended, alongside the main core test to build & run, which verified for no compilation or runtime issues.

Then, we also need to check the 2 impacted areas:

  • bolt11 strings, which had to be fixed in gobley
  • peer details & CJIT startup, because we replaced custom LnPeer type with direct use of PeerDetails

Tests:

  1. Transfer to spending & back to savings, check incoming transfer UI still works as expected
    • after LN channel is ready > Receive > Swipe > expect bolt11 string is ok
  2. Drawer > App Status > Lighting Node > scroll down > expect peer uri listed
  3. On wallet with no LN funds > Receive > Tap Receive on LN > expect cjit not geoblocked

Comment thread app/src/main/java/to/bitkit/ext/PeerDetails.kt Fixed
Comment thread app/src/main/java/to/bitkit/ext/PeerDetails.kt Fixed
Comment thread app/src/main/java/to/bitkit/services/LightningService.kt Fixed
Comment thread app/src/main/java/to/bitkit/services/LightningService.kt Fixed
Comment thread app/src/main/java/to/bitkit/services/LightningService.kt Fixed
Comment thread app/src/main/java/to/bitkit/services/LightningService.kt Fixed
@ovitrif ovitrif force-pushed the feat/ldk-node-serializable branch 2 times, most recently from b867493 to 84714ad Compare October 13, 2025 14:54
@ovitrif ovitrif marked this pull request as ready for review October 13, 2025 14:57
@ovitrif ovitrif marked this pull request as draft October 13, 2025 14:57
@ovitrif ovitrif marked this pull request as ready for review October 13, 2025 15:00
@ovitrif ovitrif requested a review from jvsena42 October 13, 2025 15:00
@ovitrif ovitrif enabled auto-merge October 13, 2025 15:01
@jvsena42 jvsena42 requested a review from Copilot October 13, 2025 15:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates from custom domain model types to serializable types from the updated ldk-node library, eliminating the need for manual type conversions. The change simplifies the codebase by using ldk-node's native types directly instead of maintaining separate domain models.

Key changes:

  • Replaced custom LnPeer, BalanceDetails, and LightningBalance domain models with ldk-node's native PeerDetails, BalanceDetails, and LightningBalance types
  • Added extension functions for PeerDetails to provide convenient access patterns and parsing functionality
  • Updated all references throughout the codebase including services, repositories, ViewModels, and UI components

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
gradle/libs.versions.toml Updated ldk-node dependency version to v0.6.2-rc.4
app/src/main/java/to/bitkit/models/LnPeer.kt Removed custom LnPeer domain model class
app/src/main/java/to/bitkit/models/BalanceState.kt Removed custom BalanceDetails and LightningBalance domain models with mapping functions
app/src/main/java/to/bitkit/ext/PeerDetails.kt Added extension functions for PeerDetails parsing and property access
app/src/main/java/to/bitkit/services/LightningService.kt Updated to use ldk-node types directly instead of domain model conversion
app/src/main/java/to/bitkit/repositories/LightningRepo.kt Updated method signatures and state management to use ldk-node types
Multiple ViewModels and UI files Updated type references from domain models to ldk-node types
Multiple test files Updated imports and mock objects to use ldk-node types
Comments suppressed due to low confidence (1)

app/src/main/java/to/bitkit/ui/screens/wallets/HomeScreen.kt:1

  • This code block appears to be duplicated and should be part of the extracted Widgets composable function. The structure suggests this was moved but some trailing code wasn't properly cleaned up during the refactoring.
package to.bitkit.ui.screens.wallets

Comment thread app/src/main/java/to/bitkit/ext/PeerDetails.kt Outdated
Comment thread app/src/main/java/to/bitkit/ext/PeerDetails.kt Outdated
@ovitrif ovitrif force-pushed the feat/ldk-node-serializable branch 2 times, most recently from 3d8ab81 to fc060f4 Compare October 13, 2025 17:22
@ovitrif ovitrif removed the request for review from jvsena42 October 13, 2025 17:23
@ovitrif ovitrif marked this pull request as draft October 13, 2025 18:59
auto-merge was automatically disabled October 13, 2025 18:59

Pull request was converted to draft

@ovitrif ovitrif force-pushed the feat/ldk-node-serializable branch from fc060f4 to 6d528ab Compare October 13, 2025 18:59
@ovitrif ovitrif marked this pull request as ready for review October 13, 2025 18:59
@ovitrif ovitrif force-pushed the feat/ldk-node-serializable branch 2 times, most recently from a0d006e to 1e3c044 Compare October 15, 2025 17:21
@ovitrif ovitrif requested a review from jvsena42 October 15, 2025 19:18
@ovitrif ovitrif enabled auto-merge October 15, 2025 19:18
@ovitrif ovitrif changed the title feat: use serializable types from updated ldk-node feat: ldk-node serializable types Oct 15, 2025
@jvsena42 jvsena42 requested a review from Copilot October 16, 2025 14:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

app/src/main/java/to/bitkit/services/LightningService.kt:1

  • [nitpick] Logging peers with '$peer' relies on PeerDetails.toString(); using peer.uri would produce a consistent, readable 'nodeId@host:port' format matching other areas. Suggest: Logger.info("Connected to trusted peer: ${peer.uri}").
package to.bitkit.services

Comment thread app/src/main/java/to/bitkit/ext/PeerDetails.kt
Comment thread app/src/main/java/to/bitkit/ui/components/Tooltip.kt
Comment thread app/src/main/java/to/bitkit/ui/components/QrCodeImage.kt
ovitrif and others added 3 commits October 16, 2025 16:29
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jvsena42
jvsena42 previously approved these changes Oct 16, 2025
Copy link
Copy Markdown
Member

@jvsena42 jvsena42 left a comment

Choose a reason for hiding this comment

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

Tested channel operations and LN node peer URI

@ovitrif
Copy link
Copy Markdown
Collaborator Author

ovitrif commented Oct 16, 2025

@jvsena42 need one final re-approval after last merge with master.

@ovitrif ovitrif merged commit 49fd09c into master Oct 17, 2025
11 checks passed
@ovitrif ovitrif deleted the feat/ldk-node-serializable branch October 17, 2025 17:09
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.

4 participants