Method: Hive::Broadcast.escrow_transfer
- Defined in:
- lib/hive/broadcast.rb
.escrow_transfer(options, &block) ⇒ Object
The purpose of this operation is to enable someone to send money contingently to another individual.
969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 |
# File 'lib/hive/broadcast.rb', line 969 def self.escrow_transfer(, &block) required_fields = %i(from to agent escrow_id fee ratification_deadline) params = [:params] if !!params[:meta] && !!params[:json_meta] raise Hive::ArgumentError, 'Assign either meta or json_meta, not both.' end = params.delete(:meta) || {} ||= (JSON[params[:json_meta]] || nil) || {} params[:json_meta] = .to_json check_required_fields(params, *required_fields) params[:hbd_amount] = normalize_amount(.merge amount: params[:hbd_amount]) params[:hive_amount] = normalize_amount(.merge amount: params[:hive_amount]) params[:fee] = normalize_amount(.merge amount: params[:fee]) params[:ratification_deadline] = Time.parse(params[:ratification_deadline].to_s) params[:ratification_deadline] = params[:ratification_deadline].strftime('%Y-%m-%dT%H:%M:%S') if !!params[:escrow_expiration] params[:escrow_expiration] = Time.parse(params[:escrow_expiration].to_s) params[:escrow_expiration] = params[:escrow_expiration].strftime('%Y-%m-%dT%H:%M:%S') end ops = [[:escrow_transfer, params]] process(.merge(ops: ops), &block) end |