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

Public Member Functions

 __construct (array $abi)
 
 encodeFunction (string $methodName, array $values)
 
 decodeMethod (string $method, EthD $rawReturn)
 
 getParamDefinition (string $methodName)
 
 getEvents ()
 
 getEventsByTopic ()
 

Static Public Member Functions

static convertByAbi (string $abiType, EthD $value)
 
- 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')
 

Detailed Description

Definition at line 9 of file Abi.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( array  $abi)

Abi constructor.

Parameters
array$abi

Definition at line 22 of file Abi.php.

References $abi.

Member Function Documentation

◆ convertByAbi()

static convertByAbi ( string  $abiType,
EthD  $value 
)
static

Convert EthD value into ABI expected value.

Todo:
Not fully implemented. Requires full test coverage.

This function maps the Ethereum data type ABI to the Ethereum<Class>

https://solidity.readthedocs.io/en/develop/abi-spec.html#types

Other implementations: https://github.com/ethereumjs/ethereumjs-abi/blob/71f123b676f2b2d81bc20f343670d90045a3d3d8/lib/index.js#L427-L485 https://github.com/Nethereum/Nethereum/blob/9eb30b298a28634d41034c1cc4b1c0354a37c175/src/Nethereum.ABI/ABIType.cs#L34-L58

Test examples: https://github.com/ethereumjs/ethereumjs-abi/blob/master/test/index.js https://github.com/ethereum/web3.js/blob/master/test/coder.encodeParam.js https://github.com/ethereum/web3.js/blob/master/test/coder.decodeParam.js

Parameters
string$abiTypeExpected Abi type.
EthD$valueExpected Abi type.
Exceptions
Todo:
Todo:

Definition at line 206 of file Abi.php.

References EthD\hexVal().

Referenced by EthD\convertByAbi().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decodeMethod()

decodeMethod ( string  $method,
EthD  $rawReturn 
)

Decode return values of Abi $method.

Parameters
$method
$rawReturn
Exceptions

Definition at line 65 of file Abi.php.

References EthD\hexVal().

+ Here is the call graph for this function:

◆ encodeFunction()

encodeFunction ( string  $methodName,
array  $values 
)
Parameters
$methodName
$valuesarray
Returns
EthD
Exceptions

Definition at line 36 of file Abi.php.

◆ getEvents()

getEvents ( )

Get all events from ABI.

Returns
Event[]

Definition at line 235 of file Abi.php.

◆ getEventsByTopic()

getEventsByTopic ( )

Array of Events by topic.

Returns
Event[]
Exceptions

Definition at line 256 of file Abi.php.

◆ getParamDefinition()

getParamDefinition ( string  $methodName)

Filter Abi for a given Method and return the definition.

Parameters
$methodNamestring
Returns
Object
Exceptions

Definition at line 141 of file Abi.php.


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