Skip to content

Expose missing uniffi APIs - #1249

Open
tnull wants to merge 7 commits into
lightningdevkit:mainfrom
tnull:2026-11-expose-missing-uniffi-apis
Open

tnull wants to merge 7 commits into
lightningdevkit:mainfrom
tnull:2026-11-expose-missing-uniffi-apis

Conversation

@tnull

@tnull tnull commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

We just expose some APIs that we so far missed to expose via uniffi.

`Builder::set_chain_source_esplora_with_headers` was only available
to Rust users, so bindings users had no way to authenticate against
an Esplora server that requires custom request headers.

Export the method via UniFFI alongside the plain Esplora setter, as
all of its arguments are already representable in the bindings.

Co-Authored-By: HAL 9000
`Builder::enable_liquidity_provider` was only available to Rust
users, even though `LSPS2ServiceConfig` is already a UniFFI record.
Bindings users could therefore construct the service configuration
but had no way to hand it to the builder.

Export the method via UniFFI next to the other liquidity setter.

Co-Authored-By: HAL 9000
`aggregate_channel_pair_stats` was only available to Rust users, so
bindings users could list channel-pair forwarding buckets but had to
reimplement the aggregation into cumulative totals themselves.

Export it as a free function via UniFFI.

Co-Authored-By: HAL 9000
@tnull
tnull requested a review from tankyleo November 19, 2026 10:17
@ldk-reviews-bot

ldk-reviews-bot commented Nov 19, 2026 •

Copy link
Copy Markdown

👋 Thanks for assigning @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull tnull added this to the 0.8 milestone Nov 19, 2026

@tankyleo tankyleo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A few more items we could expose:

  • ldk_node::bitcoin::Network::Testnet4
  • ldk_node::graph::ChannelInfo::features
  • ldk_node::probing::Prober::interval()
  • ldk_node::probing::Prober::max_locked_msat()

`Node::prober` and `Prober::locked_msat` were only available to Rust
users, so bindings users could configure background probing but had
no way to observe how much liquidity is locked in in-flight probes.

Make `Prober` a UniFFI object and export `locked_msat`, along with
getters for the probing interval and the locked amount limit, which
Rust users can read from the public fields. As bindings can't hold a
borrowed reference, `Node::prober` hands out a shared handle when
building with UniFFI.

Co-Authored-By: HAL 9000
The bindings' `NodeAnnouncementInfo` dropped the announced feature
bits and the node color when converting from LDK's type, so bindings
users querying the network graph saw less than Rust users do.

Carry both fields over, reusing the existing `NodeFeatures` object
for the feature bits and passing the color as its three raw bytes.

Co-Authored-By: HAL 9000
The bindings' `Network` enum lacked `Testnet4`, so bindings users
couldn't configure a node for it. Moreover, returning it to bindings,
e.g., when inspecting the chains of a Testnet4 offer, would panic as
UniFFI doesn't know how to convert unlisted variants.

Add the missing variant to the bindings' enum.

Co-Authored-By: HAL 9000
The bindings' `ChannelInfo` dropped the feature bits of the channel
announcement when converting from LDK's type, so bindings users
querying the network graph saw less than Rust users do.

Carry the field over via a new `ChannelFeatures` object. As no channel
features are currently defined, it only offers access to the raw
bytes. It avoids the wire encoding's length prefix so that the bytes
can be used to reconstruct the object.

Co-Authored-By: HAL 9000
@tnull
tnull force-pushed the 2026-11-expose-missing-uniffi-apis branch from 832843a to ee1e33f Compare November 23, 2026 09:54
@tnull

tnull commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator Author

A few more items we could expose:

  • ldk_node::bitcoin::Network::Testnet4
  • ldk_node::graph::ChannelInfo::features
  • ldk_node::probing::Prober::interval()
  • ldk_node::probing::Prober::max_locked_msat()

Done.

@tnull
tnull requested a review from tankyleo November 23, 2026 09:54
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