Skip to content

Conversation

@thunderbiscuit
Copy link
Member

@thunderbiscuit thunderbiscuit commented Aug 1, 2025

This PR exposes the Wallet::create_single() method.

I prefer to use single-descriptor wallets for my Tatooine faucet (easier to sync and keep track of), and realized we didn't bring this back into the bindings API after it was merged in Rust a while back.

TODO: Needs at least a test or two! Some methods should fail I think when the wallet is a single-descriptor, so we can test for that too.

Changelog notice

Added:
    - Expose `Wallet::create_single` constructor on Wallet type [#825]

[#825]: https://github.com/bitcoindevkit/bdk-ffi/pull/825

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

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

@thunderbiscuit thunderbiscuit force-pushed the feature/single-descriptor-wallets branch from a9880bb to 9eb3e60 Compare August 27, 2025 20:12
@thunderbiscuit thunderbiscuit force-pushed the feature/single-descriptor-wallets branch 2 times, most recently from d026c11 to 5040229 Compare September 4, 2025 14:40
@reez
Copy link
Collaborator

reez commented Sep 4, 2025

nice! looking pretty good, good addition.

a couple small comments questions added above.

then also a suggestion here would maybe be to add in error.rs:

impl From<BdkCreateWithPersistError<PersistenceError>> for CreateWithPersistError {
    fn from(error: BdkCreateWithPersistError<PersistenceError>) -> Self {
        match error {
            BdkCreateWithPersistError::Persist(e) => CreateWithPersistError::Persist {
                error_message: e.to_string(),
            },
            BdkCreateWithPersistError::Descriptor(e) => CreateWithPersistError::Descriptor {
                error_message: e.to_string(),
            },
            BdkCreateWithPersistError::DataAlreadyExists(_e) => {
                CreateWithPersistError::DataAlreadyExists
            }
        }
    }
}

so we can use .map_err(CreateWithPersistError::from)?; in wallet.rs instead of:

                .map_err(|e| CreateWithPersistError::Persist {
                    error_message: e.to_string(),
                })?;

Not a blocker though.

@thunderbiscuit
Copy link
Member Author

Great idea @reez on cleaning up the errors on the constructor. I added that fix in a second commit. Ready for re-review!

@thunderbiscuit thunderbiscuit force-pushed the feature/single-descriptor-wallets branch from 5040229 to dd204ec Compare September 5, 2025 20:49
@thunderbiscuit thunderbiscuit requested a review from reez September 5, 2025 20:49
@thunderbiscuit thunderbiscuit force-pushed the feature/single-descriptor-wallets branch from dd204ec to 53d4986 Compare September 8, 2025 12:40
Copy link
Collaborator

@reez reez left a comment

Choose a reason for hiding this comment

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

ACK 53d4986

Good addition

@thunderbiscuit thunderbiscuit merged commit 53d4986 into bitcoindevkit:master Sep 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants