eth_submitWork
This commit is contained in:
parent
fdcb2a2d79
commit
a34ad9216f
14
src/Eth.php
14
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
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user