Boilertalk / Web3.swift

A pure swift Ethereum Web3 library
MIT License
639 stars 188 forks source link

Cannot decode empty value #93

Open podkovyrin opened 3 years ago

podkovyrin commented 3 years ago

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")"```