Class: Bitcoin::Storage::Models::TxOut
- Inherits:
-
Protocol::TxOut
- Object
- Protocol::TxOut
- Bitcoin::Storage::Models::TxOut
- Defined in:
- lib/bitcoin/storage/models.rb
Overview
Transaction output retrieved from storage. (see Bitcoin::Protocol::TxOut)
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
-
#tx_id ⇒ Object
readonly
Returns the value of attribute tx_id.
-
#tx_idx ⇒ Object
readonly
Returns the value of attribute tx_idx.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from Protocol::TxOut
#pk_script, #pk_script_length, #value
Instance Method Summary collapse
-
#get_address ⇒ Object
get all addresses this txout corresponds to (if possible).
-
#get_addresses ⇒ Object
get the single address this txout corresponds to (first for multisig tx).
- #get_namecoin_name ⇒ Object
-
#get_next_in ⇒ Object
get the next input that references this output.
-
#get_tx ⇒ Object
get the transaction this output is in.
- #hash160 ⇒ Object
-
#initialize(store, data) ⇒ TxOut
constructor
A new instance of TxOut.
- #script ⇒ Object
Methods inherited from Protocol::TxOut
#==, from_hash, from_io, #get_script, #parse_data, #parse_data_from_io, #to_hash, #to_null_payload, #to_payload, value_to_address
Constructor Details
#initialize(store, data) ⇒ TxOut
Returns a new instance of TxOut.
128 129 130 131 132 133 134 |
# File 'lib/bitcoin/storage/models.rb', line 128 def initialize store, data @store = store @id = data[:id] @tx_id = data[:tx_id] @tx_idx = data[:tx_idx] @type = data[:type] end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
126 127 128 |
# File 'lib/bitcoin/storage/models.rb', line 126 def id @id end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
126 127 128 |
# File 'lib/bitcoin/storage/models.rb', line 126 def store @store end |
#tx_id ⇒ Object (readonly)
Returns the value of attribute tx_id.
126 127 128 |
# File 'lib/bitcoin/storage/models.rb', line 126 def tx_id @tx_id end |
#tx_idx ⇒ Object (readonly)
Returns the value of attribute tx_idx.
126 127 128 |
# File 'lib/bitcoin/storage/models.rb', line 126 def tx_idx @tx_idx end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
126 127 128 |
# File 'lib/bitcoin/storage/models.rb', line 126 def type @type end |
Instance Method Details
#get_address ⇒ Object
get all addresses this txout corresponds to (if possible)
153 154 155 |
# File 'lib/bitcoin/storage/models.rb', line 153 def get_address script.get_address end |
#get_addresses ⇒ Object
get the single address this txout corresponds to (first for multisig tx)
158 159 160 |
# File 'lib/bitcoin/storage/models.rb', line 158 def get_addresses script.get_addresses end |
#get_namecoin_name ⇒ Object
162 163 164 |
# File 'lib/bitcoin/storage/models.rb', line 162 def get_namecoin_name @store.get_name_by_txout_id(@id) end |
#get_next_in ⇒ Object
get the next input that references this output
146 147 148 149 150 |
# File 'lib/bitcoin/storage/models.rb', line 146 def get_next_in @store.get_txin_for_txout(get_tx.hash, @tx_idx) rescue nil end |
#get_tx ⇒ Object
get the transaction this output is in
141 142 143 |
# File 'lib/bitcoin/storage/models.rb', line 141 def get_tx @tx ||= @store.get_tx_by_id(@tx_id) end |
#hash160 ⇒ Object
136 137 138 |
# File 'lib/bitcoin/storage/models.rb', line 136 def hash160 script.get_hash160 end |