Class: Steem::Broadcast

Inherits:
Object
  • Object
show all
Extended by:
Retriable, Utils
Defined in:
lib/steem/broadcast.rb

Overview

These class methods make it simple to do things like broacast a Broadcast.vote or Broadcast.comment operation. They accept all of the fields expected by the blockchain plus the following additional options:

* wif
* url (optional)
* database_api (optional)
* block_api (optional)
* network_broadcast_api (optional)
* pretend (optional)

These options are not sent in the broadcast. The ‘wif` authorities can be posting, active, and owner.

Setting ‘url` will allow you to specify a different node instead of taking the default: (ChainConfig::NETWORKS_STEEM_DEFAULT_NODE).

Setting ‘database_api`, `block_api`, and `network_broadcast_api` is optional, doing so will allow you to override the default node and/or the RPC Client.

When passing the ‘pretend` field, if it is set to True, nothing is broadcasted, but the `wif` is checked for the proper authority.

For details on what to pass to these methods, check out the Steem Developer Portal Broadcast Operations page.

Constant Summary collapse

DEFAULT_MAX_ACCEPTED_PAYOUT =
Type::Amount.new(amount: '1000000000', precision: 3, nai: '@@000000013')

Constants included from Retriable

Retriable::MAX_BACKOFF, Retriable::MAX_RETRY_COUNT, Retriable::MAX_RETRY_ELAPSE, Retriable::RETRYABLE_EXCEPTIONS

Class Method Summary collapse

Methods included from Retriable

can_retry?

Methods included from Utils

hexlify, unhexlify

Class Method Details

.account_create(options, &block) ⇒ Object

Create an account.

options = {
  wif: wif,
  params: {
    fee: '1.000 STEEM',
    creator: ,
    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: '{}'
  }
}

