Class: Solace::Instructions::Token2022::MintToInstruction
- Inherits:
-
Object
- Object
- Solace::Instructions::Token2022::MintToInstruction
- Defined in:
- lib/solace/instructions/token_2022/mint_to_instruction.rb
Overview
Instruction for minting Token-2022 tokens to a token account.
Constant Summary collapse
- INSTRUCTION_INDEX =
[7].freeze
Instance Attribute Summary collapse
-
#INSTRUCTION_INDEX ⇒ Object
readonly
Instruction index for Token-2022’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 Token-2022’s MintTo instruction.
21 |
# File 'lib/solace/instructions/token_2022/mint_to_instruction.rb', line 21 INSTRUCTION_INDEX = [7].freeze |
Class Method Details
.build(amount:, mint_index:, mint_authority_index:, destination_index:, program_index:) ⇒ Solace::Instruction
Builds a MintTo instruction.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/solace/instructions/token_2022/mint_to_instruction.rb', line 31 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)]
53 54 55 |
# File 'lib/solace/instructions/token_2022/mint_to_instruction.rb', line 53 def self.data(amount) INSTRUCTION_INDEX + Solace::Utils::Codecs.encode_le_u64(amount).bytes end |