Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: anvil mine #1784

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions brownie/network/rpc/anvil.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ def sleep(seconds: int) -> int:
return seconds


def mine(timestamp: Optional[int] = None) -> None:
if timestamp:
_request("evm_setNextBlockTimestamp", [timestamp])
_request("evm_mine", [1])
def mine(blocks: Optional[int] = None) -> None:
_request("evm_mine", blocks)


def snapshot() -> int:
Expand Down
6 changes: 2 additions & 4 deletions docs/api-network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2184,13 +2184,11 @@ Chain Methods
>>> chain.time()
1550189143

.. py:method:: Chain.mine(blocks=1, timestamp=None, timedelta=None)
dudesahn marked this conversation as resolved.
Show resolved Hide resolved
.. py:method:: Chain.mine(blocks=1)

Mine one or more empty blocks.

* ``blocks``: Number of blocks to mine
* ``timestamp``: Timestamp of the final block being mined. If multiple blocks are mined, they will be mined at equal intervals starting from :func:`chain.time <Chain.time>` and ending at ``timestamp``.
* ``timedelta``: Timedelta for the final block to be mined. If given, the final block will have a timestamp of ``chain.time() + timedelta``.
* ``blocks``: Number of blocks to mine. ``chain.mine()`` will mine a single block.

Returns the block height after all new blocks have been mined.

Expand Down