• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bitcoindevkit / bdk / 5834188079

pending completion
5834188079

Pull #1071

github

web-flow
Merge 68b42331c into 0ba6bbe11
Pull Request #1071: Update rust bitcoin (BDK 0.28)

563 of 563 new or added lines in 28 files covered. (100.0%)

14625 of 18342 relevant lines covered (79.74%)

9267.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/examples/utils/mod.rs
1
pub(crate) mod tx {
2

3
    use std::str::FromStr;
4

5
    use bdk::{database::BatchDatabase, SignOptions, Wallet};
6
    use bitcoin::{Address, Transaction};
7

8
    pub fn build_signed_tx<D: BatchDatabase>(
×
9
        wallet: &Wallet<D>,
×
10
        recipient_address: &str,
×
11
        amount: u64,
×
12
    ) -> Transaction {
×
13
        // Create a transaction builder
×
14
        let mut tx_builder = wallet.build_tx();
×
15

×
16
        let to_address = Address::from_str(recipient_address)
×
17
            .unwrap()
×
18
            .assume_checked();
×
19

×
20
        // Set recipient of the transaction
×
21
        tx_builder.set_recipients(vec![(to_address.script_pubkey(), amount)]);
×
22

×
23
        // Finalise the transaction and extract PSBT
×
24
        let (mut psbt, _) = tx_builder.finish().unwrap();
×
25

×
26
        // Sign the above psbt with signing option
×
27
        wallet.sign(&mut psbt, SignOptions::default()).unwrap();
×
28

×
29
        // Extract the final transaction
×
30
        psbt.extract_tx()
×
31
    }
×
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc