class Nem::Model::Transaction
Attributes
deadline[R]
fee[R]
hash[R]
height[R]
id[R]
signer[R]
timestamp[R]
type[R]
version[R]
Public Class Methods
new_from_account_transaction(hash)
click to toggle source
# File lib/nem/model/transaction.rb, line 19 def self.new_from_account_transaction(hash) new_from_account_transaction_meta_data_pair( meta: { data: nil }, transaction: hash ) end
new_from_account_transaction_meta_data_pair(hash)
click to toggle source
# File lib/nem/model/transaction.rb, line 26 def self.new_from_account_transaction_meta_data_pair(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.new_from_transaction_meta_data_pair(hash) end
Private Class Methods
common_part(hash)
click to toggle source
# File lib/nem/model/transaction.rb, line 44 def self.common_part(hash) { timestamp: Nem::Unit::Time.new_from_nemtime(hash[:timeStamp]), deadline: Nem::Unit::Time.new_from_nemtime(hash[:deadline]), fee: hash[:fee], type: hash[:type], version: Nem::Unit::Version.new(hash[:version]), signer: hash[:signer] } end
common_part_meta_data_pair(hash)
click to toggle source
# File lib/nem/model/transaction.rb, line 55 def self.common_part_meta_data_pair(hash) meta = hash[:meta] common_part(hash[:transaction]).merge( id: meta[:id], hash: meta[:hash] ? meta[:hash][:data] : meta[:data], height: meta[:height] ) end