Sha256: 700235b1bd16cdef1e3f9d04c78cc24c7273644b2adf49eb3b912d2a36e43a36

Contents?: true

Size: 1.34 KB

Versions: 1

Compression:

Stored size: 1.34 KB

Contents

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

  def balance
    account_balance.balance
  end

  def block_count
    account_block_count.block_count
  end

  def history(opts)
    account_history(
      count: opts_pluck(opts, :count)
    ).history
  end

  def info
    account_info
  end

  def key
    account_key['key']
  end

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

  def wallet_work_set(wallet:, work:)
    work_set(
      wallet: wallet_seed(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(opts)
    account_remove(
      wallet: wallet_seed(opts_pluck(opts, :wallet))
    ).removed == 1
  end

  def representative
    account_representative.representative
  end

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

  def weight
    account_weight.weight
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nano_rpc-0.3.0 lib/nano_rpc/helpers/account_proxy_helper.rb