From 9e868e4b5fdbc83613d57079014d70e67718fcf8 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 13 Dec 2017 20:48:22 +0800 Subject: [PATCH] eth_getTransactionCount --- src/Eth.php | 12 ++++++++++++ test/unit/EthTest.php | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index 386a36a..a76ed73 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -59,6 +59,18 @@ class Eth ], ] ], + 'eth_getTransactionCount' => [ + 'params'=> [ + [ + 'validators' => AddressValidator::class, + ], [ + 'default' => 'latest', + 'validators' => [ + TagValidator::class, QuantityValidator::class, + ] + ], + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index da45d8a..6d0c568 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -241,6 +241,27 @@ class EthTest extends TestCase }); } + /** + * testTransactionCount + * + * @return void + */ + public function testTransactionCount() + { + $eth = $this->web3->eth; + + $eth->getTransactionCount('0x407d73d8a49eeb85d32cf465507dd71d507100c1', function ($err, $transactionCount) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($transactionCount->result)) { + $this->assertTrue(is_string($transactionCount->result)); + } else { + $this->fail($transactionCount->error->message); + } + }); + } + /** * testUnallowedMethod *