diff --git a/lang/derive/accounts/src/lib.rs b/lang/derive/accounts/src/lib.rs index 529c5bec6..b56844961 100644 --- a/lang/derive/accounts/src/lib.rs +++ b/lang/derive/accounts/src/lib.rs @@ -14,7 +14,7 @@ use syn::parse_macro_input; /// #[derive(Accounts)] /// pub struct Auth<'info> { /// #[account(mut, has_one = authority)] -/// pub data: ProgramAccount<'info, MyData>, +/// pub data: Account<'info, MyData>, /// #[account(signer)] /// pub authority: AccountInfo<'info>, /// } @@ -38,16 +38,16 @@ use syn::parse_macro_input; /// | Attribute | Location | Description | /// |:--|:--|:--| /// | `#[account(signer)]`

`#[account(signer @ )]` | On raw `AccountInfo` structs. | Checks the given account signed the transaction. Custom errors are supported via `@`. | -/// | `#[account(mut)]`

`#[account(mut @ )]` | On `AccountInfo`, `ProgramAccount` or `CpiAccount` structs. | Marks the account as mutable and persists the state transition. Custom errors are supported via `@`. | -/// | `#[account(init)]` | On `ProgramAccount` structs. | Marks the account as being initialized, creating the account via the system program. | -/// | `#[account(init_if_needed)]` | On `ProgramAccount` structs. | Same as `init` but skip if already initialized. | -/// | `#[account(zero)]` | On `ProgramAccount` structs. | Asserts the account discriminator is zero. | -/// | `#[account(close = )]` | On `ProgramAccount` and `Loader` structs. | Marks the account as being closed at the end of the instruction's execution, sending the rent exemption lamports to the specified . | -/// | `#[account(has_one = )]`

`#[account(has_one = @ )]` | On `ProgramAccount` or `CpiAccount` structs | Checks the `target` field on the account matches the `target` field in the struct deriving `Accounts`. Custom errors are supported via `@`. | +/// | `#[account(mut)]`

`#[account(mut @ )]` | On `AccountInfo`, `Account` or `CpiAccount` structs. | Marks the account as mutable and persists the state transition. Custom errors are supported via `@`. | +/// | `#[account(init)]` | On `Account` structs. | Marks the account as being initialized, creating the account via the system program. | +/// | `#[account(init_if_needed)]` | On `Account` structs. | Same as `init` but skip if already initialized. | +/// | `#[account(zero)]` | On `Account` structs. | Asserts the account discriminator is zero. | +/// | `#[account(close = )]` | On `Account` and `AccountLoader` structs. | Marks the account as being closed at the end of the instruction's execution, sending the rent exemption lamports to the specified . | +/// | `#[account(has_one = )]`

`#[account(has_one = @ )]` | On `Account` or `CpiAccount` structs | Checks the `target` field on the account matches the `target` field in the struct deriving `Accounts`. Custom errors are supported via `@`. | /// | `#[account(seeds = [], bump? = , payer? = , space? = , owner? = )]` | On `AccountInfo` structs | Seeds for the program derived address an `AccountInfo` struct represents. If bump is provided, then appends it to the seeds. On initialization, validates the given bump is the bump provided by `Pubkey::find_program_address`.| /// | `#[account(constraint = )]`

`#[account(constraint = @ )]` | On any type deriving `Accounts` | Executes the given code as a constraint. The expression should evaluate to a boolean. Custom errors are supported via `@`. | /// | `#[account("")]` | Deprecated | Executes the given code literal as a constraint. The literal should evaluate to a boolean. | -/// | `#[account(rent_exempt = )]` | On `AccountInfo` or `ProgramAccount` structs | Optional attribute to skip the rent exemption check. By default, all accounts marked with `#[account(init)]` will be rent exempt, and so this should rarely (if ever) be used. Similarly, omitting `= skip` will mark the account rent exempt. | +/// | `#[account(rent_exempt = )]` | On `AccountInfo` or `Account` structs | Optional attribute to skip the rent exemption check. By default, all accounts marked with `#[account(init)]` will be rent exempt, and so this should rarely (if ever) be used. Similarly, omitting `= skip` will mark the account rent exempt. | /// | `#[account(executable)]` | On `AccountInfo` structs | Checks the given account is an executable program. | /// | `#[account(state = )]` | On `CpiState` structs | Checks the given state is the canonical state account for the target program. | /// | `#[account(owner = )]`

`#[account(owner = @ )]` | On `CpiState`, `CpiAccount`, and `AccountInfo` | Checks the account owner matches the target. Custom errors are supported via `@`. |