commit
57219734c3
1 changed files with 43 additions and 24 deletions
|
@ -661,7 +661,7 @@ class MainController extends AppController {
|
||||||
$this->_jsonResponse(['success' => true, 'txs' => $txs]);
|
$this->_jsonResponse(['success' => true, 'txs' => $txs]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _gettxoutsetinfo() {
|
/*protected function _gettxoutsetinfo() {
|
||||||
$now = new \DateTime('now', new \DateTimeZone('UTC'));
|
$now = new \DateTime('now', new \DateTimeZone('UTC'));
|
||||||
$txOutSetInfo = new \stdClass();
|
$txOutSetInfo = new \stdClass();
|
||||||
$txOutSetInfo->time = $now->format('c');
|
$txOutSetInfo->time = $now->format('c');
|
||||||
|
@ -684,7 +684,6 @@ class MainController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($shouldRefreshSet) {
|
if ($shouldRefreshSet) {
|
||||||
|
|
||||||
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||||
try {
|
try {
|
||||||
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
$res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
||||||
|
@ -702,7 +701,7 @@ class MainController extends AppController {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isset($txOutSetInfo->tosi)) ? $txOutSetInfo->tosi : 'N/A';
|
return (isset($txOutSetInfo->tosi)) ? $txOutSetInfo->tosi : 'N/A';
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public function apistatus() {
|
public function apistatus() {
|
||||||
$this->autoRender = false;
|
$this->autoRender = false;
|
||||||
|
@ -876,17 +875,26 @@ class MainController extends AppController {
|
||||||
$circulating = 0;
|
$circulating = 0;
|
||||||
$txoutsetinfo = $this->_gettxoutsetinfo();
|
$txoutsetinfo = $this->_gettxoutsetinfo();
|
||||||
|
|
||||||
$reservedcommunity = ['rFLUohPG4tP3gZHYoyhvADCtrDMiaYb7Qd'];
|
$reservedcommunity = ['rEqocTgdPdoD8NEbrECTUPfpquJ4zPVCJ8'];
|
||||||
$reservedoperational = ['r9PGXsejVJb9ZfMf3QVdDEJCzxkd9JLxzL'];
|
$reservedoperational = ['r7hj61jdbGXcsccxw8UmEFCReZoCWLRr7t'];
|
||||||
$reservedinstitutional = ['r9srwX7DEN7Mex3a8oR1mKSqQmLBizoJvi'];
|
$reservedinstitutional = ['rKaAUDxr24hHNNTQuNtRvNt8SGYJMdLXo3'];
|
||||||
$reservedaux = ['bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt', 'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2', 'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD', 'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz', 'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc', 'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393', 'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH', 'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v', 'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'];
|
$reservedaux = [
|
||||||
|
'bRo4FEeqqxY7nWFANsZsuKEWByEgkvz8Qt',
|
||||||
|
'bU2XUzckfpdEuQNemKvhPT1gexQ3GG3SC2',
|
||||||
|
'bay3VA6YTQBL4WLobbG7CthmoGeUKXuXkD',
|
||||||
|
'bLPbiXBp6Vr3NSnsHzDsLNzoy5o36re9Cz',
|
||||||
|
'bMvUBo1h5WS46ThHtmfmXftz3z33VHL7wc',
|
||||||
|
'bVUrbCK8hcZ5XWti7b9eNxKEBxzc1rr393',
|
||||||
|
'bZja2VyhAC84a9hMwT8dwTU6rDRXowrjxH',
|
||||||
|
'bCrboXVztuSbZzVToCWSsu1pEr2oxKHu9v',
|
||||||
|
'bMgqQqYfwzWWYBk5o5dBMXtCndVAoeqy6h'
|
||||||
|
];
|
||||||
$allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux);
|
$allAddresses = array_merge($reservedcommunity, $reservedoperational, $reservedinstitutional, $reservedaux);
|
||||||
|
|
||||||
$reservedtotal = $this->Addresses->find()->select(['id', 'balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
|
$reservedtotal = $this->Addresses->find()->select(['balance' => 'SUM(balance)'])->where(['Addresses.address IN' => $allAddresses])->first();
|
||||||
|
|
||||||
$circulating = $txoutsetinfo->total_amount - ($reservedtotal->balance);
|
$circulating = (isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0) - ($reservedtotal->balance);
|
||||||
|
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => isset($txoutsetinfo) ? $txoutsetinfo->total_amount : 0, 'circulating' => $circulating]]);
|
||||||
return $this->_jsonResponse(['success' => true, 'utxosupply' => ['total' => $txoutsetinfo->total_amount, 'circulating' => $circulating]]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _formatHashRate($value) {
|
protected function _formatHashRate($value) {
|
||||||
|
@ -945,19 +953,6 @@ class MainController extends AppController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// private function _gettxoutsetinfo() {
|
|
||||||
// $req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
|
||||||
// try {
|
|
||||||
// $res = json_decode(self::curl_json_post(self::$rpcurl, json_encode($req)));
|
|
||||||
// if (!isset($res->result)) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// return $res->result;
|
|
||||||
// } catch (\Exception $e) {
|
|
||||||
// return 'N/A';
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
private static function curl_json_post($url, $data, $headers = []) {
|
private static function curl_json_post($url, $data, $headers = []) {
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
@ -1009,6 +1004,30 @@ class MainController extends AppController {
|
||||||
return $claimIsBlocked;
|
return $claimIsBlocked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function _gettxoutsetinfo() {
|
||||||
|
$cachedOutsetInfo = Cache::read('gettxoutsetinfo', 'api_requests');
|
||||||
|
if ($cachedOutsetInfo !== false) {
|
||||||
|
$res = json_decode($cachedOutsetInfo);
|
||||||
|
if (!isset($res->result)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $res->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$req = ['method' => 'gettxoutsetinfo', 'params' => []];
|
||||||
|
try {
|
||||||
|
$response = self::curl_json_post(self::$rpcurl, json_encode($req));
|
||||||
|
$res = json_decode($res);
|
||||||
|
if (!isset($res->result)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Cache::write('gettxoutsetinfo', $response, 'api_requests');
|
||||||
|
return $res->result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private function _getBlockedList() {
|
private function _getBlockedList() {
|
||||||
$cachedList = Cache::read('list_blocked', 'api_requests');
|
$cachedList = Cache::read('list_blocked', 'api_requests');
|
||||||
if ($cachedList !== false) {
|
if ($cachedList !== false) {
|
||||||
|
|
Loading…
Reference in a new issue