Skip to content

Commit

Permalink
Update token ixs docs (#35)
Browse files Browse the repository at this point in the history
* Update token ixs docs

* resolve changes
  • Loading branch information
Nagaprasadvr authored Nov 14, 2024
1 parent a62ab1a commit f0eac8f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 27 deletions.
4 changes: 2 additions & 2 deletions programs/token/src/instructions/initialize_account_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ impl<'a> InitilizeAccount2<'a> {
];

// instruction data
// - [0]: instruction discriminator
// - [1..33]: owner
// - [0]: instruction discriminator (1 byte, u8)
// - [1..33]: owner (32 bytes, Pubkey)
let mut instruction_data = [UNINIT_BYTE; 33];

// Set discriminator as u8 at offset [0]
Expand Down
4 changes: 2 additions & 2 deletions programs/token/src/instructions/initialize_account_3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl<'a> InitilizeAccount3<'a> {
];

// instruction data
// - [0]: instruction discriminator
// - [1..33]: owner
// - [0]: instruction discriminator (1 byte, u8)
// - [1..33]: owner (32 bytes, Pubkey)
let mut instruction_data = [UNINIT_BYTE; 33];

// Set discriminator as u8 at offset [0]
Expand Down
10 changes: 5 additions & 5 deletions programs/token/src/instructions/initialize_mint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ impl<'a> InitilizeMint<'a> {
];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1]: decimals
// - [2..34]: mint_authority
// - [34]: freeze_authority presence flag
// - [35..68]: freeze_authority
// - [0]: instruction discriminator (1 byte, u8)
// - [1]: decimals (1 byte, u8)
// - [2..34]: mint_authority (32 bytes, Pubkey)
// - [34]: freeze_authority presence flag (1 byte, u8)
// - [35..67]: freeze_authority (optional, 32 bytes, Pubkey)
let mut instruction_data = [UNINIT_BYTE; 67];

// Set discriminator as u8 at offset [0]
Expand Down
10 changes: 5 additions & 5 deletions programs/token/src/instructions/initialize_mint_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ impl<'a> InitilizeMint2<'a> {
let account_metas: [AccountMeta; 1] = [AccountMeta::writable(self.mint.key())];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1]: decimals
// - [2..34]: mint_authority
// - [34..35]: freeze_authority presence flag
// - [35..67]: freeze_authority
// - [0]: instruction discriminator (1 byte, u8)
// - [1]: decimals (1 byte, u8)
// - [2..34]: mint_authority (32 bytes, Pubkey)
// - [34]: freeze_authority presence flag (1 byte, u8)
// - [35..67]: freeze_authority (optional, 32 bytes, Pubkey)
let mut instruction_data = [UNINIT_BYTE; 67];

// Set discriminator as u8 at offset [0]
Expand Down
4 changes: 2 additions & 2 deletions programs/token/src/instructions/mint_to.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ impl<'a> MintTo<'a> {
];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1..9]: amount
// - [0]: instruction discriminator (1 byte, u8)
// - [1..9]: amount (8 bytes, u64)
let mut instruction_data = [UNINIT_BYTE; 9];

// Set discriminator as u8 at offset [0]
Expand Down
6 changes: 3 additions & 3 deletions programs/token/src/instructions/mint_to_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ impl<'a> MintToChecked<'a> {
];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1..9]: amount
// - [9]: decimals
// - [0]: instruction discriminator (1 byte, u8)
// - [1..9]: amount (8 bytes, u64)
// - [9]: decimals (1 byte, u8)
let mut instruction_data = [UNINIT_BYTE; 10];

// Set discriminator as u8 at offset [0]
Expand Down
7 changes: 4 additions & 3 deletions programs/token/src/instructions/set_authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ impl<'a> SetAuthority<'a> {
];

// instruction data
// - [0]: instruction discriminator
// - [1]: authority_type
// - [2..35] new_authority
// - [0]: instruction discriminator (1 byte, u8)
// - [1]: authority_type (1 byte, u8)
// - [2]: new_authority presence flag (1 byte, AuthorityType)
// - [3..35] new_authority (optional, 32 bytes, Pubkey)
let mut instruction_data = [UNINIT_BYTE; 35];

// Set discriminator as u8 at offset [0]
Expand Down
4 changes: 2 additions & 2 deletions programs/token/src/instructions/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl<'a> Transfer<'a> {
];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1..9]: amount
// - [0]: instruction discriminator (1 byte, u8)
// - [1..9]: amount (8 bytes, u64)
let mut instruction_data = [UNINIT_BYTE; 9];

// Set discriminator as u8 at offset [0]
Expand Down
6 changes: 3 additions & 3 deletions programs/token/src/instructions/transfer_checked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ impl<'a> TransferChecked<'a> {
];

// Instruction data layout:
// - [0]: instruction discriminator
// - [1..9]: amount
// - [9]: decimals
// - [0]: instruction discriminator (1 byte, u8)
// - [1..9]: amount (8 bytes, u64)
// - [9]: decimals (1 byte, u8)
let mut instruction_data = [UNINIT_BYTE; 10];

// Set discriminator as u8 at offset [0]
Expand Down

0 comments on commit f0eac8f

Please sign in to comment.