pub struct SyncNative<'account> {
pub native_token: &'account AccountView,
pub rent_sysvar: Option<&'account AccountView>,
}Expand description
Given a wrapped / native token account (a token account containing SOL)
updates its amount field based on the account’s underlying lamports.
This is useful if a non-wrapped SOL account uses
system_instruction::transfer to move lamports to a wrapped token
account, and needs to have its token amount field updated.
Accounts expected by this instruction:
- Using runtime Rent sysvar
[writable]The native token account to sync with its underlying lamports.
- Using Rent sysvar account
[writable]The native token account to sync with its underlying lamports.[]Rent sysvar.
Fields§
§native_token: &'account AccountViewNative Token Account
rent_sysvar: Option<&'account AccountView>Implementations§
Source§impl<'account> SyncNative<'account>
impl<'account> SyncNative<'account>
pub const DISCRIMINATOR: u8 = 17
Sourcepub const MAX_ACCOUNTS_LEN: usize = 2
pub const MAX_ACCOUNTS_LEN: usize = 2
Maximum number of accounts expected by this instruction.
The required number of accounts will depend whether the source account has a single owner or a multisignature owner.
pub fn new( native_token: &'account AccountView, rent_sysvar: Option<&'account AccountView>, ) -> Self
pub fn invoke(&self) -> ProgramResult
Trait Implementations§
Source§impl CpiWriter for SyncNative<'_>
impl CpiWriter for SyncNative<'_>
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 SyncNative<'_>
impl IntoBatch for SyncNative<'_>
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 SyncNative<'account>
impl<'account> RefUnwindSafe for SyncNative<'account>
impl<'account> !Send for SyncNative<'account>
impl<'account> !Sync for SyncNative<'account>
impl<'account> Unpin for SyncNative<'account>
impl<'account> UnsafeUnpin for SyncNative<'account>
impl<'account> UnwindSafe for SyncNative<'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