diff --git a/taptrade-cli-demo/coordinator/src/communication/api.rs b/taptrade-cli-demo/coordinator/src/communication/api.rs index 113d2b6..9ad7576 100644 --- a/taptrade-cli-demo/coordinator/src/communication/api.rs +++ b/taptrade-cli-demo/coordinator/src/communication/api.rs @@ -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, } diff --git a/taptrade-cli-demo/trader/src/communication/api.rs b/taptrade-cli-demo/trader/src/communication/api.rs index 6f09b95..834e8f1 100644 --- a/taptrade-cli-demo/trader/src/communication/api.rs +++ b/taptrade-cli-demo/trader/src/communication/api.rs @@ -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 diff --git a/taptrade-cli-demo/trader/src/communication/mod.rs b/taptrade-cli-demo/trader/src/communication/mod.rs index 8b8a08d..35ae060 100644 --- a/taptrade-cli-demo/trader/src/communication/mod.rs +++ b/taptrade-cli-demo/trader/src/communication/mod.rs @@ -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 { - // 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 { - // 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 { let client = reqwest::blocking::Client::new(); let res = client .post(format!( diff --git a/taptrade-cli-demo/trader/src/trading/mod.rs b/taptrade-cli-demo/trader/src/trading/mod.rs index af031d4..a0938ae 100644 --- a/taptrade-cli-demo/trader/src/trading/mod.rs +++ b/taptrade-cli-demo/trader/src/trading/mod.rs @@ -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