Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion accounts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"beeeeer": "\\Account\\MiningPool\\Beeeeer",
"bitminter": "\\Account\\MiningPool\\BitMinter",
"btcguild": "\\Account\\MiningPool\\BTCGuild",
"clevermining": "\\Account\\MiningPool\\CleverMining",
"coinhuntr": "\\Account\\MiningPool\\CoinHuntr",
"cryptopools_dgc": "\\Account\\MiningPool\\CryptoPoolsDGC",
"cryptotroll_doge": "\\Account\\MiningPool\\CryptoTrollDOGE",
Expand All @@ -28,9 +29,11 @@
"liteguardian": "\\Account\\MiningPool\\LiteGuardian",
"litepooleu": "\\Account\\MiningPool\\LitepoolEu",
"ltcmineru": "\\Account\\MiningPool\\LTCMineRu",
"ltcrabbit": "\\Account\\MiningPool\\LTCRabbit",
"miningforeman": "\\Account\\MiningPool\\MiningForemanLTC",
"miningforeman_ftc": "\\Account\\MiningPool\\MiningForemanFTC",
"miningpoolco": "\\Account\\MiningPool\\MiningPoolCo",
"miningpoolhub": "\\Account\\MiningPool\\MiningPoolHub",
"multipool": "\\Account\\MiningPool\\Multipool",
"mupool": "\\Account\\MiningPool\\MuPool",
"nicehash": "\\Account\\MiningPool\\NiceHash",
Expand All @@ -50,5 +53,6 @@
"teamdoge": "\\Account\\MiningPool\\TeamDoge",
"triplemining": "\\Account\\MiningPool\\TripleMining",
"westhash": "\\Account\\MiningPool\\WestHash",
"ypool": "\\Account\\MiningPool\\YPool"
"ypool": "\\Account\\MiningPool\\YPool",
"zpool": "\\Account\\MiningPool\\ZPool"
}
77 changes: 77 additions & 0 deletions src/CleverMining.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace Account\MiningPool;

use \Monolog\Logger;
use \Account\Account;
use \Account\Miner;
use \Account\DisabledAccount;
use \Account\SimpleAccountType;
use \Account\AccountFetchException;
use \Apis\FetchException;
use \Apis\FetchHttpException;
use \Apis\Fetch;
use \Openclerk\Currencies\CurrencyFactory;

/**
* Represents the clevermining.com mining pool.
*/
class CleverMining extends AbstractMiner {

public function getName() {
return "clevermining.com";
}

public function getCode() {
return "clevermining";
}

public function getURL() {
return "http://clevermining.com/";
}

public function getFields() {
return array(
'api_key' => array(
'title' => "API key",
'regexp' => "#^.{20}$#"
),
);
}

public function fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger) {
// there is no API call to list supported currencies
return array('btc');
}

public function fetchSupportedHashrateCurrencies(CurrencyFactory $factory, Logger $logger) {
return array();
}

public function fetchBalances($account, CurrencyFactory $factory, Logger $logger) {

$result = array();

foreach ($this->fetchSupportedCurrencies($factory, $logger) as $cur) {
$abbr = strtoupper($cur);
$instance = $factory->loadCurrency($cur);
if ($instance != null) {
$abbr = $instance->getAbbr();
}

$url = "https://www.clevermining.com/api/v1/users/" . urlencode($account['api_key']);
$json = $this->fetchJSON($url, $logger);

switch ($cur) {
case "btc":
$result[$cur] = array(
'confirmed' => $json['general']['balance'],
);
}
}

return $result;

}

}
77 changes: 77 additions & 0 deletions src/LTCRabbit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace Account\MiningPool;

use \Monolog\Logger;
use \Account\Account;
use \Account\Miner;
use \Account\DisabledAccount;
use \Account\SimpleAccountType;
use \Account\AccountFetchException;
use \Apis\FetchException;
use \Apis\FetchHttpException;
use \Apis\Fetch;
use \Openclerk\Currencies\CurrencyFactory;

/**
* Represents the ltcrabbit.com mining pool.
*/
class LTCRabbit extends AbstractMiner {

public function getName() {
return "ltcrabbit.com";
}

public function getCode() {
return "ltcrabbit";
}

public function getURL() {
return "http://ltcrabbit.com/";
}

public function getFields() {
return array(
'api_key' => array(
'title' => "API key",
'regexp' => "#^.{20}$#"
),
);
}

public function fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger) {
// there is no API call to list supported currencies
return array('ltc');
}

public function fetchSupportedHashrateCurrencies(CurrencyFactory $factory, Logger $logger) {
return array();
}

public function fetchBalances($account, CurrencyFactory $factory, Logger $logger) {

$result = array();

foreach ($this->fetchSupportedCurrencies($factory, $logger) as $cur) {
$abbr = strtoupper($cur);
$instance = $factory->loadCurrency($cur);
if ($instance != null) {
$abbr = $instance->getAbbr();
}

$url = "https://www.ltcrabbit.com/index.php?page=api&action=getappdata&appname=openclerk&appversion=1&api_key=" . urlencode($account['api_key']);
$json = $this->fetchJSON($url, $logger);

switch ($cur) {
case "ltc":
$result[$cur] = array(
'confirmed' => $json['getappdata']['user']['balance'],
);
}
}

return $result;

}

}
82 changes: 82 additions & 0 deletions src/MiningPoolHub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?php

