mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-22 10:43:26 +00:00
trader bond
This commit is contained in:
@ -11,8 +11,12 @@ use crate::wallet::{load_wallet, bond::Bond};
|
|||||||
|
|
||||||
pub fn run_maker(maker_config: &TraderSettings) -> Result<()> {
|
pub fn run_maker(maker_config: &TraderSettings) -> Result<()> {
|
||||||
let offer_conditions = OfferCreationResponse::fetch(maker_config)?;
|
let offer_conditions = OfferCreationResponse::fetch(maker_config)?;
|
||||||
|
|
||||||
|
let offer_conditions = OfferCreationResponse {
|
||||||
|
|
||||||
|
};
|
||||||
let wallet = load_wallet(maker_config)?;
|
let wallet = load_wallet(maker_config)?;
|
||||||
let bond = Bond::assemble(&wallet, &offer_conditions, maker_config)?;
|
let bond = Bond::assemble(&wallet, &offer_conditions, maker_config)?;
|
||||||
|
dbg!(bond);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,14 @@ impl Bond {
|
|||||||
// to have the full trading sum as change as evidence for the coordinator that the maker owns
|
// to have the full trading sum as change as evidence for the coordinator that the maker owns
|
||||||
// enough funds to cover the trade
|
// enough funds to cover the trade
|
||||||
let (mut psbt, details) = {
|
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
|
builder
|
||||||
.coin_selection(BranchAndBoundCoinSelection::new(trader_input.trade_type.value()))
|
|
||||||
.add_recipient(address.script_pubkey(), bond_target.locking_amount)
|
.add_recipient(address.script_pubkey(), bond_target.locking_amount)
|
||||||
.do_not_spend_change()
|
.do_not_spend_change()
|
||||||
.fee_rate(FeeRate::from_sat_per_vb(201.0));
|
.fee_rate(FeeRate::from_sat_per_vb(201.0));
|
||||||
|
|
||||||
builder.finish()?
|
builder.finish()?
|
||||||
};
|
};
|
||||||
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
|
let finalized = wallet.sign(&mut psbt, SignOptions::default())?;
|
||||||
|
Reference in New Issue
Block a user