-
Notifications
You must be signed in to change notification settings - Fork 62
Add DerivationPath helper methods #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DerivationPath helper methods #893
Conversation
37561a5 to
68670ac
Compare
|
I dig this addition. Are you going to add |
a9875c2 to
6544423
Compare
Good call. |
|
This is looking good! I would need 2 things before merging:
|
8f39944 to
1cd2df0
Compare
1cd2df0 to
e2809be
Compare
Done! Just arranged the commits in second push |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few cleanup ideas.
bdk-ffi/src/bitcoin.rs
Outdated
| fingerprint: v.1 .0.to_string(), | ||
| path: v.1 .1.to_string(), | ||
| path: Arc::new(v.1 .1.clone().into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spaces here I thought would have been caught by the cargo formatter, but they weren't. Those lines could be cleaned up as:
fingerprint: v.1.0.to_string(),
path: Arc::new(v.1.1.clone().into()),There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man those deeply nested types are quite a handful 😆😆😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cargo fmt is actually the one adding those spaces
bdk-ffi/src/keys.rs
Outdated
|
|
||
| /// A BIP-32 derivation path. | ||
| #[derive(uniffi::Object)] | ||
| #[derive(Clone, Debug, Hash, Eq, PartialEq, uniffi::Object)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they hurt much, but in general I'm wary of adding trait implementations that are not needed. Note also that those are not exported to the bindings, so they'd need to be useful at the Rust layer, but I don't know that they are for now (the Clone is, but not the Eq, PartialEq, and Hash).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After playing with it locally, the Debug trait is also used (as well as the Clone). Others can be dropped on this one and others that have them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
| /// A BIP-32 derivation path. | ||
| #[derive(uniffi::Object)] | ||
| #[derive(Clone, Debug, Hash, Eq, PartialEq, uniffi::Object)] | ||
| pub struct DerivationPath(pub(crate) BdkDerivationPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're missing the Display trait export here:
#[derive(Debug)]
#[derive(uniffi::Object)]
#[uniffi::export(Display)]
pub struct DerivationPath(pub(crate) BdkDerivationPath);There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have the Display implemented below, but bindings users won't get it unless we add the #[uniffi::export(Display)] line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again! I thought I added that. I really do need to "Shine my eye". Maybe lost on rebase and merge resolution. Thanks
e2809be to
4a320b1
Compare
4a320b1 to
ffcae65
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ffcae65.
Description
Notes to the reviewers
Added more useful methods for
DerivationPathfor now I added the simplest ones. More should be added later; like child, into_child.Checklists
All Submissions:
cargo fmtandcargo clippybefore committingNew Features: