Ether Binder
Set of utilities for interacting with Ethereum and it's smart contracts with PHP, with generating ABI bindings and Ethereum-related types
Loading...
Searching...
No Matches
M8B\EtherBinder\Contract\ABIGen Class Reference

Static Public Member Functions

static generate (string $fullyQualifiedClassName, array $abi, ?string $compiledBlob=null)
 

Protected Member Functions

 __construct (array $abi, protected ?string $compiledBlob=null)
 
 gen (string $fullyQualifiedClassName)
 
 generateEventClasses (string $namespace)
 
 generateTuples (string $namespace)
 
 buildMethodParams (string $fnName, array $inputs, BuilderFactory $bld)
 
 buildTupleSignatureFromTuple (array $tupleAbiData)
 
 getPhpTypingFromType (string $type, string $internalType)
 
 prepareOutputTupleInfo (array $abiOutputs, string $namespace)
 
 innerPrepareOutputTupleInfo (array $abiOutputs, string $namespace)
 
 getPhpTypingFromOutputs (array $outputs)
 
 tupleInternalTypeToType (string $internalName)
 
 registerTuple (array $tupleData)
 

Protected Attributes

array $abiFunctions
 
array $abiEvents
 
array $abiConstructor
 
string $className
 
array $tuplesRegistry = []
 
const autogenWarning =
 
const throwsCommentDeploy =
 
const throwsCommentCall =
 
const throwsCommentTransact =
 
const throwsCommentFilterFetch =
 

Detailed Description

Core class for generating ABI bindings.

Author
DubbaThony

Constructor & Destructor Documentation

◆ __construct()

M8B\EtherBinder\Contract\ABIGen::__construct ( array $abi,
protected ?string $compiledBlob = null )
protected
Exceptions
EthBinderArgumentException

Member Function Documentation

◆ buildMethodParams()

M8B\EtherBinder\Contract\ABIGen::buildMethodParams ( string $fnName,
array $inputs,
BuilderFactory $bld )
protected
Returns
array{params: Param[], names: string[], validators: Assign[], signature: string}
Exceptions
NotSupportedException

◆ gen()

M8B\EtherBinder\Contract\ABIGen::gen ( string $fullyQualifiedClassName)
protected
Exceptions
NotSupportedException
EthBinderArgumentException

◆ generate()

static M8B\EtherBinder\Contract\ABIGen::generate ( string $fullyQualifiedClassName,
array $abi,
?string $compiledBlob = null )
static

This function returns array of generated bindings code. Bindings include tuples, events and contract.

Output array shape is: [ "contract" => "<?php root source code", "events" => [ "PHPClassName" => "<?php event source code", "PHPClassName" => "<?php event source code" ] "tuples" => [ "PHPClassName" => "<?php tuple source code" ] ]

ABIGen accepts 2 files, one is ABI JSON file, which is required, and should be sourced from solidity

LIMITATIONS: currently event allows parsing event data into appropriate object (to "events" sub-array class). There is a rare case of having events that emit indexed dynamic data such as strings, arrays or tuples. Solidity in such case returns keccak256 hash of such data, not the data itself, making the data itself unrecoverable. If the ABIGen stumbles upon such event, it will throw NotSupportedException. Such events are not supported. In pinch, it's OK to remove the event from ABI JSON manually, but of course, such events will not be parsed.

Exceptions
NotSupportedException
EthBinderArgumentException

◆ generateEventClasses()

M8B\EtherBinder\Contract\ABIGen::generateEventClasses ( string $namespace)
protected
Exceptions
NotSupportedException
GlobalException

◆ generateTuples()

M8B\EtherBinder\Contract\ABIGen::generateTuples ( string $namespace)
protected
Exceptions
NotSupportedException

◆ getPhpTypingFromOutputs()

M8B\EtherBinder\Contract\ABIGen::getPhpTypingFromOutputs ( array $outputs)
protected
Exceptions
NotSupportedException

◆ getPhpTypingFromType()

M8B\EtherBinder\Contract\ABIGen::getPhpTypingFromType ( string $type,
string $internalType )
protected
Exceptions
NotSupportedException

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