XRPLF / xrpl-py

A Python library to interact with the XRP Ledger (XRPL) blockchain
ISC License
150 stars 86 forks source link

Better type validation for classes #678

Open mvadari opened 10 months ago

mvadari commented 10 months ago

The library uses mypy internally to keep types accurate, but most people don't type their Python code. This means that a lot of people who accidentally use the wrong type when filling in a transaction/request don't get a very clean error response. The most common example of this is people who accidentally put in a Wallet object instead of a str for an account or destination.

It would be very helpful to these people to add better validation for these types. This should be easily doable for all types with some metaprogramming, similar to how from_dict works.