eth_compileSolidity
This commit is contained in:
parent
630b7fc52a
commit
60e52909ff
10
src/Eth.php
10
src/Eth.php
@ -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
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user