Module: VoilkRuby::Mixins::ActsAsWallet

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

Instance Method Summary collapse

Instance Method Details

#claim_reward_balance(options) ⇒ Object

Create a claim_reward_balance operation.

Examples:

voilk = VoilkRuby::Chain.new(chain: :voilk, account_name: 'your account name', wif: 'your wif')
voilk.claim_reward_balance(reward_vsd: '100.000 VSD')
voilk.broadcast!

Parameters:

  • options (::Hash)

    options

Options Hash (options):

  • :reward_voilk (String)

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

  • :reward_vsd (String)

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

  • :reward_coins (String)

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



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

def claim_reward_balance(options)
  reward_voilk = options[:reward_voilk] || '0.000 VOILK'
  reward_vsd = options[:reward_vsd] || '0.000 VSD'
  reward_coins = options[:reward_coins] || '0.000000 COINS'
  
  @operations << {
    type: :claim_reward_balance,
    account: ,
    reward_voilk: reward_voilk,
    reward_vsd: reward_vsd,
    reward_coins: reward_coins
  }
  
  self
end

#claim_reward_balance!(permlink) ⇒ Object

Create a claim_reward_balance operation and broadcasts it right away.

Examples:

voilk = VoilkRuby::Chain.new(chain: :voilk, account_name: 'your account name', wif: 'your wif')
voilk.claim_reward_balance!(reward_vsd: '100.000 VSD')


40
# File 'lib/voilkruby/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.

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

Parameters:

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

    options

Options Hash (options):

  • :amount (String)

    The amount to transfer, like: ‘100.000 VOILK`

  • :to (String)

    The account receiving the transfer.

  • :memo (String) — default: ''

    The memo for the transfer.



52
53
54
55
56
# File 'lib/voilkruby/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.

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

See Also:



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

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