Class: Solace::Serializers::AddressLookupTableDeserializer

Inherits:
BaseDeserializer show all
Defined in:
lib/solace/serializers/address_lookup_table_deserializer.rb

Overview

Deserializes a Solana address lookup table from a binary format.

Since:

  • 0.0.2

Instance Attribute Summary

Attributes inherited from BaseDeserializer

#io, #record

Instance Method Summary collapse

Methods inherited from BaseDeserializer

#call, #initialize

Constructor Details

This class inherits a constructor from Solace::Serializers::BaseDeserializer

Instance Method Details

#next_extract_accountString

Extract the account key from the transaction

The BufferLayout is:

- [Account key (32 bytes)]

Returns:

  • (String)

    The account key

Since:

  • 0.0.2



31
32
33
# File 'lib/solace/serializers/address_lookup_table_deserializer.rb', line 31

def 
  record. = Codecs.bytes_to_base58 io.read(32).bytes
end

#next_extract_readonly_indexesArray<Integer>

Extract the readonly indexes from the transaction

The BufferLayout is:

- [Number of readonly indexes (compact u16)]
- [Readonly indexes (variable length u8)]

Returns:

  • (Array<Integer>)

    The readonly indexes

Since:

  • 0.0.2



54
55
56
57
# File 'lib/solace/serializers/address_lookup_table_deserializer.rb', line 54

def next_extract_readonly_indexes
  length, = Codecs.decode_compact_u16(io)
  record.readonly_indexes = io.read(length).unpack('C*')
end

#next_extract_writable_indexesArray<Integer>

Extract the writable indexes from the transaction

The BufferLayout is:

- [Number of writable indexes (compact u16)]
- [Writable indexes (variable length u8)]

Returns:

  • (Array<Integer>)

    The writable indexes

Since:

  • 0.0.2



42
43
44
45
# File 'lib/solace/serializers/address_lookup_table_deserializer.rb', line 42

def next_extract_writable_indexes
  length, = Codecs.decode_compact_u16(io)
  record.writable_indexes = io.read(length).unpack('C*')
end