pub async fn transfer(&mut self, custodian_neuron_id: Option<NeuronId>) -> Result<(), String> {
        if self.has_claimed {
            return Err("Neurons already claimed".to_string());
        } else if self.has_donated {
            return Err("Account has already donated its funds".to_string());
        } else if self.has_forwarded {
            return Err("Account has already forwarded its funds".to_string());
        } else if custodian_neuron_id.is_none() {
            return Err("No custodian neuron ID is defined".to_string());
        }

        let custodian_neuron_id = custodian_neuron_id.unwrap();
        let neuron_ids = self.neuron_ids.clone();

        for neuron_id in neuron_ids {
            let result = GovernanceCanister::transfer_gtc_neuron(
                neuron_id.clone(),
                custodian_neuron_id.clone(),
            )
            .await;

            self.neuron_ids.retain(|id| id != &neuron_id);

            let mut donated_neuron = TransferredNeuron {
                neuron_id: Some(neuron_id),
                timestamp_seconds: now_secs(),
                error: None,
            };

            match result {
                Ok(_) => self.successfully_transferred_neurons.push(donated_neuron),
                Err(e) => {
                    donated_neuron.error = Some(e.to_string());
                    self.failed_transferred_neurons.push(donated_neuron)
                }
            }
        }

        Ok(())
    }
/// Transfer the stake of all unclaimed neurons (associated with this
/// account) to the neuron given by `custodian_neuron_id`.
Transfer the stake of all unclaimed neurons (associated with this
account) to the neuron given by `custodian_neuron_id`.
Transfer the stake of all unclaimed neurons ( associated with this account ) to the neuron given by ` custodian_neuron_id ` .
pub async fn transfer(&mut self, custodian_neuron_id: Option<NeuronId>) -> Result<(), String> {
        if self.has_claimed {
            return Err("Neurons already claimed".to_string());
        } else if self.has_donated {
            return Err("Account has already donated its funds".to_string());
        } else if self.has_forwarded {
            return Err("Account has already forwarded its funds".to_string());
        } else if custodian_neuron_id.is_none() {
            return Err("No custodian neuron ID is defined".to_string());
        }
        let custodian_neuron_id = custodian_neuron_id.unwrap();
        let neuron_ids = self.neuron_ids.clone();
        for neuron_id in neuron_ids {
            let result = GovernanceCanister::transfer_gtc_neuron(
                neuron_id.clone(),
                custodian_neuron_id.clone(),
            )
            .await;
            self.neuron_ids.retain(|id| id != &neuron_id);
            let mut donated_neuron = TransferredNeuron {
                neuron_id: Some(neuron_id),
                timestamp_seconds: now_secs(),
                error: None,
            };
            match result {
                Ok(_) => self.successfully_transferred_neurons.push(donated_neuron),
                Err(e) => {
                    donated_neuron.error = Some(e.to_string());
                    self.failed_transferred_neurons.push(donated_neuron)
                }
            }
        }
        Ok(())
    }
pub async fn transfer ( & mut self , custodian_neuron_id : Option < NeuronId > ) -> Result < ( ) , String > { if self . has_claimed { return Err ( " " . to_string ( ) ) ; } else if self . has_donated { return Err ( " " . to_string ( ) ) ; } else if self . has_forwarded { return Err ( " " . to_string ( ) ) ; } else if custodian_neuron_id . is_none ( ) { return Err ( " " . to_string ( ) ) ; } let custodian_neuron_id = custodian_neuron_id . unwrap ( ) ; let neuron_ids = self . neuron_ids . clone ( ) ; for neuron_id in neuron_ids { let result = GovernanceCanister :: transfer_gtc_neuron ( neuron_id . clone ( ) , custodian_neuron_id . clone ( ) , ) . await ; self . neuron_ids . retain ( | id | id != & neuron_id ) ; let mut donated_neuron = TransferredNeuron { neuron_id : Some ( neuron_id ) , timestamp_seconds : now_secs ( ) , error : None , } ; match result { Ok ( _ ) => self . successfully_transferred_neurons . push ( donated_neuron ) , Err ( e ) => { donated_neuron . error = Some ( e . to_string ( ) ) ; self . failed_transferred_neurons . push ( donated_neuron ) } } } Ok ( ( ) ) }
Transfer the stake of all unclaimed neurons (associated with this
account) to the neuron given by `custodian_neuron_id`.
Transfer the stake of all unclaimed neurons ( associated with this account ) to the neuron given by ` custodian_neuron_id ` .
&mut self
custodian_neuron_id
Option<NeuronId>
&mut self
custodian_neuron_id
Option<NeuronId>