eth_newFilter
This commit is contained in:
parent
cfd80212ba
commit
1d29fd0138
@ -14,6 +14,7 @@ use Web3\Validators\HexValidator;
|
||||
use Web3\Validators\TransactionValidator;
|
||||
use Web3\Validators\BooleanValidator;
|
||||
use Web3\Validators\StringValidator;
|
||||
use Web3\Validators\FilterValidator;
|
||||
|
||||
class Eth
|
||||
{
|
||||
@ -259,6 +260,13 @@ class Eth
|
||||
'validators' => StringValidator::class
|
||||
]
|
||||
]
|
||||
],
|
||||
'eth_newFilter' => [
|
||||
'params' => [
|
||||
[
|
||||
'validators' => FilterValidator::class
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
|
@ -834,6 +834,37 @@ class EthTest extends TestCase
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* testNewFilter
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testNewFilter()
|
||||
{
|
||||
$eth = $this->eth;
|
||||
|
||||
$eth->newFilter([
|
||||
'fromBlock' => '0x1',
|
||||
'toBlock' => '0x2',
|
||||
'address' => '0x8888f1f195afa192cfee860698584c030f4c9db1',
|
||||
'topics' => ['0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b', null, ['0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc']]
|
||||
], function ($err, $filter) {
|
||||
if ($err !== null) {
|
||||
// infura banned us to new filter
|
||||
return $this->assertTrue($err->getCode() === 405);
|
||||
}
|
||||
if (isset($filter->result)) {
|
||||
$this->assertTrue(is_string($filter->result));
|
||||
} else {
|
||||
if (isset($filter->error)) {
|
||||
$this->assertTrue(is_string($filter->error->message));
|
||||
} else {
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* testUnallowedMethod
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user