fn back_campaign(&self, api_key: &String, amount: f64) -> BackedCampaign {
        let backer_address = select_wallet_address(&api_key);
        let p2s_address = get_p2s_address(&api_key, &self, &backer_address);
        let backing_tx = send_wallet_payment(&api_key, &p2s_address, amount);

        if let Some(bt) = backing_tx {
            let backer_txs = vec![bt];
            let new_camp = Campaign::new(&self.name.clone(), &self.address.clone(), &self.deadline.to_string(), &self.goal.to_string());
            let backed_camp = BackedCampaign::new(new_camp, backer_address, p2s_address, backer_txs);
            backed_camp.clone().save_locally();
            return backed_camp;
        }
        panic!("Failed to send wallet payment to P2S Address.");
    }
/// Allows the user to back the Campaign
Allows the user to back the Campaign
Allows the user to back the Campaign
fn back_campaign(&self, api_key: &String, amount: f64) -> BackedCampaign {
        let backer_address = select_wallet_address(&api_key);
        let p2s_address = get_p2s_address(&api_key, &self, &backer_address);
        let backing_tx = send_wallet_payment(&api_key, &p2s_address, amount);
        if let Some(bt) = backing_tx {
            let backer_txs = vec![bt];
            let new_camp = Campaign::new(&self.name.clone(), &self.address.clone(), &self.deadline.to_string(), &self.goal.to_string());
            let backed_camp = BackedCampaign::new(new_camp, backer_address, p2s_address, backer_txs);
            backed_camp.clone().save_locally();
            return backed_camp;
        }
        panic!("Failed to send wallet payment to P2S Address.");
    }
fn back_campaign ( & self , api_key : & String , amount : f64 ) -> BackedCampaign { let backer_address = select_wallet_address ( & api_key ) ; let p2s_address = get_p2s_address ( & api_key , & self , & backer_address ) ; let backing_tx = send_wallet_payment ( & api_key , & p2s_address , amount ) ; if let Some ( bt ) = backing_tx { let backer_txs = vec ! [ bt ] ; let new_camp = Campaign :: new ( & self . name . clone ( ) , & self . address . clone ( ) , & self . deadline . to_string ( ) , & self . goal . to_string ( ) ) ; let backed_camp = BackedCampaign :: new ( new_camp , backer_address , p2s_address , backer_txs ) ; backed_camp . clone ( ) . save_locally ( ) ; return backed_camp ; } panic ! ( " " ) ; }
Allows the user to back the Campaign
Allows the user to back the Campaign
&self
api_key
&String
amount
f64
&self
api_key
&String
amount
f64