reformat token instruction comments (#732)

This commit is contained in:
Jack May 2020-10-26 18:04:39 -07:00 committed by GitHub
parent 18e8951c97
commit f21c71ed83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 129 additions and 92 deletions

View File

@ -20,11 +20,14 @@ pub const MAX_SIGNERS: usize = 11;
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub enum TokenInstruction {
/// Initializes a new mint and optionally deposits all the newly minted tokens in an account.
/// Initializes a new mint and optionally deposits all the newly minted
/// tokens in an account.
///
/// The `InitializeMint` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeMint` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
@ -39,14 +42,17 @@ pub enum TokenInstruction {
/// The freeze authority/multisignature of the mint.
freeze_authority: COption<Pubkey>,
},
/// Initializes a new account to hold tokens. If this account is associated with the native
/// mint then the token balance of the initialized account will be equal to the amount of SOL
/// in the account. If this account is associated with another mint, that mint must be
/// initialized before this command can succeed.
/// Initializes a new account to hold tokens. If this account is associated
/// with the native mint then the token balance of the initialized account
/// will be equal to the amount of SOL in the account. If this account is
/// associated with another mint, that mint must be initialized before this
/// command can succeed.
///
/// The `InitializeAccount` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeAccount` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
@ -57,26 +63,32 @@ pub enum TokenInstruction {
InitializeAccount,
/// Initializes a multisignature account with N provided signers.
///
/// Multisignature accounts can used in place of any single owner/delegate accounts in any
/// token instruction that require an owner/delegate to be present. The variant field represents the
/// number of signers (M) required to validate this multisignature account.
/// Multisignature accounts can used in place of any single owner/delegate
/// accounts in any token instruction that require an owner/delegate to be
/// present. The variant field represents the number of signers (M)
/// required to validate this multisignature account.
///
/// The `InitializeMultisig` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeMultisig` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The multisignature account to initialize.
/// 1. `[]` Rent sysvar
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <= 11.
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <=
/// 11.
InitializeMultisig {
/// The number of signers (M) required to validate this multisignature account.
/// The number of signers (M) required to validate this multisignature
/// account.
m: u8,
},
/// Transfers tokens from one account to another either directly or via a delegate. If this
/// account is associated with the native mint then equal amounts of SOL and Tokens will be
/// transferred to the destination account.
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// Accounts expected by this instruction:
///
@ -94,8 +106,8 @@ pub enum TokenInstruction {
/// The amount of tokens to transfer.
amount: u64,
},
/// Approves a delegate. A delegate is given the authority over
/// tokens on behalf of the source account's owner.
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// Accounts expected by this instruction:
///
@ -144,7 +156,8 @@ pub enum TokenInstruction {
/// The new authority
new_authority: COption<Pubkey>,
},
/// Mints new tokens to an account. The native mint does not support minting.
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// Accounts expected by this instruction:
///
@ -162,8 +175,8 @@ pub enum TokenInstruction {
/// The amount of new tokens to mint.
amount: u64,
},
/// Burns tokens by removing them from an account. `Burn` does not support accounts
/// associated with the native mint, use `CloseAccount` instead.
/// Burns tokens by removing them from an account. `Burn` does not support
/// accounts associated with the native mint, use `CloseAccount` instead.
///
/// Accounts expected by this instruction:
///
@ -197,7 +210,8 @@ pub enum TokenInstruction {
/// 2. `[]` The account's multisignature owner.
/// 3. ..3+M `[signer]` M signer accounts.
CloseAccount,
/// Freeze an Initialized account using the Mint's freeze_authority (if set).
/// Freeze an Initialized account using the Mint's freeze_authority (if
/// set).
///
/// Accounts expected by this instruction:
///
@ -228,13 +242,14 @@ pub enum TokenInstruction {
/// 3. ..3+M `[signer]` M signer accounts.
ThawAccount,
/// Transfers tokens from one account to another either directly or via a delegate. If this
/// account is associated with the native mint then equal amounts of SOL and Tokens will be
/// transferred to the destination account.
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// This instruction differs from Transfer in that the token mint and decimals value is
/// asserted by the caller. This may be useful when creating transactions offline or within a
/// hardware wallet.
/// This instruction differs from Transfer in that the token mint and
/// decimals value is asserted by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -256,12 +271,12 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Approves a delegate. A delegate is given the authority over
/// tokens on behalf of the source account's owner.
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// This instruction differs from Approve in that the token mint and decimals value is asserted
/// by the caller. This may be useful when creating transactions offline or within a hardware
/// wallet.
/// This instruction differs from Approve in that the token mint and
/// decimals value is asserted by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -283,10 +298,12 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Mints new tokens to an account. The native mint does not support minting.
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// This instruction differs from MintTo in that the decimals value is asserted by the
/// caller. This may be useful when creating transactions offline or within a hardware wallet.
/// This instruction differs from MintTo in that the decimals value is
/// asserted by the caller. This may be useful when creating transactions
/// offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -306,11 +323,12 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Burns tokens by removing them from an account. `Burn2` does not support accounts
/// associated with the native mint, use `CloseAccount` instead.
/// Burns tokens by removing them from an account. `Burn2` does not support
/// accounts associated with the native mint, use `CloseAccount` instead.
///
/// This instruction differs from Burn in that the decimals value is asserted by the caller.
/// This may be useful when creating transactions offline or within a hardware wallet.
/// This instruction differs from Burn in that the decimals value is
/// asserted by the caller. This may be useful when creating transactions
/// offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///

View File

@ -20,11 +20,14 @@ pub const MAX_SIGNERS: usize = 11;
#[repr(C)]
#[derive(Clone, Debug, PartialEq)]
pub enum TokenInstruction {
/// Initializes a new mint and optionally deposits all the newly minted tokens in an account.
/// Initializes a new mint and optionally deposits all the newly minted
/// tokens in an account.
///
/// The `InitializeMint` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeMint` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
@ -39,14 +42,17 @@ pub enum TokenInstruction {
/// The freeze authority/multisignature of the mint.
freeze_authority: COption<Pubkey>,
},
/// Initializes a new account to hold tokens. If this account is associated with the native
/// mint then the token balance of the initialized account will be equal to the amount of SOL
/// in the account. If this account is associated with another mint, that mint must be
/// initialized before this command can succeed.
/// Initializes a new account to hold tokens. If this account is associated
/// with the native mint then the token balance of the initialized account
/// will be equal to the amount of SOL in the account. If this account is
/// associated with another mint, that mint must be initialized before this
/// command can succeed.
///
/// The `InitializeAccount` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeAccount` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
@ -57,26 +63,32 @@ pub enum TokenInstruction {
InitializeAccount,
/// Initializes a multisignature account with N provided signers.
///
/// Multisignature accounts can used in place of any single owner/delegate accounts in any
/// token instruction that require an owner/delegate to be present. The variant field represents the
/// number of signers (M) required to validate this multisignature account.
/// Multisignature accounts can used in place of any single owner/delegate
/// accounts in any token instruction that require an owner/delegate to be
/// present. The variant field represents the number of signers (M)
/// required to validate this multisignature account.
///
/// The `InitializeMultisig` instruction requires no signers and MUST be included within
/// the same Transaction as the system program's `CreateAccount` instruction that creates the account
/// being initialized. Otherwise another party can acquire ownership of the uninitialized account.
/// The `InitializeMultisig` instruction requires no signers and MUST be
/// included within the same Transaction as the system program's
/// `CreateAccount` instruction that creates the account being initialized.
/// Otherwise another party can acquire ownership of the uninitialized
/// account.
///
/// Accounts expected by this instruction:
///
/// 0. `[writable]` The multisignature account to initialize.
/// 1. `[]` Rent sysvar
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <= 11.
/// 2. ..2+N. `[]` The signer accounts, must equal to N where 1 <= N <=
/// 11.
InitializeMultisig {
/// The number of signers (M) required to validate this multisignature account.
/// The number of signers (M) required to validate this multisignature
/// account.
m: u8,
},
/// Transfers tokens from one account to another either directly or via a delegate. If this
/// account is associated with the native mint then equal amounts of SOL and Tokens will be
/// transferred to the destination account.
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// Accounts expected by this instruction:
///
@ -94,8 +106,8 @@ pub enum TokenInstruction {
/// The amount of tokens to transfer.
amount: u64,
},
/// Approves a delegate. A delegate is given the authority over
/// tokens on behalf of the source account's owner.
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// Accounts expected by this instruction:
///
@ -144,7 +156,8 @@ pub enum TokenInstruction {
/// The new authority
new_authority: COption<Pubkey>,
},
/// Mints new tokens to an account. The native mint does not support minting.
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// Accounts expected by this instruction:
///
@ -162,8 +175,8 @@ pub enum TokenInstruction {
/// The amount of new tokens to mint.
amount: u64,
},
/// Burns tokens by removing them from an account. `Burn` does not support accounts
/// associated with the native mint, use `CloseAccount` instead.
/// Burns tokens by removing them from an account. `Burn` does not support
/// accounts associated with the native mint, use `CloseAccount` instead.
///
/// Accounts expected by this instruction:
///
@ -197,7 +210,8 @@ pub enum TokenInstruction {
/// 2. `[]` The account's multisignature owner.
/// 3. ..3+M `[signer]` M signer accounts.
CloseAccount,
/// Freeze an Initialized account using the Mint's freeze_authority (if set).
/// Freeze an Initialized account using the Mint's freeze_authority (if
/// set).
///
/// Accounts expected by this instruction:
///
@ -228,13 +242,14 @@ pub enum TokenInstruction {
/// 3. ..3+M `[signer]` M signer accounts.
ThawAccount,
/// Transfers tokens from one account to another either directly or via a delegate. If this
/// account is associated with the native mint then equal amounts of SOL and Tokens will be
/// transferred to the destination account.
/// Transfers tokens from one account to another either directly or via a
/// delegate. If this account is associated with the native mint then equal
/// amounts of SOL and Tokens will be transferred to the destination
/// account.
///
/// This instruction differs from Transfer in that the token mint and decimals value is
/// checked by the caller. This may be useful when creating transactions offline or within a
/// hardware wallet.
/// This instruction differs from Transfer in that the token mint and
/// decimals value is checked by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -256,12 +271,12 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Approves a delegate. A delegate is given the authority over
/// tokens on behalf of the source account's owner.
/// Approves a delegate. A delegate is given the authority over tokens on
/// behalf of the source account's owner.
///
/// This instruction differs from Approve in that the token mint and decimals value is checked
/// by the caller. This may be useful when creating transactions offline or within a hardware
/// wallet.
/// This instruction differs from Approve in that the token mint and
/// decimals value is checked by the caller. This may be useful when
/// creating transactions offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -283,10 +298,12 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Mints new tokens to an account. The native mint does not support minting.
/// Mints new tokens to an account. The native mint does not support
/// minting.
///
/// This instruction differs from MintTo in that the decimals value is checked by the
/// caller. This may be useful when creating transactions offline or within a hardware wallet.
/// This instruction differs from MintTo in that the decimals value is
/// checked by the caller. This may be useful when creating transactions
/// offline or within a hardware wallet.
///
/// Accounts expected by this instruction:
///
@ -306,11 +323,13 @@ pub enum TokenInstruction {
/// Expected number of base 10 digits to the right of the decimal place.
decimals: u8,
},
/// Burns tokens by removing them from an account. `BurnChecked` does not support accounts
/// associated with the native mint, use `CloseAccount` instead.
/// Burns tokens by removing them from an account. `BurnChecked` does not
/// support accounts associated with the native mint, use `CloseAccount`
/// instead.
///
/// This instruction differs from Burn in that the decimals value is checked by the caller.
/// This may be useful when creating transactions offline or within a hardware wallet.
/// This instruction differs from Burn in that the decimals value is checked
/// by the caller. This may be useful when creating transactions offline or
/// within a hardware wallet.
///
/// Accounts expected by this instruction:
///