Skip to content

Commit 9e4ebc4

Browse files
committed
Old API calls removed
1 parent 4cd0391 commit 9e4ebc4

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

api/controller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function sendError($code, $message){
8080
* @return void
8181
*/
8282
public function run(){
83+
$result = FALSE;
8384
$command = $this->getCommand();
8485
if($command && in_array($command, $this->apiCommands) && method_exists($this, $command)){
8586
$key = $this->getRequest('apiKey', FALSE);
@@ -88,8 +89,8 @@ public function run(){
8889
}
8990
$this->defaults = $this->db->getAPIKeyDefaults($key, $this->getCommand());
9091
$result = call_user_func(array($this, $this->getCommand()));
91-
$this->sendResult($result);
9292
}
93+
return $result;
9394
}
9495

9596
/**

api/index.php

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,10 @@
2929
}
3030

3131
$ctr = new ethplorerController($es);
32-
$ctr->run();
32+
$result = $ctr->run();
3333

34-
$result = array();
35-
$command = $ctr->getCommand();
36-
37-
switch($command){
38-
case 'last':
39-
$options = array(
40-
'limit' => isset($_GET["limit"]) ? (int)$_GET["limit"] : 10,
41-
'timestamp' => isset($_GET["timestamp"]) ? (int)$_GET["timestamp"] : 0,
42-
);
43-
if(isset($_GET['token_address']) && $es->isValidAddress(strtolower($_GET['token_address']))){
44-
$options['address'] = strtolower($_GET['token_address']);
45-
}
46-
$result = $es->getLastTransfers($options);
47-
break;
48-
default:
49-
$ctr->sendError(17, 'Invalid request, check API manual there: https://github.com/EverexIO/Ethplorer/wiki/Ethplorer-API');
34+
if(!$result){
35+
$ctr->sendError(17, 'Invalid request, check API manual there: https://github.com/EverexIO/Ethplorer/wiki/Ethplorer-API');
5036
}
51-
$ctr->sendResult($result);
37+
38+
$ctr->sendResult($result);

0 commit comments

Comments
 (0)