Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
EthBlockParam Class Reference
+ Inheritance diagram for EthBlockParam:
+ Collaboration diagram for EthBlockParam:

Public Member Functions

 __construct ($val='latest', array $params=[])
 
 validate ($val, array $params)
 
 val ()
 
 hexVal ()
 
- Public Member Functions inherited from EthQ
 __construct ($val, array $params=[])
 
 validate ($val, array $params)
 
 hexVal ()
 
 hexValUnpadded ()
 
 getLength ($abi)
 
 isNegative ($abi=false)
 
 isLargeNumber (Math_BigInteger $val)
 
 val ()
 
 encodedHexVal ()
 
 isNotNull ()
 
 getAbi ()
 
- Public Member Functions inherited from EthD
const const __construct ($val, array $params=[])
 
 convertByAbi ($abiType)
 
 validate ($val, array $params)
 
 validateHexString ($val)
 
 convertTo ($type)
 
 toArray ()
 
 hexVal ()
 
 encodedHexVal ()
 
 val ()
 
- Public Member Functions inherited from EthDataType
 getProperty (string $property='value', bool $returnHexVal=false)
 
 setValue ($val, array $params=[])
 
 getClassName ()
 

Public Attributes

const TAGS
 
- Public Attributes inherited from EthQ
 $value
 
const HEXPADDING = 64
 

Protected Member Functions

 isTag ($val=false)
 
 validateAddress ($val, array $params)
 
- Protected Member Functions inherited from EthQ
 getAbiFromNumber (Math_BigInteger $number)
 
 validateAbi ($abi)
 

Additional Inherited Members

- Static Public Member Functions inherited from EthQ
static getValidLengths ()
 
static getDataLengthType ()
 
- Static Public Member Functions inherited from EthD
static getPrimitiveTypes ()
 
static isPrimitive ()
 
static typeMap (string $type)
 
static reverseTypeMap ($class_name)
 
static getSchemaType ()
 
static getTypeArray ()
 
- Static Public Member Functions inherited from EthDataType
const static getClassByAbi (string $abiType)
 
static getDataLengthType ()
 
static isPrimitive ()
 
static getTypeClass (string $type, bool $typed_constructor=false)
 
static getAllTypeClasses ()
 
- Static Public Member Functions inherited from EthereumStatic
static getMethodSignature ($input)
 
static phpKeccak256 ($string)
 
static sha3 ($string)
 
static isValidFunction ($input)
 
static getDefinition ()
 
static isValidHexQuantity ($str)
 
static isValidHexData ($str)
 
static isValidAddress ($address, $throw=false)
 
static hasHexPrefix ($str)
 
static removeHexPrefix ($str)
 
static ensureHexPrefix ($str)
 
static convertCurrency (float $amount, string $from='wei', string $to='ether')
 
- Static Protected Member Functions inherited from EthQ
static splitAbi ($abi)
 
- Protected Attributes inherited from EthQ
 $abi
 
- Protected Attributes inherited from EthD
 $value
 
 $abi
 

Detailed Description

Default block parameter.

See also
: https://github.com/ethereum/wiki/wiki/JSON-RPC#the-default-block-parameter.

Definition at line 11 of file EthBlockParam.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $val = 'latest',
array  $params = [] 
)

Constructor.

Parameters
string | int$valHexadecimal or number value.
array$paramsArray with optional parameters. Add Abi type $params['abi'] = 'unint8'.
Exceptions
InvalidArgumentException

Definition at line 28 of file EthBlockParam.php.

Member Function Documentation

◆ hexVal()

hexVal ( )

Return hex encoded block number or tag.

Returns
int|string|Math_BigInteger Return a PHP integer. If $val > PHP_INT_MAX we return a string containing the integer.

Definition at line 101 of file EthBlockParam.php.

References EthQ\$value, EthereumStatic\ensureHexPrefix(), and EthBlockParam\isTag().

+ Here is the call graph for this function:

◆ isTag()

isTag (   $val = false)
protected

Check if value is a block-tag.

Parameters
$valValue to check. Assuming $this->value if not given.
Returns
bool True if given value or $this->value is a tag.

Definition at line 85 of file EthBlockParam.php.

References EthQ\$value.

Referenced by EthBlockParam\hexVal(), EthBlockParam\val(), and EthBlockParam\validate().

+ Here is the caller graph for this function:

◆ val()

val ( )

Return un-prefixed bin value.

Returns
int|string|Math_BigInteger Return a PHP integer. If $val > PHP_INT_MAX we return a string containing the integer.

Definition at line 68 of file EthBlockParam.php.

References EthQ\$value, and EthBlockParam\isTag().

+ Here is the call graph for this function:

◆ validate()

validate (   $val,
array  $params 
)

Implement validation.

Parameters
string | int$valInteger block number.
array$paramsOnly $param['abi'] is relevant.
Exceptions
InvalidArgumentExceptionValue is not a valid block param
Returns
string.

Definition at line 45 of file EthBlockParam.php.

References EthBlockParam\isTag().

+ Here is the call graph for this function:

◆ validateAddress()

validateAddress (   $val,
array  $params 
)
protected

Call EthD20 validation to validate Address.

Exceptions
InvalidArgumentException

Definition at line 118 of file EthBlockParam.php.

Member Data Documentation

◆ TAGS

const TAGS
Initial value:
= [
"latest",
"earliest",
"pending",
]

Definition at line 13 of file EthBlockParam.php.


The documentation for this class was generated from the following file: