Skip to content

Commit

Permalink
[ioctl] accept 0x address for ws router command Fix #4388 (#4471)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonerom authored Nov 1, 2024
1 parent 5e40508 commit 4c562c3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ioctl/cmd/ws/wsrouterbinddapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ package ws

import (
"fmt"
"github.com/ethereum/go-ethereum/common"
"math/big"

"github.com/ethereum/go-ethereum/common"

"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/iotexproject/iotex-address/address"
"github.com/iotexproject/iotex-core/v2/ioctl/config"
"github.com/iotexproject/iotex-core/v2/ioctl/output"
"github.com/iotexproject/iotex-core/v2/ioctl/util"
)

var (
Expand Down Expand Up @@ -59,10 +61,16 @@ func init() {
}

func bindDapp(projectID uint64, dapp string) (string, error) {
addr, err := address.FromString(dapp)
addrStr, err := util.Address(dapp)
if err != nil {
return "", errors.Wrapf(err, "invalid dapp address: %s", dapp)
}
// Convert addrStr to an Address type
addr, err := address.FromString(addrStr)
if err != nil {
return "", errors.Wrapf(err, "failed to parse address: %s", addrStr)
}

newAddr := common.BytesToAddress(addr.Bytes())

caller, err := NewContractCaller(routerABI, routerAddress)
Expand Down

0 comments on commit 4c562c3

Please sign in to comment.