eth-prototype 1.1.1__py3-none-any.whl → 1.2.0b1__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.1.1
3
+ Version: 1.2.0b1
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
@@ -28,10 +28,10 @@ Requires-Dist: setuptools; extra == "testing"
28
28
  Requires-Dist: pytest; extra == "testing"
29
29
  Requires-Dist: gmpy2; extra == "testing"
30
30
  Requires-Dist: pytest-cov; extra == "testing"
31
- Requires-Dist: web3[tester]==6.*; extra == "testing"
31
+ Requires-Dist: web3[tester]==7.*; extra == "testing"
32
32
  Requires-Dist: boto3; extra == "testing"
33
33
  Provides-Extra: web3
34
- Requires-Dist: web3==6.*; extra == "web3"
34
+ Requires-Dist: web3==7.*; extra == "web3"
35
35
 
36
36
  # eth-prototype
37
37
 
@@ -0,0 +1,14 @@
1
+ ethproto/__init__.py,sha256=YWkAFysBp4tZjLWWB2FFmp5yG23pUYhQvgQW9b3soXs,579
2
+ ethproto/aa_bundler.py,sha256=R4P3o6Cmt05StuVsReMRlhpSTzsGSEhj0Mcfy8HqFv8,9460
3
+ ethproto/build_artifacts.py,sha256=xwCd5hJUHP82IA-y3sSfX6fV15kjCGtV19RxNRcoor0,5441
4
+ ethproto/contracts.py,sha256=rNVbCK1hURy7lWKhzSdXgVWo3wx9O_Ghk-6PfgOsRNk,18662
5
+ ethproto/defender_relay.py,sha256=05A8TfRZwiBhCpo924Pf9CjfKSir2Wvgg1p_asFxJbw,1777
6
+ ethproto/w3wrappers.py,sha256=fEkqvzWFCHirUsfQqyoqsrpDlNfMIgBBik3yTFws8Is,21260
7
+ ethproto/wadray.py,sha256=JBsu5KcyU9k70bDK03T2IY6qPVFO30WbYPhwrAHdXao,8262
8
+ ethproto/wrappers.py,sha256=9qDwRDOXw3wquzvGfIsub-VPWm98GBWP7dHLFOUPWzg,17307
9
+ eth_prototype-1.2.0b1.dist-info/AUTHORS.rst,sha256=Ui-05yYXtDZxna6o1yNcfdm8Jt68UIDQ01osiLxlYlU,95
10
+ eth_prototype-1.2.0b1.dist-info/LICENSE.txt,sha256=U_Q6_nDYDwZPIuhttHi37hXZ2qU2-HlV2geo9hzHXFw,1087
11
+ eth_prototype-1.2.0b1.dist-info/METADATA,sha256=hz3CfguoZtt1YZck0PhTaVDAcTeX2dlk4MBvcwLobWY,2484
12
+ eth_prototype-1.2.0b1.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
13
+ eth_prototype-1.2.0b1.dist-info/top_level.txt,sha256=Dl0X7m6N1hxeo4JpGpSNqWC2gtsN0731g-DL1J0mpjc,9
14
+ eth_prototype-1.2.0b1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
ethproto/aa_bundler.py CHANGED
@@ -1,16 +1,17 @@
1
1
  import random
2
- from warnings import warn
3
2
  from enum import Enum
4
- import requests
3
+ from warnings import warn
4
+
5
5
  from environs import Env
6
6
  from eth_abi import encode
7
7
  from eth_account import Account
8
8
  from eth_account.messages import encode_defunct
9
+ from eth_utils import add_0x_prefix
9
10
  from hexbytes import HexBytes
10
11
  from web3 import Web3
11
12
  from web3.constants import ADDRESS_ZERO
12
- from .contracts import RevertError
13
13
 
14
+ from .contracts import RevertError
14
15
 
15
16
  env = Env()
16
17
 
