eth_estimateGas
This commit is contained in:
parent
70d015961d
commit
83a514ca65
@ -155,6 +155,13 @@ class Eth
|
||||
]
|
||||
]
|
||||
],
|
||||
'eth_estimateGas' => [
|
||||
'params' => [
|
||||
[
|
||||
'validators' => TransactionValidator::class
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -483,8 +483,7 @@ class EthTest extends TestCase
|
||||
'data' => "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
|
||||
], function ($err, $transaction) {
|
||||
if ($err !== null) {
|
||||
// infura banned us to send transaction
|
||||
return $this->assertTrue($err->getCode() === 405);
|
||||
return $this->fail($err->getMessage());
|
||||
}
|
||||
if (isset($transaction->result)) {
|
||||
$this->assertTrue(is_string($transaction->result));
|
||||
@ -499,6 +498,39 @@ class EthTest extends TestCase
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* testEstimateGas
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testEstimateGas()
|
||||
{
|
||||
$eth = $this->web3->eth;
|
||||
|
||||
$eth->estimateGas([
|
||||
'from' => "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
|
||||
'to' => "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
|
||||
'gas' => "0x76c0",
|
||||
'gasPrice' => "0x9184e72a000",
|
||||
'value' => "0x9184e72a",
|
||||
'data' => "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
|
||||
], function ($err, $gas) {
|
||||
if ($err !== null) {
|
||||
return $this->fail($err->getMessage());
|
||||
}
|
||||
if (isset($gas->result)) {
|
||||
$this->assertTrue(is_string($gas->result));
|
||||
} else {
|
||||
if (isset($gas->error)) {
|
||||
// it's just test hex.
|
||||
$this->assertTrue(is_string($gas->error->message));
|
||||
} else {
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* testUnallowedMethod
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user