pub async fn create_auxiliary_token_account_with_extension_space(
        &self,
        account: &S,
        owner: &Pubkey,
        extensions: Vec<ExtensionType>,
    ) -> TokenResult<Pubkey> {
        let state = self.get_mint_info().await?;
        let mint_extensions: Vec<ExtensionType> = state.get_extension_types()?;
        let mut required_extensions =
            ExtensionType::get_required_init_account_extensions(&mint_extensions);
        for extension_type in extensions.into_iter() {
            if !required_extensions.contains(&extension_type) {
                required_extensions.push(extension_type);
            }
        }
        let space = ExtensionType::get_account_len::<Account>(&required_extensions);
        self.process_ixs(
            &[
                system_instruction::create_account(
                    &self.payer.pubkey(),
                    &account.pubkey(),
                    self.client
                        .get_minimum_balance_for_rent_exemption(space)
                        .await
                        .map_err(TokenError::Client)?,
                    space as u64,
                    &self.program_id,
                ),
                instruction::initialize_account(
                    &self.program_id,
                    &account.pubkey(),
                    &self.pubkey,
                    owner,
                )?,
            ],
            &[account],
        )
        .await
        .map(|_| account.pubkey())
        .map_err(Into::into)
    }
/// Create and initialize a new token account.
Create and initialize a new token account.
Create and initialize a new token account .
pub async fn create_auxiliary_token_account_with_extension_space(
        &self,
        account: &S,
        owner: &Pubkey,
        extensions: Vec<ExtensionType>,
    ) -> TokenResult<Pubkey> {
        let state = self.get_mint_info().await?;
        let mint_extensions: Vec<ExtensionType> = state.get_extension_types()?;
        let mut required_extensions =
            ExtensionType::get_required_init_account_extensions(&mint_extensions);
        for extension_type in extensions.into_iter() {
            if !required_extensions.contains(&extension_type) {
                required_extensions.push(extension_type);
            }
        }
        let space = ExtensionType::get_account_len::<Account>(&required_extensions);
        self.process_ixs(
            &[
                system_instruction::create_account(
                    &self.payer.pubkey(),
                    &account.pubkey(),
                    self.client
                        .get_minimum_balance_for_rent_exemption(space)
                        .await
                        .map_err(TokenError::Client)?,
                    space as u64,
                    &self.program_id,
                ),
                instruction::initialize_account(
                    &self.program_id,
                    &account.pubkey(),
                    &self.pubkey,
                    owner,
                )?,
            ],
            &[account],
        )
        .await
        .map(|_| account.pubkey())
        .map_err(Into::into)
    }
pub async fn create_auxiliary_token_account_with_extension_space ( & self , account : & S , owner : & Pubkey , extensions : Vec < ExtensionType > , ) -> TokenResult < Pubkey > { let state = self . get_mint_info ( ) . await ? ; let mint_extensions : Vec < ExtensionType > = state . get_extension_types ( ) ? ; let mut required_extensions = ExtensionType :: get_required_init_account_extensions ( & mint_extensions ) ; for extension_type in extensions . into_iter ( ) { if ! required_extensions . contains ( & extension_type ) { required_extensions . push ( extension_type ) ; } } let space = ExtensionType :: get_account_len :: < Account > ( & required_extensions ) ; self . process_ixs ( & [ system_instruction :: create_account ( & self . payer . pubkey ( ) , & account . pubkey ( ) , self . client . get_minimum_balance_for_rent_exemption ( space ) . await . map_err ( TokenError :: Client ) ? , space as u64 , & self . program_id , ) , instruction :: initialize_account ( & self . program_id , & account . pubkey ( ) , & self . pubkey , owner , ) ? , ] , & [ account ] , ) . await . map ( | _ | account . pubkey ( ) ) . map_err ( Into :: into ) }
Create and initialize a new token account.
Create and initialize a new token account .
&self
account
&S
owner
&Pubkey
extensions
Vec<ExtensionType>
&self
account
&S
owner
&Pubkey
extensions
Vec<ExtensionType>