diff --git a/src/Eth.php b/src/Eth.php index 1a12b0e..ac6f39c 100644 --- a/src/Eth.php +++ b/src/Eth.php @@ -49,130 +49,9 @@ class Eth * @var array */ private $allowedMethods = [ - 'eth_protocolVersion', 'eth_syncing', 'eth_coinbase', 'eth_mining', 'eth_hashrate', 'eth_gasPrice', 'eth_accounts', 'eth_blockNumber', 'eth_getBalance', 'eth_getStorageAt', 'eth_getTransactionCount', 'eth_getBlockTransactionCountByHash', 'eth_getBlockTransactionCountByNumber', 'eth_getUncleCountByBlockHash', 'eth_getUncleCountByBlockNumber', 'eth_getCode', 'eth_sign', 'eth_sendTransaction', 'eth_sendRawTransaction', 'eth_call', 'eth_estimateGas', 'eth_getBlockByHash', 'eth_getBlockByNumber', 'eth_getTransactionByHash', 'eth_getTransactionByBlockHashAndIndex', 'eth_getTransactionByBlockNumberAndIndex' + 'eth_protocolVersion', 'eth_syncing', 'eth_coinbase', 'eth_mining', 'eth_hashrate', 'eth_gasPrice', 'eth_accounts', 'eth_blockNumber', 'eth_getBalance', 'eth_getStorageAt', 'eth_getTransactionCount', 'eth_getBlockTransactionCountByHash', 'eth_getBlockTransactionCountByNumber', 'eth_getUncleCountByBlockHash', 'eth_getUncleCountByBlockNumber', 'eth_getUncleByBlockHashAndIndex', 'eth_getUncleByBlockNumberAndIndex', 'eth_getCode', 'eth_sign', 'eth_sendTransaction', 'eth_sendRawTransaction', 'eth_call', 'eth_estimateGas', 'eth_getBlockByHash', 'eth_getBlockByNumber', 'eth_getTransactionByHash', 'eth_getTransactionByBlockHashAndIndex', 'eth_getTransactionByBlockNumberAndIndex', 'eth_getTransactionReceipt', 'eth_getCompilers', 'eth_compileSolidity', 'eth_compileLLL', 'eth_compileSerpent', 'eth_getWork', 'eth_newFilter', 'eth_newBlockFilter', 'eth_newPendingTransactionFilter', 'eth_uninstallFilter', 'eth_getFilterChanges', 'eth_getFilterLogs', 'eth_getLogs', 'eth_submitWork', 'eth_submitHashrate' ]; - /** - * methods - * - * @var array - */ - // private $methods = [ - // 'eth_getTransactionReceipt' => [ - // 'params' => [ - // [ - // 'validators' => BlockHashValidator::class - // ] - // ] - // ], - // 'eth_getUncleByBlockHashAndIndex' => [ - // 'params' => [ - // [ - // 'validators' => BlockHashValidator::class - // ], [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_getUncleByBlockNumberAndIndex' => [ - // 'params' => [ - // [ - // 'validators' => [ - // QuantityValidator::class, TagValidator::class - // ] - // ], [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_getCompilers' => [], - // 'eth_compileSolidity' => [ - // 'params' => [ - // [ - // 'validators' => StringValidator::class - // ] - // ] - // ], - // 'eth_compileLLL' => [ - // 'params' => [ - // [ - // 'validators' => StringValidator::class - // ] - // ] - // ], - // 'eth_compileSerpent' => [ - // 'params' => [ - // [ - // 'validators' => StringValidator::class - // ] - // ] - // ], - // 'eth_newFilter' => [ - // 'params' => [ - // [ - // 'validators' => FilterValidator::class - // ] - // ] - // ], - // 'eth_newBlockFilter' => [ - // 'params' => [ - // [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_newPendingTransactionFilter' => [], - // 'eth_uninstallFilter' => [ - // 'params' => [ - // [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_getFilterChanges' => [ - // 'params' => [ - // [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_getFilterLogs' => [ - // 'params' => [ - // [ - // 'validators' => QuantityValidator::class - // ] - // ] - // ], - // 'eth_getLogs' => [ - // 'params' => [ - // [ - // 'validators' => FilterValidator::class - // ] - // ] - // ], - // 'eth_getWork' => [], - // 'eth_submitWork' => [ - // 'params' => [ - // [ - // 'validators' => NonceValidator::class - // ], [ - // 'validators' => BlockHashValidator::class - // ], [ - // 'validators' => BlockHashValidator::class - // ] - // ] - // ], - // 'eth_submitHashrate' => [ - // 'params' => [ - // [ - // 'validators' => BlockHashValidator::class - // ], [ - // 'validators' => BlockHashValidator::class - // ] - // ] - // ], - // ]; - /** * construct * diff --git a/src/Methods/Eth/Accounts.php b/src/Methods/Eth/Accounts.php index 62b349b..4b75220 100644 --- a/src/Methods/Eth/Accounts.php +++ b/src/Methods/Eth/Accounts.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class Accounts extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/BlockNumber.php b/src/Methods/Eth/BlockNumber.php index da0db24..f402239 100644 --- a/src/Methods/Eth/BlockNumber.php +++ b/src/Methods/Eth/BlockNumber.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class BlockNumber extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/Call.php b/src/Methods/Eth/Call.php index 3ec10b1..6a605e5 100644 --- a/src/Methods/Eth/Call.php +++ b/src/Methods/Eth/Call.php @@ -13,11 +13,25 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Validators\CallValidator; use Web3\Formatters\TransactionFormatter; use Web3\Formatters\OptionalQuantityFormatter; class Call extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + CallValidator::class, [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/Coinbase.php b/src/Methods/Eth/Coinbase.php index 4ae5512..47027b1 100644 --- a/src/Methods/Eth/Coinbase.php +++ b/src/Methods/Eth/Coinbase.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class Coinbase extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/CompileLLL.php b/src/Methods/Eth/CompileLLL.php new file mode 100644 index 0000000..69d33f6 --- /dev/null +++ b/src/Methods/Eth/CompileLLL.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\StringValidator; +use Web3\Formatters\StringFormatter; + +class CompileLLL extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + StringValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + StringFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/CompileSerpent.php b/src/Methods/Eth/CompileSerpent.php new file mode 100644 index 0000000..39b105d --- /dev/null +++ b/src/Methods/Eth/CompileSerpent.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\StringValidator; +use Web3\Formatters\StringFormatter; + +class CompileSerpent extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + StringValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + StringFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/CompileSolidity.php b/src/Methods/Eth/CompileSolidity.php new file mode 100644 index 0000000..05de3c0 --- /dev/null +++ b/src/Methods/Eth/CompileSolidity.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\StringValidator; +use Web3\Formatters\StringFormatter; + +class CompileSolidity extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + StringValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + StringFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/EstimateGas.php b/src/Methods/Eth/EstimateGas.php index a11f80e..63b10c7 100644 --- a/src/Methods/Eth/EstimateGas.php +++ b/src/Methods/Eth/EstimateGas.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TransactionValidator; use Web3\Formatters\TransactionFormatter; class EstimateGas extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + TransactionValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GasPrice.php b/src/Methods/Eth/GasPrice.php index 430877e..8bef5d4 100644 --- a/src/Methods/Eth/GasPrice.php +++ b/src/Methods/Eth/GasPrice.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class GasPrice extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetBalance.php b/src/Methods/Eth/GetBalance.php index ba4053a..793dad4 100644 --- a/src/Methods/Eth/GetBalance.php +++ b/src/Methods/Eth/GetBalance.php @@ -13,11 +13,25 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Validators\AddressValidator; use Web3\Formatters\AddressFormatter; use Web3\Formatters\OptionalQuantityFormatter; class GetBalance extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + AddressValidator::class, [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetBlockByHash.php b/src/Methods/Eth/GetBlockByHash.php index 1eb9708..f81eafd 100644 --- a/src/Methods/Eth/GetBlockByHash.php +++ b/src/Methods/Eth/GetBlockByHash.php @@ -13,11 +13,22 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; +use Web3\Validators\BooleanValidator; use Web3\Formatters\HexFormatter; use Web3\Formatters\BooleanFormatter; class GetBlockByHash extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class, BooleanValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetBlockByNumber.php b/src/Methods/Eth/GetBlockByNumber.php index 51cdc2d..fecb5aa 100644 --- a/src/Methods/Eth/GetBlockByNumber.php +++ b/src/Methods/Eth/GetBlockByNumber.php @@ -13,11 +13,22 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; +use Web3\Validators\BooleanValidator; use Web3\Formatters\OptionalQuantityFormatter; use Web3\Formatters\BooleanFormatter; class GetBlockByNumber extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class, BooleanValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetBlockTransactionCountByHash.php b/src/Methods/Eth/GetBlockTransactionCountByHash.php index b504bbb..259e160 100644 --- a/src/Methods/Eth/GetBlockTransactionCountByHash.php +++ b/src/Methods/Eth/GetBlockTransactionCountByHash.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; use Web3\Formatters\HexFormatter; class GetBlockTransactionCountByHash extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetBlockTransactionCountByNumber.php b/src/Methods/Eth/GetBlockTransactionCountByNumber.php index b09312e..064ff08 100644 --- a/src/Methods/Eth/GetBlockTransactionCountByNumber.php +++ b/src/Methods/Eth/GetBlockTransactionCountByNumber.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; use Web3\Formatters\OptionalQuantityFormatter; class GetBlockTransactionCountByNumber extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetCode.php b/src/Methods/Eth/GetCode.php index 425163c..35db4aa 100644 --- a/src/Methods/Eth/GetCode.php +++ b/src/Methods/Eth/GetCode.php @@ -13,11 +13,25 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Validators\AddressValidator; use Web3\Formatters\AddressFormatter; use Web3\Formatters\OptionalQuantityFormatter; class GetCode extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + AddressValidator::class, [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetCompilers.php b/src/Methods/Eth/GetCompilers.php new file mode 100644 index 0000000..0f6cfb4 --- /dev/null +++ b/src/Methods/Eth/GetCompilers.php @@ -0,0 +1,58 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; + +class GetCompilers extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = []; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetFilterChanges.php b/src/Methods/Eth/GetFilterChanges.php new file mode 100644 index 0000000..c3534bb --- /dev/null +++ b/src/Methods/Eth/GetFilterChanges.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\QuantityFormatter; + +class GetFilterChanges extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetFilterLogs.php b/src/Methods/Eth/GetFilterLogs.php new file mode 100644 index 0000000..71d9de8 --- /dev/null +++ b/src/Methods/Eth/GetFilterLogs.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\QuantityFormatter; + +class GetFilterLogs extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetLogs.php b/src/Methods/Eth/GetLogs.php new file mode 100644 index 0000000..a068ebd --- /dev/null +++ b/src/Methods/Eth/GetLogs.php @@ -0,0 +1,61 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\FilterValidator; + +class GetLogs extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + FilterValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetStorageAt.php b/src/Methods/Eth/GetStorageAt.php index 752f7bb..2d6b8da 100644 --- a/src/Methods/Eth/GetStorageAt.php +++ b/src/Methods/Eth/GetStorageAt.php @@ -13,12 +13,26 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Validators\AddressValidator; use Web3\Formatters\AddressFormatter; use Web3\Formatters\QuantityFormatter; use Web3\Formatters\OptionalQuantityFormatter; class GetStorageAt extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + AddressValidator::class, QuantityValidator::class, [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetTransactionByBlockHashAndIndex.php b/src/Methods/Eth/GetTransactionByBlockHashAndIndex.php index 5d67117..4aecba9 100644 --- a/src/Methods/Eth/GetTransactionByBlockHashAndIndex.php +++ b/src/Methods/Eth/GetTransactionByBlockHashAndIndex.php @@ -13,11 +13,22 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; +use Web3\Validators\QuantityValidator; use Web3\Formatters\HexFormatter; use Web3\Formatters\QuantityFormatter; class GetTransactionByBlockHashAndIndex extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class, QuantityValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetTransactionByBlockNumberAndIndex.php b/src/Methods/Eth/GetTransactionByBlockNumberAndIndex.php index f348948..5ec7e81 100644 --- a/src/Methods/Eth/GetTransactionByBlockNumberAndIndex.php +++ b/src/Methods/Eth/GetTransactionByBlockNumberAndIndex.php @@ -13,11 +13,24 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; use Web3\Formatters\OptionalQuantityFormatter; use Web3\Formatters\QuantityFormatter; class GetTransactionByBlockNumberAndIndex extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + [ + TagValidator::class, QuantityValidator::class + ], QuantityValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetTransactionByHash.php b/src/Methods/Eth/GetTransactionByHash.php index 7413d31..8d5c60a 100644 --- a/src/Methods/Eth/GetTransactionByHash.php +++ b/src/Methods/Eth/GetTransactionByHash.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; use Web3\Formatters\HexFormatter; class GetTransactionByHash extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetTransactionCount.php b/src/Methods/Eth/GetTransactionCount.php index 233d9e0..6c16d7c 100644 --- a/src/Methods/Eth/GetTransactionCount.php +++ b/src/Methods/Eth/GetTransactionCount.php @@ -13,11 +13,25 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Validators\AddressValidator; use Web3\Formatters\AddressFormatter; use Web3\Formatters\OptionalQuantityFormatter; class GetTransactionCount extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + AddressValidator::class, [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetTransactionReceipt.php b/src/Methods/Eth/GetTransactionReceipt.php new file mode 100644 index 0000000..6cd1fdf --- /dev/null +++ b/src/Methods/Eth/GetTransactionReceipt.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; +use Web3\Formatters\HexFormatter; + +class GetTransactionReceipt extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + HexFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetUncleByBlockHashAndIndex.php b/src/Methods/Eth/GetUncleByBlockHashAndIndex.php new file mode 100644 index 0000000..28c5d6d --- /dev/null +++ b/src/Methods/Eth/GetUncleByBlockHashAndIndex.php @@ -0,0 +1,66 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\HexFormatter; +use Web3\Formatters\QuantityFormatter; + +class GetUncleByBlockHashAndIndex extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class, QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + HexFormatter::class, QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetUncleByBlockNumberAndIndex.php b/src/Methods/Eth/GetUncleByBlockNumberAndIndex.php new file mode 100644 index 0000000..1b4e21b --- /dev/null +++ b/src/Methods/Eth/GetUncleByBlockNumberAndIndex.php @@ -0,0 +1,68 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\OptionalQuantityFormatter; +use Web3\Formatters\QuantityFormatter; + +class GetUncleByBlockNumberAndIndex extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + [ + TagValidator::class, QuantityValidator::class + ], QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + OptionalQuantityFormatter::class, QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/GetUncleCountByBlockHash.php b/src/Methods/Eth/GetUncleCountByBlockHash.php index 6cbde85..33da325 100644 --- a/src/Methods/Eth/GetUncleCountByBlockHash.php +++ b/src/Methods/Eth/GetUncleCountByBlockHash.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; use Web3\Formatters\HexFormatter; class GetUncleCountByBlockHash extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetUncleCountByBlockNumber.php b/src/Methods/Eth/GetUncleCountByBlockNumber.php index 177610f..5cb5569 100644 --- a/src/Methods/Eth/GetUncleCountByBlockNumber.php +++ b/src/Methods/Eth/GetUncleCountByBlockNumber.php @@ -13,10 +13,23 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TagValidator; +use Web3\Validators\QuantityValidator; use Web3\Formatters\OptionalQuantityFormatter; class GetUncleCountByBlockNumber extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + [ + TagValidator::class, QuantityValidator::class + ] + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/GetWork.php b/src/Methods/Eth/GetWork.php new file mode 100644 index 0000000..092edba --- /dev/null +++ b/src/Methods/Eth/GetWork.php @@ -0,0 +1,58 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; + +class GetWork extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = []; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/Hashrate.php b/src/Methods/Eth/Hashrate.php index 3d49685..a08d6ab 100644 --- a/src/Methods/Eth/Hashrate.php +++ b/src/Methods/Eth/Hashrate.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class Hashrate extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/Mining.php b/src/Methods/Eth/Mining.php index c7688e5..71c22f3 100644 --- a/src/Methods/Eth/Mining.php +++ b/src/Methods/Eth/Mining.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class Mining extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/NewBlockFilter.php b/src/Methods/Eth/NewBlockFilter.php new file mode 100644 index 0000000..863ce2c --- /dev/null +++ b/src/Methods/Eth/NewBlockFilter.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\QuantityFormatter; + +class NewBlockFilter extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/NewFilter.php b/src/Methods/Eth/NewFilter.php new file mode 100644 index 0000000..17e3a09 --- /dev/null +++ b/src/Methods/Eth/NewFilter.php @@ -0,0 +1,61 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\FilterValidator; + +class NewFilter extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + FilterValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/NewPendingTransactionFilter.php b/src/Methods/Eth/NewPendingTransactionFilter.php new file mode 100644 index 0000000..29657fe --- /dev/null +++ b/src/Methods/Eth/NewPendingTransactionFilter.php @@ -0,0 +1,58 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; + +class NewPendingTransactionFilter extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = []; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/ProtocolVersion.php b/src/Methods/Eth/ProtocolVersion.php index d95c624..032739e 100644 --- a/src/Methods/Eth/ProtocolVersion.php +++ b/src/Methods/Eth/ProtocolVersion.php @@ -17,6 +17,13 @@ use Web3\Formatters\BigNumberFormatter; class ProtocolVersion extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/SendRawTransaction.php b/src/Methods/Eth/SendRawTransaction.php index 9fcb742..8508200 100644 --- a/src/Methods/Eth/SendRawTransaction.php +++ b/src/Methods/Eth/SendRawTransaction.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\HexValidator; use Web3\Formatters\HexFormatter; class SendRawTransaction extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + HexValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/SendTransaction.php b/src/Methods/Eth/SendTransaction.php index 4bbb576..990810b 100644 --- a/src/Methods/Eth/SendTransaction.php +++ b/src/Methods/Eth/SendTransaction.php @@ -13,10 +13,20 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\TransactionValidator; use Web3\Formatters\TransactionFormatter; class SendTransaction extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + TransactionValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/Sign.php b/src/Methods/Eth/Sign.php index dcc3c07..0509566 100644 --- a/src/Methods/Eth/Sign.php +++ b/src/Methods/Eth/Sign.php @@ -13,11 +13,22 @@ namespace Web3\Methods\Eth; use InvalidArgumentException; use Web3\Methods\EthMethod; +use Web3\Validators\AddressValidator; +use Web3\Validators\HexValidator; use Web3\Formatters\AddressFormatter; use Web3\Formatters\HexFormatter; class Sign extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = [ + AddressValidator::class, HexValidator::class + ]; + /** * inputFormatters * diff --git a/src/Methods/Eth/SubmitHashrate.php b/src/Methods/Eth/SubmitHashrate.php new file mode 100644 index 0000000..b365a19 --- /dev/null +++ b/src/Methods/Eth/SubmitHashrate.php @@ -0,0 +1,61 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\BlockHashValidator; + +class SubmitHashrate extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + BlockHashValidator::class, BlockHashValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = []; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/SubmitWork.php b/src/Methods/Eth/SubmitWork.php new file mode 100644 index 0000000..44200cf --- /dev/null +++ b/src/Methods/Eth/SubmitWork.php @@ -0,0 +1,65 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\NonceValidator; +use Web3\Validators\BlockHashValidator; +use Web3\Formatters\QuantityFormatter; + +class SubmitWork extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + NonceValidator::class, BlockHashValidator::class, BlockHashValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/src/Methods/Eth/Syncing.php b/src/Methods/Eth/Syncing.php index 0628394..3713320 100644 --- a/src/Methods/Eth/Syncing.php +++ b/src/Methods/Eth/Syncing.php @@ -16,6 +16,13 @@ use Web3\Methods\EthMethod; class Syncing extends EthMethod { + /** + * validators + * + * @var array + */ + protected $validators = []; + /** * inputFormatters * diff --git a/src/Methods/Eth/UninstallFilter.php b/src/Methods/Eth/UninstallFilter.php new file mode 100644 index 0000000..a9863ef --- /dev/null +++ b/src/Methods/Eth/UninstallFilter.php @@ -0,0 +1,64 @@ + + * + * @author Peter Lai + * @license MIT + */ + +namespace Web3\Methods\Eth; + +use InvalidArgumentException; +use Web3\Methods\EthMethod; +use Web3\Validators\QuantityValidator; +use Web3\Formatters\QuantityFormatter; + +class UninstallFilter extends EthMethod +{ + /** + * validators + * + * @var array + */ + protected $validators = [ + QuantityValidator::class + ]; + + /** + * inputFormatters + * + * @var array + */ + protected $inputFormatters = [ + QuantityFormatter::class + ]; + + /** + * outputFormatters + * + * @var array + */ + protected $outputFormatters = []; + + /** + * defaultValues + * + * @var array + */ + protected $defaultValues = []; + + /** + * construct + * + * @param string $method + * @param array $arguments + * @return void + */ + // public function __construct($method='', $arguments=[]) + // { + // parent::__construct($method, $arguments); + // } +} \ No newline at end of file diff --git a/test/unit/EthApiTest.php b/test/unit/EthApiTest.php index 8d4092f..8c1ee63 100644 --- a/test/unit/EthApiTest.php +++ b/test/unit/EthApiTest.php @@ -4,6 +4,7 @@ namespace Test\Unit; use RuntimeException; use Test\TestCase; +use phpseclib\Math\BigInteger as BigNumber; class EthApiTest extends TestCase { @@ -39,7 +40,7 @@ class EthApiTest extends TestCase if ($err !== null) { return $this->fail($err->getMessage()); } - $this->assertTrue(is_string($version)); + $this->assertTrue($version instanceof BigNumber); }); }