Module: Nis::Util::Deserializer
- Defined in:
- lib/nis/util/deserializer.rb
Class Method Summary collapse
-
.deserialize_transaction(serialized) ⇒ Hash
Deserialize a transaction object.
Class Method Details
.deserialize_transaction(serialized) ⇒ Hash
Deserialize a transaction object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/nis/util/deserializer.rb', line 6 def self.deserialize_transaction(serialized) s = Nis::Util::Convert.hex2ua(serialized) common = s[0, 60] specific = s[60, s.size] type = deserialize_int(common[0, 4]) method = case type when 0x0101 then method(:deserialize_transfer) when 0x0801 then method(:deserialize_importance_transfer) when 0x1001 then method(:deserialize_multisig_aggregate_modification) when 0x1002 then method(:deserialize_multisig_signature) when 0x1004 then method(:deserialize_multisig) when 0x2001 then method(:deserialize_provision_namespace) when 0x4001 then method(:deserialize_mosaic_definition_creation) when 0x4002 then method(:deserialize_mosaic_supply_change) else raise "Not implemented entity type: #{type}" end deserialize_common(common).merge(method.call(specific)) end |