From f13217e44d2bcb230b48dbad07f81a00d594366a Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Thu, 14 Dec 2017 18:59:22 +0800 Subject: [PATCH] eth_getTransactionByBlockHashAndIndex --- src/Eth.php | 9 +++++++++ test/unit/EthTest.php | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index 8074bd2..9e70c84 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -190,6 +190,15 @@ class Eth ] ] ], + 'eth_getTransactionByBlockHashAndIndex' => [ + 'params' => [ + [ + 'validators' => BlockHashValidator::class + ], [ + 'validators' => QuantityValidator::class + ] + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index 6a92fe9..8876652 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -608,6 +608,31 @@ class EthTest extends TestCase }); } + /** + * testGetTransactionByBlockHashAndIndex + * + * @return void + */ + public function testGetTransactionByBlockHashAndIndex() + { + $eth = $this->eth; + + $eth->getTransactionByBlockHashAndIndex('0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238', '0x0', function ($err, $transaction) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($transaction->result)) { + $this->assertTrue(is_string($transaction->result)); + } else { + if (isset($transaction->error)) { + $this->fail($transaction->error->message); + } else { + $this->assertTrue(true); + } + } + }); + } + /** * testUnallowedMethod *