<commit_before>class Api::AccountController < ActionController::Base

  before_filter :build_account

  def index
    render json: @account
  end

  def withdraw
    ap params
    amount = params[:withdrawAmount].to_f.to_satoshi
    to_address = params[:toAddress]

    result = @user.withdraw(amount, to_address)

    @account[:balance] = (@account[:balance] - (amount/SATOSHIS.to_f)).round(6)
    @account[:messages][:withdraw] = {
      default: false,
      success: true,
      error: false
    }

    render json: @account
  end

  protected<commit_msg>fixed balance withdraw error<commit_after>class Api::AccountController < ActionController::Base

  before_filter :build_account

  def index
    render json: @account
  end

  def withdraw
    ap params
    amount = params[:withdrawAmount].to_f.to_satoshi
    to_address = params[:toAddress]

    result = @user.withdraw(amount, to_address)

    @account[:balance] = (@account[:balance] - ((amount + FEE) / SATOSHIS.to_f)).round(8)
    @account[:messages][:withdraw] = {
      default: false,
      success: true,
      error: false
    }

    render json: @account
  end

  protected
{'fraction_non_alphanumeric': 0.11286089238845144, 'fraction_numerical': 0.0017497812773403325, 'mean_word_length': 3.434108527131783, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5204422', 'n_tokens_mistral': 366, 'n_tokens_neox': 350, 'n_words': 78}