From 851febf04879780c8c9f080352d9b3b00769a108 Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 14 Dec 2017 22:04:44 +0800 Subject: [PATCH] eth_newPendingTransactionFilter --- src/Eth.php | 3 ++- test/unit/EthTest.php | 28 +++++++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/Eth.php b/src/Eth.php index cb5ab62..0a83902 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -274,7 +274,8 @@ class Eth 'validators' => QuantityValidator::class ] ] - ] + ], + 'eth_newPendingTransactionFilter' => [] ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index 6b8e052..b2cd337 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -876,7 +876,33 @@ class EthTest extends TestCase $eth->newBlockFilter('0x01', function ($err, $filter) { if ($err !== null) { - // infura banned us to new filter + // infura banned us to new block filter + return $this->assertTrue($err->getCode() === 405); + } + if (isset($filter->result)) { + $this->assertTrue(is_string($filter->result)); + } else { + if (isset($filter->error)) { + $this->assertTrue(is_string($filter->error->message)); + } else { + $this->assertTrue(true); + } + } + }); + } + + /** + * testNewPendingTransactionFilter + * + * @return void + */ + public function testNewPendingTransactionFilter() + { + $eth = $this->eth; + + $eth->newPendingTransactionFilter(function ($err, $filter) { + if ($err !== null) { + // infura banned us to new pending transaction filter return $this->assertTrue($err->getCode() === 405); } if (isset($filter->result)) {