trader bond

This commit is contained in:
f321x
2024-06-07 13:44:39 +02:00
parent 882c5f043a
commit aca58ebe41
2 changed files with 9 additions and 3 deletions

View File

@ -11,8 +11,12 @@ use crate::wallet::{load_wallet, bond::Bond};
pub fn run_maker(maker_config: &TraderSettings) -> Result<()> {
let offer_conditions = OfferCreationResponse::fetch(maker_config)?;
let offer_conditions = OfferCreationResponse {
};
let wallet = load_wallet(maker_config)?;
let bond = Bond::assemble(&wallet, &offer_conditions, maker_config)?;
dbg!(bond);
Ok(())
}

View File

@ -32,12 +32,14 @@ impl Bond {
// to have the full trading sum as change as evidence for the coordinator that the maker owns
// enough funds to cover the trade
let (mut psbt, details) = {
let mut builder = wallet.build_tx();
let mut builder = wallet.build_tx()
.coin_selection(BranchAndBoundCoinSelection::new(trader_input.trade_type.value()));
builder
.coin_selection(BranchAndBoundCoinSelection::new(trader_input.trade_type.value()))
.add_recipient(address.script_pubkey(), bond_target.locking_amount)
.do_not_spend_change()
.fee_rate(FeeRate::from_sat_per_vb(201.0));
builder.finish()?
};
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;