Steem::Broadcast.(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :fee (String)

    • :creator (String)

    • :new_account_name (String)

    • :owner (Hash)

    • :active (Hash)

    • :posting (Hash)

    • :memo_key (String)

    • :metadata (Hash) Metadata of the account, becomes ‘json_metadata`.

    • :json_metadata (String) String version of ‘metadata` (use one or the other).

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
# File 'lib/steem/broadcast.rb', line 584

def self.(options, &block)
  required_fields = %i(fee creator new_account_name owner active posting memo_key json_metadata)
  params = options[:params]
  
  if !!params[:metadata] && !!params[:json_metadata]
    raise Steem::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(options.merge amount: params[:fee])
  
  ops = [[:account_create, params]]
  
  process(options.merge(ops: ops), &block)
end

.account_create_with_delegation(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :fee (String)

    • :delegation (String)

    • :creator (String)

    • :new_account_name (String)

    • :owner (String)

    • :active (String)

    • :posting (String)

    • :memo_key (String)

    • :metadata (Hash) Metadata of the account, becomes ‘json_metadata`.

    • :json_metadata (String) String version of ‘metadata` (use one or the other).

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
# File 'lib/steem/broadcast.rb', line 1286

def self.(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 Steem::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(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

.account_update(options, &block) ⇒ Object

Update an account.

options = {
  wif: wif,
  params: {
    account: ,
    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: '{}'
  }
}

Steem::Broadcast.(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :account (String)

    • :owner (Hash) (optional)

    • :active (Hash) (optional)

    • :posting (Hash) (optional)

    • :memo_key (String) (optional)

    • :metadata (Hash) Metadata of the account, becomes ‘json_metadata`.

    • :json_metadata (String) String version of ‘metadata` (use one or the other).

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
# File 'lib/steem/broadcast.rb', line 706

def self.(options, &block)
  required_fields = %i(account)
  params = options[:params]
  
  if !!params[:metadata] && !!params[:json_metadata]
    raise Steem::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)
  
  ops = [[:account_update, params]]
  
  process(options.merge(ops: ops), &block)
end

.account_witness_proxy(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :account (String)

    • :proxy (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



864
865
866
867
868
869
870
871
872
# File 'lib/steem/broadcast.rb', line 864

def self.(options, &block)
  required_fields = %i(account proxy)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:account_witness_proxy, params]]
  
  process(options.merge(ops: ops), &block)
end

.account_witness_vote(options, &block) ⇒ Object

All accounts with a VFS (Vesting Fund Shares) can vote for or against any witness.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :account (String)

    • :witness (String)

    • :approve (Boolean)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



847
848
849
850
851
852
853
854
855
# File 'lib/steem/broadcast.rb', line 847

def self.(options, &block)
  required_fields = %i(account witness approve)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:account_witness_vote, params]]
  
  process(options.merge(ops: ops), &block)
end

.cancel_transfer_from_savings(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :request_id (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1216
1217
1218
1219
1220
1221
1222
1223
1224
# File 'lib/steem/broadcast.rb', line 1216

def self.cancel_transfer_from_savings(options, &block)
  required_fields = %i(from request_id)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:cancel_transfer_from_savings, params]]
  
  process(options.merge(ops: ops), &block)
end

.change_recovery_account(options, &block) ⇒ Object

Each account lists another account as their recovery account.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :account_to_recover (String)

    • :new_recovery_account (String)

    • :extensions (Array) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
# File 'lib/steem/broadcast.rb', line 1024

def self.(options, &block)
  required_fields = %i(account_to_recover)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:new_recovery_account] ||= ''
  params[:extensions] ||= []
  ops = [[:change_recovery_account, params]]
  
  process(options.merge(ops: ops), &block)
end

.claim_account(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :creator (String)

    • :fee (String)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
# File 'lib/steem/broadcast.rb', line 1317

def self.(options, &block)
  required_fields = %i(creator fee)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:fee] = normalize_amount(options.merge amount: params[:fee])
  params[:extensions] ||= []
  
  ops = [[:claim_account, params]]
  
  process(options.merge(ops: ops), &block)
end

.claim_reward_balance2(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :account (String)

    • :reward_tokens (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



115
116
117
118
119
120
121
122
123
# File 'lib/steem/broadcast.rb', line 115

def self.claim_reward_balance2(options, &block)
  required_fields = %i(account reward_tokens)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:claim_reward_balance2, params]]
  
  process(options.merge(ops: ops), &block)
end

.comment(options, &block) ⇒ Object

Creates a post/comment. This method simplifies content creation by combining ‘comment` and `comment_options` into one transaction.

options = {
  wif: wif,
  params: {
    author: author,
    title: 'This is my fancy post title.',
    body: 'This is my fancy post body.',
    metadata: {
      tags: %w(these are my fancy tags)
    } 
  }
}

Steem::Broadcast.comment(options)

options = {
  wif: wif,
  params: {
    author: author,
    title: 'This is my fancy post title.',
    body: 'This is my fancy post body.',
    metadata: {
      tags: %w(these are my fancy tags)
    },
    beneficiaries: [
      {account: "david", weight: 500},
      {account: "erin", weight: 500},
      {account: "faythe", weight: 1000},
      {account: "frank", weight: 500}
    ]
  }
}

Steem::Broadcast.comment(options)

In addition to the above denormalized ‘comment_options` fields, the author can also vote for the content in the same transaction by setting `author_vote_weight`:

options = {
  wif: wif,
  params: {
    author: author,
    title: 'This is my fancy post title.',
    body: 'This is my fancy post body.',
    metadata: {
      tags: %w(these are my fancy tags)
    },
    author_vote_weight: 10000
  }
}

Steem::Broadcast.comment(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :author (String)

    • :title (String) Title of the content.

    • :body (String) Body of the content.

    • :metadata (Hash) Metadata of the content, becomes ‘json_metadata`.

    • :json_metadata (String) String version of ‘metadata` (use one or the other).

    • :permlink (String) (automatic) Permlink of the content, defaults to formatted title.

    • :parent_permlink (String) (automatic) Parent permlink of the content, defaults to first tag.

    • :parent_author (String) (optional) Parent author of the content (only used if reply).

    • :max_accepted_payout (String) (1000000.000 SBD) Maximum accepted payout, set to ‘0.000 SBD’ to deline payout

    • :percent_steem_dollars (Numeric) (5000) Percent STEEM Dollars is used to set 50/50 or 100% STEEM Power

    • :allow_votes (Numeric) (true) Allow votes for this content.

    • :allow_curation_rewards (Numeric) (true) Allow curation rewards for this content.

    • :beneficiaries (Array<Hash>) Sets the beneficiaries of this content.

    • :author_vote_weight (Number) (optional) Cast a vote by the author in the same transaction.

    • :pretend (Boolean) Just validate, do not broadcast.

See Also:



199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/steem/broadcast.rb', line 199

def self.comment(options, &block)
  required_fields = %i(author body permlink parent_permlink)
  params = options[:params]
  
  if !!params[:metadata] && !!params[:json_metadata]
    raise Steem::ArgumentError, 'Assign either metadata or json_metadata, not both.'
  end
  
   = params[:metadata] || {}
   ||= (JSON[params[:json_metadata]] || nil) || {}
  ['app'] ||= Steem::AGENT_ID
  tags = ['tags'] || []
  params[:parent_permlink] ||= tags.first
  
  if !!params[:title]
    params[:permlink] ||= params[:title].downcase.gsub(/[^a-z0-9\-]+/, '-')
  end
  
  check_required_fields(params, *required_fields)
  
  ops = [[:comment, {
    parent_author: params[:parent_author] || '',
    parent_permlink: params[:parent_permlink],
    author: params[:author],
    permlink: params[:permlink],
    title: params[:title] || '',
    body: params[:body],
    json_metadata: .to_json
  }]]
  
  max_accepted_payout = if params.keys.include? :max_accepted_payout
    normalize_amount(options.merge amount: params[:max_accepted_payout])
  else
    normalize_amount(options.merge amount: DEFAULT_MAX_ACCEPTED_PAYOUT)
  end
  
  allow_votes = if params.keys.include? :allow_votes
    !!params[:allow_votes]
  else
    true
  end
  
  allow_curation_rewards = if params.keys.include? :allow_curation_rewards
    !!params[:allow_curation_rewards]
  else
    true
  end
  
  comment_options = {
    author: params[:author],
    permlink: params[:permlink],
    max_accepted_payout: max_accepted_payout,
    percent_steem_dollars: params[:percent_steem_dollars] || 10000,
    # allow_replies: allow_replies,
    allow_votes: allow_votes,
    allow_curation_rewards: allow_curation_rewards,
    extensions: []
  }
  
  if !!params[:beneficiaries]
    comment_options[:extensions] << [
      comment_options[:extensions].size,
      normalize_beneficiaries(options.merge(beneficiaries: params[:beneficiaries]))
    ]
  end
  
  ops << [:comment_options, comment_options]
  
  if !!params[:author_vote_weight]
    author_vote = {
      voter: params[:author],
      author: params[:author],
      permlink: params[:permlink],
      weight: params[:author_vote_weight]
    }
    
    ops << [:vote, author_vote]
  end
  
  process(options.merge(ops: ops), &block)
end

.convert(options, &block) ⇒ Object

This operation instructs the blockchain to start a conversion between STEEM and SBD, the funds are deposited after 3.5 days.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :requestid (String)

    • :amount (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



529
530
531
532
533
534
535
536
537
538
539
# File 'lib/steem/broadcast.rb', line 529

def self.convert(options, &block)
  required_fields = %i(owner requestid amount)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:amount] = normalize_amount(options.merge amount: params[:amount])
  
  ops = [[:convert, params]]
  
  process(options.merge(ops: ops), &block)
end

.create_claimed_account(options, &block) ⇒ Object

Create a claimed account.

options = {
  wif: wif,
  params: {
    creator: ,
    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: '{}'
  }
}

Steem::Broadcast.(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :creator (String)

    • :new_account_name (String)

    • :owner (Hash)

    • :active (Hash)

    • :posting (Hash)

    • :memo_key (String)

    • :metadata (Hash) Metadata of the account, becomes ‘json_metadata`.

    • :json_metadata (String) String version of ‘metadata` (use one or the other).

    • :extensions (Array) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
# File 'lib/steem/broadcast.rb', line 647

def self.(options, &block)
  required_fields = %i(creator new_account_name owner active posting memo_key json_metadata)
  params = options[:params]
  
  if !!params[:metadata] && !!params[:json_metadata]
    raise Steem::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[:extensions] ||= []
  ops = [[:create_claimed_account, params]]
  
  process(options.merge(ops: ops), &block)
end

.custom(options, &block) ⇒ Object

Provides a generic way to add higher level protocols on top of witness consensus.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :required_auths (Array<String>)

    • :id (String)

    • :data (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



885
886
887
888
889
890
891
892
893
# File 'lib/steem/broadcast.rb', line 885

def self.custom(options, &block)
  required_fields = %i(required_auths id data)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:custom, params]]
  
  process(options.merge(ops: ops), &block)
end

.custom_binary(options, &block) ⇒ Object

The semmantics for this operation are the same as the custom_json operation, but with a binary payload.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :id (String)

    • :data (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



905
906
907
908
909
910
911
912
913
# File 'lib/steem/broadcast.rb', line 905

def self.custom_binary(options, &block)
  required_fields = %i(id data)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:custom_binary, params]]
  
  process(options.merge(ops: ops), &block)
end

.custom_json(options, &block) ⇒ Object

Serves the same purpose as custom but also supports required posting authorities.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :required_auths (Array<String>)

    • :required_posting_auths (Arrat<String>)

    • :id (String)

    • :data (Hash) Data of the custom json, becomes ‘json`.

    • :json (String) String version of ‘data` (use one or the other).

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
# File 'lib/steem/broadcast.rb', line 928

def self.custom_json(options, &block)
  required_fields = %i(id)
  params = options[:params]
  
  if !!params[:data] && !!params[:json]
    raise Steem::ArgumentError, 'Assign either data or json, not both.'
  end
  
  data = params.delete(:data) || {}
  data ||= (JSON[params[:json]] || nil) || {}
  params[:json] = data.to_json
  
  check_required_fields(params, *required_fields)
  
  params[:required_auths] ||= []
  params[:required_posting_auths] ||= []
  ops = [[:custom_json, params]]
  
  process(options.merge(ops: ops), &block)
end

.decline_voting_rights(options, &block) ⇒ Object

An account can chose to decline their voting rights after a 30 day delay. This includes voting on content and witnesses. **The voting rights cannot be acquired again once they have been declined.** This is only to formalize a smart contract between certain accounts and the community that currently only exists as a social contract.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Owner wif

  • :params (Hash)
    • :account (String)

    • :decline (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/steem/broadcast.rb', line 1239

def self.decline_voting_rights(options, &block)
  required_fields = %i(account decline)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:decline_voting_rights, params]]
  
  process(options.merge(ops: ops), &block)
