Skip to content

Commit

Permalink
only change method for 0x recipients (#12328)
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshkshah1992 authored Jul 31, 2024
1 parent f13dace commit c353a9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cli/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ var SendCmd = &cli.Command{
ctx := ReqContext(cctx)
var params SendParams

is0xRecipient := false
params.To, err = address.NewFromString(cctx.Args().Get(0))
if err != nil {
// could be an ETH address
ea, err := ethtypes.ParseEthAddress(cctx.Args().Get(0))
if err != nil {
return ShowHelp(cctx, fmt.Errorf("failed to parse target address; address must be a valid FIL address or an ETH address: %w", err))
}
is0xRecipient = true
// this will be either "f410f..." or "f0..."
params.To, err = ea.ToFilecoinAddress()
if err != nil {
Expand Down Expand Up @@ -147,7 +149,7 @@ var SendCmd = &cli.Command{
params.Params = decparams
}

if ethtypes.IsEthAddress(params.From) || ethtypes.IsEthAddress(params.To) {
if ethtypes.IsEthAddress(params.From) || is0xRecipient {
// Method numbers don't make sense from eth accounts.
if cctx.IsSet("method") {
return xerrors.Errorf("messages from f410f addresses may not specify a method number")
Expand Down

0 comments on commit c353a9f

Please sign in to comment.