utils

Documentation for eth_defi.utils Python module.

Bunch of random utilities.

Module Attributes

ZERO_ADDRESS_STR

Ethereum 0x0000000000000000000000000000000000000000 address as a string

Functions

find_free_port([min_port, max_port, max_attempt])

Find a free localhost port to bind.

get_url_domain(url)

Redact URL so that only domain is displayed.

is_localhost_port_listening(port[, host])

Check if a localhost is running a server already.

sanitise_string(s)

Remove null characters.

setup_console_logging()

Set up coloured log output.

shutdown_hard(process[, log_level, block, ...])

Kill Psutil process.

to_unix_timestamp(dt)

Convert Python UTC datetime to UNIX seconds since epoch.