module NanoRpc::AccountsHelper

Public Instance Methods

<<(val) click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 46
def <<(val)
  @to_a = nil
  @addresses << val
end
[](idx) click to toggle source

Array-like access for NanoRpc::Account

# File lib/nano_rpc/helpers/accounts_helper.rb, line 41
def [](idx)
  return unless addresses[idx]
  to_a[idx]
end
balances() click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 5
def balances
  accounts_balances
    .balances
    .each_with_object({}) do |(k, v), hash|
    hash[k] = v['balance']
  end
end
balances_pending()
Alias for: pending_balances
each() { |account| ... } click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 51
def each(&_block)
  to_a.each { |account| yield account }
end
frontiers() click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 22
def frontiers
  accounts_frontiers.frontiers
end
move(from:, to:) click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 26
def move(from:, to:)
  account_move(source: from, wallet: to).moved == 1
end
pending(count:, threshold: nil, source: nil, include_active: nil) click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 30
def pending(count:, threshold: nil, source: nil, include_active: nil)
  accounts_pending(
    count: count,
    threshold: threshold,
    source: source,
    include_active: include_active
  ).blocks
end
Also aliased as: pending_blocks
pending_balances() click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 13
def pending_balances
  accounts_balances
    .balances
    .each_with_object({}) do |(k, v), hash|
    hash[k] = v['pending']
  end
end
Also aliased as: balances_pending
pending_blocks(count:, threshold: nil, source: nil, include_active: nil)
Alias for: pending
to_a() click to toggle source
# File lib/nano_rpc/helpers/accounts_helper.rb, line 55
def to_a
  @to_a ||=
    addresses.map do |address|
      NanoRpc::Account.new(address, node: node)
    end
end