Skip to main content

CreateAccountAllowPrefund

Struct CreateAccountAllowPrefund 

Source
pub struct CreateAccountAllowPrefund<'a, 'b> {
    pub to: &'a AccountView<'a>,
    pub funding: Option<(&'a AccountView<'a>, u64)>,
    pub space: u64,
    pub owner: &'b Address,
}
Expand description

Builder for the system program’s CreateAccountAllowPrefund instruction (tag 13).

Unlike CreateAccount, the target may already hold lamports: the System Program allocates, assigns, and then transfers lamports from the funding account as a delta on top of the existing balance, so callers pass required.saturating_sub(current). The account order is [to, from], the reverse of CreateAccount. A funding account is sent whenever one is given, even with a zero delta (the System Program ignores it then), so a caller that always names a payer links one CPI body; from is left out of the instruction only when funding is None. The to account must sign (or be a PDA in signers) and must be System-owned with no data. Feature gate 6sPDzwyARRExKH52LECxcGoqziH8G7SZofwuxi8Ja331, active on mainnet-beta since slot 422,928,004 (2026-05-29) and on devnet and testnet; the System Program rejects the tag where it is inactive.

Fields§

§to: &'a AccountView<'a>§funding: Option<(&'a AccountView<'a>, u64)>

Funding account and lamport delta. None omits the payer from the instruction; a zero delta keeps it (ignored by the System Program).

§space: u64§owner: &'b Address

Implementations§

Source§

impl CreateAccountAllowPrefund<'_, '_>

Source

pub fn invoke(&self) -> ProgramResult

Invoke without PDA signers.

Source

pub fn invoke_signed(&self, signers: &[Signer<'_, '_>]) -> ProgramResult

Invoke with PDA signers.

Auto Trait Implementations§

§

impl<'a, 'b> !Send for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> !Sync for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> Freeze for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> Unpin for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for CreateAccountAllowPrefund<'a, 'b>

§

impl<'a, 'b> UnwindSafe for CreateAccountAllowPrefund<'a, 'b>

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.