This commit is contained in:
sc0Vu 2017-12-13 23:22:58 +08:00
parent 6f28fc79dc
commit ff2c90c196
2 changed files with 32 additions and 0 deletions

View File

@ -10,6 +10,7 @@ use Web3\Validators\AddressValidator;
use Web3\Validators\TagValidator; use Web3\Validators\TagValidator;
use Web3\Validators\QuantityValidator; use Web3\Validators\QuantityValidator;
use Web3\Validators\BlockHashValidator; use Web3\Validators\BlockHashValidator;
use Web3\Validators\HexValidator;
class Eth class Eth
{ {
@ -118,6 +119,15 @@ class Eth
], ],
] ]
], ],
'eth_sign' => [
'params'=> [
[
'validators' => AddressValidator::class,
], [
'validators' => HexValidator::class
],
]
],
]; ];
/** /**

View File

@ -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 * testUnallowedMethod
* *