Class: Solace::Composers::AddressLookupTableProgramCreateComposer
- Defined in:
- lib/solace/composers/address_lookup_table_program_create_composer.rb
Overview
Composer for creating an address lookup table.
Resolves and orders the accounts for a CreateLookupTable instruction and
delegates construction to
Instructions::AddressLookupTableProgram::CreateLookupTableInstruction.
The table address is a program-derived address of [authority, recent_slot];
derive it (and its bump) with Utils::PDA and pass both in.
Required accounts:
- Table: the uninitialized table account (writable, non-signer)
- Authority: controls the table (readonly, signer)
- Payer: funds the table's rent (writable, signer)
- System program (readonly, non-signer)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#authority ⇒ String
The table authority.
-
#build_instruction(account_context) ⇒ Solace::Instruction
Build instruction with resolved account indices.
-
#bump ⇒ Integer
The bump seed for the table's program-derived address.
-
#lookup_table_program ⇒ String
The address lookup table program id.
-
#payer ⇒ String
The rent payer.
-
#recent_slot ⇒ Integer
The slot used to derive the table address.
-
#setup_accounts ⇒ void
Setup accounts required for the create 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
#authority ⇒ String
Returns The table authority.
38 39 40 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 38 def params[:authority].to_s end |
#build_instruction(account_context) ⇒ Solace::Instruction
Build instruction with resolved account indices
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 82 def build_instruction(account_context) Solace::Instructions::AddressLookupTableProgram::CreateLookupTableInstruction.build( recent_slot: recent_slot, bump: bump, 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 |
#bump ⇒ Integer
Returns The bump seed for the table's program-derived address.
63 64 65 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 63 def bump params[:bump] end |
#lookup_table_program ⇒ String
Returns The address lookup table program id.
53 54 55 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 53 def lookup_table_program Solace::Constants::ADDRESS_LOOKUP_TABLE_PROGRAM_ID.to_s end |
#payer ⇒ String
Returns The rent payer.
43 44 45 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 43 def payer params[:payer].to_s end |
#recent_slot ⇒ Integer
Returns The slot used to derive the table address.
58 59 60 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 58 def recent_slot params[:recent_slot] end |
#setup_accounts ⇒ void
This method returns an undefined value.
Setup accounts required for the create lookup table instruction
70 71 72 73 74 75 76 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 70 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.
48 49 50 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 48 def system_program Solace::Constants::SYSTEM_PROGRAM_ID.to_s end |
#table ⇒ String
Returns The table's on-chain address.
33 34 35 |
# File 'lib/solace/composers/address_lookup_table_program_create_composer.rb', line 33 def table params[:table].to_s end |