pub enum TokenProgram {
Legacy,
Token2022,
}Expand description
The two token programs every builder in this module can target.
The wire format of the shared instruction set is identical on both, so a builder’s encoding does not change; only the program id in the CPI does.
Variants§
Legacy
SPL Token, TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA.
Token2022
Token-2022, TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb.
Implementations§
Source§impl TokenProgram
impl TokenProgram
Sourcepub fn from_address(address: &Address) -> Option<Self>
pub fn from_address(address: &Address) -> Option<Self>
The program behind an address, if it is one of the two.
Sourcepub fn owning(account: &AccountView<'_>) -> Result<Self, ProgramError>
pub fn owning(account: &AccountView<'_>) -> Result<Self, ProgramError>
The program that owns account: a token account, a mint, or a
multisig. Anything owned by another program is refused with
IncorrectProgramId, so a builder driven by this never sends a
token instruction to a program that is not a token program.
Sourcepub fn from_program_account(
program: &AccountView<'_>,
) -> Result<Self, ProgramError>
pub fn from_program_account( program: &AccountView<'_>, ) -> Result<Self, ProgramError>
The program an executable account in the instruction stands for. Refuses any address that is not one of the two token programs.
Trait Implementations§
Source§impl Clone for TokenProgram
impl Clone for TokenProgram
impl Copy for TokenProgram
Source§impl Debug for TokenProgram
impl Debug for TokenProgram
impl Eq for TokenProgram
Source§impl PartialEq for TokenProgram
impl PartialEq for TokenProgram
impl StructuralPartialEq for TokenProgram
Auto Trait Implementations§
impl Freeze for TokenProgram
impl RefUnwindSafe for TokenProgram
impl Send for TokenProgram
impl Sync for TokenProgram
impl Unpin for TokenProgram
impl UnsafeUnpin for TokenProgram
impl UnwindSafe for TokenProgram
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