Method: Hive::Broadcast.feed_publish

Defined in:
lib/hive/broadcast.rb

.feed_publish(options, &block) ⇒ Object

Feeds can only be published by the top N witnesses which are included in every round and are used to define the exchange rate between hive and the dollar.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :publisher (String)

    • :exchange_rate (Hash)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'lib/hive/broadcast.rb', line 414

def self.feed_publish(options, &block)
  required_fields = %i(publisher exchange_rate)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  exchange_rate = params[:exchange_rate] rescue nil || {}
  base = exchange_rate[:base]
  quote = exchange_rate[:quote]
  params[:exchange_rate][:base] = normalize_amount(options.merge amount: base)
  params[:exchange_rate][:quote] = normalize_amount(options.merge amount: quote)
  
  ops = [[:feed_publish, params]]
  
  process(options.merge(ops: ops), &block)
end