Class: Solace::Serializers::TransactionSerializer
- Inherits:
-
BaseSerializer
- Object
- BaseSerializer
- Solace::Serializers::TransactionSerializer
- Defined in:
- lib/solace/serializers/transaction_serializer.rb
Overview
Serializes a Solana transaction to a binary format.
Constant Summary collapse
- SIGNATURE_PLACEHOLDER =
([0] * 64).pack('C*')
Instance Attribute Summary collapse
-
#SIGNATURE_PLACEHOLDER ⇒ String
Placeholder for a signature in the transaction.
Attributes inherited from BaseSerializer
Instance Method Summary collapse
-
#encode_message ⇒ Array<Integer>
Encodes the message from the transaction.
-
#encode_signatures ⇒ Array<Integer>
Encodes the signatures of the transaction.
Methods inherited from BaseSerializer
Constructor Details
This class inherits a constructor from Solace::Serializers::BaseSerializer
Instance Attribute Details
#SIGNATURE_PLACEHOLDER ⇒ String
Returns Placeholder for a signature in the transaction.
11 |
# File 'lib/solace/serializers/transaction_serializer.rb', line 11 SIGNATURE_PLACEHOLDER = ([0] * 64).pack('C*') |
Instance Method Details
#encode_message ⇒ Array<Integer>
Encodes the message from the transaction
40 41 42 |
# File 'lib/solace/serializers/transaction_serializer.rb', line 40 def record..to_bytes end |
#encode_signatures ⇒ Array<Integer>
Encodes the signatures of the transaction
Iterates over the number sum number of signatures and either encodes or sets the placeholder for each expected index in the signatures array.
The BufferLayout is:
- [Number of signatures (compact u16)]
- [Signatures (variable length)]
32 33 34 35 |
# File 'lib/solace/serializers/transaction_serializer.rb', line 32 def encode_signatures Codecs.encode_compact_u16(record..num_required_signatures).bytes + index_signatures(record..num_required_signatures) end |