eth-prototype 1.3.4__tar.gz → 1.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/PKG-INFO +1 -1
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/PKG-INFO +1 -1
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/wrappers.py +14 -6
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_aa_bundler.py +13 -4
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.coveragerc +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.github/workflows/publish.yaml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.github/workflows/test.yaml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.gitignore +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.isort.cfg +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.pre-commit-config.yaml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/.readthedocs.yml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/AUTHORS.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/CHANGELOG.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/LICENSE.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/README.md +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/Makefile +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/_static/.gitignore +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/authors.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/changelog.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/conf.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/index.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/license.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/readme.rst +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/docs/requirements.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/pyproject.toml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/setup.cfg +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/setup.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/SOURCES.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/dependency_links.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/not-zip-safe +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/requires.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/eth_prototype.egg-info/top_level.txt +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/__init__.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/aa_bundler.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/build_artifacts.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/contracts.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/defender_relay.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/test_utils/__init__.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/test_utils/factories.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/test_utils/hardhat.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/test_utils/vcr_utils.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/w3wrappers.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/src/ethproto/wadray.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/__init__.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/cassettes/test_aa_bundler/test_build_user_operation.yaml +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/conftest.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/README.md +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/artifacts2/TestCurrency.sol/TestCurrency.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/Count.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/Counter.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/CounterUpgradeable.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/CounterUpgradeableWithLibrary.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/CounterWithLibrary.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/Datatypes.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/EventLauncher.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/TestCurrency.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/TestCurrencyUUPS.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/TestNFT.sol +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/hardhat.config.js +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/package-lock.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/package.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/verifiable-binaries/@anotherOrg/aPkg/1.0.2/build/contracts/TestCurrency.sol/TestCurrency.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/verifiable-binaries/@org/pkg/0.2.1/build/contracts/TestCurrency.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/verifiable-binaries/@org/pkg/0.3.0/build/contracts/TestCurrency.json +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_build_artifacts.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_contracts.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_defender.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_time_control.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_w3.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/test_wadray.py +0 -0
- {eth_prototype-1.3.4 → eth_prototype-1.3.5}/tox.ini +0 -0
@@ -18,6 +18,8 @@ DEFAULT_PROVIDER = env.str("DEFAULT_PROVIDER", None)
|
|
18
18
|
ETHERSCAN_TOKEN = env.str("ETHERSCAN_TOKEN", None)
|
19
19
|
ETHERSCAN_DOMAIN = env.str("ETHERSCAN_DOMAIN", "api.etherscan.io")
|
20
20
|
ETHERSCAN_URL = env.str("ETHERSCAN_URL", "https://{domain}/v2/api?apikey={token}&chainid={chainid}&")
|
21
|
+
ETHERSCAN_CHAIN_ID = env.int("ETHERSCAN_CHAIN_ID", None)
|
22
|
+
|
21
23
|
AMOUNT_DECIMALS = env.int("AMOUNT_DECIMALS", 18)
|
22
24
|
AMOUNT_CLASSNAME = env.str("AMOUNT_CLASSNAME", None)
|
23
25
|
|
@@ -31,6 +33,10 @@ MAXUINT256 = 2**256 - 1
|
|
31
33
|
_providers = {}
|
32
34
|
|
33
35
|
|
36
|
+
class EtherscanError(Exception):
|
37
|
+
...
|
38
|
+
|
39
|
+
|
34
40
|
def get_provider(provider_key=None):
|
35
41
|
global DEFAULT_PROVIDER
|
36
42
|
provider_key = provider_key or DEFAULT_PROVIDER
|
@@ -266,9 +272,8 @@ class BaseProvider(ABC):
|
|
266
272
|
def get_etherscan_url(self):
|
267
273
|
if ETHERSCAN_TOKEN is None:
|
268
274
|
return None
|
269
|
-
|
270
|
-
|
271
|
-
)
|
275
|
+
chain_id = ETHERSCAN_CHAIN_ID or self.w3.eth.chain_id
|
276
|
+
return ETHERSCAN_URL.format(token=ETHERSCAN_TOKEN, domain=ETHERSCAN_DOMAIN, chainid=chain_id)
|
272
277
|
|
273
278
|
def get_first_block(self, eth_wrapper):
|
274
279
|
etherscan_url = self.get_etherscan_url()
|
@@ -283,9 +288,12 @@ class BaseProvider(ABC):
|
|
283
288
|
resp = requests.get(url)
|
284
289
|
resp.raise_for_status()
|
285
290
|
resp = resp.json()
|
286
|
-
if
|
287
|
-
|
288
|
-
|
291
|
+
if resp.get("status") != "1":
|
292
|
+
raise EtherscanError(f"Failed to get first block from {etherscan_url}: {resp}")
|
293
|
+
try:
|
294
|
+
return int(resp["result"][0]["blockNumber"])
|
295
|
+
except (KeyError, TypeError):
|
296
|
+
raise EtherscanError(f"Failed to parse first block for {address}: {resp}")
|
289
297
|
|
290
298
|
def get_contract_address(self, eth_wrapper):
|
291
299
|
return eth_wrapper.contract.address
|
@@ -5,13 +5,21 @@ from unittest.mock import MagicMock, patch
|
|
5
5
|
|
6
6
|
import pytest
|
7
7
|
from hexbytes import HexBytes
|
8
|
-
from web3
|
8
|
+
from web3 import HTTPProvider, Web3
|
9
9
|
from web3.constants import HASH_ZERO
|
10
|
+
from web3.middleware import ExtraDataToPOAMiddleware
|
10
11
|
|
11
12
|
from ethproto import aa_bundler
|
12
13
|
from ethproto.test_utils import factories
|
13
14
|
|
14
15
|
|
16
|
+
@pytest.fixture
|
17
|
+
def w3():
|
18
|
+
w3 = Web3(HTTPProvider("http://example.org"))
|
19
|
+
w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)
|
20
|
+
return w3
|
21
|
+
|
22
|
+
|
15
23
|
def test_pack_two():
|
16
24
|
assert aa_bundler.pack_two(0, 0) == HASH_ZERO
|
17
25
|
assert aa_bundler.pack_two(1, 2) == "0x0000000000000000000000000000000100000000000000000000000000000002"
|
@@ -166,8 +174,8 @@ def test_get_nonce_with_local_cache(fetch_nonce_mock, randint_mock):
|
|
166
174
|
fetch_nonce_mock.assert_not_called()
|
167
175
|
|
168
176
|
|
169
|
-
def test_send_transaction():
|
170
|
-
w3 = MagicMock()
|
177
|
+
def test_send_transaction(w3):
|
178
|
+
w3.eth = MagicMock()
|
171
179
|
w3.eth.chain_id = CHAIN_ID
|
172
180
|
|
173
181
|
tx = aa_bundler.Tx(
|
@@ -275,7 +283,8 @@ def test_random_key_nonces_are_thread_safe():
|
|
275
283
|
|
276
284
|
|
277
285
|
@pytest.mark.vcr
|
278
|
-
def test_build_user_operation():
|
286
|
+
def test_build_user_operation(w3):
|
287
|
+
|
279
288
|
tx = aa_bundler.Tx(
|
280
289
|
value=0,
|
281
290
|
chain_id=137,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/CounterUpgradeable.sol
RENAMED
File without changes
|
File without changes
|
{eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/CounterWithLibrary.sol
RENAMED
File without changes
|
File without changes
|
{eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/EventLauncher.sol
RENAMED
File without changes
|
{eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/TestCurrency.sol
RENAMED
File without changes
|
{eth_prototype-1.3.4 → eth_prototype-1.3.5}/tests/hardhat-project/contracts/TestCurrencyUUPS.sol
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|