eth-prototype 1.5.0b1__py3-none-any.whl → 1.5.0b3__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.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/METADATA +1 -1
- {eth_prototype-1.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/RECORD +7 -7
- ethproto/aa_bundler.py +67 -19
- {eth_prototype-1.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/WHEEL +0 -0
- {eth_prototype-1.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/licenses/AUTHORS.rst +0 -0
- {eth_prototype-1.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/licenses/LICENSE.txt +0 -0
- {eth_prototype-1.5.0b1.dist-info → eth_prototype-1.5.0b3.dist-info}/top_level.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
eth_prototype-1.5.
|
|
2
|
-
eth_prototype-1.5.
|
|
1
|
+
eth_prototype-1.5.0b3.dist-info/licenses/AUTHORS.rst,sha256=Ui-05yYXtDZxna6o1yNcfdm8Jt68UIDQ01osiLxlYlU,95
|
|
2
|
+
eth_prototype-1.5.0b3.dist-info/licenses/LICENSE.txt,sha256=U_Q6_nDYDwZPIuhttHi37hXZ2qU2-HlV2geo9hzHXFw,1087
|
|
3
3
|
ethproto/__init__.py,sha256=YWkAFysBp4tZjLWWB2FFmp5yG23pUYhQvgQW9b3soXs,579
|
|
4
|
-
ethproto/aa_bundler.py,sha256=
|
|
4
|
+
ethproto/aa_bundler.py,sha256=BV8UJD2hKs-CfQxo3r6dS-2Bk9fNQM9QIdt0VIZbfq4,24289
|
|
5
5
|
ethproto/build_artifacts.py,sha256=3t-MTSFZU1pQtDwf65zNJkceWleLRlzcEo8CFpu4_6s,10031
|
|
6
6
|
ethproto/contracts.py,sha256=R9lWKPe77jkPBXx798qhnVPWSFF2nhz4AaYowipNIBc,22625
|
|
7
7
|
ethproto/defender_relay.py,sha256=05A8TfRZwiBhCpo924Pf9CjfKSir2Wvgg1p_asFxJbw,1777
|
|
@@ -12,7 +12,7 @@ ethproto/test_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
12
12
|
ethproto/test_utils/factories.py,sha256=G8DnUDG_yThRxMTCkymzcjm9lR_ni0_ZmTsb3sEfIdI,1805
|
|
13
13
|
ethproto/test_utils/hardhat.py,sha256=HzTqIznu6zVd_-doL96ftFJ235ktDCQen1QDQbNuwfM,2361
|
|
14
14
|
ethproto/test_utils/vcr_utils.py,sha256=1FH2sgJlElSjWkJLuO3C7E2J-4HKyFvjAqkCnGRZJyk,797
|
|
15
|
-
eth_prototype-1.5.
|
|
16
|
-
eth_prototype-1.5.
|
|
17
|
-
eth_prototype-1.5.
|
|
18
|
-
eth_prototype-1.5.
|
|
15
|
+
eth_prototype-1.5.0b3.dist-info/METADATA,sha256=omwxdFV1FIeoFDkqgAud8HV5JI4zxr5jIk3u1qI1ZMY,2697
|
|
16
|
+
eth_prototype-1.5.0b3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
17
|
+
eth_prototype-1.5.0b3.dist-info/top_level.txt,sha256=Dl0X7m6N1hxeo4JpGpSNqWC2gtsN0731g-DL1J0mpjc,9
|
|
18
|
+
eth_prototype-1.5.0b3.dist-info/RECORD,,
|
ethproto/aa_bundler.py
CHANGED
|
@@ -13,6 +13,7 @@ from eth_account.messages import encode_defunct
|
|
|
13
13
|
from eth_typing import HexAddress
|
|
14
14
|
from eth_utils import add_0x_prefix, function_signature_to_4byte_selector
|
|
15
15
|
from hexbytes import HexBytes
|
|
16
|
+
from requests import HTTPError
|
|
16
17
|
from web3 import Web3
|
|
17
18
|
from web3.constants import ADDRESS_ZERO
|
|
18
19
|
from web3.types import StateOverride, TxParams
|
|
@@ -197,7 +198,7 @@ class UserOperation:
|
|
|
197
198
|
"maxFeePerGas": "0x%x" % self.max_fee_per_gas,
|
|
198
199
|
"signature": add_0x_prefix(self.signature.hex()),
|
|
199
200
|
"paymaster": self.paymaster,
|
|
200
|
-
"paymasterData": self.paymaster_data,
|
|
201
|
+
"paymasterData": self.paymaster_data.to_0x_hex(),
|
|
201
202
|
"paymasterVerificationGasLimit": "0x%x" % self.paymaster_verification_gas_limit,
|
|
202
203
|
"paymasterPostOpGasLimit": "0x%x" % self.paymaster_post_op_gas_limit,
|
|
203
204
|
}
|
|
@@ -441,7 +442,7 @@ class Bundler:
|
|
|
441
442
|
def estimate_user_operation_gas(self, user_operation: UserOperation) -> UserOpEstimation:
|
|
442
443
|
resp = self.bundler.provider.make_request(
|
|
443
444
|
"eth_estimateUserOperationGas",
|
|
444
|
-
[user_operation.
|
|
445
|
+
[user_operation.as_dict(), self.entrypoint, self.overrides],
|
|
445
446
|
)
|
|
446
447
|
if "error" in resp:
|
|
447
448
|
raise BundlerRevertError(resp["error"]["message"], user_operation, resp)
|
|
@@ -461,23 +462,32 @@ class Bundler:
|
|
|
461
462
|
)
|
|
462
463
|
|
|
463
464
|
def alchemy_estimation(self, user_operation: UserOperation) -> AlchemyGasAndPaymasterAndData:
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
"
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
465
|
+
try:
|
|
466
|
+
resp = self.bundler.provider.make_request(
|
|
467
|
+
"alchemy_requestGasAndPaymasterAndData",
|
|
468
|
+
[
|
|
469
|
+
{
|
|
470
|
+
"policyId": self.alchemy_gas_policy_id,
|
|
471
|
+
"entryPoint": self.entrypoint,
|
|
472
|
+
"dummySignature": DUMMY_SIGNATURE,
|
|
473
|
+
"userOperation": user_operation.as_reduced_dict(),
|
|
474
|
+
"overrides": {
|
|
475
|
+
"maxFeePerGas": {"multiplier": self.base_gas_price_factor},
|
|
476
|
+
"maxPriorityFeePerGas": {"multiplier": self.priority_gas_price_factor},
|
|
477
|
+
"callGasLimit": {"multiplier": self.gas_limit_factor},
|
|
478
|
+
"verificationGasLimit": {"multiplier": self.verification_gas_factor},
|
|
479
|
+
},
|
|
480
|
+
# Alchemy seems to be ignoring this, even though it's documented
|
|
481
|
+
"stateOverrideSet": self.overrides,
|
|
482
|
+
}
|
|
483
|
+
],
|
|
484
|
+
)
|
|
485
|
+
except HTTPError as e:
|
|
486
|
+
raise BundlerRevertError(
|
|
487
|
+
f"HTTP error while requesting gas and paymaster data: {str(e)}",
|
|
488
|
+
userop=user_operation,
|
|
489
|
+
response=e.response.json(),
|
|
490
|
+
) from e
|
|
481
491
|
|
|
482
492
|
if "error" in resp:
|
|
483
493
|
raise BundlerRevertError(resp["error"]["message"], userop=user_operation, response=resp)
|
|
@@ -516,6 +526,35 @@ class Bundler:
|
|
|
516
526
|
paymaster_and_data=paymaster_and_data,
|
|
517
527
|
)
|
|
518
528
|
|
|
529
|
+
def pimlico_gas_price(self):
|
|
530
|
+
resp = self.bundler.provider.make_request("pimlico_getUserOperationGasPrice", [])
|
|
531
|
+
if "error" in resp:
|
|
532
|
+
raise BundlerRevertError(resp["error"]["message"], response=resp)
|
|
533
|
+
# {
|
|
534
|
+
# "jsonrpc": "2.0",
|
|
535
|
+
# "id": 1,
|
|
536
|
+
# "result": {
|
|
537
|
+
# "slow": {
|
|
538
|
+
# "maxFeePerGas": "0x829b42b5",
|
|
539
|
+
# "maxPriorityFeePerGas": "0x829b42b5"
|
|
540
|
+
# },
|
|
541
|
+
# "standard": {
|
|
542
|
+
# "maxFeePerGas": "0x88d36a75",
|
|
543
|
+
# "maxPriorityFeePerGas": "0x88d36a75"
|
|
544
|
+
# },
|
|
545
|
+
# "fast": {
|
|
546
|
+
# "maxFeePerGas": "0x8f0b9234",
|
|
547
|
+
# "maxPriorityFeePerGas": "0x8f0b9234"
|
|
548
|
+
# }
|
|
549
|
+
# }
|
|
550
|
+
# }
|
|
551
|
+
priority_fee = int(resp["result"]["standard"]["maxPriorityFeePerGas"], 16)
|
|
552
|
+
total_fee = int(resp["result"]["standard"]["maxFeePerGas"], 16)
|
|
553
|
+
base_fee = total_fee - priority_fee
|
|
554
|
+
max_priority_fee_per_gas = int(priority_fee * self.priority_gas_price_factor)
|
|
555
|
+
max_fee_per_gas = min(max_priority_fee_per_gas + base_fee, self.max_fee_per_gas)
|
|
556
|
+
return GasPrice(max_priority_fee_per_gas=max_priority_fee_per_gas, max_fee_per_gas=max_fee_per_gas)
|
|
557
|
+
|
|
519
558
|
def generic_gas_price(self):
|
|
520
559
|
base_fee = self.get_base_fee()
|
|
521
560
|
priority_fee = self.w3.eth.max_priority_fee
|
|
@@ -539,6 +578,15 @@ class Bundler:
|
|
|
539
578
|
estimation_and_paymaster.paymaster_and_data
|
|
540
579
|
)
|
|
541
580
|
|
|
581
|
+
elif self.bundler_type == "pimlico":
|
|
582
|
+
estimation = self.estimate_user_operation_gas(user_operation)
|
|
583
|
+
|
|
584
|
+
user_operation = user_operation.add_estimation(estimation)
|
|
585
|
+
|
|
586
|
+
gas_price = self.pimlico_gas_price()
|
|
587
|
+
|
|
588
|
+
user_operation = user_operation.add_gas_price(gas_price)
|
|
589
|
+
|
|
542
590
|
elif self.bundler_type == "generic":
|
|
543
591
|
estimation = self.estimate_user_operation_gas(user_operation)
|
|
544
592
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|