Class: Nem::Model::TransferTransaction

Inherits:
Transaction show all
Defined in:
lib/nem/model/transfer_transaction.rb

Instance Attribute Summary collapse

Attributes inherited from Transaction

#deadline, #fee, #hash, #height, #id, #signer, #timestamp, #type, #version

Class Method Summary collapse

Methods inherited from Transaction

new_from_account_transaction, new_from_account_transaction_meta_data_pair

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



4
5
6
# File 'lib/nem/model/transfer_transaction.rb', line 4

def amount
  @amount
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/nem/model/transfer_transaction.rb', line 4

def message
  @message
end

#mosaicsObject (readonly)

Returns the value of attribute mosaics.



4
5
6
# File 'lib/nem/model/transfer_transaction.rb', line 4

def mosaics
  @mosaics
end

#recipientObject (readonly)

Returns the value of attribute recipient.



4
5
6
# File 'lib/nem/model/transfer_transaction.rb', line 4

def recipient
  @recipient
end

Class Method Details

.new_from_transaction_meta_data_pair(hash) ⇒ Object



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

def self.(hash)
  transaction = hash[:transaction]
  attrs = (hash).merge(
    recipient: transaction[:recipient],
    amount: transaction[:amount],
  )
  unless transaction[:message].empty?
    attrs[:message] = Message.new_from_message(transaction[:message])
  end
  if transaction[:mosaics]
    attrs[:mosaics] = transaction[:mosaics].map do |mo|
      Mosaic.new_from_mosaic(mo)
    end
  end
  new(attrs)
end