q9f / eth.rb

a straightforward library to build, sign, and broadcast ethereum transactions anywhere you can run ruby.
https://q9f.github.io/eth.rb
Apache License 2.0
196 stars 85 forks source link

Unable to parse tuple response #266

Closed wafcio closed 3 months ago

wafcio commented 4 months ago

Response from JSON API in tuple format doesn't work and fails every time.

The problem is located here: https://github.com/q9f/eth.rb/blob/main/lib/eth/abi.rb#L79

Type.parse(t)

should have a second argument - components; otherwise, for a tuple, the expectation is raised.

undefined method `none?' for nil

You can check it by calling Ethereum contract 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9, method: "getReserveData", argument "0xdAC17F958D2ee523a2206206994597C13D831ec7"

q9f commented 3 months ago

duplicate of #102

decoding tuples is not implemented unfortunately. maybe some day we can integrate the new abi decoder written by @wuminzhe - maybe take a look?

https://github.com/wuminzhe/abi_coder_rb

the answer is more complicated than adding another parameter to parse, unfortunately.