xclud / web3dart

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

abi.dart decodeResults functions do not returns undecodable params causing autogenerated contracts to break #99

Open robgsupsi opened 1 year ago

robgsupsi commented 1 year ago

If a contract event contains indexed parameters bigger than 32 bytes when decoded, or have a dynamic type they are not included by the decodeResults function from contracts/abi/abi.dart since they cannot be decoded. This leads to problems whenever using contract automatic generation with web3dart_builders since in the generated code the following is done:

final decoded = event.decodeResults(
        result.topics!,
        result.data!,
      );
return SomeEvent(decoded);

The call to SomeEvent constructor expects that the list of parameters is complete with all the required elements, but this is not true in case one of the params was not decodable and this leads to a "RangeError (index): Index out of range".

Would it be a possible solution to return the undecoded String instead of skipping it in the decodeResults implementation?