Class: ArkEcosystem::Crypto::Transactions::Deserializers::TimelockTransfer

Inherits:
Base
  • Object
show all
Defined in:
lib/arkecosystem/crypto/transactions/deserializers/timelock_transfer.rb

Overview

The deserializer for timelock transfer transactions.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ArkEcosystem::Crypto::Transactions::Deserializers::Base

Instance Method Details

#deserializeObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/arkecosystem/crypto/transactions/deserializers/timelock_transfer.rb', line 7

def deserialize
  @transaction.amount = @binary.unpack("C#{@asset_offset / 2}Q<").last
  @transaction.timelocktype = @binary.unpack("C#{@asset_offset / 2 + 8}").last & 0xff
  @transaction.timelock = @binary.unpack("C#{@asset_offset / 2 + 9}V").last

  recipient_id = @binary.unpack("H#{(@asset_offset / 2 + 13) * 2}H42").last
  @transaction.recipient_id = BTC::Base58.base58check_from_data([recipient_id].pack('H*'))

  @transaction.parse_signatures(@serialized, @asset_offset + (21 + 13) * 2)
end