-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
instruction.rs
50 lines (48 loc) · 2.44 KB
/
instruction.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Program instructions
use borsh::{BorshDeserialize, BorshSchema, BorshSerialize};
pub use spl_associated_token_account_client::instruction::*;
/// Instructions supported by the AssociatedTokenAccount program
#[derive(Clone, Debug, PartialEq, BorshDeserialize, BorshSerialize, BorshSchema)]
pub enum AssociatedTokenAccountInstruction {
/// Creates an associated token account for the given wallet address and
/// token mint Returns an error if the account exists.
///
/// 0. `[writeable,signer]` Funding account (must be a system account)
/// 1. `[writeable]` Associated token account address to be created
/// 2. `[]` Wallet address for the new associated token account
/// 3. `[]` The token mint for the new associated token account
/// 4. `[]` System program
/// 5. `[]` SPL Token program
Create,
/// 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.
///
/// 0. `[writeable,signer]` Funding account (must be a system account)
/// 1. `[writeable]` Associated token account address to be created
/// 2. `[]` Wallet address for the new associated token account
/// 3. `[]` The token mint for the new associated token account
/// 4. `[]` System program
/// 5. `[]` SPL Token program
CreateIdempotent,
/// 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.
///
/// 0. `[writeable]` Nested associated token account, must be owned by `3`
/// 1. `[]` Token mint for the nested associated token account
/// 2. `[writeable]` Wallet's associated token account
/// 3. `[]` Owner associated token account address, must be owned by `5`
/// 4. `[]` Token mint for the owner associated token account
/// 5. `[writeable, signer]` Wallet address for the owner associated token
/// account
/// 6. `[]` SPL Token program
RecoverNested,
}