web3 7.8.0__py3-none-any.whl → 7.9.0__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.
- web3/_utils/contract_sources/contract_data/ambiguous_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/arrays_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/bytes_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/constructor_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/contract_caller_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/emitter_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/event_contracts.py +7 -7
- web3/_utils/contract_sources/contract_data/extended_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/fallback_function_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/function_name_tester_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/math_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_lookup.py +3 -3
- web3/_utils/contract_sources/contract_data/offchain_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/panic_errors_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/payable_tester.py +3 -3
- web3/_utils/contract_sources/contract_data/receive_function_contracts.py +5 -5
- web3/_utils/contract_sources/contract_data/reflector_contracts.py +3 -3
- web3/_utils/contract_sources/contract_data/revert_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/simple_resolver.py +3 -3
- web3/_utils/contract_sources/contract_data/storage_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/string_contract.py +3 -3
- web3/_utils/contract_sources/contract_data/tuple_contracts.py +5 -5
- web3/_utils/error_formatters_utils.py +1 -1
- web3/_utils/formatters.py +28 -0
- web3/_utils/method_formatters.py +121 -20
- web3/_utils/module_testing/eth_module.py +99 -2
- web3/_utils/module_testing/persistent_connection_provider.py +1 -1
- web3/_utils/rpc_abi.py +1 -0
- web3/_utils/validation.py +191 -0
- web3/eth/async_eth.py +19 -0
- web3/eth/eth.py +15 -0
- web3/gas_strategies/time_based.py +1 -1
- web3/manager.py +13 -204
- web3/providers/persistent/persistent.py +29 -3
- web3/providers/persistent/subscription_manager.py +7 -2
- web3/providers/persistent/websocket.py +8 -3
- web3/types.py +26 -2
- {web3-7.8.0.dist-info → web3-7.9.0.dist-info}/METADATA +11 -7
- {web3-7.8.0.dist-info → web3-7.9.0.dist-info}/RECORD +42 -42
- {web3-7.8.0.dist-info → web3-7.9.0.dist-info}/WHEEL +1 -1
- {web3-7.8.0.dist-info → web3-7.9.0.dist-info}/LICENSE +0 -0
- {web3-7.8.0.dist-info → web3-7.9.0.dist-info}/top_level.txt +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.29.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/StringContract.sol:StringContract
|
|
7
|
-
STRING_CONTRACT_BYTECODE = "
|
|
8
|
-
STRING_CONTRACT_RUNTIME = "
|
|
7
|
+
STRING_CONTRACT_BYTECODE = "0x608060405234801561000f575f5ffd5b50604051610c1a380380610c1a83398181016040528101906100319190610193565b805f908161003f91906103ea565b50506104b9565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100a58261005f565b810181811067ffffffffffffffff821117156100c4576100c361006f565b5b80604052505050565b5f6100d6610046565b90506100e2828261009c565b919050565b5f67ffffffffffffffff8211156101015761010061006f565b5b61010a8261005f565b9050602081019050919050565b8281835e5f83830152505050565b5f610137610132846100e7565b6100cd565b9050828152602081018484840111156101535761015261005b565b5b61015e848285610117565b509392505050565b5f82601f83011261017a57610179610057565b5b815161018a848260208601610125565b91505092915050565b5f602082840312156101a8576101a761004f565b5b5f82015167ffffffffffffffff8111156101c5576101c4610053565b5b6101d184828501610166565b91505092915050565b5f81519050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061022857607f821691505b60208210810361023b5761023a6101e4565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f6008830261029d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82610262565b6102a78683610262565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f6102eb6102e66102e1846102bf565b6102c8565b6102bf565b9050919050565b5f819050919050565b610304836102d1565b610318610310826102f2565b84845461026e565b825550505050565b5f5f905090565b61032f610320565b61033a8184846102fb565b505050565b5b8181101561035d576103525f82610327565b600181019050610340565b5050565b601f8211156103a25761037381610241565b61037c84610253565b8101602085101561038b578190505b61039f61039785610253565b83018261033f565b50505b505050565b5f82821c905092915050565b5f6103c25f19846008026103a7565b1980831691505092915050565b5f6103da83836103b3565b9150826002028217905092915050565b6103f3826101da565b67ffffffffffffffff81111561040c5761040b61006f565b5b6104168254610211565b610421828285610361565b5f60209050601f831160018114610452575f8415610440578287015190505b61044a85826103cf565b8655506104b1565b601f19841661046086610241565b5f5b8281101561048757848901518255600182019150602085019450602081019050610462565b868310156104a457848901516104a0601f8916826103b3565b8355505b6001600288020188555050505b505050505050565b610754806104c65f395ff3fe608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea264697066735822122057cfad9927863e77e0346ce71b093edd9bde029ffc5a2d9589f5ec615f8d6a1764736f6c634300081d0033" # noqa: E501
|
|
8
|
+
STRING_CONTRACT_RUNTIME = "0x608060405260043610610037575f3560e01c806320965255146100995780633fa4f245146100b757806393a09352146100e157610038565b5b348015610043575f5ffd5b505f36606082828080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f820116905080830192505050505050509050915050805190602001f35b6100a1610109565b6040516100ae91906102a5565b60405180910390f35b3480156100c2575f5ffd5b506100cb610198565b6040516100d891906102a5565b60405180910390f35b3480156100ec575f5ffd5b5061010760048036038101906101029190610402565b610223565b005b60605f805461011790610476565b80601f016020809104026020016040519081016040528092919081815260200182805461014390610476565b801561018e5780601f106101655761010080835404028352916020019161018e565b820191905f5260205f20905b81548152906001019060200180831161017157829003601f168201915b5050505050905090565b5f80546101a490610476565b80601f01602080910402602001604051908101604052809291908181526020018280546101d090610476565b801561021b5780601f106101f25761010080835404028352916020019161021b565b820191905f5260205f20905b8154815290600101906020018083116101fe57829003601f168201915b505050505081565b805f9081610231919061064f565b5050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61027782610235565b610281818561023f565b935061029181856020860161024f565b61029a8161025d565b840191505092915050565b5f6020820190508181035f8301526102bd818461026d565b905092915050565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f5ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6103148261025d565b810181811067ffffffffffffffff82111715610333576103326102de565b5b80604052505050565b5f6103456102c5565b9050610351828261030b565b919050565b5f67ffffffffffffffff8211156103705761036f6102de565b5b6103798261025d565b9050602081019050919050565b828183375f83830152505050565b5f6103a66103a184610356565b61033c565b9050828152602081018484840111156103c2576103c16102da565b5b6103cd848285610386565b509392505050565b5f82601f8301126103e9576103e86102d6565b5b81356103f9848260208601610394565b91505092915050565b5f60208284031215610417576104166102ce565b5b5f82013567ffffffffffffffff811115610434576104336102d2565b5b610440848285016103d5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f600282049050600182168061048d57607f821691505b6020821081036104a05761049f610449565b5b50919050565b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026105027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826104c7565b61050c86836104c7565b95508019841693508086168417925050509392505050565b5f819050919050565b5f819050919050565b5f61055061054b61054684610524565b61052d565b610524565b9050919050565b5f819050919050565b61056983610536565b61057d61057582610557565b8484546104d3565b825550505050565b5f5f905090565b610594610585565b61059f818484610560565b505050565b5b818110156105c2576105b75f8261058c565b6001810190506105a5565b5050565b601f821115610607576105d8816104a6565b6105e1846104b8565b810160208510156105f0578190505b6106046105fc856104b8565b8301826105a4565b50505b505050565b5f82821c905092915050565b5f6106275f198460080261060c565b1980831691505092915050565b5f61063f8383610618565b9150826002028217905092915050565b61065882610235565b67ffffffffffffffff811115610671576106706102de565b5b61067b8254610476565b6106868282856105c6565b5f60209050601f8311600181146106b7575f84156106a5578287015190505b6106af8582610634565b865550610716565b601f1984166106c5866104a6565b5f5b828110156106ec578489015182556001820191506020850194506020810190506106c7565b868310156107095784890151610705601f891682610618565b8355505b6001600288020188555050505b50505050505056fea264697066735822122057cfad9927863e77e0346ce71b093edd9bde029ffc5a2d9589f5ec615f8d6a1764736f6c634300081d0033" # noqa: E501
|
|
9
9
|
STRING_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [{"internalType": "string", "name": "_value", "type": "string"}],
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Generated by `compile_contracts.py` script.
|
|
3
|
-
Compiled with Solidity v0.8.
|
|
3
|
+
Compiled with Solidity v0.8.29.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
# source: web3/_utils/contract_sources/TupleContracts.sol:TupleContract
|
|
7
|
-
TUPLE_CONTRACT_BYTECODE = "
|
|
8
|
-
TUPLE_CONTRACT_RUNTIME = "
|
|
7
|
+
TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b50610a688061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea264697066735822122093989c185ced19ac413031c41f5829f7372fbdf036232e036a7610d4ecd2ed2264736f6c634300081d0033" # noqa: E501
|
|
8
|
+
TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80638e1ae3c71461002d575b5f5ffd5b6100476004803603810190610042919061064d565b61005d565b6040516100549190610a12565b60405180910390f35b61006561006d565b819050919050565b60405180606001604052805f815260200160608152602001606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100e8826100a2565b810181811067ffffffffffffffff82111715610107576101066100b2565b5b80604052505050565b5f61011961008d565b905061012582826100df565b919050565b5f5ffd5b5f819050919050565b6101408161012e565b811461014a575f5ffd5b50565b5f8135905061015b81610137565b92915050565b5f5ffd5b5f67ffffffffffffffff82111561017f5761017e6100b2565b5b602082029050602081019050919050565b5f5ffd5b5f6101a66101a184610165565b610110565b905080838252602082019050602084028301858111156101c9576101c8610190565b5b835b818110156101f257806101de888261014d565b8452602084019350506020810190506101cb565b5050509392505050565b5f82601f8301126102105761020f610161565b5b8135610220848260208601610194565b91505092915050565b5f67ffffffffffffffff821115610243576102426100b2565b5b602082029050602081019050919050565b5f819050919050565b61026681610254565b8114610270575f5ffd5b50565b5f813590506102818161025d565b92915050565b5f67ffffffffffffffff8211156102a1576102a06100b2565b5b602082029050919050565b5f8115159050919050565b6102c0816102ac565b81146102ca575f5ffd5b50565b5f813590506102db816102b7565b92915050565b5f6102f36102ee84610287565b610110565b9050806020840283018581111561030d5761030c610190565b5b835b81811015610336578061032288826102cd565b84526020840193505060208101905061030f565b5050509392505050565b5f82601f83011261035457610353610161565b5b60026103618482856102e1565b91505092915050565b5f67ffffffffffffffff821115610384576103836100b2565b5b602082029050602081019050919050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6103be82610395565b9050919050565b6103ce816103b4565b81146103d8575f5ffd5b50565b5f813590506103e9816103c5565b92915050565b5f6104016103fc8461036a565b610110565b9050808382526020820190506020840283018581111561042457610423610190565b5b835b8181101561044d578061043988826103db565b845260208401935050602081019050610426565b5050509392505050565b5f82601f83011261046b5761046a610161565b5b813561047b8482602086016103ef565b91505092915050565b5f608082840312156104995761049861009e565b5b6104a36060610110565b90505f6104b284828501610273565b5f8301525060206104c584828501610340565b602083015250606082013567ffffffffffffffff8111156104e9576104e861012a565b5b6104f584828501610457565b60408301525092915050565b5f61051361050e84610229565b610110565b9050808382526020820190506020840283018581111561053657610535610190565b5b835b8181101561057d57803567ffffffffffffffff81111561055b5761055a610161565b5b8086016105688982610484565b85526020850194505050602081019050610538565b5050509392505050565b5f82601f83011261059b5761059a610161565b5b81356105ab848260208601610501565b91505092915050565b5f606082840312156105c9576105c861009e565b5b6105d36060610110565b90505f6105e28482850161014d565b5f83015250602082013567ffffffffffffffff8111156106055761060461012a565b5b610611848285016101fc565b602083015250604082013567ffffffffffffffff8111156106355761063461012a565b5b61064184828501610587565b60408301525092915050565b5f6020828403121561066257610661610096565b5b5f82013567ffffffffffffffff81111561067f5761067e61009a565b5b61068b848285016105b4565b91505092915050565b61069d8161012e565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6106d78383610694565b60208301905092915050565b5f602082019050919050565b5f6106f9826106a3565b61070381856106ad565b935061070e836106bd565b805f5b8381101561073e57815161072588826106cc565b9750610730836106e3565b925050600181019050610711565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61077d81610254565b82525050565b5f60029050919050565b5f81905092915050565b5f819050919050565b6107a9816102ac565b82525050565b5f6107ba83836107a0565b60208301905092915050565b5f602082019050919050565b6107db81610783565b6107e5818461078d565b92506107f082610797565b805f5b8381101561082057815161080787826107af565b9650610812836107c6565b9250506001810190506107f3565b505050505050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61085a816103b4565b82525050565b5f61086b8383610851565b60208301905092915050565b5f602082019050919050565b5f61088d82610828565b6108978185610832565b93506108a283610842565b805f5b838110156108d25781516108b98882610860565b97506108c483610877565b9250506001810190506108a5565b5085935050505092915050565b5f608083015f8301516108f45f860182610774565b50602083015161090760208601826107d2565b506040830151848203606086015261091f8282610883565b9150508091505092915050565b5f61093783836108df565b905092915050565b5f602082019050919050565b5f6109558261074b565b61095f8185610755565b93508360208202850161097185610765565b805f5b858110156109ac578484038952815161098d858261092c565b94506109988361093f565b925060208a01995050600181019050610974565b50829750879550505050505092915050565b5f606083015f8301516109d35f860182610694565b50602083015184820360208601526109eb82826106ef565b91505060408301518482036040860152610a05828261094b565b9150508091505092915050565b5f6020820190508181035f830152610a2a81846109be565b90509291505056fea264697066735822122093989c185ced19ac413031c41f5829f7372fbdf036232e036a7610d4ecd2ed2264736f6c634300081d0033" # noqa: E501
|
|
9
9
|
TUPLE_CONTRACT_ABI = [
|
|
10
10
|
{
|
|
11
11
|
"inputs": [
|
|
@@ -71,8 +71,8 @@ TUPLE_CONTRACT_DATA = {
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
# source: web3/_utils/contract_sources/TupleContracts.sol:NestedTupleContract
|
|
74
|
-
NESTED_TUPLE_CONTRACT_BYTECODE = "
|
|
75
|
-
NESTED_TUPLE_CONTRACT_RUNTIME = "
|
|
74
|
+
NESTED_TUPLE_CONTRACT_BYTECODE = "0x6080604052348015600e575f5ffd5b5061067b8061001c5f395ff3fe608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220ff697eed38af67c30b96e9fc9f252d47c047bb5fec7e88738ca25e9c2bdb661364736f6c634300081d0033" # noqa: E501
|
|
75
|
+
NESTED_TUPLE_CONTRACT_RUNTIME = "0x608060405234801561000f575f5ffd5b5060043610610029575f3560e01c80632655aef11461002d575b5f5ffd5b610047600480360381019061004291906103f1565b61005d565b6040516100549190610625565b60405180910390f35b61006561006d565b819050919050565b6040518060200160405280606081525090565b5f604051905090565b5f5ffd5b5f5ffd5b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6100db82610095565b810181811067ffffffffffffffff821117156100fa576100f96100a5565b5b80604052505050565b5f61010c610080565b905061011882826100d2565b919050565b5f5ffd5b5f5ffd5b5f67ffffffffffffffff82111561013f5761013e6100a5565b5b602082029050602081019050919050565b5f5ffd5b5f67ffffffffffffffff82111561016e5761016d6100a5565b5b602082029050602081019050919050565b5f819050919050565b6101918161017f565b811461019b575f5ffd5b50565b5f813590506101ac81610188565b92915050565b5f604082840312156101c7576101c6610091565b5b6101d16040610103565b90505f6101e08482850161019e565b5f8301525060206101f38482850161019e565b60208301525092915050565b5f61021161020c84610154565b610103565b9050808382526020820190506040840283018581111561023457610233610150565b5b835b8181101561025d578061024988826101b2565b845260208401935050604081019050610236565b5050509392505050565b5f82601f83011261027b5761027a610121565b5b813561028b8482602086016101ff565b91505092915050565b5f602082840312156102a9576102a8610091565b5b6102b36020610103565b90505f82013567ffffffffffffffff8111156102d2576102d161011d565b5b6102de84828501610267565b5f8301525092915050565b5f6102fb6102f684610125565b610103565b9050808382526020820190506020840283018581111561031e5761031d610150565b5b835b8181101561036557803567ffffffffffffffff81111561034357610342610121565b5b8086016103508982610294565b85526020850194505050602081019050610320565b5050509392505050565b5f82601f83011261038357610382610121565b5b81356103938482602086016102e9565b91505092915050565b5f602082840312156103b1576103b0610091565b5b6103bb6020610103565b90505f82013567ffffffffffffffff8111156103da576103d961011d565b5b6103e68482850161036f565b5f8301525092915050565b5f6020828403121561040657610405610089565b5b5f82013567ffffffffffffffff8111156104235761042261008d565b5b61042f8482850161039c565b91505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6104938161017f565b82525050565b604082015f8201516104ad5f85018261048a565b5060208201516104c0602085018261048a565b50505050565b5f6104d18383610499565b60408301905092915050565b5f602082019050919050565b5f6104f382610461565b6104fd818561046b565b93506105088361047b565b805f5b8381101561053857815161051f88826104c6565b975061052a836104dd565b92505060018101905061050b565b5085935050505092915050565b5f602083015f8301518482035f86015261055f82826104e9565b9150508091505092915050565b5f6105778383610545565b905092915050565b5f602082019050919050565b5f61059582610438565b61059f8185610442565b9350836020820285016105b185610452565b805f5b858110156105ec57848403895281516105cd858261056c565b94506105d88361057f565b925060208a019950506001810190506105b4565b50829750879550505050505092915050565b5f602083015f8301518482035f860152610618828261058b565b9150508091505092915050565b5f6020820190508181035f83015261063d81846105fe565b90509291505056fea2646970667358221220ff697eed38af67c30b96e9fc9f252d47c047bb5fec7e88738ca25e9c2bdb661364736f6c634300081d0033" # noqa: E501
|
|
76
76
|
NESTED_TUPLE_CONTRACT_ABI = [
|
|
77
77
|
{
|
|
78
78
|
"inputs": [
|
|
@@ -43,7 +43,7 @@ PANIC_ERROR_CODES = {
|
|
|
43
43
|
"11": "Panic error 0x11: Arithmetic operation results in underflow or overflow.",
|
|
44
44
|
"12": "Panic error 0x12: Division by zero.",
|
|
45
45
|
"21": "Panic error 0x21: Cannot convert value into an enum type.",
|
|
46
|
-
"22": "Panic error
|
|
46
|
+
"22": "Panic error 0x22: Storage byte array is incorrectly encoded.",
|
|
47
47
|
"31": "Panic error 0x31: Call to 'pop()' on an empty array.",
|
|
48
48
|
"32": "Panic error 0x32: Array index is out of bounds.",
|
|
49
49
|
"41": "Panic error 0x41: Allocation of too much memory or array too large.",
|
web3/_utils/formatters.py
CHANGED
|
@@ -6,6 +6,7 @@ from typing import (
|
|
|
6
6
|
Callable,
|
|
7
7
|
Dict,
|
|
8
8
|
Iterable,
|
|
9
|
+
Optional,
|
|
9
10
|
Tuple,
|
|
10
11
|
TypeVar,
|
|
11
12
|
)
|
|
@@ -26,11 +27,15 @@ from eth_utils.toolz import (
|
|
|
26
27
|
compose,
|
|
27
28
|
curry,
|
|
28
29
|
dissoc,
|
|
30
|
+
pipe,
|
|
29
31
|
)
|
|
30
32
|
|
|
31
33
|
from web3._utils.decorators import (
|
|
32
34
|
reject_recursive_repeats,
|
|
33
35
|
)
|
|
36
|
+
from web3.types import (
|
|
37
|
+
RPCResponse,
|
|
38
|
+
)
|
|
34
39
|
|
|
35
40
|
TReturn = TypeVar("TReturn")
|
|
36
41
|
TValue = TypeVar("TValue")
|
|
@@ -131,3 +136,26 @@ def remove_key_if(
|
|
|
131
136
|
return dissoc(input_dict, key)
|
|
132
137
|
else:
|
|
133
138
|
return input_dict
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def apply_error_formatters(
|
|
142
|
+
error_formatters: Callable[..., Any],
|
|
143
|
+
response: RPCResponse,
|
|
144
|
+
) -> RPCResponse:
|
|
145
|
+
if error_formatters:
|
|
146
|
+
formatted_resp = pipe(response, error_formatters)
|
|
147
|
+
return formatted_resp
|
|
148
|
+
else:
|
|
149
|
+
return response
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def apply_null_result_formatters(
|
|
153
|
+
null_result_formatters: Callable[..., Any],
|
|
154
|
+
response: RPCResponse,
|
|
155
|
+
params: Optional[Any] = None,
|
|
156
|
+
) -> RPCResponse:
|
|
157
|
+
if null_result_formatters:
|
|
158
|
+
formatted_resp = pipe(params, null_result_formatters)
|
|
159
|
+
return formatted_resp
|
|
160
|
+
else:
|
|
161
|
+
return response
|
web3/_utils/method_formatters.py
CHANGED
|
@@ -101,6 +101,7 @@ from web3.types import (
|
|
|
101
101
|
BlockIdentifier,
|
|
102
102
|
Formatters,
|
|
103
103
|
RPCEndpoint,
|
|
104
|
+
SimulateV1Payload,
|
|
104
105
|
StateOverrideParams,
|
|
105
106
|
TReturn,
|
|
106
107
|
TxParams,
|
|
@@ -309,7 +310,32 @@ RECEIPT_FORMATTERS = {
|
|
|
309
310
|
|
|
310
311
|
receipt_formatter = type_aware_apply_formatters_to_dict(RECEIPT_FORMATTERS)
|
|
311
312
|
|
|
312
|
-
|
|
313
|
+
BLOCK_REQUEST_FORMATTERS = {
|
|
314
|
+
"baseFeePerGas": to_hex_if_integer,
|
|
315
|
+
"extraData": to_hex_if_bytes,
|
|
316
|
+
"gasLimit": to_hex_if_integer,
|
|
317
|
+
"gasUsed": to_hex_if_integer,
|
|
318
|
+
"size": to_hex_if_integer,
|
|
319
|
+
"timestamp": to_hex_if_integer,
|
|
320
|
+
"hash": to_hex_if_bytes,
|
|
321
|
+
"logsBloom": to_hex_if_bytes,
|
|
322
|
+
"miner": to_checksum_address,
|
|
323
|
+
"mixHash": to_hex_if_bytes,
|
|
324
|
+
"nonce": to_hex_if_bytes,
|
|
325
|
+
"number": to_hex_if_integer,
|
|
326
|
+
"parentHash": to_hex_if_bytes,
|
|
327
|
+
"sha3Uncles": to_hex_if_bytes,
|
|
328
|
+
"difficulty": to_hex_if_integer,
|
|
329
|
+
"receiptsRoot": to_hex_if_bytes,
|
|
330
|
+
"stateRoot": to_hex_if_bytes,
|
|
331
|
+
"totalDifficulty": to_hex_if_integer,
|
|
332
|
+
"transactionsRoot": to_hex_if_bytes,
|
|
333
|
+
"withdrawalsRoot": to_hex_if_bytes,
|
|
334
|
+
"parentBeaconBlockRoot": to_hex_if_bytes,
|
|
335
|
+
}
|
|
336
|
+
block_request_formatter = type_aware_apply_formatters_to_dict(BLOCK_REQUEST_FORMATTERS)
|
|
337
|
+
|
|
338
|
+
BLOCK_RESULT_FORMATTERS = {
|
|
313
339
|
"baseFeePerGas": to_integer_if_hex,
|
|
314
340
|
"extraData": apply_formatter_if(is_not_null, to_hexbytes(32, variable_length=True)),
|
|
315
341
|
"gasLimit": to_integer_if_hex,
|
|
@@ -349,9 +375,7 @@ BLOCK_FORMATTERS = {
|
|
|
349
375
|
"excessBlobGas": to_integer_if_hex,
|
|
350
376
|
"parentBeaconBlockRoot": apply_formatter_if(is_not_null, to_hexbytes(32)),
|
|
351
377
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
block_formatter = type_aware_apply_formatters_to_dict(BLOCK_FORMATTERS)
|
|
378
|
+
block_result_formatter = type_aware_apply_formatters_to_dict(BLOCK_RESULT_FORMATTERS)
|
|
355
379
|
|
|
356
380
|
|
|
357
381
|
SYNCING_FORMATTERS = {
|
|
@@ -442,6 +466,22 @@ filter_result_formatter = apply_one_of_formatters(
|
|
|
442
466
|
)
|
|
443
467
|
)
|
|
444
468
|
|
|
469
|
+
TRANSACTION_REQUEST_FORMATTER = {
|
|
470
|
+
"from": to_checksum_address,
|
|
471
|
+
"to": apply_formatter_if(is_address, to_checksum_address),
|
|
472
|
+
"gas": to_hex_if_integer,
|
|
473
|
+
"gasPrice": to_hex_if_integer,
|
|
474
|
+
"value": to_hex_if_integer,
|
|
475
|
+
"data": to_hex_if_bytes,
|
|
476
|
+
"nonce": to_hex_if_integer,
|
|
477
|
+
"maxFeePerGas": to_hex_if_integer,
|
|
478
|
+
"maxPriorityFeePerGas": to_hex_if_integer,
|
|
479
|
+
"chainId": to_hex_if_integer,
|
|
480
|
+
}
|
|
481
|
+
transaction_request_formatter = type_aware_apply_formatters_to_dict(
|
|
482
|
+
TRANSACTION_REQUEST_FORMATTER
|
|
483
|
+
)
|
|
484
|
+
|
|
445
485
|
ACCESS_LIST_REQUEST_FORMATTER = type_aware_apply_formatters_to_dict(
|
|
446
486
|
{
|
|
447
487
|
"accessList": apply_formatter_if(
|
|
@@ -472,11 +512,15 @@ call_without_override: Callable[
|
|
|
472
512
|
]
|
|
473
513
|
)
|
|
474
514
|
|
|
475
|
-
|
|
515
|
+
STATE_OVERRIDE_FORMATTERS = {
|
|
476
516
|
"balance": to_hex_if_integer,
|
|
477
517
|
"nonce": to_hex_if_integer,
|
|
478
518
|
"code": to_hex_if_bytes,
|
|
479
519
|
}
|
|
520
|
+
state_override_formatter = type_aware_apply_formatters_to_dict(
|
|
521
|
+
STATE_OVERRIDE_FORMATTERS
|
|
522
|
+
)
|
|
523
|
+
|
|
480
524
|
call_with_override: Callable[
|
|
481
525
|
[Tuple[TxParams, BlockIdentifier, StateOverrideParams]],
|
|
482
526
|
Tuple[Dict[str, Any], int, Dict[str, Any]],
|
|
@@ -486,29 +530,24 @@ call_with_override: Callable[
|
|
|
486
530
|
to_hex_if_integer,
|
|
487
531
|
lambda val: type_aware_apply_formatters_to_dict_keys_and_values(
|
|
488
532
|
to_checksum_address,
|
|
489
|
-
|
|
533
|
+
state_override_formatter,
|
|
490
534
|
val,
|
|
491
535
|
),
|
|
492
536
|
]
|
|
493
537
|
)
|
|
494
538
|
|
|
495
539
|
|
|
496
|
-
estimate_gas_without_block_id: Callable[
|
|
497
|
-
|
|
540
|
+
estimate_gas_without_block_id: Callable[
|
|
541
|
+
[Dict[str, Any]], Dict[str, Any]
|
|
542
|
+
] = apply_formatter_at_index(transaction_param_formatter, 0)
|
|
498
543
|
estimate_gas_with_block_id: Callable[
|
|
499
544
|
[Tuple[Dict[str, Any], BlockIdentifier]], Tuple[Dict[str, Any], int]
|
|
500
|
-
]
|
|
501
|
-
estimate_gas_with_block_id = apply_formatters_to_sequence(
|
|
545
|
+
] = apply_formatters_to_sequence(
|
|
502
546
|
[
|
|
503
547
|
transaction_param_formatter,
|
|
504
548
|
to_hex_if_integer,
|
|
505
549
|
]
|
|
506
550
|
)
|
|
507
|
-
ESTIMATE_GAS_OVERRIDE_FORMATTERS = {
|
|
508
|
-
"balance": to_hex_if_integer,
|
|
509
|
-
"nonce": to_hex_if_integer,
|
|
510
|
-
"code": to_hex_if_bytes,
|
|
511
|
-
}
|
|
512
551
|
estimate_gas_with_override: Callable[
|
|
513
552
|
[Tuple[Dict[str, Any], BlockIdentifier, StateOverrideParams]],
|
|
514
553
|
Tuple[Dict[str, Any], int, Dict[str, Any]],
|
|
@@ -518,12 +557,71 @@ estimate_gas_with_override: Callable[
|
|
|
518
557
|
to_hex_if_integer,
|
|
519
558
|
lambda val: type_aware_apply_formatters_to_dict_keys_and_values(
|
|
520
559
|
to_checksum_address,
|
|
521
|
-
|
|
560
|
+
state_override_formatter,
|
|
522
561
|
val,
|
|
523
562
|
),
|
|
524
563
|
]
|
|
525
564
|
)
|
|
526
565
|
|
|
566
|
+
# -- eth_simulateV1 -- #
|
|
567
|
+
|
|
568
|
+
block_state_calls_formatter: Callable[
|
|
569
|
+
[Dict[str, Any]], Dict[str, Any]
|
|
570
|
+
] = apply_formatter_to_array(
|
|
571
|
+
apply_formatters_to_dict(
|
|
572
|
+
{
|
|
573
|
+
"blockOverrides": block_request_formatter,
|
|
574
|
+
"stateOverrides": (
|
|
575
|
+
lambda val: type_aware_apply_formatters_to_dict_keys_and_values(
|
|
576
|
+
to_checksum_address,
|
|
577
|
+
state_override_formatter,
|
|
578
|
+
val,
|
|
579
|
+
)
|
|
580
|
+
),
|
|
581
|
+
"calls": apply_formatter_to_array(transaction_request_formatter),
|
|
582
|
+
},
|
|
583
|
+
),
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
simulate_v1_request_formatter: Callable[
|
|
587
|
+
[Tuple[Dict[str, Any], bool, bool], BlockIdentifier],
|
|
588
|
+
Tuple[SimulateV1Payload, BlockIdentifier],
|
|
589
|
+
] = apply_formatters_to_sequence(
|
|
590
|
+
[
|
|
591
|
+
# payload
|
|
592
|
+
apply_formatters_to_dict(
|
|
593
|
+
{
|
|
594
|
+
"blockStateCalls": block_state_calls_formatter,
|
|
595
|
+
},
|
|
596
|
+
),
|
|
597
|
+
# block_identifier
|
|
598
|
+
to_hex_if_integer,
|
|
599
|
+
]
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
block_result_formatters_copy = BLOCK_RESULT_FORMATTERS.copy()
|
|
603
|
+
block_result_formatters_copy.update(
|
|
604
|
+
{
|
|
605
|
+
"calls": apply_list_to_array_formatter(
|
|
606
|
+
type_aware_apply_formatters_to_dict(
|
|
607
|
+
{
|
|
608
|
+
"returnData": HexBytes,
|
|
609
|
+
"logs": apply_list_to_array_formatter(log_entry_formatter),
|
|
610
|
+
"gasUsed": to_integer_if_hex,
|
|
611
|
+
"status": to_integer_if_hex,
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
)
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
simulate_v1_result_formatter = apply_formatter_if(
|
|
618
|
+
is_not_null,
|
|
619
|
+
apply_list_to_array_formatter(
|
|
620
|
+
type_aware_apply_formatters_to_dict(block_result_formatters_copy)
|
|
621
|
+
),
|
|
622
|
+
)
|
|
623
|
+
|
|
624
|
+
|
|
527
625
|
SIGNED_TX_FORMATTER = {
|
|
528
626
|
"raw": HexBytes,
|
|
529
627
|
"tx": transaction_result_formatter,
|
|
@@ -587,6 +685,7 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
587
685
|
(is_length(3), call_with_override),
|
|
588
686
|
)
|
|
589
687
|
),
|
|
688
|
+
RPC.eth_simulateV1: simulate_v1_request_formatter,
|
|
590
689
|
RPC.eth_createAccessList: apply_formatter_at_index(transaction_param_formatter, 0),
|
|
591
690
|
RPC.eth_estimateGas: apply_one_of_formatters(
|
|
592
691
|
(
|
|
@@ -610,6 +709,7 @@ PYTHONIC_REQUEST_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
610
709
|
}
|
|
611
710
|
|
|
612
711
|
# --- Result Formatters --- #
|
|
712
|
+
|
|
613
713
|
# -- debug -- #
|
|
614
714
|
DEBUG_CALLTRACE_LOG_ENTRY_FORMATTERS = apply_formatter_if(
|
|
615
715
|
is_not_null,
|
|
@@ -795,11 +895,11 @@ def subscription_formatter(value: Any) -> Union[HexBytes, HexStr, Dict[str, Any]
|
|
|
795
895
|
# handle dict subscription responses
|
|
796
896
|
if either_set_is_a_subset(
|
|
797
897
|
result_key_set,
|
|
798
|
-
set(
|
|
898
|
+
set(BLOCK_RESULT_FORMATTERS.keys()),
|
|
799
899
|
percentage=90,
|
|
800
900
|
):
|
|
801
901
|
# block format, newHeads
|
|
802
|
-
result_formatter =
|
|
902
|
+
result_formatter = block_result_formatter
|
|
803
903
|
|
|
804
904
|
elif either_set_is_a_subset(
|
|
805
905
|
result_key_set, set(LOG_ENTRY_FORMATTERS.keys()), percentage=75
|
|
@@ -846,8 +946,8 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
846
946
|
RPC.eth_maxPriorityFeePerGas: to_integer_if_hex,
|
|
847
947
|
RPC.eth_gasPrice: to_integer_if_hex,
|
|
848
948
|
RPC.eth_getBalance: to_integer_if_hex,
|
|
849
|
-
RPC.eth_getBlockByHash: apply_formatter_if(is_not_null,
|
|
850
|
-
RPC.eth_getBlockByNumber: apply_formatter_if(is_not_null,
|
|
949
|
+
RPC.eth_getBlockByHash: apply_formatter_if(is_not_null, block_result_formatter),
|
|
950
|
+
RPC.eth_getBlockByNumber: apply_formatter_if(is_not_null, block_result_formatter),
|
|
851
951
|
RPC.eth_getBlockReceipts: apply_formatter_to_array(receipt_formatter),
|
|
852
952
|
RPC.eth_getBlockTransactionCountByHash: to_integer_if_hex,
|
|
853
953
|
RPC.eth_getBlockTransactionCountByNumber: to_integer_if_hex,
|
|
@@ -887,6 +987,7 @@ PYTHONIC_RESULT_FORMATTERS: Dict[RPCEndpoint, Callable[..., Any]] = {
|
|
|
887
987
|
RPC.eth_sign: HexBytes,
|
|
888
988
|
RPC.eth_signTransaction: apply_formatter_if(is_not_null, signed_tx_formatter),
|
|
889
989
|
RPC.eth_signTypedData: HexBytes,
|
|
990
|
+
RPC.eth_simulateV1: simulate_v1_result_formatter,
|
|
890
991
|
RPC.eth_syncing: apply_formatter_if(is_not_false, syncing_formatter),
|
|
891
992
|
# Transaction Pool
|
|
892
993
|
RPC.txpool_content: transaction_pool_content_formatter,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import pytest
|
|
1
2
|
import asyncio
|
|
2
3
|
import json
|
|
3
4
|
import math
|
|
4
|
-
import pytest
|
|
5
5
|
from random import (
|
|
6
6
|
randint,
|
|
7
7
|
)
|
|
@@ -1690,6 +1690,52 @@ class AsyncEthModuleTest:
|
|
|
1690
1690
|
with pytest.raises(TooManyRequests, match="Too many CCIP read redirects"):
|
|
1691
1691
|
await async_offchain_lookup_contract.caller().continuousOffchainLookup() # noqa: E501 type: ignore
|
|
1692
1692
|
|
|
1693
|
+
@pytest.mark.asyncio
|
|
1694
|
+
async def test_eth_simulate_v1(self, async_w3: "AsyncWeb3") -> None:
|
|
1695
|
+
simulate_result = await async_w3.eth.simulate_v1(
|
|
1696
|
+
{
|
|
1697
|
+
"blockStateCalls": [
|
|
1698
|
+
{
|
|
1699
|
+
"blockOverrides": {
|
|
1700
|
+
"baseFeePerGas": Wei(10),
|
|
1701
|
+
},
|
|
1702
|
+
"stateOverrides": {
|
|
1703
|
+
"0xc100000000000000000000000000000000000000": {
|
|
1704
|
+
"balance": Wei(500000000),
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
"calls": [
|
|
1708
|
+
{
|
|
1709
|
+
"from": "0xc100000000000000000000000000000000000000",
|
|
1710
|
+
"to": "0xc100000000000000000000000000000000000000",
|
|
1711
|
+
"maxFeePerGas": Wei(10),
|
|
1712
|
+
"maxPriorityFeePerGas": Wei(10),
|
|
1713
|
+
}
|
|
1714
|
+
],
|
|
1715
|
+
}
|
|
1716
|
+
],
|
|
1717
|
+
"validation": True,
|
|
1718
|
+
"traceTransfers": True,
|
|
1719
|
+
},
|
|
1720
|
+
"latest",
|
|
1721
|
+
)
|
|
1722
|
+
|
|
1723
|
+
assert len(simulate_result) == 1
|
|
1724
|
+
|
|
1725
|
+
result = simulate_result[0]
|
|
1726
|
+
assert result.get("baseFeePerGas") == 10
|
|
1727
|
+
|
|
1728
|
+
calls_result = result.get("calls")
|
|
1729
|
+
assert calls_result is not None
|
|
1730
|
+
assert len(calls_result) == 1
|
|
1731
|
+
call_entry = calls_result[0]
|
|
1732
|
+
|
|
1733
|
+
assert all(
|
|
1734
|
+
key in call_entry for key in ("returnData", "logs", "gasUsed", "status")
|
|
1735
|
+
)
|
|
1736
|
+
assert call_entry["status"] == 1
|
|
1737
|
+
assert call_entry["gasUsed"] == int("0x5208", 16)
|
|
1738
|
+
|
|
1693
1739
|
@pytest.mark.asyncio
|
|
1694
1740
|
async def test_async_eth_chain_id(self, async_w3: "AsyncWeb3") -> None:
|
|
1695
1741
|
chain_id = await async_w3.eth.chain_id
|
|
@@ -2283,6 +2329,9 @@ class AsyncEthModuleTest:
|
|
|
2283
2329
|
async_w3: "AsyncWeb3",
|
|
2284
2330
|
async_keyfile_account_address_dual_type: ChecksumAddress,
|
|
2285
2331
|
) -> None:
|
|
2332
|
+
# Note: `underpriced transaction` error is only consistent with
|
|
2333
|
+
# ``txpool.nolocals`` flag as of Geth ``v1.15.4``.
|
|
2334
|
+
# https://github.com/ethereum/web3.py/pull/3636
|
|
2286
2335
|
txn_params: TxParams = {
|
|
2287
2336
|
"from": async_keyfile_account_address_dual_type,
|
|
2288
2337
|
"to": async_keyfile_account_address_dual_type,
|
|
@@ -3482,6 +3531,9 @@ class EthModuleTest:
|
|
|
3482
3531
|
def test_eth_replace_transaction_underpriced(
|
|
3483
3532
|
self, w3: "Web3", keyfile_account_address_dual_type: ChecksumAddress
|
|
3484
3533
|
) -> None:
|
|
3534
|
+
# Note: `underpriced transaction` error is only consistent with
|
|
3535
|
+
# ``txpool.nolocals`` flag as of Geth ``v1.15.4``.
|
|
3536
|
+
# https://github.com/ethereum/web3.py/pull/3636
|
|
3485
3537
|
txn_params: TxParams = {
|
|
3486
3538
|
"from": keyfile_account_address_dual_type,
|
|
3487
3539
|
"to": keyfile_account_address_dual_type,
|
|
@@ -3821,7 +3873,7 @@ class EthModuleTest:
|
|
|
3821
3873
|
math_contract: "Contract",
|
|
3822
3874
|
params: StateOverrideParams,
|
|
3823
3875
|
) -> None:
|
|
3824
|
-
txn_params: TxParams = {"from": w3.eth.accounts[0]}
|
|
3876
|
+
txn_params: TxParams = {"from": w3.eth.accounts[0], "to": math_contract.address}
|
|
3825
3877
|
|
|
3826
3878
|
# assert does not raise
|
|
3827
3879
|
w3.eth.call(txn_params, "latest", {math_contract.address: params})
|
|
@@ -3914,6 +3966,51 @@ class EthModuleTest:
|
|
|
3914
3966
|
w3.eth.call(txn_params)
|
|
3915
3967
|
assert excinfo.value.data == data
|
|
3916
3968
|
|
|
3969
|
+
def test_eth_simulate_v1(self, w3: "Web3") -> None:
|
|
3970
|
+
simulate_result = w3.eth.simulate_v1(
|
|
3971
|
+
{
|
|
3972
|
+
"blockStateCalls": [
|
|
3973
|
+
{
|
|
3974
|
+
"blockOverrides": {
|
|
3975
|
+
"baseFeePerGas": Wei(10),
|
|
3976
|
+
},
|
|
3977
|
+
"stateOverrides": {
|
|
3978
|
+
"0xc100000000000000000000000000000000000000": {
|
|
3979
|
+
"balance": Wei(500000000),
|
|
3980
|
+
}
|
|
3981
|
+
},
|
|
3982
|
+
"calls": [
|
|
3983
|
+
{
|
|
3984
|
+
"from": "0xc100000000000000000000000000000000000000",
|
|
3985
|
+
"to": "0xc100000000000000000000000000000000000000",
|
|
3986
|
+
"maxFeePerGas": Wei(10),
|
|
3987
|
+
"maxPriorityFeePerGas": Wei(10),
|
|
3988
|
+
}
|
|
3989
|
+
],
|
|
3990
|
+
}
|
|
3991
|
+
],
|
|
3992
|
+
"validation": True,
|
|
3993
|
+
"traceTransfers": True,
|
|
3994
|
+
},
|
|
3995
|
+
"latest",
|
|
3996
|
+
)
|
|
3997
|
+
|
|
3998
|
+
assert len(simulate_result) == 1
|
|
3999
|
+
|
|
4000
|
+
result = simulate_result[0]
|
|
4001
|
+
assert result.get("baseFeePerGas") == 10
|
|
4002
|
+
|
|
4003
|
+
calls_result = result.get("calls")
|
|
4004
|
+
assert calls_result is not None
|
|
4005
|
+
assert len(calls_result) == 1
|
|
4006
|
+
call_entry = calls_result[0]
|
|
4007
|
+
|
|
4008
|
+
assert all(
|
|
4009
|
+
key in call_entry for key in ("returnData", "logs", "gasUsed", "status")
|
|
4010
|
+
)
|
|
4011
|
+
assert call_entry["status"] == 1
|
|
4012
|
+
assert call_entry["gasUsed"] == int("0x5208", 16)
|
|
4013
|
+
|
|
3917
4014
|
@pytest.mark.parametrize(
|
|
3918
4015
|
"panic_error,params",
|
|
3919
4016
|
(
|
web3/_utils/rpc_abi.py
CHANGED
|
@@ -51,6 +51,7 @@ class RPC:
|
|
|
51
51
|
eth_blobBaseFee = RPCEndpoint("eth_blobBaseFee")
|
|
52
52
|
eth_blockNumber = RPCEndpoint("eth_blockNumber")
|
|
53
53
|
eth_call = RPCEndpoint("eth_call")
|
|
54
|
+
eth_simulateV1 = RPCEndpoint("eth_simulateV1")
|
|
54
55
|
eth_createAccessList = RPCEndpoint("eth_createAccessList")
|
|
55
56
|
eth_chainId = RPCEndpoint("eth_chainId")
|
|
56
57
|
eth_estimateGas = RPCEndpoint("eth_estimateGas")
|