eth_sendTransaction
This commit is contained in:
parent
122bbf24fb
commit
bda39d4e3a
@ -11,6 +11,7 @@ use Web3\Validators\TagValidator;
|
|||||||
use Web3\Validators\QuantityValidator;
|
use Web3\Validators\QuantityValidator;
|
||||||
use Web3\Validators\BlockHashValidator;
|
use Web3\Validators\BlockHashValidator;
|
||||||
use Web3\Validators\HexValidator;
|
use Web3\Validators\HexValidator;
|
||||||
|
use Web3\Validators\TransactionValidator;
|
||||||
|
|
||||||
class Eth
|
class Eth
|
||||||
{
|
{
|
||||||
@ -128,6 +129,13 @@ class Eth
|
|||||||
],
|
],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'eth_sendTransaction' => [
|
||||||
|
'params' => [
|
||||||
|
[
|
||||||
|
'validators' => TransactionValidator::class
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
'eth_sendRawTransaction' => [
|
'eth_sendRawTransaction' => [
|
||||||
'params' => [
|
'params' => [
|
||||||
[
|
[
|
||||||
|
@ -405,6 +405,40 @@ class EthTest extends TestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSendTransaction
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testSendTransaction()
|
||||||
|
{
|
||||||
|
$eth = $this->web3->eth;
|
||||||
|
|
||||||
|
$eth->sendTransaction([
|
||||||
|
'from' => "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
|
||||||
|
'to' => "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
|
||||||
|
'gas' => "0x76c0",
|
||||||
|
'gasPrice' => "0x9184e72a000",
|
||||||
|
'value' => "0x9184e72a",
|
||||||
|
'data' => "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
|
||||||
|
], function ($err, $transaction) {
|
||||||
|
if ($err !== null) {
|
||||||
|
// infura banned us to send transaction
|
||||||
|
return $this->assertTrue($err->getCode() === 405);
|
||||||
|
}
|
||||||
|
if (isset($transaction->result)) {
|
||||||
|
$this->assertTrue(is_string($transaction->result));
|
||||||
|
} else {
|
||||||
|
if (isset($transaction->error)) {
|
||||||
|
// it's just test hex.
|
||||||
|
$this->assertTrue(is_string($transaction->error->message));
|
||||||
|
} else {
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSendRawTransaction
|
* testSendRawTransaction
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user