pub async fn donate_account(
        &mut self,
        caller: &PrincipalId,
        public_key_hex: String,
    ) -> Result<(), String> {
        let public_key = decode_hex_public_key(&public_key_hex)?;
        validate_public_key_against_caller(&public_key, caller)?;

        let custodian_neuron_id = self.donate_account_recipient_neuron_id.clone();

        let address = public_key_to_gtc_address(&public_key);
        let account = self.get_account_mut(&address)?;
        account.authenticated_principal_id = Some(*caller);

        account.transfer(custodian_neuron_id).await?;
        account.has_donated = true;

        Ok(())
    }
/// Donates the stake of all GTC neurons owned by the caller to the Neuron
/// given by `self.donate_account_recipient_neuron_id`. This GTC account
/// will no longer be able to have its neurons claimed.
Donates the stake of all GTC neurons owned by the caller to the Neuron
given by `self.donate_account_recipient_neuron_id`. This GTC account
will no longer be able to have its neurons claimed.
Donates the stake of all GTC neurons owned by the caller to the Neuron given by ` self . donate_account_recipient_neuron_id ` . This GTC account will no longer be able to have its neurons claimed .
pub async fn donate_account(
        &mut self,
        caller: &PrincipalId,
        public_key_hex: String,
    ) -> Result<(), String> {
        let public_key = decode_hex_public_key(&public_key_hex)?;
        validate_public_key_against_caller(&public_key, caller)?;
        let custodian_neuron_id = self.donate_account_recipient_neuron_id.clone();
        let address = public_key_to_gtc_address(&public_key);
        let account = self.get_account_mut(&address)?;
        account.authenticated_principal_id = Some(*caller);
        account.transfer(custodian_neuron_id).await?;
        account.has_donated = true;
        Ok(())
    }
pub async fn donate_account ( & mut self , caller : & PrincipalId , public_key_hex : String , ) -> Result < ( ) , String > { let public_key = decode_hex_public_key ( & public_key_hex ) ? ; validate_public_key_against_caller ( & public_key , caller ) ? ; let custodian_neuron_id = self . donate_account_recipient_neuron_id . clone ( ) ; let address = public_key_to_gtc_address ( & public_key ) ; let account = self . get_account_mut ( & address ) ? ; account . authenticated_principal_id = Some ( * caller ) ; account . transfer ( custodian_neuron_id ) . await ? ; account . has_donated = true ; Ok ( ( ) ) }
Donates the stake of all GTC neurons owned by the caller to the Neuron
given by `self.donate_account_recipient_neuron_id`.
Donates the stake of all GTC neurons owned by the caller to the Neuron given by ` self . donate_account_recipient_neuron_id ` .
&mut self
caller
&PrincipalId
public_key_hex
String
&mut self
caller
&PrincipalId
public_key_hex
String