Class: CoinOp::Bit::SparseInput
- Inherits:
-
Object
- Object
- CoinOp::Bit::SparseInput
- Includes:
- Encodings
- Defined in:
- lib/coin-op/bit/input.rb
Overview
Used in Transaction.from_native or other situations where we do not have full information about the unspent output being used for an input.
Instance Method Summary collapse
-
#initialize(binary_hash, index) ⇒ SparseInput
constructor
A new instance of SparseInput.
- #to_json(*a) ⇒ Object
Methods included from Encodings
#base58, #decode_base58, #decode_hex, #hex, #int_to_byte_array
Constructor Details
#initialize(binary_hash, index) ⇒ SparseInput
Returns a new instance of SparseInput.
87 88 89 90 91 92 93 94 |
# File 'lib/coin-op/bit/input.rb', line 87 def initialize(binary_hash, index) @output = { # the binary hash is the result of # [tx.hash].pack("H*").reverse transaction_hash: hex(binary_hash.reverse), index: index } end |
Instance Method Details
#to_json(*a) ⇒ Object
96 97 98 99 100 |
# File 'lib/coin-op/bit/input.rb', line 96 def to_json(*a) { output: @output }.to_json(*a) end |