eth_sign
This commit is contained in:
parent
6f28fc79dc
commit
ff2c90c196
10
src/Eth.php
10
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
|
||||
],
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user