Method: CLValueSerializer#serialize_option_cl_value

Defined in:
lib/serialization/cl_value_serializer.rb

#serialize_option_cl_value(data) ⇒ Object



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/serialization/cl_value_serializer.rb', line 295

def serialize_option_cl_value(data) 
  
=begin
  # Solution 1
  # puts "\nOption:"
  cl_type = data[:cl_type]
  bytes = data[:bytes]
  parsed = data[:parsed]

  if cl_type == "U64"
    length = bytes.length/2
    # puts length
    bytes = bytes[2..]
    value = Utils::ByteUtils.hex_to_u64_value(bytes)
    # puts value == 1650706686882
    clvalue = CLu64.new(value)
    tag = CLType::TAGS[cl_type.to_sym]
    # puts "U64: " + [length].pack("L<*").unpack1("H*") + "01" + bytes + "0d" + [tag].pack("C*").unpack1("H*")
    [length].pack("L<*").unpack1("H*") + "01" + bytes + "0d" + [tag].pack("C*").unpack1("H*")
  end
=end
end