Package genlayer.py.types#

Warning

This is an internal module

Module that provides aliases for storage types and blockchain-specific types

class genlayer.py.types.Address[source]#

Represents GenLayer Address

SIZE: Final[int] = 20#

Constant that represents size of a Genlayer address

__init__(val: str | Buffer)[source]#
Parameters:

val (str | Buffer) – either a hex encoded address (that starts with ‘0x’), or base64 encoded address, or buffer of 20 bytes

Warning

checksum validation is not performed

property as_b64: str#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_b64
'WzjaanAcVoVF3PywP8uHX1a+3cQ='
Returns:

base64 representation of an address (most compact string)

property as_bytes: bytes#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_bytes
b'[8\xdajp\x1cV\x85E\xdc\xfc\xb0?\xcb\x87_V\xbe\xdd\xc4'
Returns:

raw bytes of an address (most compact representation)

property as_hex: str#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_hex
'0x5B38Da6a701c568545dCfcB03FcB875f56beddC4'
Returns:

checksum string representation

property as_int: u160#
>>> Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_int
1123907236495940146162314350759402901750813440091
>>> hex(Address('0x5b38da6a701c568545dcfcb03fcb875f56beddc4').as_int)
'0xc4ddbe565f87cb3fb0fcdc4585561c706ada385b'
Returns:

int representation of an address (unsigned little endian)

class genlayer.py.types.Lazy[source]#

Base class to support lazy evaluation

__init__(_eval: Callable[[], T])[source]#
get() T[source]#

Performs evaluation if necessary (only ones) and stores the result

Returns:

result of evaluating

Raises:

iff evaluation raised, this outcome is also cached, so subsequent calls will raise same exception

Return type:

T

exception genlayer.py.types.Rollback[source]#

Exception that will be treated as a “Rollback”

__init__(msg: str)[source]#
class genlayer.py.types.SizedArray[source]#
__init__(*args, **kwargs)#
class genlayer.py.types.bigint#

Just an alias for int, it is introduced to prevent accidental use of low-performance big integers in the store

alias of int

class genlayer.py.types.u256#

Alias for int that is used for typing

alias of int