Web3.swift icon indicating copy to clipboard operation
Web3.swift copied to clipboard

Cannot decode empty value

Open podkovyrin opened this issue 4 years ago • 0 comments

I'm trying to decode an empty value and getting couldNotDecodeType error:

let encoded = try ABI.encodeParameter(type: .bytes(length: nil), value: Data("".utf8))
let decoded = try ABI.decodeParameter(type: .bytes(length: nil), from: encoded) // throws here

Error:

failed: caught error: "couldNotDecodeType(type: Web3ContractABI.SolidityType.type(Web3ContractABI.SolidityType.ValueType.bytes(length: nil)), string: "0000000000000000000000000000000000000000000000000000000000000000")"```

podkovyrin avatar Dec 09 '20 18:12 podkovyrin