<?php

namespace App\Http\Controllers;

use App\Models\Money_model_withdraw;
use Coinremitter\Coinremitter;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class CoinremitterController extends Controller
{
    //
    public function getBalance(){
    
        $tcn_wallet = new Coinremitter('TCN');
        $balanceResponse = $tcn_wallet->get_balance();
     
        $param = [
            'address'=>'na9fzz9QCK1J19UKTemZjgo1Hu7EUT6ebh'
        ];
        
       return $validate = $tcn_wallet->validate_address($param);
        if($balanceResponse['flag'] == 1){
         
         $response = [
             'balance'=>$balanceResponse['data']['balance'],
             'coin_name'=>$balanceResponse['data']['coin_name'],
         ];
         return response()->json(['success'=>$response]);
     
         
        }else{
         $error = $balanceResponse['msg'];
         return response()->json(['error'=>$error]);
        }
     
     
     }
     function testing(){
        return view('user.test');
     }
     function testing_withdraw(){
        return view('user.testing_withdraw');
     }
     function list_of_with(){
      $money = Money_model_withdraw::where('user_id',Auth::guard('user_login')->user()->id)->get();
        return view('user.list_of_with',[
         'money'=>$money,
        ]);
     }
     function n_type(){
      return view('user.n_tymes');
     }
}
