Skip to content

Commit

Permalink
Fix Eth.FeeHistory() unmarshal input params error (#1917)
Browse files Browse the repository at this point in the history
  • Loading branch information
dusan-maksimovic committed Sep 19, 2023
1 parent 7beeb38 commit d632735
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jsonrpc/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strconv"
"strings"

"github.com/0xPolygon/polygon-edge/helper/common"
"github.com/0xPolygon/polygon-edge/helper/hex"
"github.com/0xPolygon/polygon-edge/types"
)
Expand Down Expand Up @@ -271,9 +272,9 @@ func (u argUint64) MarshalText() ([]byte, error) {
}

func (u *argUint64) UnmarshalText(input []byte) error {
str := strings.TrimPrefix(string(input), "0x")
num, err := strconv.ParseUint(str, 16, 64)
str := strings.Trim(string(input), "\"")

num, err := common.ParseUint64orHex(&str)
if err != nil {
return err
}
Expand All @@ -283,6 +284,10 @@ func (u *argUint64) UnmarshalText(input []byte) error {
return nil
}

func (u *argUint64) UnmarshalJSON(buffer []byte) error {
return u.UnmarshalText(buffer)
}

type argBytes []byte

func argBytesPtr(b []byte) *argBytes {
Expand Down

0 comments on commit d632735

Please sign in to comment.