package indexer
import (
"fmt"
"github.com/ethereum/go-ethereum/common"
)
// ParseAddress parses a ETH address from a hex string. This method will
// fail if the address is not a valid hexadecimal address.
func ParseAddress(address string) (common.Address, error) {
if common.IsHexAddress(address) {
return common.HexToAddress(address), nil
}
return common.Address{}, fmt.Errorf("invalid address: %v", address)
}
-
Mark Tyneway authored
* indexer: clean up duplicated code Remove `ParseL1Address` and `ParseL2Address` and instead use `ParseAddress`. Addresses on L1 and L2 are the same and we can use as much upstream code as possible instead of code from `l2geth`. * Update indexer/crypto.go Co-authored-by:
Javed Khan <javed@optimism.io> Co-authored-by:
Javed Khan <javed@optimism.io> Co-authored-by:
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
ec8d6b7c