Class: OpenAssets::Transaction::TransferParameters
- Inherits:
-
Object
- Object
- OpenAssets::Transaction::TransferParameters
- Defined in:
- lib/openassets/transaction/transfer_parameters.rb
Overview
The value object of a bitcoin or asset transfer.
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#change_script ⇒ Object
Returns the value of attribute change_script.
-
#output_qty ⇒ Object
Returns the value of attribute output_qty.
-
#to_script ⇒ Object
Returns the value of attribute to_script.
-
#unspent_outputs ⇒ Object
Returns the value of attribute unspent_outputs.
Instance Method Summary collapse
-
#initialize(unspent_outputs, to_script, change_script, amount, output_qty = 1) ⇒ TransferParameters
constructor
initialize.
- #split_output_amount ⇒ Object
Constructor Details
#initialize(unspent_outputs, to_script, change_script, amount, output_qty = 1) ⇒ TransferParameters
initialize
18 19 20 21 22 23 24 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 18 def initialize(unspent_outputs, to_script, change_script, amount, output_qty = 1) @unspent_outputs = unspent_outputs @to_script = to_script @change_script = change_script @amount = amount @output_qty = output_qty end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
8 9 10 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 8 def amount @amount end |
#change_script ⇒ Object
Returns the value of attribute change_script.
9 10 11 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 9 def change_script @change_script end |
#output_qty ⇒ Object
Returns the value of attribute output_qty.
11 12 13 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 11 def output_qty @output_qty end |
#to_script ⇒ Object
Returns the value of attribute to_script.
10 11 12 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 10 def to_script @to_script end |
#unspent_outputs ⇒ Object
Returns the value of attribute unspent_outputs.
7 8 9 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 7 def unspent_outputs @unspent_outputs end |
Instance Method Details
#split_output_amount ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/openassets/transaction/transfer_parameters.rb', line 26 def split_output_amount split_amounts = [] output_qty.times{|index| if index == output_qty - 1 value = amount / output_qty + amount % output_qty else value = amount / output_qty end split_amounts << value } split_amounts end |