eth-prototype 1.1.0__py3-none-any.whl → 1.1.1__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.
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/METADATA +1 -1
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/RECORD +8 -8
- ethproto/aa_bundler.py +23 -7
- ethproto/w3wrappers.py +2 -0
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/AUTHORS.rst +0 -0
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/LICENSE.txt +0 -0
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/WHEEL +0 -0
- {eth_prototype-1.1.0.dist-info → eth_prototype-1.1.1.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,14 @@
|
|
1
1
|
ethproto/__init__.py,sha256=YWkAFysBp4tZjLWWB2FFmp5yG23pUYhQvgQW9b3soXs,579
|
2
|
-
ethproto/aa_bundler.py,sha256=
|
2
|
+
ethproto/aa_bundler.py,sha256=PKuWZciyfIqxAZQ30JsKAdICWHLKuU5LDmoL7lCLMqI,9426
|
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=
|
6
|
+
ethproto/w3wrappers.py,sha256=nHMunKlmB2BuT03ic9Pk_RcvNsZsBdWQIxQeYnTluVE,21226
|
7
7
|
ethproto/wadray.py,sha256=JBsu5KcyU9k70bDK03T2IY6qPVFO30WbYPhwrAHdXao,8262
|
8
8
|
ethproto/wrappers.py,sha256=9qDwRDOXw3wquzvGfIsub-VPWm98GBWP7dHLFOUPWzg,17307
|
9
|
-
eth_prototype-1.1.
|
10
|
-
eth_prototype-1.1.
|
11
|
-
eth_prototype-1.1.
|
12
|
-
eth_prototype-1.1.
|
13
|
-
eth_prototype-1.1.
|
14
|
-
eth_prototype-1.1.
|
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,,
|
ethproto/aa_bundler.py
CHANGED
@@ -8,6 +8,7 @@ from eth_account import Account
|
|
8
8
|
from eth_account.messages import encode_defunct
|
9
9
|
from hexbytes import HexBytes
|
10
10
|
from web3 import Web3
|
11
|
+
from web3.constants import ADDRESS_ZERO
|
11
12
|
from .contracts import RevertError
|
12
13
|
|
13
14
|
|
@@ -17,6 +18,9 @@ AA_BUNDLER_SENDER = env.str("AA_BUNDLER_SENDER", None)
|
|
17
18
|
AA_BUNDLER_ENTRYPOINT = env.str("AA_BUNDLER_ENTRYPOINT", "0x0000000071727De22E5E9d8BAf0edAc6f37da032")
|
18
19
|
AA_BUNDLER_EXECUTOR_PK = env.str("AA_BUNDLER_EXECUTOR_PK", None)
|
19
20
|
AA_BUNDLER_PROVIDER = env.str("AA_BUNDLER_PROVIDER", "alchemy")
|
21
|
+
AA_BUNDLER_GAS_LIMIT_FACTOR = env.float("AA_BUNDLER_GAS_LIMIT_FACTOR", 1)
|
22
|
+
AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR = env.float("AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR", 1)
|
23
|
+
AA_BUNDLER_BASE_GAS_PRICE_FACTOR = env.float("AA_BUNDLER_BASE_GAS_PRICE_FACTOR", 1)
|
20
24
|
|
21
25
|
NonceMode = Enum(
|
22
26
|
"NonceMode",
|
@@ -147,7 +151,7 @@ def get_nonce_and_key(w3, tx, nonce_mode, entry_point=AA_BUNDLER_ENTRYPOINT, fet
|
|
147
151
|
|
148
152
|
if nonce is None:
|
149
153
|
if fetch or nonce_mode == NonceMode.FIXED_KEY_FETCH_ALWAYS:
|
150
|
-
nonce = fetch_nonce(w3, tx
|
154
|
+
nonce = fetch_nonce(w3, get_sender(tx), entry_point, nonce_key)
|
151
155
|
elif nonce_key not in NONCE_CACHE:
|
152
156
|
nonce = 0
|
153
157
|
else:
|
@@ -168,7 +172,16 @@ def handle_response_error(resp, w3, tx, retry_nonce):
|
|
168
172
|
|
169
173
|
def get_base_fee(w3):
|
170
174
|
blk = w3.eth.get_block("latest")
|
171
|
-
return blk["baseFeePerGas"]
|
175
|
+
return int(_to_uint(blk["baseFeePerGas"]) * AA_BUNDLER_BASE_GAS_PRICE_FACTOR)
|
176
|
+
|
177
|
+
|
178
|
+
def get_sender(tx):
|
179
|
+
if "from" not in tx or tx["from"] == ADDRESS_ZERO:
|
180
|
+
if AA_BUNDLER_SENDER is None:
|
181
|
+
raise RuntimeError("Must define AA_BUNDLER_SENDER or send 'from' in the TX")
|
182
|
+
return AA_BUNDLER_SENDER
|
183
|
+
else:
|
184
|
+
return tx["from"]
|
172
185
|
|
173
186
|
|
174
187
|
def send_transaction(w3, tx, retry_nonce=None):
|
@@ -185,7 +198,7 @@ def send_transaction(w3, tx, retry_nonce=None):
|
|
185
198
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c"
|
186
199
|
)
|
187
200
|
user_operation = {
|
188
|
-
"sender": tx
|
201
|
+
"sender": get_sender(tx),
|
189
202
|
"nonce": hex(make_nonce(nonce_key, nonce)),
|
190
203
|
"callData": call_data,
|
191
204
|
"signature": dummy_signature,
|
@@ -203,9 +216,12 @@ def send_transaction(w3, tx, retry_nonce=None):
|
|
203
216
|
resp = w3.provider.make_request("rundler_maxPriorityFeePerGas", [])
|
204
217
|
if "error" in resp:
|
205
218
|
raise RevertError(resp["error"]["message"])
|
206
|
-
max_priority_fee_per_gas = resp["result"]
|
207
|
-
user_operation["maxPriorityFeePerGas"] = max_priority_fee_per_gas
|
208
|
-
user_operation["maxFeePerGas"] = hex(
|
219
|
+
max_priority_fee_per_gas = int(_to_uint(resp["result"]) * AA_BUNDLER_PRIORITY_GAS_PRICE_FACTOR)
|
220
|
+
user_operation["maxPriorityFeePerGas"] = hex(max_priority_fee_per_gas)
|
221
|
+
user_operation["maxFeePerGas"] = hex(max_priority_fee_per_gas + get_base_fee(w3))
|
222
|
+
user_operation["callGasLimit"] = hex(
|
223
|
+
int(_to_uint(user_operation["callGasLimit"]) * AA_BUNDLER_GAS_LIMIT_FACTOR)
|
224
|
+
)
|
209
225
|
elif AA_BUNDLER_PROVIDER == "gelato":
|
210
226
|
user_operation.update(
|
211
227
|
{
|
@@ -231,4 +247,4 @@ def send_transaction(w3, tx, retry_nonce=None):
|
|
231
247
|
|
232
248
|
# Store nonce in the cache, so next time uses a new nonce
|
233
249
|
NONCE_CACHE[nonce_key] = nonce + 1
|
234
|
-
return resp["result"]
|
250
|
+
return {"userOpHash": resp["result"]}
|
ethproto/w3wrappers.py
CHANGED
@@ -375,6 +375,8 @@ class W3ETHCall(ETHCall):
|
|
375
375
|
def normalize_receipt(self, wrapper, receipt):
|
376
376
|
if W3_TRANSACT_MODE == "defender-async":
|
377
377
|
return receipt # Don't do anything because the receipt is just a dict of not-yet-mined tx
|
378
|
+
elif W3_TRANSACT_MODE == "aa-bundler-async":
|
379
|
+
return receipt # Don't do anything because the receipt is just a dict of {"userOpHash": "..."}
|
378
380
|
return ReceiptWrapper(receipt, wrapper.contract)
|
379
381
|
|
380
382
|
def _handle_exception(self, err):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|