eth-prototype 1.3.0b1__py3-none-any.whl → 1.3.0b2__py3-none-any.whl

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: eth-prototype
3
- Version: 1.3.0b1
3
+ Version: 1.3.0b2
4
4
  Summary: Prototype Ethereum Smart Contracts in Python
5
5
  Home-page: https://github.com/gnarvaja/eth-prototype
6
6
  Author: Guillermo M. Narvaja
@@ -26,14 +26,15 @@ Requires-Dist: boto3; extra == "defender"
26
26
  Provides-Extra: gmpy2
27
27
  Requires-Dist: gmpy2; extra == "gmpy2"
28
28
  Provides-Extra: testing
29
- Requires-Dist: setuptools; extra == "testing"
30
- Requires-Dist: pytest; extra == "testing"
29
+ Requires-Dist: boto3; extra == "testing"
30
+ Requires-Dist: factory-boy; extra == "testing"
31
31
  Requires-Dist: gmpy2; extra == "testing"
32
+ Requires-Dist: pytest; extra == "testing"
32
33
  Requires-Dist: pytest-cov; extra == "testing"
33
- Requires-Dist: web3[tester]==7.*; extra == "testing"
34
- Requires-Dist: boto3; extra == "testing"
34
+ Requires-Dist: pytest-mock; extra == "testing"
35
35
  Requires-Dist: pytest-recording; extra == "testing"
36
- Requires-Dist: factory-boy; extra == "testing"
36
+ Requires-Dist: setuptools; extra == "testing"
37
+ Requires-Dist: web3[tester]==7.*; extra == "testing"
37
38
 
38
39
  # eth-prototype
39
40
 
@@ -1,18 +1,18 @@
1
1
  ethproto/__init__.py,sha256=YWkAFysBp4tZjLWWB2FFmp5yG23pUYhQvgQW9b3soXs,579
2
- ethproto/aa_bundler.py,sha256=vVEiorWPpLq7ev8-wKUQ8fpgDZpaOz9LGlKGNFH0faU,14987
2
+ ethproto/aa_bundler.py,sha256=HupCu7fRCwlE556WXDqytRU5GEFLdBoFYzjpqDHBtE4,15789
3
3
  ethproto/build_artifacts.py,sha256=xwCd5hJUHP82IA-y3sSfX6fV15kjCGtV19RxNRcoor0,5441
4
4
  ethproto/contracts.py,sha256=rNVbCK1hURy7lWKhzSdXgVWo3wx9O_Ghk-6PfgOsRNk,18662
5
5
  ethproto/defender_relay.py,sha256=05A8TfRZwiBhCpo924Pf9CjfKSir2Wvgg1p_asFxJbw,1777
6
- ethproto/w3wrappers.py,sha256=4ZEnJFrc8bV1qHG4dNdom4FL1gEUhgoJORY6cGzlJDk,21549
6
+ ethproto/w3wrappers.py,sha256=lmyfJLhQmPYrclmbzzsthH2cShlQb6LwavKq30jqxFE,21651
7
7
  ethproto/wadray.py,sha256=JBsu5KcyU9k70bDK03T2IY6qPVFO30WbYPhwrAHdXao,8262
8
- ethproto/wrappers.py,sha256=9qDwRDOXw3wquzvGfIsub-VPWm98GBWP7dHLFOUPWzg,17307
8
+ ethproto/wrappers.py,sha256=Mj2sgZmcLVmqsnNab6PqIXtNMMPyRVvUj2_8ButEd4w,17304
9
9
  ethproto/test_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  ethproto/test_utils/factories.py,sha256=G8DnUDG_yThRxMTCkymzcjm9lR_ni0_ZmTsb3sEfIdI,1805
11
11
  ethproto/test_utils/hardhat.py,sha256=HzTqIznu6zVd_-doL96ftFJ235ktDCQen1QDQbNuwfM,2361
12
12
  ethproto/test_utils/vcr_utils.py,sha256=1FH2sgJlElSjWkJLuO3C7E2J-4HKyFvjAqkCnGRZJyk,797
