Skip to content

Commit

Permalink
include from field on eth_call
Browse files Browse the repository at this point in the history
Signed-off-by: John Hosie <john.hosie@kaleido.io>
  • Loading branch information
hosie committed Apr 14, 2023
1 parent 2b1a0be commit 1921560
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/ethereum/prepare_transaction.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2022 Kaleido, Inc.
// Copyright © 2023 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit 1921560

Please sign in to comment.