xclud / web3dart

Ethereum library, written in Dart.
https://pub.dev/packages/web3dart
MIT License
170 stars 94 forks source link

JSON-RPC: fix type-error to get useful RPCErrors #73

Closed fkirc closed 1 year ago

fkirc commented 1 year ago

Dear maintainers,

I am using web3dart ever since I switched from React to Flutter, and it is working great so far. However, I am frequently facing the following type-error if a JSON-RPC gives me an error-response:

type 'Null' is not a subtype of type 'int' in type cast

The problem is that this type-error hides the real error-message that happened in JSON-RPC. This PR fixes the problem by throwing a useful RPCError as intended by the already existing error-handling in web3dart.

fkirc commented 1 year ago

@xclud may I ask if this project is still maintained? If you want, I could help you with merging bug-fixes. My PR is basically a small one-line-fix for a small but annoying bug.

xclud commented 1 year ago

Thank you. I merged your PR.

fkirc commented 1 year ago

Thank you for merging! Do you plan a release over the next days?

xclud commented 1 year ago

@fkirc Just rolled a new release.

fkirc commented 1 year ago

Thank you for releasing! After upgrading my app to 2.5.2, I realised that the generated erc20.g.dart was not there anymore. But I suppose that this is a deliberate change to remove generated contracts from this package?

xclud commented 1 year ago

Yes. For ERC20 please use https://pub.dev/packages/erc20.