GanacheLaunch

Documentation for eth_defi.provider.ganache.GanacheLaunch Python class.

class GanacheLaunch[source]

Control ganache-cli processes launched on background.

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

Attributes summary

port

Which port was bound by the ganache

cmd

Used command-line to spin up ganache-cli

json_rpc_url

Where does Ganache listen to JSON-RPC

process

UNIX process that we opened

Methods summary

__init__(port, cmd, json_rpc_url, process)

close([verbose, block, block_timeout])

Kill the ganache-cli process.

port: int

Which port was bound by the ganache

cmd: List[str]

Used command-line to spin up ganache-cli

json_rpc_url: str

Where does Ganache listen to JSON-RPC

process: psutil.Popen

UNIX process that we opened

close(verbose=False, block=True, block_timeout=30)[source]

Kill the ganache-cli process.

Ganache is pretty hard to kill, so keep killing it until it dies and the port is free again.

Parameters
  • block – Block the execution until Ganache has terminated

  • block_timeout – How long we give for Ganache to clean up after itself

  • verbose – If set, dump anything in Ganache stdout to the Python logging using level INFO.

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

  • cmd (List[str]) –

  • json_rpc_url (str) –

  • process (psutil.Popen) –

Return type

None