Class: Solace::Serializers::AddressLookupTableSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- Solace::Serializers::AddressLookupTableSerializer
- Defined in:
- lib/solace/serializers/address_lookup_table_serializer.rb
Overview
Serializes a Solana address lookup table to a binary format.
Instance Attribute Summary
Attributes inherited from BaseSerializer
Instance Method Summary collapse
-
#encode_account ⇒ Array<Integer>
Encodes the account of the address lookup table.
-
#encode_readonly_indexes ⇒ Array<Integer>
Encodes the readonly indexes of the address lookup table.
-
#encode_writable_indexes ⇒ Array<Integer>
Encodes the writable indexes of the address lookup table.
Methods inherited from BaseSerializer
Constructor Details
This class inherits a constructor from Solace::Serializers::BaseSerializer
Instance Method Details
#encode_account ⇒ Array<Integer>
Encodes the account of the address lookup table
The BufferLayout is:
- [Account key (32 bytes)]
25 26 27 |
# File 'lib/solace/serializers/address_lookup_table_serializer.rb', line 25 def encode_account Codecs.base58_to_bytes(record.account) end |
#encode_readonly_indexes ⇒ Array<Integer>
Encodes the readonly indexes of the address lookup table
The BufferLayout is:
- [Number of readonly indexes (compact u16)]
- [Readonly indexes (variable length u8)]
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_indexes ⇒ Array<Integer>
Encodes the writable indexes of the address lookup table
The BufferLayout is:
- [Number of writable indexes (compact u16)]
- [Writable indexes (variable length u8)]
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 |