SystemInstruction

Enum SystemInstruction 

Source
pub enum SystemInstruction {
Show 14 variants CreateAccount { lamports: u64, space: u64, owner: Address, }, Assign { owner: Address, }, Transfer { lamports: u64, }, CreateAccountWithSeed { base: Address, seed: String, lamports: u64, space: u64, owner: Address, }, AdvanceNonceAccount, WithdrawNonceAccount(u64), InitializeNonceAccount(Address), AuthorizeNonceAccount(Address), Allocate { space: u64, }, AllocateWithSeed { base: Address, seed: String, space: u64, owner: Address, }, AssignWithSeed { base: Address, seed: String, owner: Address, }, TransferWithSeed { lamports: u64, from_seed: String, from_owner: Address, }, UpgradeNonceAccount, CreateAccountAllowPrefund { lamports: u64, space: u64, owner: Address, },
}
Expand description

An instruction to the system program.

Variants§

§

CreateAccount

Create a new account

§Account references

  1. [WRITE, SIGNER] Funding account
  2. [WRITE, SIGNER] New account

Fields

§lamports: u64

Number of lamports to transfer to the new account

§space: u64

Number of bytes of memory to allocate

§owner: Address

Address of program that will own the new account

§

Assign

Assign account to a program

§Account references

  1. [WRITE, SIGNER] Assigned account public key

Fields

§owner: Address

Owner program account

§

Transfer

Transfer lamports

§Account references

  1. [WRITE, SIGNER] Funding account
  2. [WRITE] Recipient account

Fields

§lamports: u64
§

CreateAccountWithSeed

Create a new account at an address derived from a base address and a seed

§Account references

  1. [WRITE, SIGNER] Funding account
  2. [WRITE] Created account
  3. [SIGNER] (optional) Base account; the account matching the base address below must be provided as a signer, but may be the same as the funding account and provided as account 0

Fields

§base: Address

Base address

§seed: String

String of ASCII chars, no longer than Address::MAX_SEED_LEN

§lamports: u64

Number of lamports to transfer to the new account

§space: u64

Number of bytes of memory to allocate

§owner: Address

Owner program account address

§

AdvanceNonceAccount

Consumes a stored nonce, replacing it with a successor

§Account references

  1. [WRITE] Nonce account
  2. [] RecentBlockhashes sysvar
  3. [SIGNER] Nonce authority
§

WithdrawNonceAccount(u64)

Withdraw funds from a nonce account

§Account references

  1. [WRITE] Nonce account
  2. [WRITE] Recipient account
  3. [] RecentBlockhashes sysvar
  4. [] Rent sysvar
  5. [SIGNER] Nonce authority

The u64 parameter is the lamports to withdraw, which must leave the account balance above the rent exempt reserve or at zero.

§

InitializeNonceAccount(Address)

Drive state of Uninitialized nonce account to Initialized, setting the nonce value

§Account references

  1. [WRITE] Nonce account
  2. [] RecentBlockhashes sysvar
  3. [] Rent sysvar

The Address parameter specifies the entity authorized to execute nonce instruction on the account

No signatures are required to execute this instruction, enabling derived nonce account addresses

§

AuthorizeNonceAccount(Address)

Change the entity authorized to execute nonce instructions on the account

§Account references

  1. [WRITE] Nonce account
  2. [SIGNER] Nonce authority

The Address parameter identifies the entity to authorize

§

Allocate

Allocate space in a (possibly new) account without funding

§Account references

  1. [WRITE, SIGNER] New account

Fields

§space: u64

Number of bytes of memory to allocate

§

AllocateWithSeed

Allocate space for and assign an account at an address derived from a base public key and a seed

§Account references

  1. [WRITE] Allocated account
  2. [SIGNER] Base account

Fields

§base: Address

Base address

§seed: String

String of ASCII chars, no longer than Address::MAX_SEED_LEN

§space: u64

Number of bytes of memory to allocate

§owner: Address

Owner program account

§

AssignWithSeed

Assign account to a program based on a seed

§Account references

  1. [WRITE] Assigned account
  2. [SIGNER] Base account

Fields

§base: Address

Base address

§seed: String

String of ASCII chars, no longer than Address::MAX_SEED_LEN

§owner: Address

Owner program account

§

TransferWithSeed

Transfer lamports from a derived address

§Account references

  1. [WRITE] Funding account
  2. [SIGNER] Base for funding account
  3. [WRITE] Recipient account

Fields

§lamports: u64

Amount to transfer

§from_seed: String

Seed to use to derive the funding account address

§from_owner: Address

Owner to use to derive the funding account address

§

UpgradeNonceAccount

One-time idempotent upgrade of legacy nonce versions in order to bump them out of chain blockhash domain.

§Account references

  1. [WRITE] Nonce account
§

CreateAccountAllowPrefund

Create a new account without enforcing the invariant that the account’s current lamports must be 0.

This constructor is identical to create_account with the exception that it does not check that the destination account (to_pubkey) has a zero lamport balance prior to creation. This enables patterns where you first transfer lamports to prefund an account, then use create_account_allow_prefund as a single CPI to transfer additional lamports, allocate space, and assign ownership.

Use create_account for typical account creation. Use create_account_allow_prefund when the target account has already been prefunded and you want to complete the creation process with a single CPI.

Safety considerations As with allocate and assign when invoked manually, this instruction can brick a wallet if used incorrectly; do not pass in a wallet system account as the new account. This instruction does not prevent the new account from having more lamports than required for rent exemption, and all lamports will become locked.

§Account references

If lamports > 0 (meaning lamports are being transferred): 0. [WRITE, SIGNER] New account

  1. [WRITE, SIGNER] Funding account

If lamports == 0 (no lamports to be transferred), you may omit funding account: 0. [WRITE, SIGNER] New account

Fields

§lamports: u64

Number of lamports to transfer to the new account

§space: u64

Number of bytes of memory to allocate

§owner: Address

Address of program that will own the new account

Trait Implementations§

Source§

impl AbiEnumVisitor for SystemInstruction

Source§

fn visit_for_abi(&self, digester: &mut AbiDigester) -> DigestResult

Source§

impl AbiExample for SystemInstruction

Source§

fn example() -> Self

Source§

impl Clone for SystemInstruction

Source§

fn clone(&self) -> SystemInstruction

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SystemInstruction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SystemInstruction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for SystemInstruction

Source§

fn eq(&self, other: &SystemInstruction) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for SystemInstruction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for SystemInstruction

Source§

impl StructuralPartialEq for SystemInstruction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AbiEnumVisitor for T
where T: Serialize + ?Sized,

Source§

default fn visit_for_abi( &self, _digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

Source§

impl<T> AbiEnumVisitor for T
where T: Serialize + AbiExample,

Source§

default fn visit_for_abi( &self, digester: &mut AbiDigester, ) -> Result<AbiDigester, DigestError>

Source§

impl<T> AbiExample for T

Source§

default fn example() -> T

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,