13
- eth_prototype-1.3.0b1.dist-info/AUTHORS.rst,sha256=Ui-05yYXtDZxna6o1yNcfdm8Jt68UIDQ01osiLxlYlU,95
14
- eth_prototype-1.3.0b1.dist-info/LICENSE.txt,sha256=U_Q6_nDYDwZPIuhttHi37hXZ2qU2-HlV2geo9hzHXFw,1087
15
- eth_prototype-1.3.0b1.dist-info/METADATA,sha256=Ipe-jiFcOwqo89hto7kwoZ52UetWAmwC7i8y_5km0_g,2583
16
- eth_prototype-1.3.0b1.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
- eth_prototype-1.3.0b1.dist-info/top_level.txt,sha256=Dl0X7m6N1hxeo4JpGpSNqWC2gtsN0731g-DL1J0mpjc,9
18
- eth_prototype-1.3.0b1.dist-info/RECORD,,
13
+ eth_prototype-1.3.0b2.dist-info/AUTHORS.rst,sha256=Ui-05yYXtDZxna6o1yNcfdm8Jt68UIDQ01osiLxlYlU,95
14
+ eth_prototype-1.3.0b2.dist-info/LICENSE.txt,sha256=U_Q6_nDYDwZPIuhttHi37hXZ2qU2-HlV2geo9hzHXFw,1087
15
+ eth_prototype-1.3.0b2.dist-info/METADATA,sha256=VGLInjZc46w_OraflEsO2vG9yXmA_crJL0DVP5dFLvM,2630
16
+ eth_prototype-1.3.0b2.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
17
+ eth_prototype-1.3.0b2.dist-info/top_level.txt,sha256=Dl0X7m6N1hxeo4JpGpSNqWC2gtsN0731g-DL1J0mpjc,9
18
+ eth_prototype-1.3.0b2.dist-info/RECORD,,
ethproto/aa_bundler.py CHANGED
@@ -14,6 +14,7 @@ from eth_utils import add_0x_prefix, function_signature_to_4byte_selector
14
14
  from hexbytes import HexBytes
15
15
  from web3 import Web3
16
16
  from web3.constants import ADDRESS_ZERO
17
+ from web3.types import TxParams
17
18
 
18
19
  from .contracts import RevertError
19
20
 
@@ -94,6 +95,16 @@ class Tx:
94
95
  from_: HexAddress = ADDRESS_ZERO
95
96
  chain_id: int = None
96
97
 
98
+ @classmethod
99
+ def from_tx_params(cls, params: TxParams) -> "Tx":
100
+ return cls(
101
+ target=params["to"],
102
+ data=HexBytes(params["data"]),
103
+ value=params["value"],
104
+ from_=params.get("from", ADDRESS_ZERO),
105
+ chain_id=params.get("chainId", None),
106
+ )
107
+
97
108
  def as_execute_args(self):
98
109
  return [self.target, self.value, self.data]
99
110
 
@@ -320,6 +331,14 @@ class Bundler:
320
331
  self.base_gas_price_factor = base_gas_price_factor
321
332
  self.executor_pk = executor_pk
322
333
 
334
+ def __str__(self):
335
+ return (
336
+ f"Bundler(type={self.bundler_type}, entrypoint={self.entrypoint}, nonce_mode={self.nonce_mode}"
337
+ f"fixed_nonce_key={self.fixed_nonce_key}, verification_gas_factor={self.verification_gas_factor},"
338
+ f"gas_limit_factor={self.gas_limit_factor}, priority_gas_price_factor={self.priority_gas_price_factor},"
339
+ f"base_gas_price_factor={self.base_gas_price_factor})"
340
+ )
341
+
323
342
  def get_nonce_and_key(self, tx: Tx, fetch=False):
324
343
  nonce_key = tx.nonce_key
325
344
  nonce = tx.nonce
ethproto/w3wrappers.py CHANGED
@@ -111,7 +111,7 @@ def transact(provider, function, tx_kwargs):
111
111
  }
112
112
  )
113
113
  signed_tx = from_.sign_transaction(tx)
114
- tx_hash = provider.w3.eth.send_raw_transaction(signed_tx.rawTransaction)
114
+ tx_hash = provider.w3.eth.send_raw_transaction(signed_tx.raw_transaction)
115
115
  elif W3_TRANSACT_MODE == "defender-async":
116
116
  from .defender_relay import send_transaction
117
117
 
@@ -211,8 +211,8 @@ class W3EnvAddressBook(AddressBook):
211
211
  if isinstance(name, (Account, LocalAccount)):
212
212
  return name
213
213
  if name is None:
214
- return self.ZERO
215
- if type(name) == str and name.startswith("0x"):
214
+ return list(self.signers.values())[0] if self.signers else self.ZERO
215
+ if isinstance(name, str) and name.startswith("0x"):
216
216
  return name
217
217
  if name in self.name_to_address:
218
218
  return self.name_to_address[name]
@@ -483,7 +483,7 @@ class W3Provider(BaseProvider):
483
483
  for lib, _ in contract_def.libraries():
484
484
  if lib not in libraries:
485
485
  library_def = self.get_contract_factory(lib)
486
- library = self.construct(library_def)
486
+ library = self.construct(library_def, transact_kwargs={"from": eth_wrapper.owner})
487
487
  libraries[lib] = library.address
488
488
 
489
489
  if libraries:
ethproto/wrappers.py CHANGED
@@ -303,7 +303,7 @@ class ETHWrapper:
303
303
  constructor_args = None
304
304
  initialize_args = None
305
305
 
306
- def __init__(self, owner="owner", *init_params, **kwargs):
306
+ def __init__(self, owner=None, *init_params, **kwargs):
307
307
  self.provider_key = kwargs.get("provider_key", None)
308
308
  init_params = self._parse_init_params(init_params, kwargs)
309
309
  self.provider.init_eth_wrapper(self, owner, init_params, kwargs)