end

.delegate_to_pool(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :from_account (String)

    • :to_pool (String)

    • :amount (Hash)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
# File 'lib/steem/broadcast.rb', line 1478

def self.delegate_to_pool(options, &block)
  required_fields = %i(from_account to_pool amount)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:delegate_to_pool, params]]
  
  process(options.merge(ops: ops), &block)
end

.delegate_vesting_shares(options, &block) ⇒ Object

Delegate vesting shares from one account to the other.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :delegator (String)

    • :delegatee (String)

    • :vesting_shares (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
# File 'lib/steem/broadcast.rb', line 1259

def self.delegate_vesting_shares(options, &block)
  required_fields = %i(delegator delegatee vesting_shares)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:vesting_shares] = normalize_amount(options.merge amount: params[:vesting_shares])
  ops = [[:delegate_vesting_shares, params]]
  
  process(options.merge(ops: ops), &block)
end

.delete_comment(options, &block) ⇒ Object

Deletes a post/comment.

Steem::Broadcast.delete_comment(wif: wif, params: {author: author, permlink: permlink}) do |result|
  puts result
end

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :author (String)

    • :permlink (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



294
295
296
297
298
299
300
301
302
# File 'lib/steem/broadcast.rb', line 294

def self.delete_comment(options, &block)
  required_fields = %i(author permlink)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:delete_comment, params]]
  
  process(options.merge(ops: ops), &block)
