Class: ArkEcosystem::Crypto::Deserialisers::TimelockTransfer

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

Overview

The deserialiser for timelock transfer transactions.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ArkEcosystem::Crypto::Deserialisers::Base

Instance Method Details

#deserialiseObject



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

def deserialise
  @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}Q<").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*'))

  ArkEcosystem::Crypto::Crypto.parse_signatures(@serialised, @transaction, @asset_offset + (21 + 13) * 2)
end