mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-12-24 13:56:57 +00:00
comments
This commit is contained in:
@ -22,11 +22,11 @@ pub struct BondRequirementResponse {
|
||||
#[derive(Deserialize, Serialize, Debug)]
|
||||
pub struct BondSubmissionRequest {
|
||||
pub robohash_hex: String,
|
||||
pub signed_bond_hex: String, // signed bond transaction, hex encoded
|
||||
pub payout_address: String, // does this make sense here?
|
||||
pub taproot_pubkey_hex: String,
|
||||
pub signed_bond_hex: String, // signed bond transaction, hex encoded
|
||||
pub payout_address: String, // does this make sense here?
|
||||
pub taproot_pubkey_hex: String, // used for script path spending
|
||||
pub musig_pub_nonce_hex: String,
|
||||
pub musig_pubkey_hex: String,
|
||||
pub musig_pubkey_hex: String, // used for key path spending
|
||||
pub bdk_psbt_inputs_hex_csv: String,
|
||||
pub client_change_address: String,
|
||||
}
|
||||
|
||||
@ -24,11 +24,11 @@ pub struct BondRequirementResponse {
|
||||
#[derive(Serialize, Debug)]
|
||||
pub struct BondSubmissionRequest {
|
||||
pub robohash_hex: String,
|
||||
pub signed_bond_hex: String, // signed bond transaction, hex encoded
|
||||
pub payout_address: String, // does this make sense here?
|
||||
pub taproot_pubkey_hex: String,
|
||||
pub signed_bond_hex: String, // signed bond transaction, hex encoded
|
||||
pub payout_address: String, // does this make sense here?
|
||||
pub taproot_pubkey_hex: String, // used for script path spending
|
||||
pub musig_pub_nonce_hex: String,
|
||||
pub musig_pubkey_hex: String,
|
||||
pub musig_pubkey_hex: String, // used for key path spending
|
||||
pub bdk_psbt_inputs_hex_csv: String,
|
||||
pub client_change_address: String,
|
||||
}
|
||||
@ -77,7 +77,7 @@ pub struct PublicOffer {
|
||||
pub amount_sat: u64,
|
||||
pub offer_id_hex: String,
|
||||
pub required_bond_amount_sat: u64,
|
||||
pub bond_locking_address: String,
|
||||
pub bond_locking_address: String, // its probably bad privacy to make the locking address static
|
||||
}
|
||||
|
||||
// request to receive the escrow psbt to sign for the specified offer to take it
|
||||
|
||||
@ -67,44 +67,8 @@ impl BondRequirementResponse {
|
||||
}
|
||||
|
||||
impl BondSubmissionRequest {
|
||||
// pub fn prepare_bond_request(
|
||||
// bond: &partiallysignedtransaction,
|
||||
// payout_address: &addressinfo,
|
||||
// musig_data: &mut musigdata,
|
||||
// trader_config: &tradersettings,
|
||||
// taproot_pubkey: &xonlypublickey,
|
||||
// ) -> result<bondsubmissionrequest> {
|
||||
// let signed_bond_hex = serialize_hex(&bond.to_owned().extract_tx());
|
||||
// let musig_pub_nonce_hex = hex::encode(musig_data.nonce.get_pub_for_sharing()?.serialize());
|
||||
// let musig_pubkey_hex = hex::encode(musig_data.public_key.to_string());
|
||||
// let taproot_pubkey_hex = hex::encode(taproot_pubkey.serialize());
|
||||
|
||||
// let request = bondsubmissionrequest {
|
||||
// robohash_hex: trader_config.robosats_robohash_hex.clone(),
|
||||
// signed_bond_hex,
|
||||
// payout_address: payout_address.address.to_string(),
|
||||
// musig_pub_nonce_hex,
|
||||
// musig_pubkey_hex,
|
||||
// taproot_pubkey_hex,
|
||||
// };
|
||||
// ok(request)
|
||||
// }
|
||||
|
||||
pub fn send_maker(
|
||||
&self, // robohash_hex: &str,
|
||||
// bond: &PartiallySignedTransaction,
|
||||
// musig_data: &mut MuSigData,
|
||||
// payout_address: &AddressInfo,
|
||||
trader_setup: &TraderSettings,
|
||||
// taproot_pubkey: &XOnlyPublicKey,
|
||||
) -> Result<OrderActivatedResponse> {
|
||||
// let request = Self::prepare_bond_request(
|
||||
// bond,
|
||||
// payout_address,
|
||||
// musig_data,
|
||||
// trader_setup,
|
||||
// taproot_pubkey,
|
||||
// )?;
|
||||
/// sending the signed maker bond and additional trade data to the coordinator
|
||||
pub fn send_maker(&self, trader_setup: &TraderSettings) -> Result<OrderActivatedResponse> {
|
||||
let client = reqwest::blocking::Client::new();
|
||||
let res = client
|
||||
.post(format!(
|
||||
|
||||
@ -32,6 +32,7 @@ pub fn run_maker(maker_config: &TraderSettings) -> Result<()> {
|
||||
let offer = ActiveOffer::create(&wallet, maker_config)?;
|
||||
info!("Maker offer created: {:#?}", &offer);
|
||||
|
||||
// waits until taker accepts offer, then gets the escrow psbt in return to sign the inputs
|
||||
let escrow_psbt_requirements = offer.wait_until_taken(maker_config)?;
|
||||
let mut escrow_psbt =
|
||||
PartiallySignedTransaction::from_str(escrow_psbt_requirements.escrow_psbt_hex.as_str())?;
|
||||
@ -46,7 +47,7 @@ pub fn run_maker(maker_config: &TraderSettings) -> Result<()> {
|
||||
maker_config,
|
||||
)?;
|
||||
|
||||
// wait for confirmation
|
||||
// wait for confirmation of the escrow locking transaction (polling)
|
||||
offer.wait_on_trade_ready_confirmation(maker_config)?;
|
||||
if offer.fiat_confirmation_cli_input(maker_config)? {
|
||||
// this represents the "confirm payment" / "confirm fiat recieved" button
|
||||
|
||||
Reference in New Issue
Block a user