Module: Raiblocks::AccountsProxyHelper

Included in:
Accounts
Defined in:
lib/raiblocks/helpers/accounts_proxy_helper.rb

Instance Method Summary collapse

Instance Method Details

#<<(val) ⇒ Object



27
28
29
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 27

def <<(val)
  @addresses << val
end

#[](idx) ⇒ Object

Array-like access for Raiblocks::Account



21
22
23
24
25
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 21

def [](idx)
  return unless @addresses[idx]
  @account_objects ||= []
  @account_objects[idx] ||= Raiblocks::.new(@addresses[idx])
end

#balancesObject



7
8
9
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 7

def balances
  accounts_balances.balances
end

#create(wallet:, count:, work: nil) ⇒ Object



11
12
13
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 11

def create(wallet:, count:, work: nil)
  accounts_create(wallet: wallet, count: count, work: work).accounts
end

#each(&_block) ⇒ Object



31
32
33
34
35
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 31

def each(&_block)
  @addresses.each do |address|
    yield Raiblocks::.new(address)
  end
end

#firstObject



37
38
39
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 37

def first
  self[0]
end

#frontiersObject



3
4
5
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 3

def frontiers
  accounts_frontiers.frontiers
end

#pending(count:, threshold: nil, source: nil) ⇒ Object Also known as: pending_blocks



15
16
17
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 15

def pending(count:, threshold: nil, source: nil)
  accounts_pending(count: count, threshold: threshold, source: source).blocks
end

#secondObject



41
42
43
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 41

def second
  self[1]
end

#thirdObject



45
46
47
# File 'lib/raiblocks/helpers/accounts_proxy_helper.rb', line 45

def third
  self[2]
end