Class: Solace::Instructions::SplToken::MintToInstruction
- Inherits:
-
Object
- Object
- Solace::Instructions::SplToken::MintToInstruction
- Defined in:
- lib/solace/instructions/spl_token/mint_to_instruction.rb
Overview
Instruction for minting tokens to a token account.
This instruction is used to mint tokens to a token account for a given mint and owner.
Constant Summary collapse
- INSTRUCTION_INDEX =
[7].freeze
Instance Attribute Summary collapse
-
#INSTRUCTION_INDEX ⇒ Object
readonly
Instruction index for SPL Token Program’s MintTo instruction.
Class Method Summary collapse
-
.build(amount:, mint_index:, mint_authority_index:, destination_index:, program_index:) ⇒ Solace::Instruction
Builds a MintTo instruction.
-
.data(amount) ⇒ Array
Builds the data for a MintTo instruction.
Instance Attribute Details
#INSTRUCTION_INDEX ⇒ Object (readonly)
Instruction index for SPL Token Program’s MintTo instruction.
23 |
# File 'lib/solace/instructions/spl_token/mint_to_instruction.rb', line 23 INSTRUCTION_INDEX = [7].freeze |
Class Method Details
.build(amount:, mint_index:, mint_authority_index:, destination_index:, program_index:) ⇒ Solace::Instruction
Builds a MintTo instruction.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/solace/instructions/spl_token/mint_to_instruction.rb', line 33 def self.build( amount:, mint_index:, mint_authority_index:, destination_index:, program_index: ) Solace::Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [mint_index, destination_index, ] ix.data = data(amount) end end |
.data(amount) ⇒ Array
Builds the data for a MintTo instruction.
The BufferLayout is:
- [Instruction Index (1 byte)]
- [Amount (8 bytes)]
55 56 57 |
# File 'lib/solace/instructions/spl_token/mint_to_instruction.rb', line 55 def self.data(amount) INSTRUCTION_INDEX + Solace::Utils::Codecs.encode_le_u64(amount).bytes end |