Skip to content

Commit

Permalink
docs: Replace ProgramAccount with Account in tutorial-2.md (coral-xyz…
Browse files Browse the repository at this point in the history
  • Loading branch information
hjchan authored Sep 19, 2021
1 parent 296f4b6 commit 65db766
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/src/tutorials/tutorial-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To address these problems, Anchor provides several types, traits, and macros. It
from the untrusted `&[AccountInfo]` slice given to a Solana program into a validated struct
of deserialized account types.
* [#[account]](https://docs.rs/anchor-lang/latest/anchor_lang/attr.account.html): attribute macro implementing [AccountSerialize](https://docs.rs/anchor-lang/latest/anchor_lang/trait.AccountSerialize.html) and [AccountDeserialize](https://docs.rs/anchor-lang/latest/anchor_lang/trait.AnchorDeserialize.html), automatically prepending a unique 8 byte discriminator to the account array. The discriminator is defined by the first 8 bytes of the `Sha256` hash of the account's Rust identifier--i.e., the struct type name--and ensures no account can be substituted for another.
* [ProgramAccount](https://docs.rs/anchor-lang/latest/anchor_lang/struct.ProgramAccount.html): a wrapper type for a deserialized account implementing `AccountDeserialize`. Using this type within an `Accounts` struct will ensure the account is **owned** by the currently executing program.
* [Account](https://docs.rs/anchor-lang/latest/anchor_lang/struct.Account.html): a wrapper type for a deserialized account implementing `AccountDeserialize`. Using this type within an `Accounts` struct will ensure the account is **owned** by the currently executing program.

With the above, we can define preconditions for our any instruction handler expecting a certain set of
accounts, allowing us to more easily reason about the security of our programs.
Expand Down Expand Up @@ -47,7 +47,7 @@ Let's focus on the `increment` instruction, specifically the `Increment` struct
#[derive(Accounts)]
pub struct Increment<'info> {
#[account(mut, has_one = authority)]
pub counter: ProgramAccount<'info, Counter>,
pub counter: Account<'info, Counter>,
#[account(signer)]
pub authority: AccountInfo<'info>,
}
Expand Down

0 comments on commit 65db766

Please sign in to comment.