Boilertalk / Web3.swift

A pure swift Ethereum Web3 library
MIT License
636 stars 187 forks source link

Handle case of single parameter outputs returning empty string #148

Closed kohlivarun5 closed 1 year ago

kohlivarun5 commented 1 year ago

In cases where a ingle output function (such as function name() returns (string) returns an empty result, ABIDecoding now fails in https://github.com/Boilertalk/Web3.swift/blob/master/Sources/ContractABI/ABI/ABIDecoder.swift#L96, as the output is empty

This seems like a regression/fix introduced in https://github.com/Boilertalk/Web3.swift/pull/135/files

The proposed 'fix' here is to treat single output tuples as just single outputs, not sure if that is always accurate though.

Please feel free to comment if you have alternate suggestions. This 'fix' does seem to work in my app

koraykoska commented 1 year ago

@kohlivarun5 Can you add tests and confirm with Solidity documentations that this is correct before we merge it?