|
@@ -18,14 +18,19 @@ use std::ops::Deref;
|
|
/// if the program is owned by the [`BPFUpgradeableLoader`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/index.html)
|
|
/// if the program is owned by the [`BPFUpgradeableLoader`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/index.html)
|
|
/// and will contain the `programdata_address` property of the `Program` variant of the [`UpgradeableLoaderState`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/enum.UpgradeableLoaderState.html) enum.
|
|
/// and will contain the `programdata_address` property of the `Program` variant of the [`UpgradeableLoaderState`](https://docs.rs/solana-program/latest/solana_program/bpf_loader_upgradeable/enum.UpgradeableLoaderState.html) enum.
|
|
///
|
|
///
|
|
|
|
+/// # Table of Contents
|
|
|
|
+/// - [Basic Functionality](#basic-functionality)
|
|
|
|
+/// - [Out of the Box Types](#out-of-the-box-types)
|
|
|
|
+///
|
|
|
|
+/// # Basic Functionality
|
|
|
|
+///
|
|
/// Checks:
|
|
/// Checks:
|
|
///
|
|
///
|
|
-/// - `Account.info.key == Program`
|
|
|
|
-/// - `Account.info.executable == true`
|
|
|
|
|
|
+/// - `account_info.key == expected_program`
|
|
|
|
+/// - `account_info.executable == true`
|
|
///
|
|
///
|
|
/// # Example
|
|
/// # Example
|
|
/// ```ignore
|
|
/// ```ignore
|
|
-///
|
|
|
|
/// #[program]
|
|
/// #[program]
|
|
/// mod my_program {
|
|
/// mod my_program {
|
|
/// fn set_admin_settings(...){...}
|
|
/// fn set_admin_settings(...){...}
|
|
@@ -58,6 +63,16 @@ use std::ops::Deref;
|
|
/// will be `None` if it's not).
|
|
/// will be `None` if it's not).
|
|
/// - `program_data`'s constraint checks that its upgrade authority is the `authority` account.
|
|
/// - `program_data`'s constraint checks that its upgrade authority is the `authority` account.
|
|
/// - Finally, `authority` needs to sign the transaction.
|
|
/// - Finally, `authority` needs to sign the transaction.
|
|
|
|
+///
|
|
|
|
+/// # Out of the Box Types
|
|
|
|
+///
|
|
|
|
+/// Between the [`anchor_lang`](https://docs.rs/anchor-lang/latest/anchor_lang) and [`anchor_spl`](https://docs.rs/anchor_spl/latest/anchor_spl) crates,
|
|
|
|
+/// the following `Program` types are provided out of the box:
|
|
|
|
+///
|
|
|
|
+/// - [`System`](https://docs.rs/anchor-lang/latest/anchor_lang/struct.System.html)
|
|
|
|
+/// - [`AssociatedToken`](https://docs.rs/anchor-spl/latest/anchor_spl/associated_token/struct.AssociatedToken.html)
|
|
|
|
+/// - [`Token`](https://docs.rs/anchor-spl/latest/anchor_spl/token/struct.Token.html)
|
|
|
|
+///
|
|
#[derive(Clone)]
|
|
#[derive(Clone)]
|
|
pub struct Program<'info, T: Id + Clone> {
|
|
pub struct Program<'info, T: Id + Clone> {
|
|
info: AccountInfo<'info>,
|
|
info: AccountInfo<'info>,
|