code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def decode_calldata(self, abi: Union["ConstructorABI", "MethodABI"], calldata: bytes) -> dict:
"""
Decode method calldata.
Args:
abi (Union[ConstructorABI, MethodABI]): The method called.
calldata (bytes): The raw calldata bytes.
Returns:
Dict: A map... |
Decode method calldata.
Args:
abi (Union[ConstructorABI, MethodABI]): The method called.
calldata (bytes): The raw calldata bytes.
Returns:
Dict: A mapping of input names to decoded values.
If an input is anonymous, it should use the stringified... | decode_calldata | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def encode_calldata(self, abi: Union["ConstructorABI", "MethodABI"], *args: Any) -> HexBytes:
"""
Encode method calldata.
Args:
abi (Union[ConstructorABI, MethodABI]): The ABI of the method called.
*args (Any): The arguments given to the method.
Returns:
... |
Encode method calldata.
Args:
abi (Union[ConstructorABI, MethodABI]): The ABI of the method called.
*args (Any): The arguments given to the method.
Returns:
HexBytes: The encoded calldata of the arguments to the given method.
| encode_calldata | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def decode_returndata(self, abi: "MethodABI", raw_data: bytes) -> Any:
"""
Get the result of a contract call.
Arg:
abi (MethodABI): The method called.
raw_data (bytes): Raw returned data.
Returns:
Any: All of the values returned from the contract fun... |
Get the result of a contract call.
Arg:
abi (MethodABI): The method called.
raw_data (bytes): Raw returned data.
Returns:
Any: All of the values returned from the contract function.
| decode_returndata | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def get_deployment_address( # type: ignore[empty-body]
self,
address: AddressType,
nonce: int,
) -> AddressType:
"""
Calculate the deployment address of a contract before it is deployed.
This is useful if the address is an argument to another contract's deployment
... |
Calculate the deployment address of a contract before it is deployed.
This is useful if the address is an argument to another contract's deployment
and you have not yet deployed the first contract yet.
| get_deployment_address | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def get_network(self, network_name: str) -> "NetworkAPI":
"""
Get the network for the given name.
Args:
network_name (str): The name of the network to get.
Raises:
:class:`~ape.exceptions.NetworkNotFoundError`: When the network is not present.
Returns:
... |
Get the network for the given name.
Args:
network_name (str): The name of the network to get.
Raises:
:class:`~ape.exceptions.NetworkNotFoundError`: When the network is not present.
Returns:
:class:`~ape.api.networks.NetworkAPI`
| get_network | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def get_network_data(
self, network_name: str, provider_filter: Optional[Collection[str]] = None
) -> dict:
"""
Get a dictionary of data about providers in the network.
**NOTE**: The keys are added in an opinionated order for nicely
translating into ``yaml``.
Args:
... |
Get a dictionary of data about providers in the network.
**NOTE**: The keys are added in an opinionated order for nicely
translating into ``yaml``.
Args:
network_name (str): The name of the network to get provider data from.
provider_filter (Optional[Collection... | get_network_data | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def get_python_types( # type: ignore[empty-body]
self, abi_type: "ABIType"
) -> Union[type, Sequence]:
"""
Get the Python types for a given ABI type.
Args:
abi_type (``ABIType``): The ABI type to get the Python types for.
Returns:
Union[Type, Sequen... |
Get the Python types for a given ABI type.
Args:
abi_type (``ABIType``): The ABI type to get the Python types for.
Returns:
Union[Type, Sequence]: The Python types for the given ABI type.
| get_python_types | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def decode_custom_error(
self,
data: HexBytes,
address: AddressType,
**kwargs,
) -> Optional[CustomError]:
"""
Decode a custom error class from an ABI defined in a contract.
Args:
data (HexBytes): The error data containing the selector
... |
Decode a custom error class from an ABI defined in a contract.
Args:
data (HexBytes): The error data containing the selector
and input data.
address (AddressType): The address of the contract containing
the error.
**kwargs: Additional ini... | decode_custom_error | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def chain_id(self) -> int:
"""
The ID of the blockchain.
**NOTE**: Unless overridden, returns same as
:py:attr:`ape.api.providers.ProviderAPI.chain_id`.
"""
if (
self.provider.network.name == self.name
and self.provider.network.ecosystem.name == s... |
The ID of the blockchain.
**NOTE**: Unless overridden, returns same as
:py:attr:`ape.api.providers.ProviderAPI.chain_id`.
| chain_id | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def transaction_acceptance_timeout(self) -> int:
"""
The amount of time to wait for a transaction to be accepted on the network.
Does not include waiting for block-confirmations. Defaults to two minutes.
Local networks use smaller timeouts.
"""
return self.config.get(
... |
The amount of time to wait for a transaction to be accepted on the network.
Does not include waiting for block-confirmations. Defaults to two minutes.
Local networks use smaller timeouts.
| transaction_acceptance_timeout | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def explorer(self) -> Optional["ExplorerAPI"]:
"""
The block-explorer for the given network.
Returns:
:class:`ape.api.explorers.ExplorerAPI`, optional
"""
chain_id = None if self.network_manager.active_provider is None else self.provider.chain_id
for plugin_n... |
The block-explorer for the given network.
Returns:
:class:`ape.api.explorers.ExplorerAPI`, optional
| explorer | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def is_mainnet(self) -> bool:
"""
True when the network is the mainnet network for the ecosystem.
"""
cfg_is_mainnet: Optional[bool] = self.config.get("is_mainnet")
if cfg_is_mainnet is not None:
return cfg_is_mainnet
return self.name == "mainnet" |
True when the network is the mainnet network for the ecosystem.
| is_mainnet | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def providers(self): # -> dict[str, Partial[ProviderAPI]]
"""
The providers of the network, such as Infura, Alchemy, or Node.
Returns:
dict[str, partial[:class:`~ape.api.providers.ProviderAPI`]]
"""
providers = {}
for _, plugin_tuple in self._get_plugin_prov... |
The providers of the network, such as Infura, Alchemy, or Node.
Returns:
dict[str, partial[:class:`~ape.api.providers.ProviderAPI`]]
| providers | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def get_provider(
self,
provider_name: Optional[str] = None,
provider_settings: Optional[dict] = None,
connect: bool = False,
):
"""
Get a provider for the given name. If given ``None``, returns the default provider.
Args:
provider_name (str, opti... |
Get a provider for the given name. If given ``None``, returns the default provider.
Args:
provider_name (str, optional): The name of the provider to get. Defaults to ``None``.
When ``None``, returns the default provider.
provider_settings (dict, optional): Setting... | get_provider | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def use_provider(
self,
provider: Union[str, "ProviderAPI"],
provider_settings: Optional[dict] = None,
disconnect_after: bool = False,
disconnect_on_exit: bool = True,
) -> ProviderContextManager:
"""
Use and connect to a provider in a temporary context. When ... |
Use and connect to a provider in a temporary context. When entering the context, it calls
method :meth:`ape.api.providers.ProviderAPI.connect` and when exiting, it calls
method :meth:`ape.api.providers.ProviderAPI.disconnect`.
Usage example::
from ape import networks
... | use_provider | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def default_provider_name(self) -> Optional[str]:
"""
The name of the default provider or ``None``.
Returns:
Optional[str]
"""
provider_from_config: str
if provider := self._default_provider:
# Was set programmatically.
return provide... |
The name of the default provider or ``None``.
Returns:
Optional[str]
| default_provider_name | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def set_default_provider(self, provider_name: str):
"""
Change the default provider.
Raises:
:class:`~ape.exceptions.NetworkError`: When the given provider is not found.
Args:
provider_name (str): The name of the provider to switch to.
"""
if pr... |
Change the default provider.
Raises:
:class:`~ape.exceptions.NetworkError`: When the given provider is not found.
Args:
provider_name (str): The name of the provider to switch to.
| set_default_provider | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def use_default_provider(
self,
provider_settings: Optional[dict] = None,
disconnect_after: bool = False,
) -> ProviderContextManager:
"""
Temporarily connect and use the default provider. When entering the context, it calls
method :meth:`ape.api.providers.ProviderAPI... |
Temporarily connect and use the default provider. When entering the context, it calls
method :meth:`ape.api.providers.ProviderAPI.connect` and when exiting, it calls
method :meth:`ape.api.providers.ProviderAPI.disconnect`.
**NOTE**: If multiple providers exist, uses whatever was "first... | use_default_provider | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def publish_contract(self, address: AddressType):
"""
A convenience method to publish a contract to the explorer.
Raises:
:class:`~ape.exceptions.NetworkError`: When there is no explorer for this network.
Args:
address (:class:`~ape.types.address.AddressType`): ... |
A convenience method to publish a contract to the explorer.
Raises:
:class:`~ape.exceptions.NetworkError`: When there is no explorer for this network.
Args:
address (:class:`~ape.types.address.AddressType`): The address of the contract.
| publish_contract | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def verify_chain_id(self, chain_id: int):
"""
Verify a chain ID for this network.
Args:
chain_id (int): The chain ID to verify.
Raises:
:class:`~ape.exceptions.NetworkMismatchError`: When the network is
not local or adhoc and has a different hardco... |
Verify a chain ID for this network.
Args:
chain_id (int): The chain ID to verify.
Raises:
:class:`~ape.exceptions.NetworkMismatchError`: When the network is
not local or adhoc and has a different hardcoded chain ID than
the given one.
... | verify_chain_id | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def upstream_provider(self) -> "UpstreamProvider":
"""
The provider used when requesting data before the local fork.
Set this in your config under the network settings.
When not set, will attempt to use the default provider, if one
exists.
"""
config_choice: str =... |
The provider used when requesting data before the local fork.
Set this in your config under the network settings.
When not set, will attempt to use the default provider, if one
exists.
| upstream_provider | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def create_network_type(chain_id: int, network_id: int, is_fork: bool = False) -> type[NetworkAPI]:
"""
Easily create a :class:`~ape.api.networks.NetworkAPI` subclass.
"""
BaseNetwork = ForkedNetworkAPI if is_fork else NetworkAPI
class network_def(BaseNetwork): # type: ignore
@property
... |
Easily create a :class:`~ape.api.networks.NetworkAPI` subclass.
| create_network_type | python | ApeWorX/ape | src/ape/api/networks.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/networks.py | Apache-2.0 |
def package_id(self) -> str:
"""
The full name of the package, used for storage.
Example: ``OpenZeppelin/openzeppelin-contracts``.
""" |
The full name of the package, used for storage.
Example: ``OpenZeppelin/openzeppelin-contracts``.
| package_id | python | ApeWorX/ape | src/ape/api/projects.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/projects.py | Apache-2.0 |
def version_id(self) -> str:
"""
The ID to use as the sub-directory in the download cache.
Most often, this is either a version number or a branch name.
""" |
The ID to use as the sub-directory in the download cache.
Most often, this is either a version number or a branch name.
| version_id | python | ApeWorX/ape | src/ape/api/projects.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/projects.py | Apache-2.0 |
def fetch(self, destination: Path):
"""
Fetch the dependency. E.g. for GitHub dependency,
download the files to the destination.
Args:
destination (Path): The destination for the dependency
files.
""" |
Fetch the dependency. E.g. for GitHub dependency,
download the files to the destination.
Args:
destination (Path): The destination for the dependency
files.
| fetch | python | ApeWorX/ape | src/ape/api/projects.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/projects.py | Apache-2.0 |
def is_valid(self) -> bool:
"""
Return ``True`` when detecting a project of this type.
""" |
Return ``True`` when detecting a project of this type.
| is_valid | python | ApeWorX/ape | src/ape/api/projects.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/projects.py | Apache-2.0 |
def extract_config(self, **overrides) -> "ApeConfig":
"""
Extra configuration from the project so that
Ape understands the dependencies and how to compile everything.
Args:
**overrides: Config overrides.
Returns:
:class:`~ape.managers.config.ApeConfig`
... |
Extra configuration from the project so that
Ape understands the dependencies and how to compile everything.
Args:
**overrides: Config overrides.
Returns:
:class:`~ape.managers.config.ApeConfig`
| extract_config | python | ApeWorX/ape | src/ape/api/projects.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/projects.py | Apache-2.0 |
def validate_size(cls, values, handler):
"""
A validator for handling non-computed size.
Saves it to a private member on this class and
gets returned in computed field "size".
"""
if isinstance(values, BlockAPI):
size = values.size
else:
i... |
A validator for handling non-computed size.
Saves it to a private member on this class and
gets returned in computed field "size".
| validate_size | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def size(self) -> HexInt:
"""
The size of the block in gas. Most of the time,
this field is passed to the model at validation time,
but occasionally it is missing (like in `eth_subscribe:newHeads`),
in which case it gets calculated if and only if the user
requests it (or ... |
The size of the block in gas. Most of the time,
this field is passed to the model at validation time,
but occasionally it is missing (like in `eth_subscribe:newHeads`),
in which case it gets calculated if and only if the user
requests it (or during serialization of this model to... | size | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def is_connected(self) -> bool:
"""
``True`` if currently connected to the provider. ``False`` otherwise.
""" |
``True`` if currently connected to the provider. ``False`` otherwise.
| is_connected | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def connect(self):
"""
Connect to a provider, such as start-up a process or create an HTTP connection.
""" |
Connect to a provider, such as start-up a process or create an HTTP connection.
| connect | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def disconnect(self):
"""
Disconnect from a provider, such as tear-down a process or quit an HTTP session.
""" |
Disconnect from a provider, such as tear-down a process or quit an HTTP session.
| disconnect | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def settings(self) -> "PluginConfig":
"""
The combination of settings from ``ape-config.yaml`` and ``.provider_settings``.
"""
CustomConfig = self.config.__class__
data = {**self.config.model_dump(), **self.provider_settings}
return CustomConfig.model_validate(data) |
The combination of settings from ``ape-config.yaml`` and ``.provider_settings``.
| settings | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def connection_id(self) -> Optional[str]:
"""
A connection ID to uniquely identify and manage multiple
connections to providers, especially when working with multiple
providers of the same type, like multiple Geth --dev nodes.
"""
try:
chain_id = self.chain_i... |
A connection ID to uniquely identify and manage multiple
connections to providers, especially when working with multiple
providers of the same type, like multiple Geth --dev nodes.
| connection_id | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def update_settings(self, new_settings: dict):
"""
Change a provider's setting, such as configure a new port to run on.
May require a reconnect.
Args:
new_settings (dict): The new provider settings.
""" |
Change a provider's setting, such as configure a new port to run on.
May require a reconnect.
Args:
new_settings (dict): The new provider settings.
| update_settings | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def chain_id(self) -> int:
"""
The blockchain ID.
See `ChainList <https://chainlist.org/>`__ for a comprehensive list of IDs.
""" |
The blockchain ID.
See `ChainList <https://chainlist.org/>`__ for a comprehensive list of IDs.
| chain_id | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_balance(self, address: "AddressType", block_id: Optional["BlockID"] = None) -> int:
"""
Get the balance of an account.
Args:
address (:class:`~ape.types.address.AddressType`): The address of the account.
block_id (:class:`~ape.types.BlockID`): Optionally specify ... |
Get the balance of an account.
Args:
address (:class:`~ape.types.address.AddressType`): The address of the account.
block_id (:class:`~ape.types.BlockID`): Optionally specify a block
ID. Defaults to using the latest block.
Returns:
int: The ac... | get_balance | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_code(
self, address: "AddressType", block_id: Optional["BlockID"] = None
) -> "ContractCode":
"""
Get the bytes a contract.
Args:
address (:class:`~ape.types.address.AddressType`): The address of the contract.
block_id (Optional[:class:`~ape.types.Blo... |
Get the bytes a contract.
Args:
address (:class:`~ape.types.address.AddressType`): The address of the contract.
block_id (Optional[:class:`~ape.types.BlockID`]): The block ID
for checking a previous account nonce.
Returns:
:class:`~ape.typ... | get_code | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def make_request(self, rpc: str, parameters: Optional[Iterable] = None) -> Any:
"""
Make a raw RPC request to the provider.
Advanced features such as tracing may utilize this to by-pass unnecessary
class-serializations.
""" |
Make a raw RPC request to the provider.
Advanced features such as tracing may utilize this to by-pass unnecessary
class-serializations.
| make_request | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def stream_request( # type: ignore[empty-body]
self, method: str, params: Iterable, iter_path: str = "result.item"
) -> Iterator[Any]:
"""
Stream a request, great for large requests like events or traces.
Args:
method (str): The RPC method to call.
params (I... |
Stream a request, great for large requests like events or traces.
Args:
method (str): The RPC method to call.
params (Iterable): Parameters for the method.s
iter_path (str): The response dict-path to the items.
Returns:
An iterator of items.
... | stream_request | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_storage( # type: ignore[empty-body]
self, address: "AddressType", slot: int, block_id: Optional["BlockID"] = None
) -> "HexBytes":
"""
Gets the raw value of a storage slot of a contract.
Args:
address (AddressType): The address of the contract.
slot ... |
Gets the raw value of a storage slot of a contract.
Args:
address (AddressType): The address of the contract.
slot (int): Storage slot to read the value of.
block_id (Optional[:class:`~ape.types.BlockID`]): The block ID
for checking a previous storage ... | get_storage | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_nonce(self, address: "AddressType", block_id: Optional["BlockID"] = None) -> int:
"""
Get the number of times an account has transacted.
Args:
address (AddressType): The address of the account.
block_id (Optional[:class:`~ape.types.BlockID`]): The block ID
... |
Get the number of times an account has transacted.
Args:
address (AddressType): The address of the account.
block_id (Optional[:class:`~ape.types.BlockID`]): The block ID
for checking a previous account nonce.
Returns:
int
| get_nonce | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def gas_price(self) -> int:
"""
The price for what it costs to transact
(pre-`EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`__).
""" |
The price for what it costs to transact
(pre-`EIP-1559 <https://eips.ethereum.org/EIPS/eip-1559>`__).
| gas_price | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_block(self, block_id: "BlockID") -> BlockAPI:
"""
Get a block.
Args:
block_id (:class:`~ape.types.BlockID`): The ID of the block to get.
Can be ``"latest"``, ``"earliest"``, ``"pending"``, a block hash or a block number.
Raises:
:class:`~... |
Get a block.
Args:
block_id (:class:`~ape.types.BlockID`): The ID of the block to get.
Can be ``"latest"``, ``"earliest"``, ``"pending"``, a block hash or a block number.
Raises:
:class:`~ape.exceptions.BlockNotFoundError`: Likely the exception raised w... | get_block | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def send_call(
self,
txn: TransactionAPI,
block_id: Optional["BlockID"] = None,
state: Optional[dict] = None,
**kwargs,
) -> "HexBytes": # Return value of function
"""
Execute a new transaction call immediately without creating a
transaction on the bl... |
Execute a new transaction call immediately without creating a
transaction on the block chain.
Args:
txn: :class:`~ape.api.transactions.TransactionAPI`
block_id (Optional[:class:`~ape.types.BlockID`]): The block ID
to use to send a call at a historical po... | send_call | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_receipt(self, txn_hash: str, **kwargs) -> ReceiptAPI:
"""
Get the information about a transaction from a transaction hash.
Args:
txn_hash (str): The hash of the transaction to retrieve.
kwargs: Any other kwargs that other providers might allow when fetching a rec... |
Get the information about a transaction from a transaction hash.
Args:
txn_hash (str): The hash of the transaction to retrieve.
kwargs: Any other kwargs that other providers might allow when fetching a receipt.
Returns:
:class:`~api.providers.ReceiptAPI`:
... | get_receipt | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_transactions_by_block(self, block_id: "BlockID") -> Iterator[TransactionAPI]:
"""
Get the information about a set of transactions from a block.
Args:
block_id (:class:`~ape.types.BlockID`): The ID of the block.
Returns:
Iterator[:class: `~ape.api.transac... |
Get the information about a set of transactions from a block.
Args:
block_id (:class:`~ape.types.BlockID`): The ID of the block.
Returns:
Iterator[:class: `~ape.api.transactions.TransactionAPI`]
| get_transactions_by_block | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_transactions_by_account_nonce( # type: ignore[empty-body]
self,
account: "AddressType",
start_nonce: int = 0,
stop_nonce: int = -1,
) -> Iterator[ReceiptAPI]:
"""
Get account history for the given account.
Args:
account (:class:`~ape.type... |
Get account history for the given account.
Args:
account (:class:`~ape.types.address.AddressType`): The address of the account.
start_nonce (int): The nonce of the account to start the search with.
stop_nonce (int): The nonce of the account to stop the search with.
... | get_transactions_by_account_nonce | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def send_transaction(self, txn: TransactionAPI) -> ReceiptAPI:
"""
Send a transaction to the network.
Args:
txn (:class:`~ape.api.transactions.TransactionAPI`): The transaction to send.
Returns:
:class:`~ape.api.transactions.ReceiptAPI`
""" |
Send a transaction to the network.
Args:
txn (:class:`~ape.api.transactions.TransactionAPI`): The transaction to send.
Returns:
:class:`~ape.api.transactions.ReceiptAPI`
| send_transaction | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_contract_logs(self, log_filter: "LogFilter") -> Iterator["ContractLog"]:
"""
Get logs from contracts.
Args:
log_filter (:class:`~ape.types.LogFilter`): A mapping of event ABIs to
topic filters. Defaults to getting all events.
Returns:
Itera... |
Get logs from contracts.
Args:
log_filter (:class:`~ape.types.LogFilter`): A mapping of event ABIs to
topic filters. Defaults to getting all events.
Returns:
Iterator[:class:`~ape.types.ContractLog`]
| get_contract_logs | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def send_private_transaction(self, txn: TransactionAPI, **kwargs) -> ReceiptAPI:
"""
Send a transaction through a private mempool (if supported by the Provider).
Raises:
:class:`~ape.exceptions.APINotImplementedError`: If using a non-local
network and not implemented b... |
Send a transaction through a private mempool (if supported by the Provider).
Raises:
:class:`~ape.exceptions.APINotImplementedError`: If using a non-local
network and not implemented by the provider.
Args:
txn (:class:`~ape.api.transactions.TransactionAPI... | send_private_transaction | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def snapshot(self) -> "SnapshotID": # type: ignore[empty-body]
"""
Defined to make the ``ProviderAPI`` interchangeable with a
:class:`~ape.api.providers.TestProviderAPI`, as in
:class:`ape.managers.chain.ChainManager`.
Raises:
:class:`~ape.exceptions.APINotImplement... |
Defined to make the ``ProviderAPI`` interchangeable with a
:class:`~ape.api.providers.TestProviderAPI`, as in
:class:`ape.managers.chain.ChainManager`.
Raises:
:class:`~ape.exceptions.APINotImplementedError`: Unless overridden.
| snapshot | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def set_balance(self, address: "AddressType", amount: int):
"""
Change the balance of an account.
Args:
address (AddressType): An address on the network.
amount (int): The balance to set in the address.
""" |
Change the balance of an account.
Args:
address (AddressType): An address on the network.
amount (int): The balance to set in the address.
| set_balance | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_test_account(self, index: int) -> "TestAccountAPI": # type: ignore[empty-body]
"""
Retrieve one of the provider-generated test accounts.
Args:
index (int): The index of the test account in the HD-Path.
Returns:
:class:`~ape.api.accounts.TestAccountAPI`
... |
Retrieve one of the provider-generated test accounts.
Args:
index (int): The index of the test account in the HD-Path.
Returns:
:class:`~ape.api.accounts.TestAccountAPI`
| get_test_account | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def set_code( # type: ignore[empty-body]
self, address: "AddressType", code: "ContractCode"
) -> bool:
"""
Change the code of a smart contract, for development purposes.
Test providers implement this method when they support it.
Args:
address (AddressType): An a... |
Change the code of a smart contract, for development purposes.
Test providers implement this method when they support it.
Args:
address (AddressType): An address on the network.
code (:class:`~ape.types.ContractCode`): The new bytecode.
| set_code | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def set_storage( # type: ignore[empty-body]
self, address: "AddressType", slot: int, value: "HexBytes"
):
"""
Sets the raw value of a storage slot of a contract.
Args:
address (str): The address of the contract.
slot (int): Storage slot to write the value to... |
Sets the raw value of a storage slot of a contract.
Args:
address (str): The address of the contract.
slot (int): Storage slot to write the value to.
value: (HexBytes): The value to overwrite the raw storage slot with.
| set_storage | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def relock_account(self, address: "AddressType"):
"""
Stop impersonating an account.
Args:
address (:class:`~ape.types.address.AddressType`): The address to relock.
""" |
Stop impersonating an account.
Args:
address (:class:`~ape.types.address.AddressType`): The address to relock.
| relock_account | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def get_transaction_trace( # type: ignore[empty-body]
self, txn_hash: Union["HexBytes", str]
) -> "TraceAPI":
"""
Provide a detailed description of opcodes.
Args:
txn_hash (Union[HexBytes, str]): The hash of a transaction
to trace.
Returns:
... |
Provide a detailed description of opcodes.
Args:
txn_hash (Union[HexBytes, str]): The hash of a transaction
to trace.
Returns:
:class:`~ape.api.trace.TraceAPI`: A transaction trace.
| get_transaction_trace | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def poll_blocks( # type: ignore[empty-body]
self,
stop_block: Optional[int] = None,
required_confirmations: Optional[int] = None,
new_block_timeout: Optional[int] = None,
) -> Iterator[BlockAPI]:
"""
Poll new blocks.
**NOTE**: When a chain reorganization occ... |
Poll new blocks.
**NOTE**: When a chain reorganization occurs, this method logs an error and
yields the missed blocks, even if they were previously yielded with different
block numbers.
**NOTE**: This is a daemon method; it does not terminate unless an exception occurs
... | poll_blocks | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def poll_logs( # type: ignore[empty-body]
self,
stop_block: Optional[int] = None,
address: Optional["AddressType"] = None,
topics: Optional[list[Union[str, list[str]]]] = None,
required_confirmations: Optional[int] = None,
new_block_timeout: Optional[int] = None,
... |
Poll new blocks. Optionally set a start block to include historical blocks.
**NOTE**: This is a daemon method; it does not terminate unless an exception occurs.
Usage example::
for new_log in contract.MyEvent.poll_logs():
print(f"New event log found: block_number=... | poll_logs | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def snapshot(self) -> "SnapshotID":
"""
Record the current state of the blockchain with intent to later
call the method :meth:`~ape.managers.chain.ChainManager.revert`
to go back to this point. This method is for local networks only.
Returns:
:class:`~ape.types.Snaps... |
Record the current state of the blockchain with intent to later
call the method :meth:`~ape.managers.chain.ChainManager.revert`
to go back to this point. This method is for local networks only.
Returns:
:class:`~ape.types.SnapshotID`: The snapshot ID.
| snapshot | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def restore(self, snapshot_id: "SnapshotID"):
"""
Regress the current call using the given snapshot ID.
Allows developers to go back to a previous state.
Args:
snapshot_id (str): The snapshot ID.
""" |
Regress the current call using the given snapshot ID.
Allows developers to go back to a previous state.
Args:
snapshot_id (str): The snapshot ID.
| restore | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def set_timestamp(self, new_timestamp: int):
"""
Change the pending timestamp.
Args:
new_timestamp (int): The timestamp to set.
Returns:
int: The new timestamp.
""" |
Change the pending timestamp.
Args:
new_timestamp (int): The timestamp to set.
Returns:
int: The new timestamp.
| set_timestamp | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def mine(self, num_blocks: int = 1):
"""
Advance by the given number of blocks.
Args:
num_blocks (int): The number of blocks allotted to mine. Defaults to ``1``.
""" |
Advance by the given number of blocks.
Args:
num_blocks (int): The number of blocks allotted to mine. Defaults to ``1``.
| mine | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def _increment_call_func_coverage_hit_count(self, txn: TransactionAPI):
"""
A helper method for incrementing a method call function hit count in a
non-orthodox way. This is because Hardhat does not support call traces yet.
"""
if (
not txn.receiver
or not ... |
A helper method for incrementing a method call function hit count in a
non-orthodox way. This is because Hardhat does not support call traces yet.
| _increment_call_func_coverage_hit_count | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def build_command(self) -> list[str]:
"""
Get the command as a list of ``str``.
Subclasses should override and add command arguments if needed.
Returns:
list[str]: The command to pass to ``subprocess.Popen``.
""" |
Get the command as a list of ``str``.
Subclasses should override and add command arguments if needed.
Returns:
list[str]: The command to pass to ``subprocess.Popen``.
| build_command | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def connect(self):
"""
Start the process and connect to it.
Subclasses handle the connection-related tasks.
"""
if self.is_connected:
raise ProviderError("Cannot connect twice. Call disconnect before connecting again.")
# Always disconnect after,
# u... |
Start the process and connect to it.
Subclasses handle the connection-related tasks.
| connect | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def disconnect(self):
"""
Stop the process if it exists.
Subclasses override this method to do provider-specific disconnection tasks.
"""
if self.process:
self.stop()
# Delete entry from managed list of running nodes.
self.network_manager.running_nod... |
Stop the process if it exists.
Subclasses override this method to do provider-specific disconnection tasks.
| disconnect | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def start(self, timeout: int = 20):
"""Start the process and wait for its RPC to be ready."""
if self.is_connected:
logger.info(f"Connecting to existing '{self.process_name}' process.")
self.process = None # Not managing the process.
elif self.allow_start:
... | Start the process and wait for its RPC to be ready. | start | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def _windows_taskkill(self) -> None:
"""
Kills the given process and all child processes using taskkill.exe. Used
for subprocesses started up on Windows which run in a cmd.exe wrapper that
doesn't propagate signals by default (leaving orphaned processes).
"""
process = se... |
Kills the given process and all child processes using taskkill.exe. Used
for subprocesses started up on Windows which run in a cmd.exe wrapper that
doesn't propagate signals by default (leaving orphaned processes).
| _windows_taskkill | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def _linux_set_death_signal():
"""
Automatically sends SIGTERM to child subprocesses when parent process
dies (only usable on Linux).
"""
# from: https://stackoverflow.com/a/43152455/75956
# the first argument, 1, is the flag for PR_SET_PDEATHSIG
# the second argument is what signal to send ... |
Automatically sends SIGTERM to child subprocesses when parent process
dies (only usable on Linux).
| _linux_set_death_signal | python | ApeWorX/ape | src/ape/api/providers.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/providers.py | Apache-2.0 |
def from_receipt(cls, receipt: ReceiptAPI) -> "ContractCreation":
"""
Create a metadata class.
Args:
receipt (:class:`~ape.api.transactions.ReceiptAPI`): The receipt
of the deploy transaction.
Returns:
:class:`~ape.api.query.ContractCreation`
... |
Create a metadata class.
Args:
receipt (:class:`~ape.api.transactions.ReceiptAPI`): The receipt
of the deploy transaction.
Returns:
:class:`~ape.api.query.ContractCreation`
| from_receipt | python | ApeWorX/ape | src/ape/api/query.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/query.py | Apache-2.0 |
def estimate_query(self, query: QueryType) -> Optional[int]:
"""
Estimation of time needed to complete the query. The estimation is returned
as an int representing milliseconds. A value of None indicates that the
query engine is not available for use or is unable to complete the query.
... |
Estimation of time needed to complete the query. The estimation is returned
as an int representing milliseconds. A value of None indicates that the
query engine is not available for use or is unable to complete the query.
Args:
query (``QueryType``): Query to estimate.
... | estimate_query | python | ApeWorX/ape | src/ape/api/query.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/query.py | Apache-2.0 |
def perform_query(self, query: QueryType) -> Iterator:
"""
Executes the query using best performing ``estimate_query`` query engine.
Args:
query (``QueryType``): query to execute
Returns:
Iterator
""" |
Executes the query using best performing ``estimate_query`` query engine.
Args:
query (``QueryType``): query to execute
Returns:
Iterator
| perform_query | python | ApeWorX/ape | src/ape/api/query.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/query.py | Apache-2.0 |
def update_cache(self, query: QueryType, result: Iterator[BaseInterfaceModel]):
"""
Allows a query plugin the chance to update any cache using the results obtained
from other query plugins. Defaults to doing nothing, override to store cache data.
Args:
query (``QueryType``):... |
Allows a query plugin the chance to update any cache using the results obtained
from other query plugins. Defaults to doing nothing, override to store cache data.
Args:
query (``QueryType``): query that was executed
result (``Iterator``): the result of the query
... | update_cache | python | ApeWorX/ape | src/ape/api/query.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/query.py | Apache-2.0 |
def return_value(self) -> Any:
"""
The return value deduced from the trace.
""" |
The return value deduced from the trace.
| return_value | python | ApeWorX/ape | src/ape/api/trace.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/trace.py | Apache-2.0 |
def revert_message(self) -> Optional[str]:
"""
The revert message deduced from the trace.
""" |
The revert message deduced from the trace.
| revert_message | python | ApeWorX/ape | src/ape/api/trace.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/trace.py | Apache-2.0 |
def get_raw_frames(self) -> Iterator[dict]:
"""
Get raw trace frames for deeper analysis.
""" |
Get raw trace frames for deeper analysis.
| get_raw_frames | python | ApeWorX/ape | src/ape/api/trace.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/trace.py | Apache-2.0 |
def get_raw_calltree(self) -> dict:
"""
Get a raw calltree for deeper analysis.
""" |
Get a raw calltree for deeper analysis.
| get_raw_calltree | python | ApeWorX/ape | src/ape/api/trace.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/trace.py | Apache-2.0 |
def txn_hash(self) -> HexBytes:
"""
The calculated hash of the transaction.
""" |
The calculated hash of the transaction.
| txn_hash | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def receipt(self) -> Optional["ReceiptAPI"]:
"""
This transaction's associated published receipt, if it exists.
"""
try:
txn_hash = to_hex(self.txn_hash)
except SignatureError:
return None
try:
return self.chain_manager.get_receipt(txn... |
This transaction's associated published receipt, if it exists.
| receipt | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def to_string(self, calldata_repr: Optional["CalldataRepr"] = None) -> str:
"""
Get the stringified representation of the transaction.
Args:
calldata_repr (:class:`~ape.types.abi.CalldataRepr` | None): Pass "full"
to see the full calldata. Defaults to the value from th... |
Get the stringified representation of the transaction.
Args:
calldata_repr (:class:`~ape.types.abi.CalldataRepr` | None): Pass "full"
to see the full calldata. Defaults to the value from the config.
Returns:
str
| to_string | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def total_fees_paid(self) -> int:
"""
The total amount of fees paid for the transaction.
""" |
The total amount of fees paid for the transaction.
| total_fees_paid | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def decode_logs(
self,
abi: Optional[
Union[list[Union["EventABI", "ContractEvent"]], Union["EventABI", "ContractEvent"]]
] = None,
) -> "ContractLogContainer":
"""
Decode the logs on the receipt.
Args:
abi (``EventABI``): The ABI of the event... |
Decode the logs on the receipt.
Args:
abi (``EventABI``): The ABI of the event to decode into logs.
Returns:
list[:class:`~ape.types.ContractLog`]
| decode_logs | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def raise_for_status(self) -> Optional[NoReturn]:
"""
Handle provider-specific errors regarding a non-successful
:class:`~api.providers.TransactionStatusEnum`.
""" |
Handle provider-specific errors regarding a non-successful
:class:`~api.providers.TransactionStatusEnum`.
| raise_for_status | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def await_confirmations(self) -> "ReceiptAPI":
"""
Wait for a transaction to be considered confirmed.
Returns:
:class:`~ape.api.ReceiptAPI`: The receipt that is now confirmed.
"""
# NOTE: Even when required_confirmations is `0`, we want to wait for the nonce to
... |
Wait for a transaction to be considered confirmed.
Returns:
:class:`~ape.api.ReceiptAPI`: The receipt that is now confirmed.
| await_confirmations | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def return_value(self) -> Any:
"""
Obtain the final return value of the call. Requires tracing to function,
since this is not available from the receipt object.
"""
if trace := self.trace:
ret_val = trace.return_value
return ret_val[0] if isinstance(ret_va... |
Obtain the final return value of the call. Requires tracing to function,
since this is not available from the receipt object.
| return_value | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def source_traceback(self) -> "SourceTraceback": # type: ignore[empty-body]
"""
A Pythonic style traceback for both failing and non-failing receipts.
Requires a provider that implements
:meth:~ape.api.providers.ProviderAPI.get_transaction_trace`.
""" |
A Pythonic style traceback for both failing and non-failing receipts.
Requires a provider that implements
:meth:~ape.api.providers.ProviderAPI.get_transaction_trace`.
| source_traceback | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def show_trace(self, verbose: bool = False, file: IO[str] = sys.stdout):
"""
Display the complete sequence of contracts and methods called during
the transaction.
Args:
verbose (bool): Set to ``True`` to include more information.
file (IO[str]): The file to send ... |
Display the complete sequence of contracts and methods called during
the transaction.
Args:
verbose (bool): Set to ``True`` to include more information.
file (IO[str]): The file to send output to. Defaults to stdout.
| show_trace | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def show_gas_report(self, file: IO[str] = sys.stdout):
"""
Display a gas report for the calls made in this transaction.
""" |
Display a gas report for the calls made in this transaction.
| show_gas_report | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def show_source_traceback(self):
"""
Show a receipt traceback mapping to lines in the source code.
Only works when the contract type and source code are both available,
like in local projects.
""" |
Show a receipt traceback mapping to lines in the source code.
Only works when the contract type and source code are both available,
like in local projects.
| show_source_traceback | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def show_events(self):
"""
Show the events from the receipt.
""" |
Show the events from the receipt.
| show_events | python | ApeWorX/ape | src/ape/api/transactions.py | https://github.com/ApeWorX/ape/blob/master/src/ape/api/transactions.py | Apache-2.0 |
def non_existing_alias_argument(**kwargs):
"""
A ``click.argument`` for an account alias that does not yet exist in ape.
Args:
**kwargs: click.argument overrides.
"""
callback = kwargs.pop("callback", _alias_callback)
return click.argument("alias", callback=callback, **kwargs) |
A ``click.argument`` for an account alias that does not yet exist in ape.
Args:
**kwargs: click.argument overrides.
| non_existing_alias_argument | python | ApeWorX/ape | src/ape/cli/arguments.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/arguments.py | Apache-2.0 |
def callback(cls, ctx, param, value) -> set[Path]:
"""
Use this for click.option / argument callbacks.
"""
project = ctx.params.get("project")
return cls(value, project=project).filtered_paths |
Use this for click.option / argument callbacks.
| callback | python | ApeWorX/ape | src/ape/cli/arguments.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/arguments.py | Apache-2.0 |
def filtered_paths(self) -> set[Path]:
"""
Get the filtered set of paths.
"""
value = self.value
contract_paths: Iterable[Path]
if value and isinstance(value, (Path, str)):
# Given single path.
contract_paths = (Path(value),)
elif not valu... |
Get the filtered set of paths.
| filtered_paths | python | ApeWorX/ape | src/ape/cli/arguments.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/arguments.py | Apache-2.0 |
def print_choices(self):
"""
Echo the choices to the terminal.
"""
choices = dict(enumerate(self.choices, 0))
did_print = False
for idx, choice in choices.items():
click.echo(f"{idx}. {choice}")
did_print = True
if did_print:
c... |
Echo the choices to the terminal.
| print_choices | python | ApeWorX/ape | src/ape/cli/choices.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/choices.py | Apache-2.0 |
def select_account(
prompt_message: Optional[str] = None, key: _ACCOUNT_TYPE_FILTER = None
) -> "AccountAPI":
"""
Prompt the user to pick from their accounts and return that account.
Use this method if you want to prompt users to select accounts _outside_
of CLI options. For CLI options, use
:me... |
Prompt the user to pick from their accounts and return that account.
Use this method if you want to prompt users to select accounts _outside_
of CLI options. For CLI options, use
:meth:`~ape.cli.options.account_option`.
Args:
prompt_message (Optional[str]): Customize the prompt message.
... | select_account | python | ApeWorX/ape | src/ape/cli/choices.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/choices.py | Apache-2.0 |
def select_account(self) -> "AccountAPI":
"""
Returns the selected account.
Returns:
:class:`~ape.api.accounts.AccountAPI`
"""
from ape.utils.basemodel import ManagerAccessMixin as access
accounts = access.account_manager
if not self.choices or len(s... |
Returns the selected account.
Returns:
:class:`~ape.api.accounts.AccountAPI`
| select_account | python | ApeWorX/ape | src/ape/cli/choices.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/choices.py | Apache-2.0 |
def abort(msg: str, base_error: Optional[Exception] = None) -> NoReturn:
"""
End execution of the current command invocation.
Args:
msg (str): A message to output to the terminal.
base_error (Exception, optional): Optionally provide
an error to preserve the... |
End execution of the current command invocation.
Args:
msg (str): A message to output to the terminal.
base_error (Exception, optional): Optionally provide
an error to preserve the exception stack.
| abort | python | ApeWorX/ape | src/ape/cli/options.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py | Apache-2.0 |
def verbosity_option(
cli_logger: Optional[ApeLogger] = None,
default: Optional[Union[str, int, LogLevel]] = None,
callback: Optional[Callable] = None,
**kwargs,
) -> Callable:
"""A decorator that adds a `--verbosity, -v` option to the decorated
command.
Args:
cli_logger (:class:`~a... | A decorator that adds a `--verbosity, -v` option to the decorated
command.
Args:
cli_logger (:class:`~ape.logging.ApeLogger` | None): Optionally pass
a custom logger object.
default (str | int | :class:`~ape.logging.LogLevel`): The default log-level
for this command.
... | verbosity_option | python | ApeWorX/ape | src/ape/cli/options.py | https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.