-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpool.php
More file actions
38 lines (33 loc) · 874 Bytes
/
pool.php
File metadata and controls
38 lines (33 loc) · 874 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');
include './checkAdmin.php';
include './Webhook.php';
require_once 'libs/jsonRPCClient.php';
$gethRPC = new jsonRPCClient('http://127.0.0.1:8545');
function getRPCResponse($result){
if(isset($result['result'])){
return $result['result'];
} else {
throw new Exception($result['error']['message']);
}
}
function getDefaultResponse(){
$data['error'] = false;
$data['msg'] = "";
$data['data'] = "";
return $data;
}
function getPoolContent($gethRPC){
$data = getDefaultResponse();
try {
$data['data'] = getRPCResponse($gethRPC->txpool_content());
}
catch (exception $e) {
$data['error'] = true;
$data['msg'] = $e->getMessage();
}
return json_encode($data);
}
echo getPoolContent($gethRPC);
?>