Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

feat/pool-offline-status

  • Loading branch information...
Stoyvo committed Apr 10, 2015
1 parent 4b73bc4 commit 60c03013db04b3d7cbffd1015e21d52dc1c4bf07
@@ -1389,6 +1389,9 @@ a#dash-add-panel.flash {
text-align: center;
clear: both;
}
.panel-offline .panel-body {
padding: 0px;
}

.full-content .panel-body {
font-size: 18px;
@@ -57,6 +57,11 @@ public function update() {
$poolData[$action] = $poolData[$action]['data'];
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -43,6 +43,11 @@ public function update() {
}
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -22,6 +22,12 @@ public function update() {
$poolData['global'] = curlCall($this->_apiURL . '/api/pool/stats');
$poolData['user'] = curlCall($this->_apiURL . '/api/users/'.$this->_userId.'?key='. $this->_apiKey);
// Offline Check
if (empty($poolData['global']) || empty($poolData['user'])) {
return;
}
// Payout Information
$data['type'] = $this->_type;
@@ -20,6 +20,11 @@ public function update() {
$poolData = curlCall($this->_apiURL . '/api.php?api_key='. $this->_apiKey);
// Offline Check
if (empty($poolData)) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -20,6 +20,11 @@ public function update() {
$poolData = array();
$poolData = curlCall($this->_apiURL . '?accountId='.$this->_userId);
// Offline Check
if (empty($poolData)) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -23,6 +23,11 @@ public function update() {
$poolData['user'] = curlCall($this->_apiURL . '/index.php?k=api&json=y&username='.$this->_userId.'&api='.$this->_apiKey);
$poolData['workers'] = curlCall($this->_apiURL . '/index.php?k=api&json=y&work=y&username='.$this->_userId.'&api='.$this->_apiKey);
// Offline Check
if (empty($poolData['user']) || empty($poolData['workers'])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -8,13 +8,13 @@ class Pools_Eclipse extends Pools_Abstract {
// Pool Information
protected $_apiKey;
protected $_type = 'eclipse';
// api calls to make
protected $_actions = array(
'poolstats',
'userstats',
);
public function __construct($params) {
parent::__construct(array('apiurl' => 'https://eclipsemc.com'));
// https://eclipsemc.com
@@ -28,18 +28,23 @@ public function update() {
foreach ($this->_actions as $action) {
$poolData[$action] = curlCall($this->_apiURL . '/api.php?key='.$this->_apiKey.'&action='. $action);
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
$data['total_sent'] = $poolData['userstats']['data']['user']['total_payout'];
$data['balance'] = $poolData['userstats']['data']['user']['confirmed_rewards'];
$data['unconfirmed_balance'] = $poolData['userstats']['data']['user']['unconfirmed_rewards'];
$data['estimated_rewards'] = $poolData['userstats']['data']['user']['estimated_rewards'];
$data['pool_hashrate'] = $poolData['poolstats']['hashrate'];
$data['user_hashrate'] = 0;
$speedMultiplier = array(
'GH/s' => 1000,
@@ -52,21 +57,21 @@ public function update() {
$data['user_hashrate'] += $hashrate * $speedMultiplier[$hashspeed];
}
}
$data['user_hashrate'] = formatHashRate($data['user_hashrate']*1000);
$data['pool_workers'] = $poolData['poolstats']['active_workers'];
// how to get active user workers and total hashrate?
$data['time_since_last_block'] = $poolData['poolstats']['round_duration']; // Would love to format this one day
// $data['time_since_last_block'] = formatTimeElapsed(); // how to format? 00:52:44
$data['url'] = $this->_apiURL;
$this->_fileHandler->write(json_encode($data));
return $data;
}
return json_decode($this->_fileHandler->read(), true);
}
@@ -42,6 +42,11 @@ public function update() {
$poolData[$action] = curlCall($this->_apiURL . '/api.php?cmd='.$actionParam);
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -8,7 +8,7 @@ class Pools_MagicPool extends Pools_Abstract {
// Pool Information
protected $_btcaddess;
protected $_type = 'magicpool';
public function __construct($params) {
parent::__construct(array('apiurl' => 'https://magicpool.org'));
$this->_btcaddess = $params['address'];
@@ -19,25 +19,30 @@ public function update() {
if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) { // updates every 30 seconds
$poolData['pool'] = curlCall($this->_apiURL . '/api.php');
$poolData['user'] = curlCall($this->_apiURL . '/api.php?user='.$this->_btcaddess);
// Offline Check
if (empty($poolData['pool']) || empty($poolData['user'])) {
return;
}
// Data Order
$data['type'] = $this->_type;
$data['total_paid'] = number_format($poolData['user']['totalPaid'], 8);
$data['balance'] = number_format($poolData['user']['pending'], 8);
$data['profitability_(BTC/MHs/day)'] = number_format($poolData['user']['lastProf'], 8);
$data['pool_hashrate'] = formatHashrate($poolData['pool']['poolhashrate']*1000);
$data['user_hashrate'] = formatHashrate($poolData['user']['hashrate']*1000);
$data['url'] = $this->_apiURL;
$this->_fileHandler->write(json_encode($data));
return $data;
}
return json_decode($this->_fileHandler->read(), true);
}
@@ -43,6 +43,11 @@ public function update() {
}
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -20,9 +20,15 @@ public function update() {
if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 30) { // updates every 30 seconds
$poolData = curlCall($this->_apiURL . '?api_key='. $this->_apiKey);
// Offline Check
if (empty($poolData)) {
return;
}
// Payout Information
$data['type'] = $this->_type;
$poolHashrate = 0;
$userHashrate = 0;
foreach ($poolData['currency'] as $coin => $values) {
@@ -41,10 +47,10 @@ public function update() {
}
$poolHashrate += $values['pool_hashrate'];
}
$data['pool_hashrate'] = $poolHashrate;
$data['user_hashrate'] = $userHashrate;
$userWorkers = array();
foreach ($poolData['workers'] as $coin => $workers) {
foreach ($workers as $name => $worker) {
@@ -56,20 +62,20 @@ public function update() {
}
}
}
foreach ($userWorkers as $name => $worker) {
$name = explode('.', $name);
$data['worker_'.$name[1]] = formatHashrate($worker);
}
$data['pool_hashrate'] = formatHashrate($data['pool_hashrate']);
$data['user_hashrate'] = formatHashrate($data['user_hashrate']);
$data['url_name'] = 'https://multipool.us';
$data['url'] = 'https://multipool.us/';
$this->_fileHandler->write(json_encode($data));
return $data;
}
@@ -59,6 +59,12 @@ public function update() {
$poolData['user'] = curlCall($this->_apiURL . '/api?method=stats.provider&addr='. $this->_btcaddess);
$poolData['global'] = curlCall($this->_apiURL . '/api?method=stats.global.current');
// Offline Check
if (empty($poolData['user']) || empty($poolData['global'])) {
return;
}
$algoNetSpeed = array();
foreach ($poolData['global']['result']['stats'] as $values) {
$algoNetSpeed[$values['algo']] = $values['speed'];
@@ -22,6 +22,12 @@ public function update() {
$poolData = array();
$poolData = curlCall($this->_apiURL . '/api/stats');
// Offline Check
if (empty($poolData)) {
return;
}
if (empty($this->_coin)) {
$this->findCoin($poolData);
}
@@ -29,6 +29,11 @@ public function update() {
foreach ($this->_actions as $action) {
$poolData[$action] = curlCall($this->_apiURL . '/' . $action);
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
@@ -8,12 +8,12 @@ class Pools_Simplecoin extends Pools_Abstract {
// Pool Information
protected $_apiKey;
protected $_type = 'simplecoin';
// api calls to make
protected $_actions = array(
'pool_stats',
);
public function __construct($params) {
parent::__construct($params);
$this->_apiKey = $params['apikey'];
@@ -27,20 +27,25 @@ public function update() {
foreach ($this->_actions as $action) {
$poolData[$action] = curlCall($this->_apiURL . '/api/'. $action);
}
// Offline Check
if (empty($poolData[$this->_actions[0]])) {
return;
}
// Data Order
$data['type'] = $this->_type;
$data['total_paid'] = (!empty($poolData[$this->_apiKey]['total_paid']) ? $poolData[$this->_apiKey]['total_paid']/100000000 : 0);
$data['balance'] = (!empty($poolData[$this->_apiKey]['balance']) ? $poolData[$this->_apiKey]['balance']/100000000 : 0);
$data['unconfirmed_balance'] = (!empty($poolData[$this->_apiKey]['unconfirmed_balance']) ? $poolData[$this->_apiKey]['unconfirmed_balance']/100000000 : 0);
$data['estimated_round_payout'] = (!empty($poolData[$this->_apiKey]['est_round_payout']) ? number_format($poolData[$this->_apiKey]['est_round_payout'], 8) : 0);
$data['pool_hashrate'] = formatHashrate($poolData['pool_stats']['hashrate']);
$data['user_hashrate'] = formatHashrate($poolData[$this->_apiKey]['last_10_hashrate'] * 1000);
$data['pool_workers'] = $poolData['pool_stats']['workers'];
$data['accepted'] = 0;
@@ -61,18 +66,18 @@ public function update() {
$data['efficiency'] = 0.00;
}
$data['efficiency'] .= '%';
$data['time_since_last_block'] = gmdate('H\H i\M s\S', $poolData['pool_stats']['round_duration']);
$data['last_block_found'] = $poolData['pool_stats']['last_block_found'];
$data['url'] = $this->_apiURL;
$this->_fileHandler->write(json_encode($data));
return $data;
}
return json_decode($this->_fileHandler->read(), true);
}

0 comments on commit 60c0301

Please sign in to comment.
You can’t perform that action at this time.