namespace Account\MiningPool;

use \Monolog\Logger;
use \Account\Account;
use \Account\Miner;
use \Account\DisabledAccount;
use \Account\SimpleAccountType;
use \Account\AccountFetchException;
use \Apis\FetchException;
use \Apis\FetchHttpException;
use \Apis\Fetch;
use \Openclerk\Currencies\CurrencyFactory;

/**
* Represents the miningpoolhub.com mining pool.
*/
class MiningPoolHub extends AbstractMiner {

public function getName() {
return "miningpoolhub.com";
}

public function getCode() {
return "miningpoolhub";
}

public function getURL() {
return "http://miningpoolhub.com/";
}

public function getFields() {
return array(
'api_id' => array(
'title' => "API ID",
'regexp' => "#^[0-9]+$#",
),
'api_key' => array(
'title' => "API key",
'regexp' => "#^.{20}$#"
),
);
}

public function fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger) {
// there is no API call to list supported currencies
return array('btc'); // all converted to BTC
}

public function fetchSupportedHashrateCurrencies(CurrencyFactory $factory, Logger $logger) {
return array();
}

public function fetchBalances($account, CurrencyFactory $factory, Logger $logger) {

$confirmed = 0;
$pending = 0;
$unconfirmed = 0;

foreach (json_decode(@file_get_contents("http://miningpoolhub.com/index.php?page=api&action=getminingandprofitsstatistics"))->{'return'} as $coin) {
$url = "http://" . $coin->{'coin_name'} . ".miningpoolhub.com/index.php?page=api&action=getdashboarddata&api_key=" . urlencode($account['api_key']) . "&id=" . urlencode($account['api_id']);
$json = @file_get_contents($url);
$data = json_decode($json)->{'getdashboarddata'}->{'data'};
$confirmed += ((float)$data->{'balance'}->{'confirmed'} + (float)$data->{'balance_for_auto_exchange'}->{'confirmed'}) * (float)$coin->{'highest_buy_price'};
$pending += (float)$data->{'balance_on_exchange'} * (float)$coin->{'highest_buy_price'};
$unconfirmed += ((float)$data->{'balance'}->{'unconfirmed'} + (float)$data->{'balance_for_auto_exchange'}->{'unconfirmed'}) * (float)$coin->{'highest_buy_price'};
}

return array(
'btc' => array(
'confirmed' => $confirmed,
'pending' => $pending,
'unconfirmed' => $unconfirmed,
),
);

$result = array();

}

}
10 changes: 10 additions & 0 deletions src/NiceHash.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,20 @@ public function fetchBalances($account, CurrencyFactory $factory, Logger $logger
throw new AccountFetchException($json['result']['error']);
}

$unconfirmed = 0;
foreach (json_decode(@file_get_contents("https://www.nicehash.com/api?method=buy.info"))->{'result'}->{'algorithms'} as $algo) {
for ($location = 0; $location <= 1; $location++) {
foreach (json_decode(@file_get_contents("https://www.nicehash.com/api?method=orders.get&my&id=" . urlencode($account['api_id']) . "&key=" . urlencode($account['api_key']) . "&location=" . $location . "&algo=" . $algo->{'algo'}))->{'result'}->{'orders'} as $order) {
$unconfirmed += $order->{'btc_avail'};
}
}
}

return array(
'btc' => array(
'confirmed' => $json['result']['balance_confirmed'],
'pending' => $json['result']['balance_pending'],
'unconfirmed' => $unconfirmed,
),
);

Expand Down
75 changes: 75 additions & 0 deletions src/ZPool.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace Account\MiningPool;

use \Monolog\Logger;
use \Account\Account;
use \Account\Miner;
use \Account\DisabledAccount;
use \Account\SimpleAccountType;
use \Account\AccountFetchException;
use \Apis\FetchException;
use \Apis\FetchHttpException;
use \Apis\Fetch;
use \Openclerk\Currencies\CurrencyFactory;

/**
* Represents the zpool.ca mining pool.
*/
class ZPool extends AbstractMiner {

public function getName() {
return "zpool.ca";
}

public function getCode() {
return "zpool";
}

public function getURL() {
return "http://zpool.ca/";
}

public function getFields() {
return array(
'api_key' => array(
'title' => "API key",
'regexp' => "#^.{20}$#"
),
);
}

public function fetchSupportedCurrencies(CurrencyFactory $factory, Logger $logger) {
// there is no API call to list supported currencies
return array('btc');
}

public function fetchSupportedHashrateCurrencies(CurrencyFactory $factory, Logger $logger) {
return array();
}

public function fetchBalances($account, CurrencyFactory $factory, Logger $logger) {

$result = array();

foreach ($this->fetchSupportedCurrencies($factory, $logger) as $cur) {
$abbr = strtoupper($cur);
$instance = $factory->loadCurrency($cur);
if ($instance != null) {
$abbr = $instance->getAbbr();
}

$url = "http://www.zpool.ca/api/wallet?address=" . urlencode($account['api_key']);
$json = $this->fetchJSON($url, $logger);

$result[$cur] = array(
'confirmed' => $json['balance'],
'unconfirmed' => $json['unsold'],
);
}

return $result;

}

}
Loading