Skip to content
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

refactor(bdk): use idiomatic naming for all getter methods #1221

Closed
Tracked by #86 ...
notmandatory opened this issue Nov 16, 2023 · 6 comments · Fixed by #1455
Closed
Tracked by #86 ...

refactor(bdk): use idiomatic naming for all getter methods #1221

notmandatory opened this issue Nov 16, 2023 · 6 comments · Fixed by #1455
Labels
api A breaking API change module-wallet
Milestone

Comments

@notmandatory
Copy link
Member

          I don't think this should be addressed in this PR, but I think we should use idiomatic naming for methods: https://rust-lang.github.io/api-guidelines/naming.html#getter-names-follow-rust-convention-c-getter

I.e. Wallet::get_address should be Wallet::address.

Originally posted by @evanlinjin in #1028 (comment)

@notmandatory notmandatory added this to the 1.0.0-alpha.4 milestone Nov 16, 2023
@nondiremanuel nondiremanuel modified the milestones: 1.0.0-alpha.4, 1.0.0 Jan 6, 2024
@ValuedMammal
Copy link
Contributor

ValuedMammal commented Feb 5, 2024

Rename Psbt::get_utxo_for -> utxo_at_index ?

or get_txout

@LLFourn
Copy link
Contributor

LLFourn commented Feb 6, 2024

My personal preference which is slightly different from the rust style guide: I'm fine with get_ if there is something like a corresponding insert_. So get_tx feels good because there's also insert_tx. It shouldn't be get_balance though.

@notmandatory
Copy link
Member Author

A small change but I think we should push to 2.0 milestone.

@ValuedMammal
Copy link
Contributor

I'd also be fine with making this a note in CONTRIBUTING.md along with some additional code conventions and guidelines, in hopes that it sort of implements itself over time.

@notmandatory
Copy link
Member Author

Yes I like that idea, and between 1.0 and 2.0 we can slowly deprecate old naming and add the new ones. We just can't fully remove the old names until a 2.0 version bump.

@notmandatory
Copy link
Member Author

notmandatory commented Jun 1, 2024

We only need to change Wallet::get_balance() to Wallet::balance() so we should be able to get this in to the 1.0 milestone.

The Wallet::get_address fix was done in #1402.

Any other pub fn get_* are less commonly used and can wait until 2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api A breaking API change module-wallet
Projects
Status: Done
4 participants