eth_compileSolidity

This commit is contained in:
sc0Vu 2017-12-14 19:22:08 +08:00
parent 630b7fc52a
commit 60e52909ff
2 changed files with 34 additions and 1 deletions

View File

@ -13,6 +13,7 @@ use Web3\Validators\BlockHashValidator;
use Web3\Validators\HexValidator; use Web3\Validators\HexValidator;
use Web3\Validators\TransactionValidator; use Web3\Validators\TransactionValidator;
use Web3\Validators\BooleanValidator; use Web3\Validators\BooleanValidator;
use Web3\Validators\StringValidator;
class Eth class Eth
{ {
@ -237,7 +238,14 @@ class Eth
] ]
] ]
], ],
'eth_getCompilers' => [] 'eth_getCompilers' => [],
'eth_compileSolidity' => [
'params' => [
[
'validators' => StringValidator::class
]
]
]
]; ];
/** /**

View File

@ -759,6 +759,31 @@ class EthTest extends TestCase
}); });
} }
/**
* testCompileSolidity
*
* @return void
*/
public function testCompileSolidity()
{
$eth = $this->eth;
$eth->compileSolidity('contract test { function multiply(uint a) returns(uint d) { return a * 7; } }', function ($err, $compiled) {
if ($err !== null) {
return $this->fail($err->getMessage());
}
if (isset($compiled->result)) {
$this->assertTrue(is_string($compiled->result));
} else {
// if (isset($compilers->error)) {
$this->assertTrue(true);
// } else {
// $this->assertTrue(true);
// }
}
});
}
/** /**
* testUnallowedMethod * testUnallowedMethod
* *