Comments (5)
Following up, web3.types
will not be updated to include the "error"
Literal on the ABIFunction
type
. ABIError
is preferred.
from web3.py.
@avoiney-ledger sorry for the back and forth, I had another chat with the team and we'll implement the error type in the web3.types
module in v6. Instead of adding "error"
to the ABIFunction
type, we decided to add ABIError
as a type and it will be added as another valid ABIElement
. Look for that in the next v6
release!
from web3.py.
There are new types for ABIs available in ethereum/eth-typing for this purpose. You can get around this by using the new types and casting your ABI
to the new type.
from eth_typing import ABI
abi: ABI = { ... }
c: Contract = w3.eth.contract(
address="0x48C7f48622a2C31FC72B326332cF1e2357C8EF30", abi=abi
)
for el_abi in cast(ABI, c.abi):
if el_abi["type"] == "error":
print(
f"Error: {el_abi['name']}({', '.join([arg['name'] for arg in el_abi['inputs']])})"
)
Using ABI
from web3.typing
will show a type error when referencing the "error"
type on an ABIFunction
.
Non-overlapping equality check (left operand type: "Literal['fallback', 'receive']", right operand type: "Literal['error']")Mypy[comparison-overlap](https://mypy.readthedocs.io/en/latest/_refs.html#code-comparison-overlap)
(variable) el_abi: Any | ABIFunction | ABIEvent
We could add "error"
as a valid ABIFunction
type in web3.types
to mitigate the typing error. Do you agree with adding that @kclowes @fselmo @pacrob ?
from web3.py.
Ok thanks for this detailed answer!
from web3.py.
So cool thanks! I will look forward for it!
from web3.py.
Related Issues (20)
- Remove filtering by pending blocks
- Add blob / eip-4844 KZG verifications for sending type 3 transactions HOT 4
- Add `blob_versioned_hashes` for EIP-4844 transactions in `transaction` dict HOT 4
- Request Caching can't be configured via providers classes constructors
- Explicitly export symbols via __all__
- `PersistentConnectionProvider` UX Improvements HOT 3
- Padding bytes were not empty: b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00A' HOT 1
- Recompile test contracts with new Solidity version: v0.8.26
- Weird Web3 object behaviour when using timeout in request_kwargs HOT 2
- RuntimeError: There is no current event loop in thread 'MainThread'. HOT 3
- Help for ERC20Permit: invalid signature
- HTTPProvider timeout is not working for chunked responses HOT 8
- When using"Contract.decode_function_input" , TypeError: 'NoneType' object is not iterable
- Structs with fields starting with underscores are not readable and clash with non-underscore fields HOT 1
- Async Gas Price Strategy HOT 1
- Poa middleware is not working in async mode HOT 1
- Remove dependence on eth-utils `ValidationError` for `Web3ValidationError`
- Document web3.py exceptions and hierarchy at a high level
- batch request bug HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3.py.