Class: OpenAssets::Transaction::SpendableOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/openassets/transaction/spendable_output.rb

Overview

A transaction output with information about the asset ID and asset quantity associated to it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out_point, output) ⇒ SpendableOutput

Returns a new instance of SpendableOutput.



16
17
18
19
20
# File 'lib/openassets/transaction/spendable_output.rb', line 16

def initialize(out_point, output)
  @out_point = out_point
  @output = output
  @confirmations = nil
end

Instance Attribute Details

#confirmationsObject

Returns the value of attribute confirmations.



12
13
14
# File 'lib/openassets/transaction/spendable_output.rb', line 12

def confirmations
  @confirmations
end

#out_pointObject

An object that can be used to locate the output.



8
9
10
# File 'lib/openassets/transaction/spendable_output.rb', line 8

def out_point
  @out_point
end

#outputObject

The actual output object.



10
11
12
# File 'lib/openassets/transaction/spendable_output.rb', line 10

def output
  @output
end

Instance Method Details

#to_hashObject

convert to hash.



23
24
25
26
# File 'lib/openassets/transaction/spendable_output.rb', line 23

def to_hash
  return {} if @output.nil?
  {'txid' => @out_point.hash, 'vout' => @out_point.index, 'confirmations' => @confirmations}.merge(@output.to_hash)
end