diff --git a/src/Eth.php b/src/Eth.php index 621787e..29bcfad 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -10,6 +10,7 @@ use Web3\Validators\AddressValidator; use Web3\Validators\TagValidator; use Web3\Validators\QuantityValidator; use Web3\Validators\BlockHashValidator; +use Web3\Validators\HexValidator; class Eth { @@ -118,6 +119,15 @@ class Eth ], ] ], + 'eth_sign' => [ + 'params'=> [ + [ + 'validators' => AddressValidator::class, + ], [ + 'validators' => HexValidator::class + ], + ] + ], ]; /** diff --git a/test/unit/EthTest.php b/test/unit/EthTest.php index a100ef7..04d69b0 100644 --- a/test/unit/EthTest.php +++ b/test/unit/EthTest.php @@ -383,6 +383,28 @@ class EthTest extends TestCase }); } + /** + * testSign + * + * @return void + */ + public function testSign() + { + $eth = $this->web3->eth; + + $eth->sign('0x407d73d8a49eeb85d32cf465507dd71d507100c1', '0xdeadbeaf', function ($err, $sign) { + if ($err !== null) { + // infura banned us to sign message + return $this->assertTrue($err->getCode() === 405); + } + if (isset($sign->result)) { + $this->assertTrue(is_string($sign->result)); + } else { + $this->fail($sign->error->message); + } + }); + } + /** * testUnallowedMethod *