Add UniFFI Kotlin bindings for payjoin-ffi - #1869
Merged
Merged
Conversation
ram0verflow
requested review from
DanGould,
benalleng and
spacebear21
as code owners
September 8, 2026 18:05
Collaborator
|
@ram0verflow Thanks, I'll take a look today |
chavic
requested review from
chavic
and removed request for
DanGould,
benalleng and
spacebear21
September 10, 2026 14:30
Collaborator
Coverage Report for CI Build 34760182247Coverage remained the same at 86.646%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Collaborator
|
@ram0verflow it looks like you're hitting an unrelated probelm, that's fixed on master, you want to rebase |
chavic
reviewed
Sep 10, 2026
caarloshenriq
suggested changes
Sep 10, 2026
caarloshenriq
left a comment
Contributor
There was a problem hiding this comment.
Concept ACK.
Kotlin/JVM bindings alongside the other four is a good addition, and the layout mirrors python/csharp closely enough that it should be easy to keep in sync
Contributor
Author
|
will fix and update |
ram0verflow
force-pushed
the
kotlin-bindings-pr
branch
from
September 10, 2026 17:21
a991880 to
df8922e
Compare
chavic
reviewed
Sep 11, 2026
chavic
left a comment
Collaborator
There was a problem hiding this comment.
A few more comments on the tests.
chavic
reviewed
Sep 11, 2026
Generate with in-tree uniffi-bindgen --language kotlin, siloed like Python (no extra cargo feature). Rename protocol close to closeSession in Kotlin only so AutoCloseable still works. Pin the Gradle 9.1.0 wrapper with distributionSha256Sum; validateDistributionUrl only checks the download URL. Add a kotlin nix dev shell (JDK 21, MSRV, bitcoind) and run CI inside it, matching the other language bindings. Unit tests cover URIs, persistence, cancel, and validation.
Drive a full BIP77 round trip against the in-process directory, OHTTP relay, and bitcoind, mirroring the Python suite's RPC sequence and assertions. TestHttp trusts only the self-signed rcgen directory cert so HTTPS through the relay succeeds in the JVM. Parse bitcoind RPC responses with kotlinx-serialization-json.
Honor CARGO_TARGET_DIR, load the OS-native library, and assert percent-encoded URIs, overflow variants, and persister close via Rust. Co-authored-by: Cursor <cursoragent@cursor.com>
ram0verflow
force-pushed
the
kotlin-bindings-pr
branch
from
September 12, 2026 05:40
df8922e to
64a8082
Compare
chavic
reviewed
Sep 12, 2026
Honor CARGO_TARGET_DIR and [build] target-dir instead of assuming ../target. Co-authored-by: Cursor <cursoragent@cursor.com>
chavic
reviewed
Sep 13, 2026
chavic
reviewed
Sep 13, 2026
Use the compiler-artifact filename so generate follows target-dir, CARGO_BUILD_TARGET, and custom profiles.
Contributor
Author
|
updated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.
What
UniFFI Kotlin/JVM bindings for
payjoin-ffi, plus a BIP77 v2 round-tripintegration test.
Layout matches python/csharp:
payjoin-ffi/kotlin/scripts/generate_bindings.shpayjoin-ffi/kotlin/contrib/test.shPAYJOIN_FFI_FEATURES(default_test-utils; empty string is passedthrough) and
PAYJOIN_FFI_PROFILE(defaultdev→target/debug)Generated sources are not committed (gitignored under
kotlin/src/main/kotlin/org/). Generate is a build step.CI runs inside
nix develop .#kotlin(JDK 21, MSRV, nixpkgs bitcoind),matching csharp/python/dart.
Unit tests (15) cover URIs, persistence, cancel, and validation — the
same count as the Python unit suite. The second commit adds the v2
integration test (16 Gradle tests on HEAD).
Why
[bindings.kotlin.rename]Generated UniFFI objects implement
DisposableandAutoCloseable, soclose()drops the Rust handle. Payjoin also exports protocolclose()onReceiverPendingFallback,SenderPendingFallback, and the four JSONsession persister traits. Kotlin cannot overload on return type.
The table is Kotlin-only. It maps those protocol methods to
closeSession(). No Rust API change. Other language bindings keepclose.Integration test
IntegrationTests.ktdrives a full BIP77 v2 round trip, sender andreceiver, against the in-process directory, OHTTP relay, and a real
bitcoind. Under the kotlin nix shell,
BITCOIND_EXEcomes from nixpkgsand
BITCOIND_SKIP_DOWNLOAD=1. Outside the shell,corepc-nodemaydownload Bitcoin Core into a temp regtest dir.
On Linux,
v2ToV2Payjoincompletes in about 4s.TestHttptrusts only the directory's rcgen cert and proxies through theOHTTP relay.
Wrapper pin
Gradle 9.1.0 wrapper is pinned with
distributionSha256Sum.validateDistributionUrlonly checks the URL.Release / publish
Not published anywhere. No pack, Maven, signing, or attestation jobs.
The workflow does not trigger on
payjoin-kotlin-*tags. python.yml'stag trigger runs wheel build, PyPI publish, and GitHub release assets.
Until Kotlin has something to publish, a tag trigger would only re-run
tests.
Follow-ups (out of this PR)
.ktDisclosure
This PR was written with Cursor Cloud Agent (Grok 4.6).
shell, CI workflow, unit tests, and the v2 integration test were
AI-generated and then hand-reviewed against the Python suite and a
known-good round trip (~4s).
Disclosure: co-authored by Cursor Grok 4.6