end

.escrow_approve(options, &block) ⇒ Object

The agent and to accounts must approve an escrow transaction for it to be valid on the blockchain.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :to (String)

    • :agent (String)

    • :who (String)

    • :escrow_id (String)

    • :approve (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/steem/broadcast.rb', line 1152

def self.escrow_approve(options, &block)
  required_fields = %i(from to agent who escrow_id approve)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:escrow_approve, params]]
  
  process(options.merge(ops: ops), &block)
end

.escrow_dispute(options, &block) ⇒ Object

If either the sender or receiver of an escrow payment has an issue, they can raise it for dispute.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :to (String)

    • :agent (String)

    • :who (String)

    • :escrow_id (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/steem/broadcast.rb', line 1099

def self.escrow_dispute(options, &block)
  required_fields = %i(from to agent who escrow_id)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:escrow_dispute, params]]
  
  process(options.merge(ops: ops), &block)
end

.escrow_release(options, &block) ⇒ Object

This operation can be used by anyone associated with the escrow transfer to release funds if they have permission.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :to (String)

    • :agent (String)

    • :who (String)

    • :receiver (String)

    • :escrow_id (String)

    • :sbd_amount (String)

    • :steem_amount (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
# File 'lib/steem/broadcast.rb', line 1125

def self.escrow_release(options, &block)
  required_fields = %i(from to agent who receiver escrow_id)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:sbd_amount] = normalize_amount(options.merge amount: params[:sbd_amount])
  params[:steem_amount] = normalize_amount(options.merge amount: params[:steem_amount])

  ops = [[:escrow_release, params]]
  
  process(options.merge(ops: ops), &block)
end

.escrow_transfer(options, &block) ⇒ Object

The purpose of this operation is to enable someone to send money contingently to another individual.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :to (String)

    • :agent (String)

    • :escrow_id (String)

    • :sbd_amount (String)

    • :steem_amount (String)

    • :fee (String)

    • :ratification_deadline (String)

    • :escrow_expiration (String)

    • :meta (Hash) Meta of the escrow transfer, becomes ‘json_meta`.

    • :json_meta (String) String version of ‘metadata` (use one or the other).

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/steem/broadcast.rb', line 1055

def self.escrow_transfer(options, &block)
  required_fields = %i(from to agent escrow_id fee ratification_deadline)
  params = options[:params]
  
  if !!params[:meta] && !!params[:json_meta]
    raise Steem::ArgumentError, 'Assign either meta or json_meta, not both.'
  end
  
  meta = params.delete(:meta) || {}
  meta ||= (JSON[params[:json_meta]] || nil) || {}
  params[:json_meta] = meta.to_json
  
  check_required_fields(params, *required_fields)
  
  params[:sbd_amount] = normalize_amount(options.merge amount: params[:sbd_amount])
  params[:steem_amount] = normalize_amount(options.merge amount: params[:steem_amount])
  params[:fee] = normalize_amount(options.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(options.merge(ops: ops), &block)
end

.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 steem 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:



502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/steem/broadcast.rb', line 502

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

.limit_order_cancel(options, &block) ⇒ Object

Cancels an order and returns the balance to owner.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :orderid (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



481
482
483
484
485
486
487
488
489
# File 'lib/steem/broadcast.rb', line 481

def self.limit_order_cancel(options, &block)
  required_fields = %i(owner orderid)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:limit_order_cancel, params]]
  
  process(options.merge(ops: ops), &block)
end

.limit_order_create(options, &block) ⇒ Object

This operation creates a limit order and matches it against existing open orders.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :orderid (String)

    • :amount_to_sell (String)

    • :min_to_receive (String)

    • :fill_or_kill (Boolean)

    • :expiration (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# File 'lib/steem/broadcast.rb', line 417

def self.limit_order_create(options, &block)
  required_fields = %i(owner orderid amount_to_sell min_to_receive
    fill_or_kill)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:amount_to_sell] = normalize_amount(options.merge amount: params[:amount_to_sell])
  params[:min_to_receive] = normalize_amount(options.merge amount: params[:min_to_receive])
  
  if !!params[:expiration]
    params[:expiration] = Time.parse(params[:expiration].to_s)
    params[:expiration] = params[:expiration].strftime('%Y-%m-%dT%H:%M:%S')
  end
  
  ops = [[:limit_order_create, params]]
  
  process(options.merge(ops: ops), &block)
end

.limit_order_create2(options, &block) ⇒ Object

This operation creates a limit order and matches it against existing open orders.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :orderid (String)

    • :amount_to_sell (String)

    • :exchange_rate (Hash)

    • :fill_or_kill (Boolean)

    • :expiration (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
# File 'lib/steem/broadcast.rb', line 450

def self.limit_order_create2(options, &block)
  required_fields = %i(owner orderid amount_to_sell exchange_rate
    fill_or_kill)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:amount_to_sell] = normalize_amount(options.merge amount: params[:amount_to_sell])
  params[:exchange_rate] = {
    base: normalize_amount(options.merge amount: params[:exchange_rate][:base]),
    quote: normalize_amount(options.merge amount: params[:exchange_rate][:quote])
  }
  
  if !!params[:expiration]
    params[:expiration] = Time.parse(params[:expiration].to_s)
    params[:expiration] = params[:expiration].strftime('%Y-%m-%dT%H:%M:%S')
  end
  
  ops = [[:limit_order_create2, params]]
  
  process(options.merge(ops: ops), &block)
end

.process(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • Array] (Array<Array<Hash>] :ops Operations to process.)

    :ops Operations to process.

  • :pretend (Boolean)

    Just validate, do not broadcast.



1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
# File 'lib/steem/broadcast.rb', line 1494

def self.process(options, &block)
  ops = options[:ops]
  tx = TransactionBuilder.new(options)
  response = nil
  
  loop do; begin
    tx.operations = ops
    trx = tx.transaction
    
    response = if !!options[:pretend]
      if !!options[:app_base]
        database_api(options).verify_authority(trx: trx)
      else
        database_api(options).verify_authority(trx)
      end
    else
      if !!options[:app_base]
        network_broadcast_api(options).broadcast_transaction(trx: trx)
      else
        network_broadcast_api(options).broadcast_transaction_synchronous(trx)
      end
    end
    
    break
  rescue => e
    if can_retry? e
      tx.expiration = nil
      redo
    end
    
    raise e
  end; end
  
  if !!block
    block.call response.result
  else
    return response.result
  end
end

.recover_account(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :account_to_recover (String)

    • :new_owner_authority (Hash)

    • :recent_owner_authority (Hash)

    • :extensions (Array) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
# File 'lib/steem/broadcast.rb', line 1003

def self.(options, &block)
  required_fields = %i(account_to_recover new_owner_authority recent_owner_authority)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  ops = [[:recover_account, params]]
  
  process(options.merge(ops: ops), &block)
end

.request_account_recovery(options, &block) ⇒ Object

All account recovery requests come from a listed recovery account.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :recovery_account (String)

    • :account_to_recover (String)

    • :new_owner_authority (Hash)

    • :extensions (Array) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



983
984
985
986
987
988
989
990
991
992
# File 'lib/steem/broadcast.rb', line 983

def self.(options, &block)
  required_fields = %i(recovery_account account_to_recover new_owner_authority)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  ops = [[:request_account_recovery, params]]
  
  process(options.merge(ops: ops), &block)
end

.set_withdraw_vesting_route(options, &block) ⇒ Object

Allows an account to setup a vesting withdraw but with the additional request for the funds to be transferred directly to another account’s balance rather than the withdrawing account.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :from_account (String)

    • :to_account (String)

    • :percent (Numeric)

    • :auto_vest (Boolean)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



962
963
964
965
966
967
968
969
970
# File 'lib/steem/broadcast.rb', line 962

def self.set_withdraw_vesting_route(options, &block)
  required_fields = %i(from_account to_account percent auto_vest)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:set_withdraw_vesting_route, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_contribute(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
# File 'lib/steem/broadcast.rb', line 1456

def self.smt_contribute(options, &block)
  required_fields = %i(contributor symbol contribution_id contribution)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:smt_contribute, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_create(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :smt_creation_fee (Hash)

    • :precision (Integer)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
# File 'lib/steem/broadcast.rb', line 1341

def self.smt_create(options, &block)
  required_fields = %i(control_account symbol smt_creation_fee precision)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:smt_creation_fee] = normalize_amount(options.merge amount: params[:smt_creation_fee])
  params[:extensions] ||= []
  
  ops = [[:smt_create, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_set_runtime_parameters(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :runtime_parameters (Array)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
# File 'lib/steem/broadcast.rb', line 1414

def self.smt_set_runtime_parameters(options, &block)
  required_fields = %i(control_account symbol runtime_parameters)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:smt_set_runtime_parameters, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_set_setup_parameters(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :setup_parameters (Array)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
# File 'lib/steem/broadcast.rb', line 1392

def self.smt_set_setup_parameters(options, &block)
  required_fields = %i(control_account symbol setup_parameters)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:smt_set_setup_parameters, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_setup(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :contribution_begin_time (String)

    • :contribution_end_time (String)

    • :launch_time max_supply (String)

    • :steem_units_hard_cap (Integer)

    • :steem_units_soft_cap (Integer)

    • :steem_units_min (Integer)

    • initial_generation_policy (String)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
# File 'lib/steem/broadcast.rb', line 1370

def self.smt_setup(options, &block)
  required_fields = %i(control_account symbol contribution_begin_time contribution_end_time launch_time max_supply steem_units_hard_cap steem_units_soft_cap steem_units_min initial_generation_policy)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:smt_setup, params]]
  
  process(options.merge(ops: ops), &block)
end

.smt_setup_emissions(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :control_account (String)

    • :symbol (Hash)

    • :extensions (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
# File 'lib/steem/broadcast.rb', line 1435

def self.smt_setup_emissions(options, &block)
  required_fields = %i(control_account symbol schedule_time emissions_unit interval_seconds interval_count lep_time rep_time lep_abs_amount rep_abs_amount lep_rel_amount_numerator rep_rel_amount_numerator rel_amount_denom_bits remove floor_emissions)
  params = options[:params]
  
  check_required_fields(params, *required_fields)
  
  params[:extensions] ||= []
  
  ops = [[:smt_setup_emissions, params]]
  
  process(options.merge(ops: ops), &block)
end

.transfer(options, &block) ⇒ Object

Transfers asset from one account to another.

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

Steem::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:



329
330
331
332
333
334
335
336
337
338
339
# File 'lib/steem/broadcast.rb', line 329

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

.transfer_from_savings(options, &block) ⇒ Object

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :request_id (String)

    • :to (String)

    • :amount (String)

    • :memo (String) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
# File 'lib/steem/broadcast.rb', line 1196

def self.transfer_from_savings(options, &block)
  required_fields = %i(from request_id to amount)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:memo] ||= ''
  params[:amount] = normalize_amount(options.merge amount: params[:amount])

  ops = [[:transfer_from_savings, params]]
  
  process(options.merge(ops: ops), &block)
end

.transfer_to_savings(options, &block) ⇒ Object

For time locked savings accounts.

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

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

    • :to (String)

    • :amount (String)

    • :memo (String) (optional)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
# File 'lib/steem/broadcast.rb', line 1173

def self.transfer_to_savings(options, &block)
  required_fields = %i(from to amount)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:memo] ||= ''
  params[:amount] = normalize_amount(options.merge amount: params[:amount])

  ops = [[:transfer_to_savings, params]]
  
  process(options.merge(ops: ops), &block)
end

.transfer_to_vesting(options, &block) ⇒ Object

This operation converts STEEM into VFS (Vesting Fund Shares) at the current exchange rate.

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

Steem::Broadcast.transfer_to_vesting(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)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



365
366
367
368
369
370
371
372
373
374
375
# File 'lib/steem/broadcast.rb', line 365

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

.vote(options, &block) ⇒ Object

This operation is used to cast a vote on a post/comment.

options = {
  wif: wif,
  params: {
    voter: voter,
    author: author,
    permlink: permlink,
    weight: weight
  }
}

Steem::Broadcast.vote(options) do |result|
  puts result
end

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :voter (String)

    • :author (String)

    • :permlink (String)

    • :weight (Number)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



63
64
65
66
67
68
69
70
71
# File 'lib/steem/broadcast.rb', line 63

def self.vote(options, &block)
  required_fields = %i(voter author permlink weight)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:vote, params]]
  
  process(options.merge(ops: ops), &block)
end

.vote2(options, &block) ⇒ Object

This operation is used to cast a vote on a post/comment using multiple votable assets.

options = {
  wif: wif,
  params: {
    voter: voter,
    author: author,
    permlink: permlink,
    TODO
  }
}

Steem::Broadcast.vote2(options) do |result|
  puts result
end

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Posting wif

  • :params (Hash)
    • :voter (String)

    • :author (String)

    • :permlink (String)

    • :rshares (Array)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



98
99
100
101
102
103
104
105
106
# File 'lib/steem/broadcast.rb', line 98

def self.vote2(options, &block)
  required_fields = %i(voter author permlink rshares)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  ops = [[:vote2, params]]
  
  process(options.merge(ops: ops), &block)
end

.withdraw_vesting(options, &block) ⇒ Object

At any given point in time an account can be withdrawing from their vesting shares.

Steem::Broadcast.withdraw_vesting(wif: wif, params: {account: , vesting_shares: vesting_shares}) do |result|
  puts result
end

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :account (String)

    • :vesting_shares (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



391
392
393
394
395
396
397
398
399
400
401
# File 'lib/steem/broadcast.rb', line 391

def self.withdraw_vesting(options, &block)
  required_fields = %i(account vesting_shares)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  params[:vesting_shares] = normalize_amount(options.merge amount: params[:vesting_shares])
  
  ops = [[:withdraw_vesting, params]]
  
  process(options.merge(ops: ops), &block)
end

.witness_set_properties(options, &block) ⇒ Object

Extensible replacement for #witness_update that supports additional properties added since HF20 and beyond.

options = {
  wif: wif,
  params: {
    owner: ,
    props: {
      account_creation_fee: '0.000 STEEM',
      maximum_block_size: 131072,
      sbd_interest_rate: 1000,
      account_subsidy_budget: 50000,
      account_subsidy_decay: 330782,
      sbd_exchange_rate: '1.000 STEEM',
      url: "https://steemit.com",
      new_signing_key: 'STM8LoQjQqJHvotqBo7HjnqmUbFW9oJ2theyqonzUd9DdJ7YYHsvD'
    }
  }
}

Steem::Broadcast.witness_set_properties(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :props (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
# File 'lib/steem/broadcast.rb', line 799

def self.witness_set_properties(options, &block)
  required_fields = %i(owner props)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
  if !!( = params[:props][:account_creation_fee] rescue nil)
    params[:props][:account_creation_fee] = normalize_amount(options.merge amount: , serialize: true)
  end
  
  if !!(sbd_exchange_rate = params[:props][:sbd_exchange_rate] rescue nil)
    params[:props][:sbd_exchange_rate][:base] = normalize_amount(options.merge amount: sbd_exchange_rate[:base], serialize: true)
    params[:props][:sbd_exchange_rate][:quote] = normalize_amount(options.merge amount: sbd_exchange_rate[:quote], serialize: true)
    params[:props][:sbd_exchange_rate] = params[:props][:sbd_exchange_rate].to_json
  end
  
  %i(key new_signing_key).each do |key|
    if !!params[key] && params[key].size == 53
      params[key] = params[key][3..-1]
    end
  end
  
  %i(account_creation_fee sbd_exchange_rate url new_signing_key).each do |key|
    next unless !!params[:props][key]
    
    val = params[:props][key].to_s
      
    params[:props][key] = hexlify val unless val =~ /^[0-9A-F]+$/i
  end
  
  params[:props] = params[:props].to_a
  
  params[:extensions] ||= []
  ops = [[:witness_set_properties, params]]
  
  process(options.merge(ops: ops), &block)
end

.witness_update(options, &block) ⇒ Object

Users who wish to become a witness must pay a fee acceptable to the current witnesses to apply for the position and allow voting to begin.

options = {
  wif: wif,
  params: {
    owner: ,
    url: '',
    block_signing_key: 'STM8ZSyzjPm48GmUuMSRufkVYkwYbZzbxeMysAVp7KFQwbTf98TcG',
    props: {
      account_creation_fee: '0.000 STEEM',
      maximum_block_size: 131072,
      sbd_interest_rate:1000
    },
    fee: '0.000 STEEM',
  }
}

Steem::Broadcast.witness_update(options)

Parameters:

  • options (Hash)

    options

Options Hash (options):

  • :wif (String)

    Active wif

  • :params (Hash)
    • :owner (String)

    • :url (String) (optional)

    • :block_signing_key (String)

    • :props (String)

    • :fee (String)

  • :pretend (Boolean)

    Just validate, do not broadcast.

See Also:



755
756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/steem/broadcast.rb', line 755

def self.witness_update(options, &block)
  required_fields = %i(owner block_signing_key props fee)
  params = options[:params]
  check_required_fields(params, *required_fields)
  
   = params[:props][:account_creation_fee] rescue nil
  params[:props][:account_creation_fee] = normalize_amount(options.merge amount: )
  params[:fee] = normalize_amount(options.merge amount: params[:fee])
  
  ops = [[:witness_update, params]]
  
  process(options.merge(ops: ops), &block)
end