pub struct InitializeAccount2<'account> {
pub account: &'account AccountView,
pub mint: &'account AccountView,
pub rent_sysvar: &'account AccountView,
pub owner: &'account Address,
}Expand description
Like super::InitializeAccount, but the owner pubkey is
passed via instruction data rather than the accounts list. This
variant may be preferable when using Cross Program Invocation from
an instruction that does not need the owner’s AccountInfo
otherwise.
Accounts expected by this instruction:
[writable]The account to initialize.[]The mint this account will be associated with.[]Rent sysvar.
Fields§
§account: &'account AccountViewThe account to initialize.
mint: &'account AccountViewThe mint this account will be associated with.
rent_sysvar: &'account AccountViewRent sysvar.
owner: &'account AddressThe new account’s owner/multisignature.
Implementations§
Source§impl<'account> InitializeAccount2<'account>
impl<'account> InitializeAccount2<'account>
pub const DISCRIMINATOR: u8 = 16
Sourcepub const ACCOUNTS_LEN: usize = 3
pub const ACCOUNTS_LEN: usize = 3
Expected number of accounts.
Sourcepub const DATA_LEN: usize = 33
pub const DATA_LEN: usize = 33
Instruction data length:
- discriminator (1 byte)
- owner pubkey (32 bytes)
pub fn new( account: &'account AccountView, mint: &'account AccountView, rent_sysvar: &'account AccountView, owner: &'account Address, ) -> Self
pub fn invoke(&self) -> ProgramResult
Trait Implementations§
Source§impl CpiWriter for InitializeAccount2<'_>
impl CpiWriter for InitializeAccount2<'_>
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,
Writes the
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,
Writes the
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>
Writes the instruction data for this instruction into the provided
slice. Read more
Source§impl IntoBatch for InitializeAccount2<'_>
impl IntoBatch for InitializeAccount2<'_>
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,
Serializes
self into the provided batch.Auto Trait Implementations§
impl<'account> Freeze for InitializeAccount2<'account>
impl<'account> RefUnwindSafe for InitializeAccount2<'account>
impl<'account> !Send for InitializeAccount2<'account>
impl<'account> !Sync for InitializeAccount2<'account>
impl<'account> Unpin for InitializeAccount2<'account>
impl<'account> UnsafeUnpin for InitializeAccount2<'account>
impl<'account> UnwindSafe for InitializeAccount2<'account>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more