private static function LTC_MinAndMaxWallets() { $wallets = WalletsLtc::getAllWallets(); if (empty($wallets)) { return null; } $maxBalance = null; $keyMax = null; $minBalance = null; $keyMin = null; $litecoin = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ":" . LTC_RPC_PORT . '/'); foreach ($wallets as $key => $value) { try { $balance = $litecoin->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 ltc() { $wallets = WalletsLtc::getAllWallets(); $litecoin = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ':' . LTC_RPC_PORT . '/'); foreach ($wallets as $key => $value) { try { $balance = $litecoin->getbalance($value['account']); } catch (Exception $e) { $balance = "currently unavailable"; } $wallets[$key]['current_balance'] = $balance; } Core::runView('ViewTemplate/account', array('pageName' => 'LTC wallets', 'activeMenu' => 'LTC wallets', 'pagePath' => 'Administration/admin_ltc', 'user' => self::$user, 'wallets' => $wallets)); }