mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-09-12 13:52:01 +00:00
implement getBlockHash method
This commit is contained in:
parent
ca692ef60d
commit
704dc97951
@ -46,4 +46,35 @@ class Twister {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getBlockHash(int $number) {
|
||||||
|
|
||||||
|
$this->_curl->prepare(
|
||||||
|
'/',
|
||||||
|
'POST',
|
||||||
|
30,
|
||||||
|
[
|
||||||
|
'jsonrpc' => '2.0',
|
||||||
|
'method' => 'getblockhash',
|
||||||
|
'params' => [
|
||||||
|
$number
|
||||||
|
],
|
||||||
|
'id' => time() + rand()
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($response = $this->_curl->execute()) {
|
||||||
|
|
||||||
|
if ($response['error']) {
|
||||||
|
|
||||||
|
$this->_error = _($response['error']['message']);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
return $response['result'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user