From 1921560d1b9eb05f9872150dcdb7d0a726afbd6a Mon Sep 17 00:00:00 2001 From: John Hosie Date: Fri, 14 Apr 2023 01:12:29 +0100 Subject: [PATCH] include from field on eth_call Signed-off-by: John Hosie --- internal/ethereum/prepare_transaction.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/ethereum/prepare_transaction.go b/internal/ethereum/prepare_transaction.go index 799bbe0..1763d56 100644 --- a/internal/ethereum/prepare_transaction.go +++ b/internal/ethereum/prepare_transaction.go @@ -1,4 +1,4 @@ -// Copyright © 2022 Kaleido, Inc. +// Copyright © 2023 Kaleido, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -138,11 +138,13 @@ func (c *ethConnector) buildTx(ctx context.Context, txType txType, fromString, t } // Parse the from address - if txType != txTypeQuery { - from, err := ethtypes.NewAddress(fromString) - if err != nil { + from, err := ethtypes.NewAddress(fromString) + if err != nil { + if txType != txTypeQuery { + // ignore the error if query, from is optional for query return nil, i18n.NewError(ctx, msgs.MsgInvalidFromAddress, fromString, err) } + } else { tx.From = json.RawMessage(fmt.Sprintf(`"%s"`, from)) }