AnvilLaunch

Documentation for eth_defi.provider.anvil.AnvilLaunch Python class.

class AnvilLaunch[source]

Control Anvil processes launched on background.

Comes with a helpful close() method when it is time to put Anvil rest.

Attributes summary

port

Which port was bound by the Anvil

cmd

Used command-line to spin up anvil

json_rpc_url

Where does Anvil listen to JSON-RPC

process

UNIX process that we opened

Methods summary

__init__(port, cmd, json_rpc_url, process)

close([log_level, block, block_timeout])

Close the background Anvil process.

port: int

Which port was bound by the Anvil

cmd: list[str]

Used command-line to spin up anvil

json_rpc_url: str

Where does Anvil listen to JSON-RPC

process: psutil.Popen

UNIX process that we opened

close(log_level=None, block=True, block_timeout=30)[source]

Close the background Anvil process.

Parameters
  • log_level (Optional[int]) – Dump Anvil messages to logging

  • block – Block the execution until anvil is gone

  • block_timeout – How long time we try to kill Anvil until giving up.

Returns

Anvil stdout, stderr as string

Return type

tuple[bytes, bytes]

__init__(port, cmd, json_rpc_url, process)
Parameters
  • port (int) –

  • cmd (list[str]) –

  • json_rpc_url (str) –

  • process (psutil.Popen) –

Return type

None