Sha256: 7688da4d4728b83deee9a699e5b38427536d0906517769197ce00eeb47695a79

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true
module Nano::AccountHelper
  include Nano::ApplicationHelper

  def balance
    account_balance.balance
  end

  def block_count
    account_block_count.block_count
  end

  def history(count:)
    account_history(count: count).history
  end

  def info
    account_info
  end

  def key
    account_key['key']
  end

  def move(from:, to:)
    account_move(
      source: from,
      wallet: to,
      accounts: [address]
    ).moved == 1
  end

  def wallet_work_set(wallet:, work:)
    work_set(wallet: wallet, work: work).success == ''
  end

  def pending_balance
    account_balance.pending
  end
  alias balance_pending pending_balance

  def pending_blocks(count:, threshold: nil, source: nil)
    pending(
      count: count,
      threshold: threshold,
      source: source
    ).blocks
  end
  alias blocks_pending pending_blocks

  def remove(wallet:)
    account_remove(wallet: wallet).removed == 1
  end

  def representative
    account_representative.representative
  end

  def representative_set(wallet:, representative:)
    account_representative_set(
      wallet: wallet,
      representative: representative
    ).set == 1
  end

  def weight
    account_weight.weight
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nano_rpc-0.9.0 lib/nano_rpc/helpers/account_helper.rb
nano_rpc-0.8.0 lib/nano_rpc/helpers/account_helper.rb
nano_rpc-0.7.0 lib/nano_rpc/helpers/account_helper.rb
nano_rpc-0.6.0 lib/nano_rpc/helpers/account_helper.rb
nano_rpc-0.5.0 lib/nano_rpc/helpers/account_helper.rb