private static function BTC_MinAndMaxWallets()
 {
     $wallets = WalletsBtc::getAllWallets();
     if (empty($wallets)) {
         return null;
     }
     $maxBalance = null;
     $keyMax = null;
     $minBalance = null;
     $keyMin = null;
     $bitcoin = new jsonRPCClient('http://' . BTC_RPC_USER . ':' . BTC_RPC_PASSWORD . '@' . BTC_RPC_HOST . ":" . BTC_RPC_PORT . '/');
     foreach ($wallets as $key => $value) {
         try {
             $balance = $bitcoin->getbalance($value['account']);
         } catch (Exception $e) {
             $balance = null;
         }
         if ($balance !== null) {
             $wallets[$key]['current_balance'] = $balance;
             if ($minBalance === null || $minBalance > $balance) {
                 $minBalance = $balance;
                 $keyMin = $key;
             }
             if ($maxBalance === null || $maxBalance < $balance) {
                 $maxBalance = $balance;
                 $keyMax = $key;
             }
         }
     }
     $result['min'] = $wallets[$keyMin];
     $result['max'] = $wallets[$keyMax];
     return $result;
 }
 public static function btc()
 {
     $wallets = WalletsBtc::getAllWallets();
     $bitcoin = new jsonRPCClient('http://' . BTC_RPC_USER . ':' . BTC_RPC_PASSWORD . '@' . BTC_RPC_HOST . ':' . BTC_RPC_PORT . '/');
     foreach ($wallets as $key => $value) {
         try {
             $balance = $bitcoin->getbalance($value['account']);
         } catch (Exception $e) {
             $balance = "currently unavailable";
         }
         $wallets[$key]['current_balance'] = $balance;
     }
     Core::runView('ViewTemplate/account', array('pageName' => 'BTC wallets', 'activeMenu' => 'BTC wallets', 'pagePath' => 'Administration/admin_btc', 'user' => self::$user, 'wallets' => $wallets));
 }