eth_getBlockByNumber
This commit is contained in:
parent
54159e3c6f
commit
f48df7d2c7
11
src/Eth.php
11
src/Eth.php
@ -171,6 +171,17 @@ class Eth
|
|||||||
'validators' => BooleanValidator::class
|
'validators' => BooleanValidator::class
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
'eth_getBlockByNumber' => [
|
||||||
|
'params' => [
|
||||||
|
[
|
||||||
|
'validators' => [
|
||||||
|
QuantityValidator::class, TagValidator::class
|
||||||
|
]
|
||||||
|
], [
|
||||||
|
'validators' => BooleanValidator::class
|
||||||
|
]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -557,6 +557,32 @@ class EthTest extends TestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testGetBlockByNumber
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testGetBlockByNumber()
|
||||||
|
{
|
||||||
|
$eth = $this->eth;
|
||||||
|
|
||||||
|
$eth->getBlockByNumber('latest', false, function ($err, $block) {
|
||||||
|
if ($err !== null) {
|
||||||
|
return $this->fail($err->getMessage());
|
||||||
|
}
|
||||||
|
if (isset($block->result)) {
|
||||||
|
// weired behavior, see https://github.com/sc0Vu/web3.php/issues/16
|
||||||
|
$this->assertTrue($block->result !== null);
|
||||||
|
} else {
|
||||||
|
if (isset($block->error)) {
|
||||||
|
$this->fail($block->error->message);
|
||||||
|
} else {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUnallowedMethod
|
* testUnallowedMethod
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user