Method: Hive::Broadcast.account_create
- Defined in:
- lib/hive/broadcast.rb
.account_create(options, &block) ⇒ Object
Create an account. options = { wif: wif, params: { fee: '1.000 HIVE', creator: creator_account_name, new_account_name: new_account_name, owner: { weight_threshold: 1, account_auths: [], key_auths: [[owner_public_key, 1]], }, active: { weight_threshold: 1, account_auths: [], key_auths: [[active_public_key, 1]], }, posting: { weight_threshold: 1, account_auths: [], key_auths: [[posting_public_key, 1]], }, memo_key: memo_public_key, json_metadata: '{}' } }
Hive::Broadcast.account_create()
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
# File 'lib/hive/broadcast.rb', line 496 def self.account_create(, &block) required_fields = %i(fee creator new_account_name owner active posting memo_key json_metadata) params = [:params] if !!params[:metadata] && !!params[:json_metadata] raise Hive::ArgumentError, 'Assign either metadata or json_metadata, not both.' end = params.delete(:metadata) || {} ||= (JSON[params[:json_metadata]] || nil) || {} params[:json_metadata] = .to_json check_required_fields(params, *required_fields) params[:fee] = normalize_amount(.merge amount: params[:fee]) ops = [[:account_create, params]] process(.merge(ops: ops), &block) end |