Class: Solace::Serializers::AddressLookupTableSerializer

Inherits:
BaseSerializer
  • Object
show all
Defined in:
lib/solace/serializers/address_lookup_table_serializer.rb

Overview

Serializes a Solana address lookup table to a binary format.

Since:

  • 0.0.2

Instance Attribute Summary

Attributes inherited from BaseSerializer

#record

Instance Method Summary collapse

Methods inherited from BaseSerializer

#call, #initialize

Constructor Details

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

Instance Method Details

#encode_accountArray<Integer>

Encodes the account of the address lookup table

The BufferLayout is:

- [Account key (32 bytes)]

Returns:

  • (Array<Integer>)

    The bytes of the encoded account

Since:

  • 0.0.2



25
26
27
# File 'lib/solace/serializers/address_lookup_table_serializer.rb', line 25

def 
  Codecs.base58_to_bytes(record.)
end

#encode_readonly_indexesArray<Integer>

Encodes the readonly indexes of the address lookup table

The BufferLayout is:

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

Returns:

  • (Array<Integer>)

    The bytes of the encoded readonly indexes

Since:

  • 0.0.2



48
49
50
51
# File 'lib/solace/serializers/address_lookup_table_serializer.rb', line 48

def encode_readonly_indexes
  Codecs.encode_compact_u16(record.readonly_indexes.size).bytes +
    record.readonly_indexes
end

#encode_writable_indexesArray<Integer>

Encodes the writable indexes of the address lookup table

The BufferLayout is:

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

Returns:

  • (Array<Integer>)

    The bytes of the encoded writable indexes

Since:

  • 0.0.2



36
37
38
39
# File 'lib/solace/serializers/address_lookup_table_serializer.rb', line 36

def encode_writable_indexes
  Codecs.encode_compact_u16(record.writable_indexes.size).bytes +
    record.writable_indexes
end