pub struct InitializeAccount<'account> {
pub account: &'account AccountView,
pub mint: &'account AccountView,
pub owner: &'account AccountView,
pub rent_sysvar: &'account AccountView,
}Expand description
Initializes a new account to hold tokens. If this account is associated with the native mint then the token balance of the initialized account will be equal to the amount of SOL in the account. If this account is associated with another mint, that mint must be initialized before this command can succeed.
The super::InitializeAccount instruction requires no
signers and MUST be included within the same Transaction as the
system program’s CreateAccount instruction that creates the
account being initialized. Otherwise another party can acquire
ownership of the uninitialized account.
Accounts expected by this instruction:
[writable]The account to initialize.[]The mint this account will be associated with.[]The new account’s owner/multisignature.[]Rent sysvar.
Fields§
§account: &'account AccountViewThe account to initialize.
mint: &'account AccountViewThe mint this account will be associated with.
owner: &'account AccountViewThe new account’s owner/multisignature.
rent_sysvar: &'account AccountViewRent sysvar.
Implementations§
Source§impl<'account> InitializeAccount<'account>
impl<'account> InitializeAccount<'account>
pub const DISCRIMINATOR: u8 = 1
Sourcepub const ACCOUNTS_LEN: usize = 4
pub const ACCOUNTS_LEN: usize = 4
Expected number of accounts.
pub fn new( account: &'account AccountView, mint: &'account AccountView, owner: &'account AccountView, rent_sysvar: &'account AccountView, ) -> Self
pub fn invoke(&self) -> ProgramResult
Trait Implementations§
Source§impl CpiWriter for InitializeAccount<'_>
impl CpiWriter for InitializeAccount<'_>
Source§fn write_accounts<'cpi>(
&self,
accounts: &mut [MaybeUninit<CpiAccount<'cpi>>],
) -> Result<usize, ProgramError>where
Self: 'cpi,
fn write_accounts<'cpi>(
&self,
accounts: &mut [MaybeUninit<CpiAccount<'cpi>>],
) -> Result<usize, ProgramError>where
Self: 'cpi,
AccountViews required by this instruction into the provided
slice. Read moreSource§fn write_instruction_accounts<'cpi>(
&self,
accounts: &mut [MaybeUninit<InstructionAccount<'cpi>>],
) -> Result<usize, ProgramError>where
Self: 'cpi,
fn write_instruction_accounts<'cpi>(
&self,
accounts: &mut [MaybeUninit<InstructionAccount<'cpi>>],
) -> Result<usize, ProgramError>where
Self: 'cpi,
InstructionAccounts required by this instruction into the
provided slice. Read moreSource§fn write_instruction_data(
&self,
data: &mut [MaybeUninit<u8>],
) -> Result<usize, ProgramError>
fn write_instruction_data( &self, data: &mut [MaybeUninit<u8>], ) -> Result<usize, ProgramError>
Source§impl IntoBatch for InitializeAccount<'_>
impl IntoBatch for InitializeAccount<'_>
Source§fn into_batch<'account, 'state>(
self,
batch: &mut Batch<'account, 'state>,
) -> ProgramResultwhere
Self: 'account + 'state,
fn into_batch<'account, 'state>(
self,
batch: &mut Batch<'account, 'state>,
) -> ProgramResultwhere
Self: 'account + 'state,
self into the provided batch.