Web3 apis.
This commit is contained in:
parent
819608d510
commit
34647e7fdf
16
src/Web3.php
16
src/Web3.php
@ -132,18 +132,10 @@ class Web3
|
|||||||
} else {
|
} else {
|
||||||
$methodObject = $this->methods[$method];
|
$methodObject = $this->methods[$method];
|
||||||
}
|
}
|
||||||
try {
|
if ($methodObject->validate($arguments)) {
|
||||||
if ($methodObject->validate($arguments)) {
|
$inputs = $methodObject->transform($arguments, $methodObject->inputFormatters);
|
||||||
$inputs = $methodObject->transform($arguments, $methodObject->inputFormatters);
|
$methodObject->arguments = $inputs;
|
||||||
$methodObject->arguments = $inputs;
|
$this->provider->send($methodObject, $callback);
|
||||||
$this->provider->send($methodObject, $callback);
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
if (is_callable($callback) === true) {
|
|
||||||
call_user_func($callback, $e, null);
|
|
||||||
} else {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,13 +102,13 @@ class Web3ApiTest extends TestCase
|
|||||||
*/
|
*/
|
||||||
public function testWrongParam()
|
public function testWrongParam()
|
||||||
{
|
{
|
||||||
// $this->expectException(RuntimeException::class);
|
$this->expectException(RuntimeException::class);
|
||||||
|
|
||||||
$web3 = $this->web3;
|
$web3 = $this->web3;
|
||||||
|
|
||||||
$web3->sha3($web3, function ($err, $hash) {
|
$web3->sha3($web3, function ($err, $hash) {
|
||||||
if ($err !== null) {
|
if ($err !== null) {
|
||||||
return $this->assertTrue($err instanceof RuntimeException);
|
return $this->fail($err->getMessage());
|
||||||
}
|
}
|
||||||
$this->assertTrue(true);
|
$this->assertTrue(true);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user