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

View File

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