Enum spl_tlv_account_resolution::seeds::Seed
source · pub enum Seed {
Uninitialized,
Literal {
bytes: Vec<u8>,
},
InstructionData {
index: u8,
length: u8,
},
AccountKey {
index: u8,
},
AccountData {
account_index: u8,
data_index: u8,
length: u8,
},
}
Expand description
Enum to describe a required seed for a Program-Derived Address
Variants§
Uninitialized
Uninitialized configuration byte space
Literal
Fields
A literal hard-coded argument Packed as: * 1 - Discriminator * 1 - Length of literal * N - Literal bytes themselves
InstructionData
Fields
An instruction-provided argument, to be resolved from the instruction data Packed as: * 1 - Discriminator * 1 - Start index of instruction data * 1 - Length of instruction data starting at index
AccountKey
The public key of an account from the entire accounts list. Note: This includes an extra accounts required.
Packed as: * 1 - Discriminator * 1 - Index of account in accounts list
AccountData
Fields
An argument to be resolved from the inner data of some account Packed as: * 1 - Discriminator * 1 - Index of account in accounts list * 1 - Start index of account data * 1 - Length of account data starting at index
Implementations§
source§impl Seed
impl Seed
sourcepub fn pack(&self, dst: &mut [u8]) -> Result<(), ProgramError>
pub fn pack(&self, dst: &mut [u8]) -> Result<(), ProgramError>
Packs a seed configuration into a slice
sourcepub fn pack_into_address_config(
seeds: &[Self]
) -> Result<[u8; 32], ProgramError>
pub fn pack_into_address_config( seeds: &[Self] ) -> Result<[u8; 32], ProgramError>
Packs a vector of seed configurations into a 32-byte array, filling the rest with 0s. Errors if it overflows.
sourcepub fn unpack(bytes: &[u8]) -> Result<Self, ProgramError>
pub fn unpack(bytes: &[u8]) -> Result<Self, ProgramError>
Unpacks a seed configuration from a slice
sourcepub fn unpack_address_config(
address_config: &[u8; 32]
) -> Result<Vec<Self>, ProgramError>
pub fn unpack_address_config( address_config: &[u8; 32] ) -> Result<Vec<Self>, ProgramError>
Unpacks all seed configurations from a 32-byte array. Stops when it hits uninitialized data (0s).