Class: Nem::Model::Transaction

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Nem::Mixin::Assignable
Defined in:
lib/nem/model/transaction.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#deadlineObject (readonly)

Returns the value of attribute deadline.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def deadline
  @deadline
end

#feeObject (readonly)

Returns the value of attribute fee.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def fee
  @fee
end

#hashObject (readonly)

Returns the value of attribute hash.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def hash
  @hash
end

#heightObject (readonly)

Returns the value of attribute height.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def height
  @height
end

#idObject (readonly)

Returns the value of attribute id.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def id
  @id
end

#signerObject (readonly)

Returns the value of attribute signer.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def signer
  @signer
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version.



9
10
11
# File 'lib/nem/model/transaction.rb', line 9

def version
  @version
end

Class Method Details

.new_from_account_transaction(hash) ⇒ Object



19
20
21
22
23
24
# File 'lib/nem/model/transaction.rb', line 19

def self.(hash)
  (
    meta: { data: nil },
    transaction: hash
  )
end

.new_from_account_transaction_meta_data_pair(hash) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/nem/model/transaction.rb', line 26

def self.(hash)
  type = hash[:transaction][:type]
  klass = case type
          when 0x0101 then TransferTransaction
          when 0x0801 then ImportanceTransferTransaction
          when 0x1001 then MultisigAggregateModificationTransaction
          when 0x1002 then MultisigSignatureTransaction
          when 0x1004 then MultisigTransaction
          when 0x2001 then ProvisionNamespaceTransaction
          when 0x4001 then MosaicDefinitionCreationTransaction
          when 0x4002 then MosaicSupplyChangeTransaction
    else raise "Undefined transaction type: #{type}"
  end
  klass.(hash)
end