Skip to content

Commit

Permalink
Merge pull request #74 from kaleido-io/include-from
Browse files Browse the repository at this point in the history
include from field on eth_call
  • Loading branch information
peterbroadhurst authored Apr 14, 2023
2 parents 2b1a0be + 1921560 commit b2b095e
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 b2b095e

Please sign in to comment.