From f92bfc7af174e08fd034c88b506f14734ddc292d Mon Sep 17 00:00:00 2001 From: steffenix <87598469+steffenix@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:51:41 +0100 Subject: [PATCH] Fix return value is the function signature --- lib/abi/type_decoder.ex | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/abi/type_decoder.ex b/lib/abi/type_decoder.ex index c78974a..066667a 100644 --- a/lib/abi/type_decoder.ex +++ b/lib/abi/type_decoder.ex @@ -151,10 +151,14 @@ defmodule ABI.TypeDecoder do def decode(encoded_data, %FunctionSelector{returns: types, method_id: method_id}, :output) when is_binary(method_id) do - case ABI.Util.split_method_id(encoded_data) do - {:ok, ^method_id, rest} -> decode_raw(rest, types) - _ -> decode_raw(encoded_data, types) - end + if rem(byte_size(encoded_data), 32) == 0 do + decode_raw(encoded_data, types) + else + case ABI.Util.split_method_id(encoded_data) do + {:ok, ^method_id, rest} -> + decode_raw(rest, types) + _ -> decode_raw(encoded_data, types) + end end def decode(encoded_data, %FunctionSelector{returns: types}, :output) do