From 413c1abb689ad4e824a2322745dce96f53aa4e0d Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Wed, 13 Dec 2017 16:10:22 +0800 Subject: [PATCH] eth_coinbase. --- src/Eth.php | 1 + test/unit/EthTest.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Eth.php b/src/Eth.php index fecb6f9..dd80e63 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -24,6 +24,7 @@ class Eth private $methods = [ 'eth_protocolVersion' => [], 'eth_syncing' => [], + 'eth_coinbase' => [], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index b13ef48..18f5ac0 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -72,6 +72,28 @@ class EthTest extends TestCase }); } + /** + * testCoinbase + * + * @return void + */ + public function testCoinbase() + { + $eth = $this->web3->eth; + + $eth->coinbase(function ($err, $coinbase) { + if ($err !== null) { + // infura banned us to use coinbase + return $this->assertTrue($err->getCode() === 405); + } + if (isset($coinbase->result)) { + $this->assertTrue(is_string($coinbasse->result)); + } else { + $this->fail($coinbase->error->message); + } + }); + } + /** * testUnallowedMethod *