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 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 restore(self, snapshot_id: "SnapshotID"): """ 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 o...
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.
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): """ 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 ov...
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.
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): """ 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...
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.
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 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
def ape_cli_context( default_log_level: Optional[Union[str, int, LogLevel]] = None, obj_type: type = ApeCliContextObject, ) -> Callable: """ A ``click`` context object with helpful utilities. Use in your commands to get access to common utility features, such as logging or accessing managers. ...
A ``click`` context object with helpful utilities. Use in your commands to get access to common utility features, such as logging or accessing managers. Args: default_log_level (str | int | :class:`~ape.logging.LogLevel` | None): The log-level value to pass to :meth:`~ape.cli.option...
ape_cli_context
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def network_option( default: Optional[Union[str, Callable]] = "auto", ecosystem: Optional[Union[list[str], str]] = None, network: Optional[Union[list[str], str]] = None, provider: Optional[Union[list[str], str]] = None, required: bool = False, **kwargs, ) -> Callable: """ A ``click.optio...
A ``click.option`` for specifying a network. Args: default (Optional[str]): Optionally, change which network to use as the default. Defaults to how ``ape`` normally selects a default network unless ``required=True``, then defaults to ``None``. ecosystem (Optional[Union[list...
network_option
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def skip_confirmation_option(help="") -> Callable: """ A ``click.option`` for skipping confirmation (``--yes``). Args: help (str): CLI option help text. Defaults to ``""``. """ return click.option( "-y", "--yes", "skip_confirmation", default=False, i...
A ``click.option`` for skipping confirmation (``--yes``). Args: help (str): CLI option help text. Defaults to ``""``.
skip_confirmation_option
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def account_option(account_type: _ACCOUNT_TYPE_FILTER = None) -> Callable: """ A CLI option that accepts either the account alias or the account number. If not given anything, it will prompt the user to select an account. """ return click.option( "--account", type=AccountAliasPrompt...
A CLI option that accepts either the account alias or the account number. If not given anything, it will prompt the user to select an account.
account_option
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def contract_option(help=None, required=False, multiple=False) -> Callable: """ Contract(s) from the current project. If you pass ``multiple=True``, you will get a list of contract types from the callback. :class:`~ape.exceptions.ContractError`: In the callback when it fails to load the contracts....
Contract(s) from the current project. If you pass ``multiple=True``, you will get a list of contract types from the callback. :class:`~ape.exceptions.ContractError`: In the callback when it fails to load the contracts.
contract_option
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def output_format_option(default: OutputFormat = OutputFormat.TREE) -> Callable: """ A ``click.option`` for specifying a format to use when outputting data. Args: default (:class:`~ape.cli.choices.OutputFormat`): Defaults to ``TREE`` format. """ return click.option( "--format", ...
A ``click.option`` for specifying a format to use when outputting data. Args: default (:class:`~ape.cli.choices.OutputFormat`): Defaults to ``TREE`` format.
output_format_option
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def incompatible_with(incompatible_opts) -> type[click.Option]: """ Factory for creating custom ``click.Option`` subclasses that enforce incompatibility with the option strings passed to this function. Usage example:: import click @click.command() @click.option("--option", cls...
Factory for creating custom ``click.Option`` subclasses that enforce incompatibility with the option strings passed to this function. Usage example:: import click @click.command() @click.option("--option", cls=incompatible_with(["other_option"])) def cmd(option, other_opt...
incompatible_with
python
ApeWorX/ape
src/ape/cli/options.py
https://github.com/ApeWorX/ape/blob/master/src/ape/cli/options.py
Apache-2.0
def _repr_pretty_(self, printer, cycle): """ Show the NatSpec of a Method in any IPython console (including ``ape console``). """ console = get_rich_console() output = self._get_info(enrich=True) or "\n".join(abi.signature for abi in self.abis) console.print(output)
Show the NatSpec of a Method in any IPython console (including ``ape console``).
_repr_pretty_
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def estimate_gas_cost(self, *args, **kwargs) -> int: """ Get the estimated gas cost (according to the provider) for the contract method call (as if it were a transaction). Args: *args: The contract method invocation arguments. **kwargs: Transaction kwargs, such a...
Get the estimated gas cost (according to the provider) for the contract method call (as if it were a transaction). Args: *args: The contract method invocation arguments. **kwargs: Transaction kwargs, such as value or sender. Returns: i...
estimate_gas_cost
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def as_transaction(self, *args, **kwargs) -> "TransactionAPI": """ Get a :class:`~ape.api.transactions.TransactionAPI` for this contract method invocation. This is useful for simulations or estimating fees without sending the transaction. Args: *args: The con...
Get a :class:`~ape.api.transactions.TransactionAPI` for this contract method invocation. This is useful for simulations or estimating fees without sending the transaction. Args: *args: The contract method invocation arguments. **kwargs: Transaction kwarg...
as_transaction
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def as_transaction_bytes(self, *args, **txn_kwargs) -> HexBytes: """ Get a signed serialized transaction. Returns: HexBytes: The serialized transaction """ txn_kwargs["sign"] = True tx = self.as_transaction(*args, **txn_kwargs) return tx.serialize_tra...
Get a signed serialized transaction. Returns: HexBytes: The serialized transaction
as_transaction_bytes
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def estimate_gas_cost(self, *args, **kwargs) -> int: """ Get the estimated gas cost (according to the provider) for the contract method-invocation transaction. Args: *args: The contract method invocation arguments. **kwargs: Transaction kwargs, such as value or ...
Get the estimated gas cost (according to the provider) for the contract method-invocation transaction. Args: *args: The contract method invocation arguments. **kwargs: Transaction kwargs, such as value or sender. Returns: int: The esti...
estimate_gas_cost
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def __getitem_int(self, index: int) -> ContractLog: """ Access events on the contract by the index of when they occurred. Args: index (int): The index such that ``0`` is the first log to have occurred and ``-1`` is the last. Returns: :class:`~ape.c...
Access events on the contract by the index of when they occurred. Args: index (int): The index such that ``0`` is the first log to have occurred and ``-1`` is the last. Returns: :class:`~ape.contracts.base.ContractLog`
__getitem_int
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def __getitem_slice(self, value: slice) -> list[ContractLog]: """ Access a slice of logs from this event. Args: value (slice): The range of log to get, e.g. ``[5:10]``. Returns: Iterator[:class:`~ape.contracts.base.ContractLog`] """ logs = self.p...
Access a slice of logs from this event. Args: value (slice): The range of log to get, e.g. ``[5:10]``. Returns: Iterator[:class:`~ape.contracts.base.ContractLog`]
__getitem_slice
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def __call__(self, *args: Any, **kwargs: Any) -> MockContractLog: """ Create a mock-instance of a log using this event ABI and the contract address. Args: *args: Positional arguments for the event. **kwargs: Key-word arguments for the event. Returns: ...
Create a mock-instance of a log using this event ABI and the contract address. Args: *args: Positional arguments for the event. **kwargs: Key-word arguments for the event. Returns: :class:`~ape.types.events.MockContractLog`
__call__
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def query( self, *columns: str, start_block: int = 0, stop_block: Optional[int] = None, step: int = 1, engine_to_use: Optional[str] = None, ) -> "DataFrame": """ Iterate through blocks for log events Args: *columns (str): ``*``-bas...
Iterate through blocks for log events Args: *columns (str): ``*``-based argument for columns in the DataFrame to return. start_block (int): The first block, by number, to include in the query. Defaults to ``0``. stop_block (Optional[int])...
query
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def range( self, start_or_stop: int, stop: Optional[int] = None, search_topics: Optional[dict[str, Any]] = None, extra_addresses: Optional[list] = None, ) -> Iterator[ContractLog]: """ Search through the logs for this event using the given filter parameters. ...
Search through the logs for this event using the given filter parameters. Args: start_or_stop (int): When also given ``stop``, this is the earliest block number in the desired log set. Otherwise, it is the total amount of blocks to get starting from ``0``. ...
range
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def from_receipt(self, receipt: "ReceiptAPI") -> list[ContractLog]: """ Get all the events from the given receipt. Args: receipt (:class:`~ape.api.transactions.ReceiptAPI`): The receipt containing the logs. Returns: list[:class:`~ape.contracts.base.ContractLog`]...
Get all the events from the given receipt. Args: receipt (:class:`~ape.api.transactions.ReceiptAPI`): The receipt containing the logs. Returns: list[:class:`~ape.contracts.base.ContractLog`]
from_receipt
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def poll_logs( self, start_block: Optional[int] = None, stop_block: Optional[int] = None, required_confirmations: Optional[int] = None, new_block_timeout: Optional[int] = None, search_topics: Optional[dict[str, Any]] = None, **search_topic_kwargs: dict[str, Any], ...
Poll new logs for this event. Can specify topic filters to use when setting up the filter. 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 contra...
poll_logs
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def __call__(self, *args, **kwargs) -> MockContractLog: """ Create a mock contract log using the first working ABI. Args: *args: Positional arguments for the event. **kwargs: Key-word arguments for the event. Returns: :class:`~ape.types.events.MockCo...
Create a mock contract log using the first working ABI. Args: *args: Positional arguments for the event. **kwargs: Key-word arguments for the event. Returns: :class:`~ape.types.events.MockContractLog`
__call__
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0
def source_path(self) -> Optional[Path]: """ Returns the path to the local contract if determined that this container belongs to the active project by cross checking source_id. """ if not (source_id := self.contract_type.source_id): return None base = self.ba...
Returns the path to the local contract if determined that this container belongs to the active project by cross checking source_id.
source_path
python
ApeWorX/ape
src/ape/contracts/base.py
https://github.com/ApeWorX/ape/blob/master/src/ape/contracts/base.py
Apache-2.0