Class: Nem::Model::Transaction

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Nem::Mixin::Assignable

#initialize

Instance Attribute Details

#deadlineObject (readonly)

Returns the value of attribute deadline.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def deadline
  @deadline
end

#feeObject (readonly)

Returns the value of attribute fee.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def fee
  @fee
end

#hashObject (readonly)

Returns the value of attribute hash.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def hash
  @hash
end

#heightObject (readonly)

Returns the value of attribute height.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def height
  @height
end

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def id
  @id
end

#signerObject (readonly)

Returns the value of attribute signer.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def signer
  @signer
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def timestamp
  @timestamp
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def type
  @type
end

#versionObject (readonly)

Returns the value of attribute version.



6
7
8
# File 'lib/nem/model/transaction.rb', line 6

def version
  @version
end

Class Method Details

.new_from_account_transaction(hash) ⇒ Object



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

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

.new_from_account_transaction_meta_data_pair(hash) ⇒ Object



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

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

Instance Method Details

#version?(num) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/nem/model/transaction.rb', line 16

def version?(num)
  version & 0x00000003 == num ? true : false
end