#[repr(C)]pub struct ExtraAccountMeta {
pub discriminator: u8,
pub address_config: [u8; 32],
pub is_signer: PodBool,
pub is_writable: PodBool,
}
Expand description
Pod
type for defining a required account in a validation account.
This can be any of the following:
- A standard
AccountMeta
- A PDA (with seed configurations)
- A pubkey stored in some data (account or instruction data)
Can be used in TLV-encoded data.
Fields§
§discriminator: u8
Discriminator to tell whether this represents a standard
AccountMeta
, PDA, or pubkey data.
address_config: [u8; 32]
This address_config
field can either be the pubkey of the account,
the seeds used to derive the pubkey from provided inputs (PDA), or the
data used to derive the pubkey (account or instruction data).
is_signer: PodBool
Whether the account should sign
is_writable: PodBool
Whether the account should be writable
Implementations§
source§impl ExtraAccountMeta
impl ExtraAccountMeta
sourcepub fn new_with_pubkey(
pubkey: &Pubkey,
is_signer: bool,
is_writable: bool,
) -> Result<Self, ProgramError>
pub fn new_with_pubkey( pubkey: &Pubkey, is_signer: bool, is_writable: bool, ) -> Result<Self, ProgramError>
Create a ExtraAccountMeta
from a public key,
thus representing a standard AccountMeta
sourcepub fn new_with_seeds(
seeds: &[Seed],
is_signer: bool,
is_writable: bool,
) -> Result<Self, ProgramError>
pub fn new_with_seeds( seeds: &[Seed], is_signer: bool, is_writable: bool, ) -> Result<Self, ProgramError>
Create a ExtraAccountMeta
from a list of seed configurations,
thus representing a PDA
sourcepub fn new_with_pubkey_data(
key_data: &PubkeyData,
is_signer: bool,
is_writable: bool,
) -> Result<Self, ProgramError>
pub fn new_with_pubkey_data( key_data: &PubkeyData, is_signer: bool, is_writable: bool, ) -> Result<Self, ProgramError>
Create a ExtraAccountMeta
from a pubkey data configuration.
sourcepub fn new_external_pda_with_seeds(
program_index: u8,
seeds: &[Seed],
is_signer: bool,
is_writable: bool,
) -> Result<Self, ProgramError>
pub fn new_external_pda_with_seeds( program_index: u8, seeds: &[Seed], is_signer: bool, is_writable: bool, ) -> Result<Self, ProgramError>
Create a ExtraAccountMeta
from a list of seed configurations,
representing a PDA for an external program
This PDA belongs to a program elsewhere in the account list, rather
than the executing program. For a PDA on the executing program, use
ExtraAccountMeta::new_with_seeds
.
sourcepub fn resolve<'a, F>(
&self,
instruction_data: &[u8],
program_id: &Pubkey,
get_account_key_data_fn: F,
) -> Result<AccountMeta, ProgramError>
pub fn resolve<'a, F>( &self, instruction_data: &[u8], program_id: &Pubkey, get_account_key_data_fn: F, ) -> Result<AccountMeta, ProgramError>
Resolve an ExtraAccountMeta
into an AccountMeta
, potentially
resolving a program-derived address (PDA) if necessary
Trait Implementations§
source§impl Clone for ExtraAccountMeta
impl Clone for ExtraAccountMeta
source§fn clone(&self) -> ExtraAccountMeta
fn clone(&self) -> ExtraAccountMeta
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ExtraAccountMeta
impl Debug for ExtraAccountMeta
source§impl Default for ExtraAccountMeta
impl Default for ExtraAccountMeta
source§fn default() -> ExtraAccountMeta
fn default() -> ExtraAccountMeta
source§impl From<&AccountInfo<'_>> for ExtraAccountMeta
impl From<&AccountInfo<'_>> for ExtraAccountMeta
source§fn from(account_info: &AccountInfo<'_>) -> Self
fn from(account_info: &AccountInfo<'_>) -> Self
source§impl From<&AccountMeta> for ExtraAccountMeta
impl From<&AccountMeta> for ExtraAccountMeta
source§fn from(meta: &AccountMeta) -> Self
fn from(meta: &AccountMeta) -> Self
source§impl From<AccountInfo<'_>> for ExtraAccountMeta
impl From<AccountInfo<'_>> for ExtraAccountMeta
source§fn from(account_info: AccountInfo<'_>) -> Self
fn from(account_info: AccountInfo<'_>) -> Self
source§impl From<AccountMeta> for ExtraAccountMeta
impl From<AccountMeta> for ExtraAccountMeta
source§fn from(meta: AccountMeta) -> Self
fn from(meta: AccountMeta) -> Self
source§impl PartialEq for ExtraAccountMeta
impl PartialEq for ExtraAccountMeta
source§fn eq(&self, other: &ExtraAccountMeta) -> bool
fn eq(&self, other: &ExtraAccountMeta) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<&ExtraAccountMeta> for AccountMeta
impl TryFrom<&ExtraAccountMeta> for AccountMeta
§type Error = ProgramError
type Error = ProgramError
impl Copy for ExtraAccountMeta
impl Pod for ExtraAccountMeta
impl StructuralPartialEq for ExtraAccountMeta
Auto Trait Implementations§
impl Freeze for ExtraAccountMeta
impl RefUnwindSafe for ExtraAccountMeta
impl Send for ExtraAccountMeta
impl Sync for ExtraAccountMeta
impl Unpin for ExtraAccountMeta
impl UnwindSafe for ExtraAccountMeta
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> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
bits
as &Self
.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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