Browse Source

Update token.h

Michael Vines 5 years ago
parent
commit
4d41bccd28
1 changed files with 139 additions and 0 deletions
  1. 139 0
      program/inc/token.h

+ 139 - 0
program/inc/token.h

@@ -180,6 +180,7 @@ typedef enum Token_TokenInstruction_Tag {
     /**
      * Approves a delegate.  A delegate is given the authority over
      * tokens on behalf of the source account's owner.
+     *
      * Accounts expected by this instruction:
      *
      *   * Single owner
@@ -311,6 +312,96 @@ typedef enum Token_TokenInstruction_Tag {
      *   3. ..3+M '[signer]' M signer accounts.
      */
     Token_TokenInstruction_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.
+     *
+     * 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:
+     *
+     *   * Single owner/delegate
+     *   0. `[writable]` The source account.
+     *   1. '[]' The token mint.
+     *   2. `[writable]` The destination account.
+     *   3. '[signer]' The source account's owner/delegate.
+     *
+     *   * Multisignature owner/delegate
+     *   0. `[writable]` The source account.
+     *   1. '[]' The token mint.
+     *   2. `[writable]` The destination account.
+     *   3. '[]' The source account's multisignature owner/delegate.
+     *   4. ..4+M '[signer]' M signer accounts.
+     */
+    Token_TokenInstruction_Transfer2,
+    /**
+     * 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.
+     *
+     * Accounts expected by this instruction:
+     *
+     *   * Single owner
+     *   0. `[writable]` The source account.
+     *   1. '[]' The token mint.
+     *   2. `[]` The delegate.
+     *   3. `[signer]` The source account owner.
+     *
+     *   * Multisignature owner
+     *   0. `[writable]` The source account.
+     *   1. '[]' The token mint.
+     *   2. `[]` The delegate.
+     *   3. '[]' The source account's multisignature owner.
+     *   4. ..4+M '[signer]' M signer accounts
+     */
+    Token_TokenInstruction_Approve2,
+    /**
+     * 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.
+     *
+     * Accounts expected by this instruction:
+     *
+     *   * Single authority
+     *   0. `[writable]` The mint.
+     *   1. `[writable]` The account to mint tokens to.
+     *   2. `[signer]` The mint's minting authority.
+     *
+     *   * Multisignature authority
+     *   0. `[writable]` The mint.
+     *   1. `[writable]` The account to mint tokens to.
+     *   2. `[]` The mint's multisignature mint-tokens authority.
+     *   3. ..3+M '[signer]' M signer accounts.
+     */
+    Token_TokenInstruction_MintTo2,
+    /**
+     * 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.
+     *
+     * Accounts expected by this instruction:
+     *
+     *   * Single owner/delegate
+     *   0. `[writable]` The account to burn from.
+     *   1. '[writable]' The token mint.
+     *   2. `[signer]` The account's owner/delegate.
+     *
+     *   * Multisignature owner/delegate
+     *   0. `[writable]` The account to burn from.
+     *   1. '[writable]' The token mint.
+     *   2. `[]` The account's multisignature owner/delegate.
+     *   3. ..3+M '[signer]' M signer accounts.
+     */
+    Token_TokenInstruction_Burn2,
 } Token_TokenInstruction_Tag;
 
 typedef struct Token_TokenInstruction_Token_InitializeMint_Body {
@@ -374,6 +465,50 @@ typedef struct Token_TokenInstruction_Token_Burn_Body {
     uint64_t amount;
 } Token_TokenInstruction_Token_Burn_Body;
 
+typedef struct Token_TokenInstruction_Token_Transfer2_Body {
+    /**
+     * The amount of tokens to transfer.
+     */
+    uint64_t amount;
+    /**
+     * Expected number of base 10 digits to the right of the decimal place.
+     */
+    uint8_t decimals;
+} Token_TokenInstruction_Token_Transfer2_Body;
+
+typedef struct Token_TokenInstruction_Token_Approve2_Body {
+    /**
+     * The amount of tokens the delegate is approved for.
+     */
+    uint64_t amount;
+    /**
+     * Expected number of base 10 digits to the right of the decimal place.
+     */
+    uint8_t decimals;
+} Token_TokenInstruction_Token_Approve2_Body;
+
+typedef struct Token_TokenInstruction_Token_MintTo2_Body {
+    /**
+     * The amount of new tokens to mint.
+     */
+    uint64_t amount;
+    /**
+     * Expected number of base 10 digits to the right of the decimal place.
+     */
+    uint8_t decimals;
+} Token_TokenInstruction_Token_MintTo2_Body;
+
+typedef struct Token_TokenInstruction_Token_Burn2_Body {
+    /**
+     * The amount of tokens to burn.
+     */
+    uint64_t amount;
+    /**
+     * Expected number of base 10 digits to the right of the decimal place.
+     */
+    uint8_t decimals;
+} Token_TokenInstruction_Token_Burn2_Body;
+
 typedef struct Token_TokenInstruction {
     Token_TokenInstruction_Tag tag;
     union {
@@ -384,6 +519,10 @@ typedef struct Token_TokenInstruction {
         Token_TokenInstruction_Token_SetAuthority_Body set_authority;
         Token_TokenInstruction_Token_MintTo_Body mint_to;
         Token_TokenInstruction_Token_Burn_Body burn;
+        Token_TokenInstruction_Token_Transfer2_Body transfer2;
+        Token_TokenInstruction_Token_Approve2_Body approve2;
+        Token_TokenInstruction_Token_MintTo2_Body mint_to2;
+        Token_TokenInstruction_Token_Burn2_Body burn2;
     };
 } Token_TokenInstruction;