Class: Solace::Instructions::AddressLookupTableProgram::ExtendLookupTableInstruction
- Inherits:
-
Object
- Object
- Solace::Instructions::AddressLookupTableProgram::ExtendLookupTableInstruction
- Defined in:
- lib/solace/instructions/address_lookup_table_program/extend_lookup_table_instruction.rb
Overview
Instruction for appending addresses to an existing address lookup table.
Newly added addresses become usable one slot after the extend lands.
Constant Summary collapse
- INSTRUCTION_ID =
Instruction discriminator for ExtendLookupTable (u32 LE)
[2, 0, 0, 0].freeze
Class Method Summary collapse
-
.build(addresses:, program_index:, table_index:, authority_index:, payer_index:, system_program_index:) ⇒ Solace::Instruction
Builds a Solace::Instruction for extending a lookup table.
-
.data(addresses) ⇒ Array<Integer>
Instruction data for an extend lookup table instruction.
Class Method Details
.build(addresses:, program_index:, table_index:, authority_index:, payer_index:, system_program_index:) ⇒ Solace::Instruction
Builds a Solace::Instruction for extending a lookup table
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/solace/instructions/address_lookup_table_program/extend_lookup_table_instruction.rb', line 34 def self.build( addresses:, program_index:, table_index:, authority_index:, payer_index:, system_program_index: ) Instruction.new.tap do |ix| ix.program_index = program_index ix.accounts = [table_index, , payer_index, system_program_index] ix.data = data(addresses) end end |
.data(addresses) ⇒ Array<Integer>
Instruction data for an extend lookup table instruction
The BufferLayout is:
- [Instruction discriminator (4 bytes, u32 LE)]
- [Number of addresses (8 bytes, u64 LE)]
- [Addresses (32 bytes each)]
The address vector uses a u64 length prefix (bincode), not the u32 Borsh prefix of Utils::Codecs.encode_vec_pubkeys.
61 62 63 64 65 |
# File 'lib/solace/instructions/address_lookup_table_program/extend_lookup_table_instruction.rb', line 61 def self.data(addresses) INSTRUCTION_ID + Utils::Codecs.encode_le_u64(addresses.length).bytes + addresses.flat_map { |address| Utils::Codecs.encode_pubkey(address) } end |