Sha256: 7d9e77bf149e105fb0fd311bf31021d3204133903ca2d2fb94150d1fb35eb286
Contents?: true
Size: 745 Bytes
Versions: 2
Compression:
Stored size: 745 Bytes
Contents
module Graphdb module Model class AssetId < ActiveNodeBase property :asset_id, index: :exact has_many :in, :outputs, origin: :asset_id, model_class: 'Graphdb::Model::TxOut' validates :asset_id, :presence => true scope :with_asset_id, ->(asset_id){where(asset_id: asset_id)} def self.find_or_create(asset_id) a = with_asset_id(asset_id).first unless a a = new a.asset_id = asset_id a.save! end a end # Get issuance transactions def issuance_txs outputs.select{|o|o.oa_output_type == 'issuance'}. map(&:transaction).uniq{|tx| tx.txid}.sort{|a,b| b.block_time <=> a.block_time} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bitcoin2graphdb-0.3.9 | lib/graphdb/model/extensions/open_assets/asset_id.rb |
bitcoin2graphdb-0.3.8 | lib/graphdb/model/extensions/open_assets/asset_id.rb |