eth_getBlockTransactionCountByHash

This commit is contained in:
sc0Vu 2017-12-13 20:56:19 +08:00
parent 9e868e4b5f
commit d14b6c7ee1
2 changed files with 35 additions and 2 deletions

View File

@ -9,6 +9,7 @@ use Web3\RequestManagers\HttpRequestManager;
use Web3\Validators\AddressValidator; use Web3\Validators\AddressValidator;
use Web3\Validators\TagValidator; use Web3\Validators\TagValidator;
use Web3\Validators\QuantityValidator; use Web3\Validators\QuantityValidator;
use Web3\Validators\BlockHashValidator;
class Eth class Eth
{ {
@ -71,6 +72,13 @@ class Eth
], ],
] ]
], ],
'eth_getBlockTransactionCountByHash' => [
'params' => [
[
'validators' => BlockHashValidator::class
]
]
],
]; ];
/** /**

View File

@ -242,11 +242,11 @@ class EthTest extends TestCase
} }
/** /**
* testTransactionCount * testGetTransactionCount
* *
* @return void * @return void
*/ */
public function testTransactionCount() public function testGetTransactionCount()
{ {
$eth = $this->web3->eth; $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 * testUnallowedMethod
* *