From 23db38068cf75c15193cf0da006b3c339bca0bfe Mon Sep 17 00:00:00 2001 From: spongeboi Date: Thu, 21 Dec 2023 05:55:34 +0530 Subject: [PATCH] fix intoFn --- ethrpc/methods.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ethrpc/methods.go b/ethrpc/methods.go index 82d2601d..12ff6cb1 100644 --- a/ethrpc/methods.go +++ b/ethrpc/methods.go @@ -316,8 +316,13 @@ func ContractQuery(contractAddress common.Address, inputAbiExpr, outputAbiExpr s return CallBuilder[[]string]{ method: "eth_call", params: []any{toCallArg(msg), toBlockNumArg(nil)}, - intoFn: func(raw json.RawMessage, ret *[]string) error { - resp, err := ethcoder.AbiDecodeExprAndStringify(outputAbiExpr, raw) + intoFn: func(message json.RawMessage, ret *[]string) error { + var result hexutil.Bytes + if err := json.Unmarshal(message, &result); err != nil { + return err + } + + resp, err := ethcoder.AbiDecodeExprAndStringify(outputAbiExpr, result) if err != nil { return fmt.Errorf("abi decode of response failed: %w", err) }