Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ABIDecoder - Decoding failed #167

Open
LiuGuoli opened this issue Sep 1, 2023 · 1 comment
Open

ABIDecoder - Decoding failed #167

LiuGuoli opened this issue Sep 1, 2023 · 1 comment

Comments

@LiuGuoli
Copy link

LiuGuoli commented Sep 1, 2023

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

@dev-johnny-gh
Copy link

same issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants