Class: ArkEcosystem::Crypto::Serialisers::TimelockTransfer

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

Overview

The serialiser for timelock transfer transactions.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#serialiseObject



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

def serialise
  @bytes << [@transaction[:amount]].pack('Q<')
  @bytes << [@transaction[:timelocktype]].pack('h*')
  @bytes << [@transaction[:timelock]].pack('Q<')

  recipient_id = BTC::Base58.data_from_base58check(@transaction[:recipientId])
  recipient_id = BTC::Data.hex_from_data(recipient_id)

  @bytes << [recipient_id].pack('H*')

  @bytes
end