diff --git a/src/Eth.php b/src/Eth.php index a76ed73..93e2a5b 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -9,6 +9,7 @@ use Web3\RequestManagers\HttpRequestManager; use Web3\Validators\AddressValidator; use Web3\Validators\TagValidator; use Web3\Validators\QuantityValidator; +use Web3\Validators\BlockHashValidator; class Eth { @@ -71,6 +72,13 @@ class Eth ], ] ], + 'eth_getBlockTransactionCountByHash' => [ + 'params' => [ + [ + 'validators' => BlockHashValidator::class + ] + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index 6d0c568..9700cb5 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -242,11 +242,11 @@ class EthTest extends TestCase } /** - * testTransactionCount + * testGetTransactionCount * * @return void */ - public function testTransactionCount() + public function testGetTransactionCount() { $eth = $this->web3->eth; @@ -262,6 +262,31 @@ class EthTest extends TestCase }); } + /** + * testGetBlockTransactionCountByHash + * + * @return void + */ + public function testGetBlockTransactionCountByHash() + { + $eth = $this->web3->eth; + + $eth->getBlockTransactionCountByHash('0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238', function ($err, $transactionCount) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($transactionCount->result)) { + $this->assertTrue(is_string($transactionCount->result)); + } else { + if (isset($transactionCount->error)) { + $this->fail($transactionCount->error->message); + } else { + $this->assertTrue(true); + } + } + }); + } + /** * testUnallowedMethod *