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

Public Member Functions

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 ()
 

Static Public Member Functions

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')
 

Protected Attributes

 $value
 
 $abi
 

Detailed Description

Basic Ethereum data types.

Can be bool, integer, data, lists, arrays...

See also
: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI#types

Definition at line 15 of file EthD.php.

Constructor & Destructor Documentation

◆ __construct()

const const __construct (   $val,
array  $params = [] 
)

Constructor.

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

Definition at line 143 of file EthD.php.

References EthDataType\setValue().

+ Here is the call graph for this function:

Member Function Documentation

◆ convertByAbi()

convertByAbi (   $abiType)

Convert EthD value into ABI expected value.

Deprecated:
Prefer Abi::convertByAbi(string $abiType, EthD $value)
Parameters
string$abiTypeExpected Abi type.
Exceptions

Definition at line 164 of file EthD.php.

References Abi\convertByAbi().

+ Here is the call graph for this function:

◆ convertTo()

convertTo (   $type)

Turn value into Expected value.

Deprecated:
This function will be removed ans should not be used. Pleas switch toconvertByAbi($abiType).
Parameters
string$typeExpected Abi type.
Returns
object Return object of the expected data type.

Definition at line 325 of file EthD.php.

References EthD\hexVal(), and EthD\typeMap().

+ Here is the call graph for this function:

◆ encodedHexVal()

encodedHexVal ( )
Returns
string

Definition at line 376 of file EthD.php.

References EthD\$value.

◆ getPrimitiveTypes()

static getPrimitiveTypes ( )
static

Get an Array of all EthD based data types.

Todo:
Implement all EthD data types.
Returns
array

Definition at line 236 of file EthD.php.

Referenced by EthDataType\getAllTypeClasses().

+ Here is the caller graph for this function:

◆ getSchemaType()

static getSchemaType ( )
static

Get schema type of a primitive data type..

Returns
string Returns the CLass name of the type or The schema name if $schema is TRUE.
Exceptions
Exception

Definition at line 302 of file EthD.php.

◆ getTypeArray()

static getTypeArray ( )
static

Array of properties.

For primitive types the property is always 'value'.

Returns
array Return object of the expected data type.

Definition at line 340 of file EthD.php.

◆ hexVal()

hexVal ( )

Return hex value. Padded and prefixed.

Returns
string Prefixed Hex value.

Definition at line 368 of file EthD.php.

References EthD\$value.

Referenced by Abi\convertByAbi(), EthD\convertTo(), Abi\decodeMethod(), and Ethereum\personalEcRecover().

+ Here is the caller graph for this function:

◆ isPrimitive()

static isPrimitive ( )
static

Check if Type is a primitive type.

Returns
bool True if data type is primitive.

Implements EthDataTypeInterface.

Definition at line 247 of file EthD.php.

◆ reverseTypeMap()

static reverseTypeMap (   $class_name)
static

Reverse type SCHEMA_MAP (SCHEMA_MAP)

Parameters
string$class_nameClassname of the type.
Returns
string Schema name of the type.
Exceptions
Exception

Definition at line 283 of file EthD.php.

◆ toArray()

toArray ( )

Converts object to an array.

Returns
array Return object of the expected data type.

Implements EthDataTypeInterface.

Definition at line 353 of file EthD.php.

◆ typeMap()

static typeMap ( string  $type)
static

SCHEMA_MAP types.

Parameters
string$typeSchema name of data type.
Returns
string|bool Class name of data type or NULL if not exists.

Definition at line 261 of file EthD.php.

Referenced by Ethereum\__construct(), EthD\convertTo(), and EthDataType\getTypeClass().

+ Here is the caller graph for this function:

◆ val()

val ( )

Return un-prefixed and un-padded hex value.

Subclasses may return other types.

Returns
string Un-prefixed Hex value.

Definition at line 389 of file EthD.php.

◆ validateHexString()

validateHexString (   $val)

Validate hex string for Hex letters.

Todo:
This might be moved to EthereumStatic.
Parameters
string$valPrefixed Hexadecimal String.
Returns
bool Return TRUE if value contains only Hex digits.
Exceptions
InvalidArgumentExceptionIf value contains non Hexadecimal characters.

Definition at line 217 of file EthD.php.

Referenced by EthD\validate().

+ Here is the caller graph for this function:

Member Data Documentation

◆ $abi

$abi
protected

Definition at line 20 of file EthD.php.

◆ $value

$value
protected

Definition at line 18 of file EthD.php.

Referenced by EthD\encodedHexVal(), EthBytes\hexVal(), EthD\hexVal(), and EthS\val().


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