Class: Nem::Model::Transaction
- Inherits:
-
Object
- Object
- Nem::Model::Transaction
- Includes:
- Nem::Mixin::Assignable
- Defined in:
- lib/nem/model/transaction.rb
Direct Known Subclasses
ImportanceTransferTransaction, MosaicDefinitionCreationTransaction, MosaicSupplyChangeTransaction, MultisigAggregateModificationTransaction, MultisigSignatureTransaction, MultisigTransaction, ProvisionNamespaceTransaction, TransferTransaction
Instance Attribute Summary collapse
-
#deadline ⇒ Object
readonly
Returns the value of attribute deadline.
-
#fee ⇒ Object
readonly
Returns the value of attribute fee.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#signer ⇒ Object
readonly
Returns the value of attribute signer.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
- .common_part(hash) ⇒ Object
- .common_part_meta_data_pair(hash) ⇒ Object
- .new_from_account_transaction(hash) ⇒ Object
- .new_from_account_transaction_meta_data_pair(hash) ⇒ Object
Instance Method Summary collapse
Methods included from Nem::Mixin::Assignable
Instance Attribute Details
#deadline ⇒ Object (readonly)
Returns the value of attribute deadline.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def deadline @deadline end |
#fee ⇒ Object (readonly)
Returns the value of attribute fee.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def fee @fee end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def hash @hash end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def height @height end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def id @id end |
#signer ⇒ Object (readonly)
Returns the value of attribute signer.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def signer @signer end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def @timestamp end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/nem/model/transaction.rb', line 6 def type @type end |
#version ⇒ Object (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
.common_part(hash) ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/nem/model/transaction.rb', line 43 def self.common_part(hash) { timestamp: hash[:timeStamp], version: hash[:version], type: hash[:type], signer: hash[:signer], fee: hash[:fee], deadline: hash[:deadline] } end |
.common_part_meta_data_pair(hash) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/nem/model/transaction.rb', line 54 def self.(hash) = hash[:meta] transaction = hash[:transaction] { id: [:id], hash: [:hash] ? [:hash][:data] : [:data], height: [:height], timestamp: transaction[:timeStamp], version: transaction[:version], type: transaction[:type], signer: transaction[:signer], fee: transaction[:fee], deadline: transaction[:deadline] } end |
.new_from_account_transaction(hash) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/nem/model/transaction.rb', line 20 def self.new_from_account_transaction(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
16 17 18 |
# File 'lib/nem/model/transaction.rb', line 16 def version?(num) num == 1 ? true : false # TODO: version end |