Method: Hive::Broadcast.transfer

Defined in:
lib/hive/broadcast.rb

.transfer(options, &block) ⇒ Object

Transfers asset from one account to another.

options = {
  wif: wif,
  params: {
    from: from,
    to: to,
    amount: amount,
    memo: memo
  }
}

Hive::Broadcast.transfer(options) do |result|
  puts result
end

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :from (String)

    • :to (String)

    • :amount (String)

    • :memo (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



277
278
279
280
281
282
283
284
285
286
287
# File 'lib/hive/broadcast.rb', line 277

def self.transfer(options, &block)
  required_fields = %i(from to amount memo)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:amount] = normalize_amount(options.merge amount: params[:amount])
  
  ops = [[:transfer, params]]
  
  process(options.merge(ops: ops), &block)
end