class OpenAssets::Transaction::TransferParameters

The value object of a bitcoin or asset transfer.

Attributes

amount[RW]
change_script[RW]
output_qty[RW]
to_script[RW]
unspent_outputs[RW]

Public Class Methods

new(unspent_outputs, to_script, change_script, amount, output_qty = 1) click to toggle source

initialize @param [Array] unspent_outputs Array of the unspent outputs available for the transaction. @param [String] to_script the output script to which to send the assets or bitcoins. @param [String] change_script the output script to which to send any remaining change. @param [Integer] amount The asset quantity or amount of the satoshi sent in the transaction.

# 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

Public Instance Methods

split_output_amount() click to toggle source
# 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