Class: Graphdb::Model::Transaction
- Inherits:
-
ActiveNodeBase
- Object
- ActiveNodeBase
- Graphdb::Model::Transaction
- Includes:
- Extensions::OpenAssets::Transaction
- Defined in:
- lib/graphdb/model/transaction.rb
Class Method Summary collapse
Methods included from Extensions::OpenAssets::Transaction
#apply_oa_outputs, #openassets_tx?, prepended
Methods inherited from ActiveNodeBase
Class Method Details
.create_from_txid(txid) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/graphdb/model/transaction.rb', line 25 def self.create_from_txid(txid) puts "create tx #{txid}. #{Time.now}" tx = new hash = load_tx(txid) tx.hex = hash['hex'] tx.txid = hash['txid'] tx.version = hash['version'] tx.block_time = hash['blocktime'] tx.lock_time = hash['locktime'] tx.block_hash = hash['blockhash'] tx.time = hash['time'] tx.confirmations = hash['confirmations'] tx.save! hash['vin'].each do |i| tx.inputs << Graphdb::Model::TxIn.create_from_hash(i) end hash['vout'].each do |o| tx.outputs << Graphdb::Model::TxOut.create_from_hash(o) end tx.save! tx end |