Class: Solace::Composers::AddressLookupTableProgramExtendComposer
- Defined in:
- lib/solace/composers/address_lookup_table_program_extend_composer.rb
Overview
Composer for extending an address lookup table with new addresses.
Resolves and orders the accounts for an ExtendLookupTable instruction and
delegates construction to
Instructions::AddressLookupTableProgram::ExtendLookupTableInstruction.
Addresses appended here become usable one slot after the extend lands.
Required accounts:
- Table: the table account being extended (writable, non-signer)
- Authority: controls the table (readonly, signer)
- Payer: funds any additional rent (writable, signer)
- System program (readonly, non-signer)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#addresses ⇒ Array<String>
The addresses to append to the table.
-
#authority ⇒ String
The table authority.
-
#build_instruction(account_context) ⇒ Solace::Instruction
Build instruction with resolved account indices.
-
#lookup_table_program ⇒ String
The address lookup table program id.
-
#payer ⇒ String
The rent payer.
-
#setup_accounts ⇒ void
Setup accounts required for the extend lookup table instruction.
-
#system_program ⇒ String
The system program id.
-
#table ⇒ String
The table's on-chain address.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Solace::Composers::Base
Instance Method Details
#addresses ⇒ Array<String>
Returns The addresses to append to the table.
56 57 58 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 56 def addresses params[:addresses].map(&:to_s) end |
#authority ⇒ String
Returns The table authority.
36 37 38 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 36 def params[:authority].to_s end |
#build_instruction(account_context) ⇒ Solace::Instruction
Build instruction with resolved account indices
75 76 77 78 79 80 81 82 83 84 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 75 def build_instruction(account_context) Solace::Instructions::AddressLookupTableProgram::ExtendLookupTableInstruction.build( addresses: addresses, program_index: account_context.index_of(lookup_table_program), table_index: account_context.index_of(table), authority_index: account_context.index_of(), payer_index: account_context.index_of(payer), system_program_index: account_context.index_of(system_program) ) end |
#lookup_table_program ⇒ String
Returns The address lookup table program id.
51 52 53 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 51 def lookup_table_program Solace::Constants::ADDRESS_LOOKUP_TABLE_PROGRAM_ID.to_s end |
#payer ⇒ String
Returns The rent payer.
41 42 43 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 41 def payer params[:payer].to_s end |
#setup_accounts ⇒ void
This method returns an undefined value.
Setup accounts required for the extend lookup table instruction
63 64 65 66 67 68 69 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 63 def setup_accounts account_context.add_writable_nonsigner(table) account_context.add_readonly_signer() account_context.add_writable_signer(payer) account_context.add_readonly_nonsigner(system_program) account_context.add_readonly_nonsigner(lookup_table_program) end |
#system_program ⇒ String
Returns The system program id.
46 47 48 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 46 def system_program Solace::Constants::SYSTEM_PROGRAM_ID.to_s end |
#table ⇒ String
Returns The table's on-chain address.
31 32 33 |
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 31 def table params[:table].to_s end |