Skip to content

ABIDecoder - Decoding failed #167

@LiuGuoli

Description

@LiuGuoli

Hi,

I need to decrypt the actual parameters from parameters and dataString. However, the decryption is failing, and I check that the failure is due to the bytes field being empty in the parameters. Does the current SDK not support decoding when the bytes field is empty, or am I using it incorrectly?

let parameters: [SolidityType] = [.address, .uint16, .uint256, .address, .address, .bytes(length: nil)]
let dataString =
"000000000000000000000000174d056ea9944d49c6f67491541922f524869bc9
0000000000000000000000000000000000000000000000000000000000000065
00000000000000000000000000000000000000000000000014d1120d7b160000
000000000000000000000000174d056ea9944d49c6f67491541922f524869bc9
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000c0
0000000000000000000000000000000000000000000000000000000000000000";
do {
let decodeParamters = try ABI.decodeParameters(types: parameters, from: dataString)
} catch let error {
print("Error: (error)")
//Error: couldNotDecodeType(type: Web3ContractABI.SolidityType.type(Web3ContractABI.SolidityType.ValueType.bytes(length: nil)), string: "0000000000000000000000000000000000000000000000000000000000000000")
}

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions