Module: Radiator::Mixins::ActsAsWallet

Included in:
Chain
Defined in:
lib/radiator/mixins/acts_as_wallet.rb

Instance Method Summary collapse

Instance Method Details

#claim_reward_balance(options) ⇒ Object

Create a claim_reward_balance operation.

Examples:

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.claim_reward_balance(reward_sbd: '100.000 SBD')
steem.broadcast!

Parameters:

  • options (::Hash)

    options

Options Hash (options):

  • :reward_steem (String)

    The amount of STEEM to claim, like: ‘100.000 STEEM`

  • :reward_sbd (String)

    The amount of SBD to claim, like: ‘100.000 SBD`

  • :reward_vests (String)

    The amount of VESTS to claim, like: ‘100.000000 VESTS`



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/radiator/mixins/acts_as_wallet.rb', line 16

def claim_reward_balance(options)
  reward_steem = options[:reward_steem] || '0.000 STEEM'
  reward_sbd = options[:reward_sbd] || '0.000 SBD'
  reward_vests = options[:reward_vests] || '0.000000 VESTS'
  
  @operations << {
    type: :claim_reward_balance,
    account: ,
    reward_steem: reward_steem,
    reward_sbd: reward_sbd,
    reward_vests: reward_vests
  }
  
  self
end

#claim_reward_balance!(permlink) ⇒ Object

Create a claim_reward_balance operation and broadcasts it right away.

Examples:

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.claim_reward_balance!(reward_sbd: '100.000 SBD')


40
# File 'lib/radiator/mixins/acts_as_wallet.rb', line 40

def claim_reward_balance!(permlink); claim_reward_balance(permlink).broadcast!(true); end

#transfer(options = {}) ⇒ Object

Create a transfer operation.

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your active wif')
steem.transfer(amount: '1.000 SBD', to: 'account name', memo: 'this is a memo')
steem.broadcast!

Parameters:

  • options (::Hash) (defaults to: {})

    options

Options Hash (options):

  • :amount (String)

    The amount to transfer, like: ‘100.000 STEEM`

  • :to (String)

    The account receiving the transfer.

  • :memo (String) — default: ''

    The memo for the transfer.



52
53
54
55
56
# File 'lib/radiator/mixins/acts_as_wallet.rb', line 52

def transfer(options = {})
  @operations << options.merge(type: :transfer, from: )
  
  self
end

#transfer!(options = {}) ⇒ Object

Create a transfer operation and broadcasts it right away.

steem = Radiator::Chain.new(chain: :steem, account_name: 'your account name', wif: 'your wif')
steem.transfer!(amount: '1.000 SBD', to: 'account name', memo: 'this is a memo')

See Also:



64
# File 'lib/radiator/mixins/acts_as_wallet.rb', line 64

def transfer!(options = {}); transfer(options).broadcast!(true); end