Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Fix eth_FeeHistory unmarshal input params error #1917

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading