pub enum AssociatedTokenAccountInstruction {
    Create,
    CreateIdempotent,
    RecoverNested,
}
Expand description

Instructions supported by the AssociatedTokenAccount program

Variants

Create

Creates an associated token account for the given wallet address and token mint Returns an error if the account exists.

  1. [writeable,signer] Funding account (must be a system account)
  2. [writeable] Associated token account address to be created
  3. [] Wallet address for the new associated token account
  4. [] The token mint for the new associated token account
  5. [] System program
  6. [] SPL Token program

CreateIdempotent

Creates an associated token account for the given wallet address and token mint, if it doesn’t already exist. Returns an error if the account exists, but with a different owner.

  1. [writeable,signer] Funding account (must be a system account)
  2. [writeable] Associated token account address to be created
  3. [] Wallet address for the new associated token account
  4. [] The token mint for the new associated token account
  5. [] System program
  6. [] SPL Token program

RecoverNested

Transfers from and closes a nested associated token account: an associated token account owned by an associated token account.

The tokens are moved from the nested associated token account to the wallet’s associated token account, and the nested account lamports are moved to the wallet.

Note: Nested token accounts are an anti-pattern, and almost always created unintentionally, so this instruction should only be used to recover from errors.

  1. [writeable] Nested associated token account, must be owned by 3
  2. [] Token mint for the nested associated token account
  3. [writeable] Wallet’s associated token account
  4. [] Owner associated token account address, must be owned by 5
  5. [] Token mint for the owner associated token account
  6. [writeable, signer] Wallet address for the owner associated token account
  7. [] SPL Token program

Trait Implementations

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes. Read more

Deserialize this instance from a slice of bytes.

Get the name of the type without brackets.

Recursively, using DFS, add type definitions required for this type. For primitive types this is an empty map. Type definition explains how to serialize/deserialize a type. Read more

Helper method to add a single type definition to the map.

Serialize this instance into a vector of bytes.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.