Class: ArkEcosystem::Crypto::Serialisers::Vote
- Defined in:
- lib/arkecosystem/crypto/serialisers/vote.rb
Overview
The serialiser for vote transactions.
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from ArkEcosystem::Crypto::Serialisers::Base
Instance Method Details
#serialise ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/arkecosystem/crypto/serialisers/vote.rb', line 6 def serialise vote_bytes = [] @transaction[:asset][:votes].each do |item| prefix = item.start_with?('+') ? '01' : '00' vote_bytes.push(prefix + item[1..-1]) end @bytes << [@transaction[:asset][:votes].count].pack('C') @bytes << BTC::Data.data_from_hex(vote_bytes.join('')) @bytes end |