AbiBytes
extends AbstractABIValue
in package
Base class for encoding and decoding ABI (Application Binary Interface) types for Ethereum contracts.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- __toString() : string
- Returns string representation of structure, for known sized arrays with prefix k, for unknown size u, works recursively. The stringified representation purpose is debugging - to see what data and structure was created by bindings etc. It's often more useful representation than print_r or var_dump (with or without XDebug).
- decodeBin() : int
- Decodes the binary data and updates the object(recursive).
- encodeBin() : string
- Encodes the ABI value to its binary representation (recursive).
- isDynamic() : bool
- Checks whether the ABI value is dynamic or not.
- parseValue() : AbstractABIValue
- Parse the ABI type and value and returns the corresponding AbstractABIValue object.
- splitTypeBits() : array<string|int, mixed>
- Splits the ABI type into its type and bit-length components. Also works for amount of bytes for non-dynamic bytes.
- unwrapToPhpFriendlyVals() : mixed
- Transforms the ABI value into a more PHP-friendly types, such as Common\Address, OOGmp, and such (recursive).
Properties
$data
protected
string|null
$data
$dynamic
protected
bool
$dynamic
$size
protected
int
$size
Methods
__construct()
public
__construct(string|null $data, int $size) : mixed
Parameters
- $data : string|null
- $size : int
__toString()
Returns string representation of structure, for known sized arrays with prefix k, for unknown size u, works recursively. The stringified representation purpose is debugging - to see what data and structure was created by bindings etc. It's often more useful representation than print_r or var_dump (with or without XDebug).
public
__toString() : string
Tags
Return values
string —stringified structure, for example (u[k[123,0xabcd],k[456,0x1234]],256)
decodeBin()
Decodes the binary data and updates the object(recursive).
public
decodeBin(string &$dataBin, int $globalOffset) : int
Parameters
- $dataBin : string
-
The binary data to be decoded.
- $globalOffset : int
-
The global offset in the binary data.
Tags
Return values
int —The new global offset.
encodeBin()
Encodes the ABI value to its binary representation (recursive).
public
encodeBin() : string
Tags
Return values
string —The binary-encoded string.
isDynamic()
Checks whether the ABI value is dynamic or not.
public
isDynamic() : bool
Tags
Return values
bool —True if dynamic, false otherwise.
parseValue()
Parse the ABI type and value and returns the corresponding AbstractABIValue object.
public
static parseValue(string $type, mixed $value) : AbstractABIValue
Parameters
- $type : string
-
The ABI type.
- $value : mixed
-
The value to be parsed.
Tags
Return values
AbstractABIValue —An instance of the parsed ABI type.
splitTypeBits()
Splits the ABI type into its type and bit-length components. Also works for amount of bytes for non-dynamic bytes.
public
static splitTypeBits(string $type) : array<string|int, mixed>
Parameters
- $type : string
-
The ABI type.
Return values
array<string|int, mixed>unwrapToPhpFriendlyVals()
Transforms the ABI value into a more PHP-friendly types, such as Common\Address, OOGmp, and such (recursive).
public
unwrapToPhpFriendlyVals(array<string|int, mixed>|null $tuplerData) : mixed
Parameters
- $tuplerData : array<string|int, mixed>|null
-
Data structure for wanted tuples, tightly related to ABIGen logic. Always null-safe.
Tags
Return values
mixed —The PHP-friendly value.