@@ -55,8 +56,8 @@ RANDOM_NONCE_KEY = None
55
56
 
56
57
 
57
58
  def pack_two(a, b):
58
- a = HexBytes(a).hex()[2:]
59
- b = HexBytes(b).hex()[2:]
59
+ a = HexBytes(a).hex()
60
+ b = HexBytes(b).hex()
60
61
  return "0x" + a.zfill(32) + b.zfill(32)
61
62
 
62
63
 
@@ -102,23 +103,23 @@ def hash_packed_user_operation_only(packed_user_op):
102
103
  hash_paymaster_and_data,
103
104
  ],
104
105
  ).hex()
105
- ).hex()
106
+ )
106
107
 
107
108
 
108
109
  def hash_packed_user_operation(packed_user_op, chain_id, entry_point):
109
110
  return Web3.keccak(
110
111
  hexstr=encode(
111
112
  ["bytes32", "address", "uint256"],
112
- [HexBytes(hash_packed_user_operation_only(packed_user_op)), entry_point, chain_id],
113
+ [hash_packed_user_operation_only(packed_user_op), entry_point, chain_id],
113
114
  ).hex()
114
- ).hex()
115
+ )
115
116
 
116
117
 
117
118
  def sign_user_operation(private_key, user_operation, chain_id, entry_point):
118
119
  packed_user_op = pack_user_operation(user_operation)
119
120
  hash = hash_packed_user_operation(packed_user_op, chain_id, entry_point)
120
- signature = Account.sign_message(encode_defunct(hexstr=hash), private_key)
121
- return signature.signature.hex()
121
+ signature = Account.sign_message(encode_defunct(hexstr=hash.hex()), private_key)
122
+ return signature.signature
122
123
 
123
124
 
124
125
  def make_nonce(nonce_key, nonce):
@@ -232,8 +233,10 @@ def send_transaction(w3, tx, retry_nonce=None):
232
233
  "maxPriorityFeePerGas": "0x00",
233
234
  }
234
235
  )
235
- user_operation["signature"] = sign_user_operation(
236
- AA_BUNDLER_EXECUTOR_PK, user_operation, tx["chainId"], AA_BUNDLER_ENTRYPOINT
236
+ user_operation["signature"] = add_0x_prefix(
237
+ sign_user_operation(
238
+ AA_BUNDLER_EXECUTOR_PK, user_operation, tx["chainId"], AA_BUNDLER_ENTRYPOINT
239
+ ).hex()
237
240
  )
238
241
  # Remove paymaster related fields
239
242
  user_operation.pop("paymaster", None)
ethproto/w3wrappers.py CHANGED
@@ -9,7 +9,7 @@ from eth_utils.abi import event_abi_to_log_topic
9
9
  from hexbytes import HexBytes
10
10
  from web3.contract import Contract
11
11
  from web3.exceptions import ContractLogicError, ExtraDataLengthError
12
- from web3.middleware import geth_poa_middleware
12
+ from web3.middleware import ExtraDataToPOAMiddleware
13
13
 
14
14
  from .build_artifacts import ArtifactLibrary
15
15
  from .contracts import RevertError
@@ -68,9 +68,9 @@ def register_w3_provider(provider_key="w3", tester=None, provider_kwargs={}):
68
68
  try:
69
69
  w3.eth.get_block("latest")
70
70
  except ExtraDataLengthError:
71
- w3.middleware_onion.inject(geth_poa_middleware, layer=0)
71
+ w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)
72
72
  elif W3_POA == "yes":
73
- w3.middleware_onion.inject(geth_poa_middleware, layer=0)
73
+ w3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0)
74
74
 
75
75
  # If address_book not provided and there are envs with W3_ADDRESS_BOOK_PREFIX,
76
76
  # use W3EnvAddressBook
@@ -444,7 +444,7 @@ class W3Provider(BaseProvider):
444
444
  def get_events(self, eth_wrapper, event_name, filter_kwargs={}):
