Skip to content

Commit

Permalink
- fixed the URL parameter for hint epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
iulianpascalau committed Oct 16, 2024
1 parent 1db7ecd commit ae8048e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion api/groups/urlParams.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
17 changes: 17 additions & 0 deletions api/groups/urlParams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()

Expand Down

0 comments on commit ae8048e

Please sign in to comment.