mirror of
https://github.com/twisterarmy/cloud-server.git
synced 2025-03-13 05:51:46 +00:00
implement getBlock method
This commit is contained in:
parent
704dc97951
commit
abd9787fae
@ -77,4 +77,35 @@ class Twister {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getBlock(string $hash) {
|
||||
|
||||
$this->_curl->prepare(
|
||||
'/',
|
||||
'POST',
|
||||
30,
|
||||
[
|
||||
'jsonrpc' => '2.0',
|
||||
'method' => 'getblock',
|
||||
'params' => [
|
||||
$hash
|
||||
],
|
||||
'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