Skip to content
This repository has been archived by the owner on Oct 13, 2019. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
coin/burstcoin
  • Loading branch information
Stoyvo committed Mar 9, 2015
1 parent beb9044 commit 82e6e8b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
Binary file added images/coin/burstcoin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion includes/classes/wallets.php
Expand Up @@ -11,14 +11,15 @@ class Wallets extends Config_Wallets {

protected $_currencies = array(
'bitcoin' => 'BTC',
'burstcoin' => 'BURST',
'darkcoin' => 'DRK',
'dogecoin' => 'DOGE',
'dogecoindark' => 'DOGED',
'litecoin' => 'LTC',
'neoscoin' => 'NEOS',
'paycoin' => 'XPY',
'reddcoin' => 'RDD',
// 'vertcoin' => 'VTC', // Disabled until blockchain works
// 'vertcoin' => 'VTC', // Disabled until blockchain explorer works
);

protected $_fiat = array(
Expand Down
31 changes: 31 additions & 0 deletions includes/classes/wallets/burstcoin.php
@@ -0,0 +1,31 @@
<?php
require_once('abstract.php');
/*
* @author Stoyvo
*/
class Wallets_Burstcoin extends Wallets_Abstract {

public function __construct($label, $address) {
parent::__construct($label, $address);
$this->_apiURL = 'http://api.burstcoin.eu/account/balance';
$this->_fileHandler = new FileHandler('wallets/burstcoin/' . $this->_address . '.json');
}

public function update() {
if ($GLOBALS['cached'] == false || $this->_fileHandler->lastTimeModified() >= 3600) { // updates every 60 minutes. How much are you being paid out that this must change? We take donations :)
$data = curlCall($this->_apiURL, http_build_query(array('account' => $this->_address)));

$data = array (
'label' => $this->_label,
'address' => $this->_address,
'balance' => (float) $data['balanceNQT']/100000000
);

$this->_fileHandler->write(json_encode($data));
return $data;
}

return json_decode($this->_fileHandler->read(), true);
}

}
5 changes: 5 additions & 0 deletions includes/functions.php
Expand Up @@ -9,10 +9,15 @@ function curlCall($url, $params = null, $key = null, $sig = null) {
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSLVERSION, 4);


if (!is_null($params) && !is_null($key) && !is_null($sig)) {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded', 'key: '.$key, 'sig: '.$sig));
} else if (!is_null($params)) {
curl_setopt($curl, CURLOPT_POST, TRUE);
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
} else {
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
}
Expand Down

0 comments on commit 82e6e8b

Please sign in to comment.