# frozen_string_literal: true module SolanaRuby module HttpMethods # Lookup Table Related HTTP Methods module LookupTableMethods def get_address_lookup_table(pubkey) response = get_account_info_and_context(pubkey) # Handle the response to ensure the account is a valid Address Lookup Table unless response && response["value"] raise SolanaError.new("Address Lookup Table not found or invalid account data.") end account_data = response["value"]["data"] # Decode the account data decode_lookup_table_data(Base64.decode64(account_data)) # Return the parsed lookup table details end private def decode_lookup_table_data(data) lookup_table_state = {} lookup_table_state[:last_extended_slot], lookup_table_state[:last_extended_block_height], deactivation_slot = data[0, 24].unpack("Q