Type stubs for simular-evm
Fully documented type annotations for PyEvm and PyAbi in simular-evm
Contents
from typing import Optional, Tuple
class DynSolTypeWrapper:
"""Decode output from function"""
class PyEvm:
"""An in-memory EVM"""
def __new__() -> PyEvm:
"""Create an in-memory EVM"""
def call(
self,
fn_name: str,
args: str,
to: str,
abi: PyAbi,
) -> object:
"""
Transaction (read) operation to a contract at the given address `to`.
This will NOT change state in the EVM.
"""
def simulate(
self,
fn_name: str,
args: str,
caller: str,
to: str,
value: int,
abi: PyAbi,
) -> object:
"""
Transaction operation to a contract at the given address `to`.
This can simulate a transact/call operation, but will NOT change state in the EVM.
"""
def deploy(self, args: str, caller: str, value: int, abi: PyAbi) -> str:
"""Deploy a contract"""
def transact(
self,
fn_name: str,
args: str,
caller: str,
to: str,
value: int,
abi: PyAbi,
) -> object: # TODO: figure out the return type, and the "py: Python<'_>" argument
"""
Transaction (write) operation to a contract at the given address `to`.
This will change state in the EVM.
"""
@staticmethod
def from_fork(url: str, blocknumber: Optional[int] = None) -> PyEvm:
"""Create a fork EVM"""
@staticmethod
def from_snapshot(snapshot: str) -> PyEvm:
"""Create an in-memory EVM from a `SnapShot`"""
def create_snapshot(self) -> str:
"""Create a `SnapShot` of the current EVM state"""
def create_account(self, address: str, balance: Optional[int] = None) -> None:
"""Create account with an initial balance"""
def get_balance(self, address: str) -> int:
"""Get the balance of the given user"""
def transfer(self, caller: str, to: str, amount: int) -> None:
"""Transfer the amount of value from `caller` to the given recipient `to`."""
class PyAbi:
"""
Can load and parse ABI information.
Used in `Contract.py` to process function calls.
"""
def bytecode(self) -> list[int]:
"""Return the contract bytecode"""
def encode_constructor(self, args: str) -> Tuple[list[int], bool]:
"""
Encode constructor arguments.
Returns the encoded args, and whether the constructor is payable
"""
def encode_function(
self, name: str, args: str
) -> Tuple[list[int], bool, DynSolTypeWrapper]:
"""
Encode the arguments for a specific function.
Returns:
- `encoded args`
- `is the function payable?`
- `DynSolType` to decode output from function
"""
@staticmethod
def from_abi_bytecode(abi: str, bytes: Optional[bytes]) -> PyAbi:
"""Load from the un-parsed json `abi` and optionally `bytecode`"""
@staticmethod
def from_full_json(abi: str) -> PyAbi:
"""
Load a complete ABI file from a compiled Solidity contract.
This is a raw un-parsed json file that includes both `abi` and `bytecode`.
"""
@staticmethod
def from_human_readable(values: list[str]) -> PyAbi:
"""
Create an ABI by providing shortened definitions of the functions of interest.
## Example:
`["function hello() (uint256)"]` creates the function `hello` that can be encoded/decoded for calls to the Evm.
"""
def has_fallback(self) -> bool:
"""Does the Contract have a fallback function?"""
def has_function(self, name: str) -> bool:
"""Does the ABI contain the function `name`?"""
def has_receive(self) -> bool:
"""Does the contract have a receive function?"""
Metadata
Release files for simular-eth-stubs 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| simular-eth-stubs-0.0.7.tar.gz | 3.7 kB | Without provenance | Details |
Release files / simular-eth-stubs-0.0.7.tar.gz
| Download URL | simular-eth-stubs-0.0.7.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
345e7162ffdd296f471cc116b136017c15f83dacb90a72da6ae79334775cfa2f
|
|
BLAKE2b-256 checksum How to use checksums |
f822a7b84ded52f2d3743e6b45542cb8f65002f29d7da559a2103d69b9faef5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.9.2
|
Security for simular-eth-stubs 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.