bdk
bdk copied to clipboard
feat: add further `bitcoin::Amount` usage on public APIs
builds on top of #1411, further improves #823
Description
It further updates and adds the usage of bitcoin::Amount
instead of u64
.
Notes to the reviewers
Open for comments and discussions.
Changelog notice
- Updated
CreateTxError::FeeTooLow
to usebitcoin::Amount
. - Updated
Wallet::calculate_fee()
. to usebitcoin::Amount
- Updated
TxBuilder::fee_absolute()
. to usebitcoin::Amount
. - Updated
CalculateFeeError::NegativeFee
to usebitcoin::SignedAmount
. - Updated
TxGraph::calculate_fee()
. to usebitcoin::Amount
. - Updated
PsbUtils::fee_amount()
to usebitcoin::Amount
.
Checklists
All Submissions:
- [x] I've signed all my commits
- [x] I followed the contribution guidelines
- [x] I ran
cargo fmt
andcargo clippy
before committing
New Features:
- [x] I've added tests for the new feature
- [x] I've added docs for the new feature
@ValuedMammal Please let me know what are your thoughts on these changes.
@ValuedMammal Please let me know what are your thoughts on these changes.
I did remove the updates where it's pub(crate)
APIs, and kept only the ones for explicitly pub
APIs.
Here's how I would approach this PR with fewer lines touched ValuedMammal/bdk@0c72958e388e060a1ad6db46e7f19192938b8f1f
However I think it's worth having a discussion about where we can continue to get benefits from the Amount type so I opened an issue #1432
--
edit: @oleonardolima Just checking, is the plan to go ahead and complete #1432 in this PR?
[...]
--
edit: @oleonardolima Just checking, is the plan to go ahead and complete #1432 in this PR?
I think I can continue the work on non-public code (everywhere) on another PR, and keep this one only for the public APIs that remained from #1411. wdyt @ValuedMammal ?
Also, I was waiting if some new discussion would occur on #1432 before working on it :)
Thanks for working on this. There's a small typo in the changelog notice -
FeePolicy::fee_absolute
should sayTxBuilder::fee_absolute
.
Oh, thanks! Sorry for the oversight, fixed it.