1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
|
# File 'lib/hive/broadcast.rb', line 1200
def self.account_create_with_delegation(options, &block)
required_fields = %i(fee delegation creator new_account_name owner active posting memo_key)
params = options[:params]
if !!params[:metadata] && !!params[:json_metadata]
raise Hive::ArgumentError, 'Assign either metadata or json_metadata, not both.'
end
metadata = params.delete(:metadata) || {}
metadata ||= (JSON[params[:json_metadata]] || nil) || {}
params[:json_metadata] = metadata.to_json
check_required_fields(params, *required_fields)
params[:fee] = normalize_amount(options.merge amount: params[:fee])
params[:delegation] = normalize_amount(options.merge amount: params[:delegation])
params[:extensions] ||= []
ops = [[:account_create_with_delegation, params]]
process(options.merge(ops: ops), &block)
end
|