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, #redeem_script, #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.
Methods inherited from Protocol::TxOut
#==, from_hash, from_io, #parse_data, #parse_data_from_io, #parsed_script, #to_hash, #to_null_payload, #to_payload, value_to_address
Constructor Details
#initialize(store, data) ⇒ TxOut
Returns a new instance of TxOut.
129 130 131 132 133 134 135 |
# File 'lib/bitcoin/storage/models.rb', line 129 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.
127 128 129 |
# File 'lib/bitcoin/storage/models.rb', line 127 def id @id end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
127 128 129 |
# File 'lib/bitcoin/storage/models.rb', line 127 def store @store end |
#tx_id ⇒ Object (readonly)
Returns the value of attribute tx_id.
127 128 129 |
# File 'lib/bitcoin/storage/models.rb', line 127 def tx_id @tx_id end |
#tx_idx ⇒ Object (readonly)
Returns the value of attribute tx_idx.
127 128 129 |
# File 'lib/bitcoin/storage/models.rb', line 127 def tx_idx @tx_idx end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
127 128 129 |
# File 'lib/bitcoin/storage/models.rb', line 127 def type @type end |
Instance Method Details
#get_address ⇒ Object
get all addresses this txout corresponds to (if possible)
152 153 154 |
# File 'lib/bitcoin/storage/models.rb', line 152 def get_address parsed_script.get_address end |
#get_addresses ⇒ Object
get the single address this txout corresponds to (first for multisig tx)
157 158 159 |
# File 'lib/bitcoin/storage/models.rb', line 157 def get_addresses parsed_script.get_addresses end |
#get_namecoin_name ⇒ Object
161 162 163 |
# File 'lib/bitcoin/storage/models.rb', line 161 def get_namecoin_name @store.get_name_by_txout_id(@id) end |
#get_next_in ⇒ Object
get the next input that references this output
147 148 149 |
# File 'lib/bitcoin/storage/models.rb', line 147 def get_next_in @store.get_txin_for_txout(get_tx.hash, @tx_idx) end |
#get_tx ⇒ Object
get the transaction this output is in
142 143 144 |
# File 'lib/bitcoin/storage/models.rb', line 142 def get_tx @tx ||= @store.get_tx_by_id(@tx_id) end |
#hash160 ⇒ Object
137 138 139 |
# File 'lib/bitcoin/storage/models.rb', line 137 def hash160 parsed_script.get_hash160 end |