From d0a97a14721bef8d8577f8c50a4d6a02697413bc Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 13 Dec 2017 16:15:52 +0800 Subject: [PATCH] eth_hashrate. --- src/Eth.php | 1 + test/unit/EthTest.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index d9c98eb..41bd3f7 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -26,6 +26,7 @@ class Eth 'eth_syncing' => [], 'eth_coinbase' => [], 'eth_mining' => [], + 'eth_hashrate' => [], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index ae76054..cd98b22 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -115,6 +115,27 @@ class EthTest extends TestCase }); } + /** + * testHashrate + * + * @return void + */ + public function testHashrate() + { + $eth = $this->web3->eth; + + $eth->hashrate(function ($err, $hashrate) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($hashrate->result)) { + $this->assertTrue(is_string($hashrate->result)); + } else { + $this->fail($hashrate->error->message); + } + }); + } + /** * testUnallowedMethod *