Skip to content

Commit 89bd47b

Browse files
committed
Merge bitcoindevkit/bdk#1841: Generalize add_recipient to accept Address
de2c44f feat(wallet): generalize `add_recipient` to accept `Address` (Rob N) Pull request description: ### Description I would imagine many users would be handling a `Address<NetworkChecked>` when building a transaction. They may pass this structure directly with this patch, or continue to use `ScriptBuf`. ### Notes to the reviewers To my knowledge this is non-breaking, but it is a change in the function signature so I am not sure. ### Changelog notice Accept any type that is convertible to a `ScriptBuf` in `TxBuilder::add_recipient` ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] 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 #### Bugfixes: * [ ] This pull request breaks the existing API * [ ] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: ValuedMammal: reACK de2c44f Tree-SHA512: 42a266190964e8afa1ade8f5a054b9ce86dc61728c8c441c7dad5c5b70459543617515b28199467e7dab3721bef24cffde2b9c807a6f7f0ec4f814caebafd93d
2 parents 63e62b4 + de2c44f commit 89bd47b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/wallet/src/wallet/tx_builder.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,12 @@ impl<'a, Cs> TxBuilder<'a, Cs> {
602602
}
603603

604604
/// Add a recipient to the internal list
605-
pub fn add_recipient(&mut self, script_pubkey: ScriptBuf, amount: Amount) -> &mut Self {
606-
self.params.recipients.push((script_pubkey, amount));
605+
pub fn add_recipient(
606+
&mut self,
607+
script_pubkey: impl Into<ScriptBuf>,
608+
amount: Amount,
609+
) -> &mut Self {
610+
self.params.recipients.push((script_pubkey.into(), amount));
607611
self
608612
}
609613

0 commit comments

Comments
 (0)