Sha256: c42d78a936aa40e1b44636003e0cfaf340d9d0330f5d4cb0359313e71d3135c6
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
# frozen_string_literal: true module Nano::AccountsProxyHelper include Nano::ApplicationHelper def balances accounts_balances .balances .each_with_object({}) do |(k, v), hash| hash[k] = v['balance'] end end def pending_balances accounts_balances .balances .each_with_object({}) do |(k, v), hash| hash[k] = v['pending'] end end alias balances_pending pending_balances def frontiers accounts_frontiers.frontiers end def move(from:, to:) account_move( source: wallet_seed(from), wallet: wallet_seed(to) ).moved == 1 end def pending(count:, threshold: nil, source: nil) accounts_pending( count: count, threshold: threshold, source: source ).blocks end alias pending_blocks pending # Array-like access for Nano::Account def [](idx) return unless @addresses[idx] @account_objects ||= [] @account_objects[idx] ||= Nano::Account.new(@addresses[idx]) end def <<(val) @addresses << val end def each(&_block) @addresses.each do |address| yield Nano::Account.new(address) end end def first self[0] end def second self[1] end def third self[2] end def last self[-1] end def size addresses.size end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nano_rpc-0.3.0 | lib/nano_rpc/helpers/accounts_proxy_helper.rb |