mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-22 10:43:26 +00:00
changed descriptor
This commit is contained in:
@ -24,7 +24,7 @@ use std::str::FromStr;
|
|||||||
/// The main function in this module is `combine_and_broadcast`, which combines the PSBTs
|
/// The main function in this module is `combine_and_broadcast`, which combines the PSBTs
|
||||||
/// from the maker and taker, finalizes the transaction, and broadcasts it on the blockchain.
|
/// from the maker and taker, finalizes the transaction, and broadcasts it on the blockchain.
|
||||||
pub async fn combine_and_broadcast() -> Result<(), Box<dyn std::error::Error>> {
|
pub async fn combine_and_broadcast() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mut base_psbt = PartiallySignedTransaction::from_str("TODO: insert the psbt created in step 3 here")?;
|
let mut base_psbt = PartiallySignedTransaction::from_str("TODO: insert the psbt created by the coordinator here")?;
|
||||||
let signed_psbts = vec![
|
let signed_psbts = vec![
|
||||||
// TODO: Paste each participant's PSBT here
|
// TODO: Paste each participant's PSBT here
|
||||||
"makers_psbt",
|
"makers_psbt",
|
||||||
@ -93,10 +93,12 @@ async fn create_script(coordinator_key: &str, maker_key:&str, taker_key:&str ) -
|
|||||||
/// the provided keys, and `create_psbt`, which creates a PSBT from the descriptor
|
/// the provided keys, and `create_psbt`, which creates a PSBT from the descriptor
|
||||||
/// Figure out how to put UTXO's
|
/// Figure out how to put UTXO's
|
||||||
pub async fn create_psbt(descriptor: Descriptor<String>)-> Result<(PartiallySignedTransaction), Box<dyn std::error::Error>> {
|
pub async fn create_psbt(descriptor: Descriptor<String>)-> Result<(PartiallySignedTransaction), Box<dyn std::error::Error>> {
|
||||||
|
let descriptor_str = descriptor.to_string(); // Step 2 and 3
|
||||||
// Step 1: Create a BDK wallet
|
// Step 1: Create a BDK wallet
|
||||||
let wallet = Wallet::new(
|
let wallet = Wallet::new(
|
||||||
// TODO: insert your descriptor here
|
// TODO: insert your descriptor here
|
||||||
"tr(youshouldputyourdescriptorhere)",
|
// "tr(youshouldputyourdescriptorhere)",
|
||||||
|
&descriptor_str,
|
||||||
None,
|
None,
|
||||||
bdk::bitcoin::Network::Testnet,
|
bdk::bitcoin::Network::Testnet,
|
||||||
MemoryDatabase::new()
|
MemoryDatabase::new()
|
||||||
@ -165,4 +167,3 @@ fn taker_unresponsive(psbt: PartiallySignedTransaction, wallet: Wallet<MemoryDat
|
|||||||
println!("Coordinator signed PSBT: {:?}", coordinator_signed_psbt);
|
println!("Coordinator signed PSBT: {:?}", coordinator_signed_psbt);
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
|
Reference in New Issue
Block a user