diff --git a/coin.js b/coin.js index e3b4b30..f936bfd 100644 --- a/coin.js +++ b/coin.js @@ -48,7 +48,7 @@ var CoinWidgetCom = { } , validate: function(config) { var $accepted = []; - $accepted['currencies'] = ['bitcoin','litecoin']; + $accepted['currencies'] = ['bitcoin','litecoin','dash','ethereum']; $accepted['counters'] = ['count','amount','hide']; $accepted['alignment'] = ['al','ac','ar','bl','bc','br']; if (!config.currency || !CoinWidgetCom.in_array(config.currency,$accepted['currencies'])) @@ -230,6 +230,7 @@ var CoinWidgetCom = { } $lrg.attr({ src: CoinWidgetCom.source +'qr/?address='+$config.wallet_address + // src: "https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl="+$config.currency+":"+$config.wallet_address }).show(); }).bind('mouseleave',function(){ $lrg = $(this).parent().find('.COINWIDGETCOM_QRCODE_LARGE'); @@ -329,4 +330,4 @@ var CoinWidgetCom = { CoinWidgetCom.init(); } } -}; \ No newline at end of file +}; diff --git a/icon_dash.png b/icon_dash.png new file mode 100644 index 0000000..5555b6f Binary files /dev/null and b/icon_dash.png differ diff --git a/icon_ethereum.png b/icon_ethereum.png new file mode 100644 index 0000000..17ef323 Binary files /dev/null and b/icon_ethereum.png differ diff --git a/lookup.php b/lookup.php index 7515d4e..6d59a23 100644 --- a/lookup.php +++ b/lookup.php @@ -50,6 +50,12 @@ case 'litecoin': $response = get_litecoin($address); break; + case 'dash': + $response = get_dash($address); + break; + case 'ethereum': + $response = get_ethereum($address); + break; } $responses[$instance] = $response; } @@ -83,6 +89,32 @@ function get_litecoin($address) { return $return; } } + + function get_dash($address) { + $return = array(); + $data = get_request('https://prohashing.com/explorerJson/getAddress?coin_id=42&address='.$address); + if (!empty($data)) { + $data = json_decode($data); + $return += array( + 'count' => (int) $data->transactionCount, + 'amount' => (float) $data->balance + ); + return $return; + } + } + + function get_ethereum($address) { + $return = array(); + $data = get_request('https://api.ethplorer.io/getAddressInfo/'.$address.'?apiKey=freekey'); + if (!empty($data)) { + $data = json_decode($data); + $return += array( + 'count' => (int) $data->countTxs, + 'amount' => (float) $data->ETH->balance + ); + return $return; + } + } function get_request($url,$timeout=4) { if (function_exists('curl_version')) { @@ -92,6 +124,7 @@ function get_request($url,$timeout=4) { curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13'); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); $return = curl_exec($curl); curl_close($curl); return $return;