diff --git a/src/api/rest/addresses.go b/src/api/rest/addresses.go index 9ecfecc..a7fa2bd 100644 --- a/src/api/rest/addresses.go +++ b/src/api/rest/addresses.go @@ -155,7 +155,7 @@ func handlerGetAddressDetails(c *fiber.Ctx) error { return c.SendString(`{"error": "address required"}`) } - params := new(AddressesQuery) + params := new(SkipLimitQuery) if err := c.QueryParser(params); err != nil { zap.S().Warnf("Addresses Get Handler ERROR: %s", err.Error()) c.Status(422) @@ -338,6 +338,13 @@ func handlerGetContracts(c *fiber.Ctx) error { func handlerGetTokenAddresses(c *fiber.Ctx) error { addressString := c.Params("address") + params := new(SkipLimitQuery) + if err := c.QueryParser(params); err != nil { + zap.S().Warnf("Addresses Get Handler ERROR: %s", err.Error()) + c.Status(422) + return c.SendString(`{"error": "could not parse query parameters"}`) + } + // Get TokenAddresses tokenAddress, err := crud.GetTokenAddressCrud().SelectManyByAddress(addressString) if err != nil { diff --git a/src/api/rest/transactions.go b/src/api/rest/transactions.go index fdf6de7..054a1d7 100644 --- a/src/api/rest/transactions.go +++ b/src/api/rest/transactions.go @@ -428,7 +428,7 @@ func handlerGetTransactionAddress(c *fiber.Ctx) error { return c.SendString(`{"error": "address required"}`) } - params := new(TransactionsQuery) + params := new(SkipLimitQuery) if err := c.QueryParser(params); err != nil { c.Status(422) return c.SendString(`{"error": "could not parse query parameters"}`) @@ -813,7 +813,7 @@ func handlerGetTokenTransfersAddress(c *fiber.Ctx) error { return c.SendString(`{"error": "address required"}`) } - params := new(TransactionsQuery) + params := new(SkipLimitQuery) if err := c.QueryParser(params); err != nil { zap.S().Warnf("Transactions Get Handler ERROR: %s", err.Error()) diff --git a/src/api/rest/utils.go b/src/api/rest/utils.go index aef4b9c..3f4dba9 100644 --- a/src/api/rest/utils.go +++ b/src/api/rest/utils.go @@ -9,6 +9,11 @@ import ( "strconv" ) +type SkipLimitQuery struct { + Limit int `query:"limit"` + Skip int `query:"skip"` +} + // https://stackoverflow.com/a/28818489/12642712 func newTrue() *bool { b := true diff --git a/src/config/config.go b/src/config/config.go index 729fc5d..4681614 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -88,8 +88,8 @@ type configType struct { IconNodeRpcRetryAttempts int `envconfig:"ICON_NODE_RPC_RETRY_ATTEMPTS" required:"false" default:"20"` // Stats endpoints - StatsMarketCapUpdateTime time.Duration `envconfig:"STATS_MARKET_CAP_UPDATE_TIME" required:"false" default:"1h"` - StatsCirculatingSupplyUpdateTime time.Duration `envconfig:"STATS_CIRCULATING_SUPPLY_UPDATE_TIME" required:"false" default:"1h"` + StatsMarketCapUpdateTime time.Duration `envconfig:"STATS_MARKET_CAP_UPDATE_TIME" required:"false" default:"5m"` + StatsCirculatingSupplyUpdateTime time.Duration `envconfig:"STATS_CIRCULATING_SUPPLY_UPDATE_TIME" required:"false" default:"5m"` } // Config - runtime config struct