This commit is contained in:
Felix
2024-06-14 14:47:03 +00:00
parent df4c4b0347
commit eb438388db
2 changed files with 41 additions and 41 deletions

View File

@ -42,40 +42,40 @@ impl PublicOffers {
} }
} }
impl PublicOffer { impl PublicOffer { tbd
pub fn take(&self, taker_config: &TraderSettings) -> Result<BondRequirementResponse> { // pub fn take(&self, taker_config: &TraderSettings) -> Result<BondRequirementResponse> {
let client = reqwest::blocking::Client::new(); // let client = reqwest::blocking::Client::new();
let res = client // let res = client
.post(format!( // .post(format!(
"{}{}", // "{}{}",
taker_config.coordinator_endpoint, "/take-offer" // taker_config.coordinator_endpoint, "/take-offer"
)) // ))
.json(self) // .json(self)
.send()? // .send()?
.json::<BondRequirementResponse>()?; // .json::<BondRequirementResponse>()?;
Ok(res) // Ok(res)
} // }
} }
impl OfferTakenRequest { impl OfferTakenRequest { // tbd
pub fn taker_request( // pub fn taker_request(
bond: &Bond, // bond: &Bond,
mut musig_data: &MuSigData, // mut musig_data: &MuSigData,
taker_config: &TraderSettings, // taker_config: &TraderSettings,
) -> Result<PartiallySignedTransaction> { // ) -> Result<PartiallySignedTransaction> {
let request = RequestOfferPsbt { // let request = RequestOfferPsbt {
offer: // offer:
}; // };
let client = reqwest::blocking::Client::new(); // let client = reqwest::blocking::Client::new();
let res = client // let res = client
.post(format!( // .post(format!(
"{}{}", // "{}{}",
taker_config.coordinator_endpoint, "/submit-taker-bond" // taker_config.coordinator_endpoint, "/submit-taker-bond"
)) // ))
.json(self) // .json(self)
.send()? // .send()?
.json::<OfferTakenResponse>()?; // .json::<OfferTakenResponse>()?;
Ok(res) // Ok(res)
} // }
} }

View File

@ -2,14 +2,14 @@ use super::utils::*;
use super::*; use super::*;
impl ActiveOffer { impl ActiveOffer {
pub fn take( // pub fn take( tbd
trading_wallet: &TradingWallet, // trading_wallet: &TradingWallet,
taker_config: &TraderSettings, // taker_config: &TraderSettings,
offer: &PublicOffer, // offer: &PublicOffer,
) -> Result<ActiveOffer> { // ) -> Result<ActiveOffer> {
let bond_conditions: BondRequirementResponse = offer.take(taker_config)?; // let bond_conditions: BondRequirementResponse = offer.take(taker_config)?;
let (bond, mut musig_data, payout_address) = // let (bond, mut musig_data, payout_address) =
trading_wallet.trade_onchain_assembly(&bond_conditions, taker_config)?; // trading_wallet.trade_onchain_assembly(&bond_conditions, taker_config)?;
// let trading_psbt = // let trading_psbt =
} }