Documentation

Encoder
in package

Encoder of RLP format capable of working with both binary and hex outputs. Internally works on binary.

Tags
author

DubbaThony

Table of Contents

Methods

encodeBin()  : string
Converts data to RLP Accepts array (recursively - can contain sub-arrays, sub-sub-arrays, etc.) of 0x-hex strings, ints, Hash (and children) types.
encodeHex()  : string
Converts data to RLP Accepts array (recursively - can contain sub-arrays, sub-sub-arrays, etc.) of 0x-hex strings, ints, Hash (and children) types.
encodeArray()  : string
encodeBinaryVal()  : string
encodeHash()  : string
encodeInt()  : string
encodeLength()  : string
encodeOOGmp()  : string
encodeString()  : string

Methods

encodeBin()

Converts data to RLP Accepts array (recursively - can contain sub-arrays, sub-sub-arrays, etc.) of 0x-hex strings, ints, Hash (and children) types.

public static encodeBin(array<string|int, mixed> $input) : string

All non-hex-strings will be converted to hex strings as actual strings (ie. "foo" will be 0x666f6f - 102, 111, 111). Entire input will NOT be wrapped with array, as some might expect. If you require this (ie. legacy transactions), wrap the input on caller side

Parameters
$input : array<string|int, mixed>

data to be encoded

Return values
string

binary blob of encoded data

encodeHex()

Converts data to RLP Accepts array (recursively - can contain sub-arrays, sub-sub-arrays, etc.) of 0x-hex strings, ints, Hash (and children) types.

public static encodeHex(array<string|int, mixed> $input) : string

All non-hex-strings will be converted to hex strings as actual strings (ie. "foo" will be 0x666f6f - 102, 111, 111). Entire input will NOT be wrapped with array, as some might expect. If you require this (ie. legacy transactions), wrap the input on caller side

Parameters
$input : array<string|int, mixed>

data to be encoded

Return values
string

hex representation of encoded data

encodeArray()

private static encodeArray(array<string|int, mixed> $input) : string
Parameters
$input : array<string|int, mixed>
Return values
string

encodeBinaryVal()

private static encodeBinaryVal(string $input) : string
Parameters
$input : string
Return values
string

encodeHash()

private static encodeHash(Hash $input) : string
Parameters
$input : Hash
Return values
string

encodeInt()

private static encodeInt(int $input) : string
Parameters
$input : int
Return values
string

encodeLength()

private static encodeLength(int $length, int $base) : string
Parameters
$length : int
$base : int
Return values
string

encodeOOGmp()

private static encodeOOGmp(OOGmp $input) : string
Parameters
$input : OOGmp
Return values
string

encodeString()

private static encodeString(string $input) : string
Parameters
$input : string
Return values
string

        
On this page

Search results