diff --git a/api/groups/urlParams.go b/api/groups/urlParams.go index 1aa3c140..8cd3a6ef 100644 --- a/api/groups/urlParams.go +++ b/api/groups/urlParams.go @@ -85,7 +85,7 @@ func parseAccountQueryOptions(c *gin.Context, address string) (common.AccountQue return common.AccountQueryOptions{}, err } - hintEpoch, err := parseUint32UrlParam(c, common.UrlParameterOnStartOfEpoch) + hintEpoch, err := parseUint32UrlParam(c, common.UrlParameterHintEpoch) if err != nil { return common.AccountQueryOptions{}, err } diff --git a/api/groups/urlParams_test.go b/api/groups/urlParams_test.go index 9eb17614..4846f6bc 100644 --- a/api/groups/urlParams_test.go +++ b/api/groups/urlParams_test.go @@ -7,11 +7,14 @@ import ( "testing" "github.com/gin-gonic/gin" + "github.com/multiversx/mx-chain-core-go/core" "github.com/multiversx/mx-chain-proxy-go/common" "github.com/stretchr/testify/require" ) func TestParseBlockQueryOptions(t *testing.T) { + t.Parallel() + options, err := parseBlockQueryOptions(createDummyGinContextWithQuery("withTxs=true&withLogs=true")) require.Nil(t, err) require.Equal(t, common.BlockQueryOptions{WithTransactions: true, WithLogs: true}, options) @@ -25,6 +28,20 @@ func TestParseBlockQueryOptions(t *testing.T) { require.Empty(t, options) } +func TestParseAccountOptions(t *testing.T) { + t.Parallel() + + expectedOptions := common.AccountQueryOptions{ + HintEpoch: core.OptionalUint32{ + Value: 3737, + HasValue: true, + }, + } + options, err := parseAccountQueryOptions(createDummyGinContextWithQuery("hintEpoch=3737"), "") + require.Nil(t, err) + require.Equal(t, expectedOptions, options) +} + func TestParseHyperblockQueryOptions(t *testing.T) { t.Parallel()