pub struct PackedAccounts(pub PackedAccounts<AccountMeta>);Expand description
Packs accounts and creates indices for instruction building (client-side).
Wraps the generic PackedAccounts<AccountMeta> from sdk-types with
Solana-specific system account helpers as inherent methods.
Tuple Fields§
§0: PackedAccounts<AccountMeta>Implementations§
Source§impl PackedAccounts
impl PackedAccounts
Sourcepub fn new_with_system_accounts(config: SystemAccountMetaConfig) -> Result<Self>
pub fn new_with_system_accounts(config: SystemAccountMetaConfig) -> Result<Self>
Creates a new PackedAccounts with v1 system accounts pre-configured.
Use with cpi::v1::CpiAccounts on the program side.
Sourcepub fn add_system_accounts(
&mut self,
config: SystemAccountMetaConfig,
) -> Result<()>
pub fn add_system_accounts( &mut self, config: SystemAccountMetaConfig, ) -> Result<()>
Adds v1 Light system program accounts to the account list.
Use with cpi::v1::CpiAccounts on the program side.
This adds all the accounts required by the Light system program for v1 operations, including the CPI authority, registered programs, account compression program, and Noop program.
Sourcepub fn add_system_accounts_v2(
&mut self,
config: SystemAccountMetaConfig,
) -> Result<()>
pub fn add_system_accounts_v2( &mut self, config: SystemAccountMetaConfig, ) -> Result<()>
Adds v2 Light system program accounts to the account list.
Use with cpi::v2::CpiAccounts on the program side.
This adds all the accounts required by the Light system program for v2 operations. V2 uses a different account layout optimized for batched state trees.
Methods from Deref<Target = PackedAccounts<AccountMeta>>§
pub fn system_accounts_set(&self) -> bool
pub fn add_pre_accounts_signer( &mut self, pubkey: <AM as AccountMetaTrait>::Pubkey, )
pub fn add_pre_accounts_signer_mut( &mut self, pubkey: <AM as AccountMetaTrait>::Pubkey, )
pub fn add_pre_accounts_meta(&mut self, account_meta: AM)
pub fn add_pre_accounts_metas(&mut self, account_metas: &[AM])
pub fn add_system_accounts_raw(&mut self, system_accounts: Vec<AM>)
Sourcepub fn insert_or_get(&mut self, pubkey: <AM as AccountMetaTrait>::Pubkey) -> u8
pub fn insert_or_get(&mut self, pubkey: <AM as AccountMetaTrait>::Pubkey) -> u8
Returns the index of the provided pubkey in the collection.
If the provided pubkey is not a part of the collection, it gets
inserted with a next_index.
If the provided pubkey already exists in the collection, its already
existing index is returned.
pub fn insert_or_get_read_only( &mut self, pubkey: <AM as AccountMetaTrait>::Pubkey, ) -> u8
pub fn insert_or_get_config( &mut self, pubkey: <AM as AccountMetaTrait>::Pubkey, is_signer: bool, is_writable: bool, ) -> u8
Sourcepub fn to_account_metas(&self) -> (Vec<AM>, usize, usize)
pub fn to_account_metas(&self) -> (Vec<AM>, usize, usize)
Converts the collection of accounts to a vector of account metas, which can be used as remaining accounts in instructions or CPI calls.
§Returns
A tuple of (account_metas, system_accounts_offset, packed_accounts_offset):
account_metas: All accounts concatenated in order:[pre_accounts][system_accounts][packed_accounts]system_accounts_offset: Index where system accounts start (= pre_accounts.len())packed_accounts_offset: Index where packed accounts start (= pre_accounts.len() + system_accounts.len())
pub fn packed_pubkeys(&self) -> Vec<[u8; 32]>
pub fn add_custom_system_accounts<T>(
&mut self,
accounts: T,
) -> Result<(), LightSdkTypesError>where
T: AccountMetasVec<AM>,
Trait Implementations§
Source§impl Debug for PackedAccounts
impl Debug for PackedAccounts
Source§impl Default for PackedAccounts
impl Default for PackedAccounts
Source§fn default() -> PackedAccounts
fn default() -> PackedAccounts
Source§impl Deref for PackedAccounts
impl Deref for PackedAccounts
Source§type Target = PackedAccounts<AccountMeta>
type Target = PackedAccounts<AccountMeta>
Source§impl DerefMut for PackedAccounts
impl DerefMut for PackedAccounts
Source§impl From<PackedAccounts<AccountMeta>> for PackedAccounts
impl From<PackedAccounts<AccountMeta>> for PackedAccounts
Source§fn from(inner: PackedAccounts<AccountMeta>) -> Self
fn from(inner: PackedAccounts<AccountMeta>) -> Self
Source§impl From<PackedAccounts> for PackedAccounts<AccountMeta>
impl From<PackedAccounts> for PackedAccounts<AccountMeta>
Source§fn from(wrapper: PackedAccounts) -> Self
fn from(wrapper: PackedAccounts) -> Self
Auto Trait Implementations§
impl Freeze for PackedAccounts
impl RefUnwindSafe for PackedAccounts
impl Send for PackedAccounts
impl Sync for PackedAccounts
impl Unpin for PackedAccounts
impl UnsafeUnpin for PackedAccounts
impl UnwindSafe for PackedAccounts
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more