eth_submitWork

This commit is contained in:
sc0Vu 2017-12-14 23:15:13 +08:00
parent fdcb2a2d79
commit a34ad9216f
2 changed files with 42 additions and 1 deletions

View File

@ -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
]
]
],
];
/**

View File

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