445
445
  """Returns a list of events given a filter, like this:
446
446
 
447
- >>> provider.get_events(currencywrapper, "Transfer", dict(fromBlock=0))
447
+ >>> provider.get_events(currencywrapper, "Transfer", dict(from_block=0))
448
448
  [AttributeDict({
449
449
  'args': AttributeDict(
450
450
  {'from': '0x0000000000000000000000000000000000000000',
@@ -463,8 +463,8 @@ class W3Provider(BaseProvider):
463
463
  """
464
464
  contract = eth_wrapper.contract
465
465
  event = getattr(contract.events, event_name)
466
- if "fromBlock" not in filter_kwargs:
467
- filter_kwargs["fromBlock"] = self.get_first_block(eth_wrapper)
466
+ if "from_block" not in filter_kwargs:
467
+ filter_kwargs["from_block"] = self.get_first_block(eth_wrapper)
468
468
  event_filter = event.create_filter(**filter_kwargs)
469
469
  return event_filter.get_all_entries()
470
470
 
@@ -490,7 +490,7 @@ class W3Provider(BaseProvider):
490
490
  constructor_params, init_params = init_params
491
491
  real_contract = self.construct(eth_contract, constructor_params, {"from": eth_wrapper.owner})
492
492
  ERC1967Proxy = self.get_contract_factory("ERC1967Proxy")
493
- init_data = eth_contract.encodeABI(fn_name="initialize", args=init_params)
493
+ init_data = eth_contract.encode_abi(abi_element_identifier="initialize", args=init_params)
494
494
  proxy_contract = self.construct(
495
495
  ERC1967Proxy,
496
496
  (real_contract.address, init_data),
@@ -1,14 +0,0 @@
1
- ethproto/__init__.py,sha256=YWkAFysBp4tZjLWWB2FFmp5yG23pUYhQvgQW9b3soXs,579
2
- ethproto/aa_bundler.py,sha256=PKuWZciyfIqxAZQ30JsKAdICWHLKuU5LDmoL7lCLMqI,9426
3
- ethproto/build_artifacts.py,sha256=xwCd5hJUHP82IA-y3sSfX6fV15kjCGtV19RxNRcoor0,5441
4
- ethproto/contracts.py,sha256=rNVbCK1hURy7lWKhzSdXgVWo3wx9O_Ghk-6PfgOsRNk,18662
5
- ethproto/defender_relay.py,sha256=05A8TfRZwiBhCpo924Pf9CjfKSir2Wvgg1p_asFxJbw,1777
6
- ethproto/w3wrappers.py,sha256=nHMunKlmB2BuT03ic9Pk_RcvNsZsBdWQIxQeYnTluVE,21226
7
- ethproto/wadray.py,sha256=JBsu5KcyU9k70bDK03T2IY6qPVFO30WbYPhwrAHdXao,8262
8
- ethproto/wrappers.py,sha256=9qDwRDOXw3wquzvGfIsub-VPWm98GBWP7dHLFOUPWzg,17307
9
- eth_prototype-1.1.1.dist-info/AUTHORS.rst,sha256=Ui-05yYXtDZxna6o1yNcfdm8Jt68UIDQ01osiLxlYlU,95
10
- eth_prototype-1.1.1.dist-info/LICENSE.txt,sha256=U_Q6_nDYDwZPIuhttHi37hXZ2qU2-HlV2geo9hzHXFw,1087
11
- eth_prototype-1.1.1.dist-info/METADATA,sha256=KYeFLVgwSlTKLtKvwUyzbxjbuoh0wGyRAO36sHvDLO0,2482
12
- eth_prototype-1.1.1.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
13
- eth_prototype-1.1.1.dist-info/top_level.txt,sha256=Dl0X7m6N1hxeo4JpGpSNqWC2gtsN0731g-DL1J0mpjc,9
14
- eth_prototype-1.1.1.dist-info/RECORD,,