Skip to main content

MintPlan

Struct MintPlan 

Source
pub struct MintPlan<'a> { /* private fields */ }
Expand description

Validated, allocation-free mint creation plan.

new rejects duplicate extensions, invalid nullable addresses and fee rates, and extensions on the legacy program. space includes Token-2022 padding and TLV headers. There is no arbitrary spare capacity: Token-2022 requires the allocation to equal the initialized extension set’s canonical size.

Implementations§

Source§

impl<'a> MintPlan<'a>

Source

pub fn new( program: MintProgram, config: MintConfig<'a>, extensions: &'a [MintExtension<'a>], ) -> Result<Self, ProgramError>

Source

pub const fn space(&self) -> usize

Source

pub fn check_space(&self, space: usize) -> ProgramResult

Check an explicitly supplied allocation before paying rent or invoking CPI.

Source

pub fn initialize(&self, mint: &AccountView<'_>) -> ProgramResult

Initialize an already allocated, rent-exempt, entirely zeroed mint. Include the selected executable token program in the outer instruction. Propagate errors: if a later CPI fails, the enclosing instruction must fail to roll back earlier extension initialization.

Source

pub fn create( &self, payer: &AccountView<'_>, mint: &AccountView<'_>, signers: &[Signer<'_, '_>], ) -> ProgramResult

Allocate a fresh System-owned mint, initialize extensions, then the base mint. Prefunding is supported; only the live rent shortfall is charged.

Include the System and selected token programs in the outer instruction. The mint and payer must sign, directly or through signers. As with any sequence of CPIs, propagate errors to preserve transaction atomicity. Uses System CreateAccountAllowPrefund; the target cluster must enable it.

Auto Trait Implementations§

§

impl<'a> Freeze for MintPlan<'a>

§

impl<'a> RefUnwindSafe for MintPlan<'a>

§

impl<'a> Send for MintPlan<'a>

§

impl<'a> Sync for MintPlan<'a>

§

impl<'a> Unpin for MintPlan<'a>

§

impl<'a> UnsafeUnpin for MintPlan<'a>

§

impl<'a> UnwindSafe for MintPlan<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.