diff --git a/src/Eth.php b/src/Eth.php index 2f59db9..355f474 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -15,6 +15,7 @@ use Web3\Validators\TransactionValidator; use Web3\Validators\BooleanValidator; use Web3\Validators\StringValidator; use Web3\Validators\FilterValidator; +use Web3\Validators\NonceValidator; class Eth { @@ -304,7 +305,18 @@ class Eth ] ] ], - 'eth_getWork' => [] + 'eth_getWork' => [], + 'eth_submitWork' => [ + 'params' => [ + [ + 'validators' => NonceValidator::class + ], [ + 'validators' => BlockHashValidator::class + ], [ + 'validators' => BlockHashValidator::class + ] + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index 2f12ba8..79871ce 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -1051,6 +1051,35 @@ class EthTest extends TestCase }); } + /** + * testSubmitWork + * + * @return void + */ + public function testSubmitWork() + { + $eth = $this->eth; + + $eth->submitWork( + '0x0000000000000001', + '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef', + '0xD1FE5700000000000000000000000000D1FE5700000000000000000000000000' + , function ($err, $work) { + if ($err !== null) { + return $this->fail($err->getMessage()); + } + if (isset($work->result)) { + $this->assertTrue(is_bool($work->result)); + } else { + if (isset($work->error)) { + $this->assertTrue(is_string($work->error->message)); + } else { + $this->assertTrue(true); + } + } + }); + } + /** * testUnallowedMethod *