Class: Solace::Composers::AddressLookupTableProgramExtendComposer

Inherits:
Base
  • Object
show all
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)

Examples:

composer = AddressLookupTableProgramExtendComposer.new(
  table:     table_address,
  authority: authority,
  payer:     payer,
  addresses: [recipient1, recipient2]
)

See Also:

Since:

  • 0.1.8

Instance Attribute Summary

Attributes inherited from Base

#account_context, #params

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Solace::Composers::Base

Instance Method Details

#addressesArray<String>

Returns The addresses to append to the table.

Returns:

  • (Array<String>)

    The addresses to append to the table

Since:

  • 0.1.8



56
57
58
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 56

def addresses
  params[:addresses].map(&:to_s)
end

#authorityString

Returns The table authority.

Returns:

  • (String)

    The table authority

Since:

  • 0.1.8



36
37
38
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 36

def authority
  params[:authority].to_s
end

#build_instruction(account_context) ⇒ Solace::Instruction

Build instruction with resolved account indices

Parameters:

Returns:

Since:

  • 0.1.8



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()
  Solace::Instructions::AddressLookupTableProgram::ExtendLookupTableInstruction.build(
    addresses:            addresses,
    program_index:        .index_of(lookup_table_program),
    table_index:          .index_of(table),
    authority_index:      .index_of(authority),
    payer_index:          .index_of(payer),
    system_program_index: .index_of(system_program)
  )
end

#lookup_table_programString

Returns The address lookup table program id.

Returns:

  • (String)

    The address lookup table program id

Since:

  • 0.1.8



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

#payerString

Returns The rent payer.

Returns:

  • (String)

    The rent payer

Since:

  • 0.1.8



41
42
43
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 41

def payer
  params[:payer].to_s
end

#setup_accountsvoid

This method returns an undefined value.

Setup accounts required for the extend lookup table instruction

Since:

  • 0.1.8



63
64
65
66
67
68
69
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 63

def setup_accounts
  .add_writable_nonsigner(table)
  .add_readonly_signer(authority)
  .add_writable_signer(payer)
  .add_readonly_nonsigner(system_program)
  .add_readonly_nonsigner(lookup_table_program)
end

#system_programString

Returns The system program id.

Returns:

  • (String)

    The system program id

Since:

  • 0.1.8



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

#tableString

Returns The table's on-chain address.

Returns:

  • (String)

    The table's on-chain address

Since:

  • 0.1.8



31
32
33
# File 'lib/solace/composers/address_lookup_table_program_extend_composer.rb', line 31

def table
  params[:table].to_s
end