Skip to content

Conversation

@kumulynja
Copy link

This PR updates bdk dart to v2.3.0-alpha.0 which uses uniffi 0.30, and it uses a fork that refactors uniffi-dart to use Native Assets instead of needing to open the libs on a specific path. This means a build hook could be used in bdk-dart and no precompiled binaries are needed anymore and the package can be published to pub.dev like this. Native Assets is the new and recommended way in Dart and Flutter to use native libraries.

It required some "hacks" in generate_bindings.sh that could be solved if some adjustments in bdk-ffi are made, but it are minor things.

I added a pure dart CLI package as example next to the other examples folder and bdk_demo folder, all three work out-of-the-box. Just run flutter/dart pub get and flutter/dart run and it should. In the bdk_demo app you can press the "Get Signet Network" button and this should print a mnemonic in the console using bdk-dart bindings.

- Add patterns for all native binary types (.so, .dylib, .dll, .a)
- Remove lib/bdk.dart from .gitignore to include in published package
Generated bindings are now tracked in version control to enable
publishing to pub.dev. Users should not need to generate bindings
themselves when installing the package.
…fork

- Bump version to 2.3.0-alpha.0
- Upgrade uniffi from 0.29.4 to 0.30.0
- Switch to kumulynja/uniffi-dart fork
- Add camino dependency for uniffi 0.30.0 compatibility
- Update bdk_kyoto from 0.15.1 to 0.15.3
- Use placeholder UDL path (metadata extracted from library)
- Auto-detect library file by extension instead of --library flag
- Use camino::Utf8Path required by uniffi 0.30.0
- Simplify code with match expression
- Add path variables for cleaner navigation
- Add submodule init/update and version checkout
- Remove manual fat binary creation (handled by Native Assets)
- Add rsync to copy bdk-ffi source to native/ for publishing
- Update to work with uniffi 0.30.0 library mode
Add hook/build.dart to compile native libraries automatically for the\
user's platform during dart/flutter pub get, eliminating manual build\
steps for users and the need to manage pre-compiled binaries.
@reez
Copy link
Collaborator

reez commented Nov 24, 2025

@Johnosezele if you can review this too

@kumulynja
Copy link
Author

kumulynja commented Nov 24, 2025

@reez @Johnosezele Don't be scared by the big number of files changed, you don't have to review the /native folder since that is really just a copy of the /bkd-ffi/bdk-ffi folder so that the build hook has the source to build the lib from.
For publishing of the package it is needed that this source code is in the package like this, since git submodules do not work for pub.dev. Also the native_toolchain_rs package used in the build hook expects this code to be either in a folder named native or rust. So that's the main reason of the file changes, I didn't find a way around it to be able to publish the package.
This copy is being done automatically in the generate_bindings.sh script by the way.

@Johnosezele
Copy link

@Johnosezele if you can review this too

Sure!

@reez
Copy link
Collaborator

reez commented Nov 25, 2025

side note: ci on repo passes now via #11 not sure if you need to rebase on that and/or if we can get this PR ci passing even though it targets 0.30.0

@reez reez mentioned this pull request Nov 25, 2025
15 tasks
@reez
Copy link
Collaborator

reez commented Nov 26, 2025

I really like the ideas in this pr, but as I've been looking at this pr more I think things would be clearer as separate PRs, as an example splitting things like these out from each other:

  • uniffi upgrade to 0.30.0
  • native assets migration

Thoughts?

@kumulynja
Copy link
Author

kumulynja commented Nov 26, 2025

I really like the ideas in this pr, but as I've been looking at this pr more I think things would be clearer as separate PRs, as an example splitting things like these out from each other:

  • uniffi upgrade to 0.30.0
  • native assets migration

Thoughts?

Yes, although I think there is not much done around migration to uniffi v0.30.0 specifically in this PR other than using bdk-ffi v2.3.0-alpha, which is the first bdk-ffi version using uniffi v0.30.0 if I am not mistaken. Most (if not all) of the migration work is done in bdk-ffi for that.

The reason why I needed that is because the version of uniffi-dart that has Native Assets support doesn't work for < 0.30.0, and this PR actually is more (pretty much completely) about setting bdk-dart up for Native Assets support and so to avoid needing to have platform specific code or binary publishing/binding.

So yeah, not sure if you want to have bdk-ffi-v2.3.0-alpha working without Native Assets first as well?

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