14 lines
		
	
	
		
			370 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			370 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
class Api::KreditsController < Api::BaseController
 | 
						|
 | 
						|
  def onchain_btc_balance
 | 
						|
    btcpay = BtcPay.new
 | 
						|
    balance = btcpay.onchain_wallet_balance
 | 
						|
    render json: balance
 | 
						|
  rescue => error
 | 
						|
    Rails.logger.warn "Failed to fetch kredits BTC wallet balance: #{error.message}"
 | 
						|
    render json: { error: 'Failed to fetch wallet balance' },
 | 
						|
           status: 500
 | 
						|
  end
 | 
						|
 | 
						|
end
 |