personal_sendTransaction
This commit is contained in:
parent
e441831782
commit
125f48a6e5
@ -18,6 +18,7 @@ use Web3\RequestManagers\HttpRequestManager;
|
|||||||
use Web3\Validators\AddressValidator;
|
use Web3\Validators\AddressValidator;
|
||||||
use Web3\Validators\StringValidator;
|
use Web3\Validators\StringValidator;
|
||||||
use Web3\Validators\QuantityValidator;
|
use Web3\Validators\QuantityValidator;
|
||||||
|
use Web3\Validators\TransactionValidator;
|
||||||
|
|
||||||
class Personal
|
class Personal
|
||||||
{
|
{
|
||||||
@ -54,6 +55,15 @@ class Personal
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
'personal_sendTransaction' => [
|
||||||
|
'params' => [
|
||||||
|
[
|
||||||
|
'validators' => TransactionValidator::class
|
||||||
|
], [
|
||||||
|
'validators' => StringValidator::class
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +92,40 @@ class PersonalApiTest extends TestCase
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testSendTransaction
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testSendTransaction()
|
||||||
|
{
|
||||||
|
$personal = $this->personal;
|
||||||
|
|
||||||
|
$personal->sendTransaction([
|
||||||
|
'from' => "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
|
||||||
|
'to' => "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
|
||||||
|
'gas' => "0x76c0",
|
||||||
|
'gasPrice' => "0x9184e72a000",
|
||||||
|
'value' => "0x9184e72a",
|
||||||
|
'data' => "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
|
||||||
|
], '123456', function ($err, $transaction) {
|
||||||
|
if ($err !== null) {
|
||||||
|
// infura banned us to use 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testUnallowedMethod
|
* testUnallowedMethod
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user