From c957f3621732043cde163dcae1d64bbc0cc5858d Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 13 Dec 2017 22:05:34 +0800 Subject: [PATCH] eth_getUncleCountByBlockNumber --- src/Eth.php | 10 ++++++++++ test/unit/EthTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index b84a255..b47bb7d 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -96,6 +96,16 @@ class Eth ] ] ], + 'eth_getUncleCountByBlockNumber' => [ + 'params' => [ + [ + 'default' => 'latest', + 'validators' => [ + TagValidator::class, QuantityValidator::class, + ] + ] + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index b8a59b8..0bf8f7b 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -337,6 +337,31 @@ class EthTest extends TestCase }); } + /** + * testGetUncleCountByBlockNumber + * + * @return void + */ + public function testGetUncleCountByBlockNumber() + { + $eth = $this->web3->eth; + + $eth->getUncleCountByBlockNumber('0x0', function ($err, $uncleCount) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($uncleCount->result)) { + $this->assertTrue(is_string($uncleCount->result)); + } else { + if (isset($uncleCount->error)) { + $this->fail($uncleCount->error->message); + } else { + $this->assertTrue(true); + } + } + }); + } + /** * testUnallowedMethod *