Module: Nem::Util::Serializer

Defined in:
lib/nem/util/serializer.rb

Class Method Summary collapse

Class Method Details

.serialize_transaction(entity) ⇒ Array

Serialize a transaction object

Parameters:

  • entity (Hash)

Returns:

  • (Array)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nem/util/serializer.rb', line 7

def self.serialize_transaction(entity)
  specific = case entity[:type]
             when 0x0101 then serialize_transfer(entity)
             when 0x0801 then serialize_importance_transfer(entity)
             when 0x1001 then serialize_multisig_aggregate_modification(entity)
             when 0x1002 then serialize_multisig_signature(entity)
             when 0x1004 then serialize_multisig(entity)
             when 0x2001 then serialize_provision_namespace(entity)
             when 0x4001 then serialize_mosaic_definition_creation(entity)
             when 0x4002 then serialize_mosaic_supply_change(entity)
    else raise "Not implemented entity type: #{entity[:type]}"
  end
  serialize_common(entity) + specific
end