Class: Solace::Instructions::SplToken::InitializeAccountInstruction
- Inherits:
-
Object
- Object
- Solace::Instructions::SplToken::InitializeAccountInstruction
- Defined in:
- lib/solace/instructions/spl_token/initialize_account_instruction.rb
Overview
Instruction for initializing a new token account.
This instruction is used to initialize a new token account for a given mint and owner. It is used in conjunction with the CreateAccount instruction to create and initialize a new token account. Note that the AssociatedTokenAccount::CreateAssociatedTokenAccountInstruction is a special “all-in-one” instruction that creates and initializes the account in a single instruction.
Constant Summary collapse
- INSTRUCTION_INDEX =
[1].freeze
Instance Attribute Summary collapse
-
#INSTRUCTION_INDEX ⇒ Object
readonly
Instruction index for SPL Token Program’s InitializeAccount instruction.
Class Method Summary collapse
-
.build(account_index:, mint_index:, owner_index:, rent_sysvar_index:, program_index:) ⇒ Solace::Instruction
Builds a SPLToken::InitializeAccount instruction.
-
.data ⇒ Array
Builds the data for a SPLToken::InitializeAccount instruction.
Instance Attribute Details
#INSTRUCTION_INDEX ⇒ Object (readonly)
Instruction index for SPL Token Program’s InitializeAccount instruction.
31 |
# File 'lib/solace/instructions/spl_token/initialize_account_instruction.rb', line 31 INSTRUCTION_INDEX = [1].freeze |
Class Method Details
.build(account_index:, mint_index:, owner_index:, rent_sysvar_index:, program_index:) ⇒ Solace::Instruction
Builds a SPLToken::InitializeAccount instruction.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/solace/instructions/spl_token/initialize_account_instruction.rb', line 41 def self.build( account_index:, mint_index:, owner_index:, rent_sysvar_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [account_index, mint_index, owner_index, rent_sysvar_index] ix.data = data end end |
.data ⇒ Array
Builds the data for a SPLToken::InitializeAccount instruction.
The BufferLayout is:
- [Instruction Index (1 byte)]
61 62 63 |
# File 'lib/solace/instructions/spl_token/initialize_account_instruction.rb', line 61 def self.data INSTRUCTION_INDEX end |