You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.2 KiB

  1. package api
  2. import (
  3. "database/sql"
  4. "errors"
  5. "net/http"
  6. "github.com/gin-gonic/gin"
  7. "github.com/hermeznetwork/hermez-node/db/historydb"
  8. )
  9. const (
  10. // maxLimit is the max permited items to be returned in paginated responses
  11. maxLimit uint = 2049
  12. // dfltOrder indicates how paginated endpoints are ordered if not specified
  13. dfltOrder = historydb.OrderAsc
  14. // dfltLimit indicates the limit of returned items in paginated responses if the query param limit is not provided
  15. dfltLimit uint = 20
  16. // 2^32 -1
  17. maxUint32 = 4294967295
  18. // 2^64 /2 -1
  19. maxInt64 = 9223372036854775807
  20. )
  21. var (
  22. // ErrNillBidderAddr is used when a nil bidderAddr is received in the getCoordinator method
  23. ErrNillBidderAddr = errors.New("biderAddr can not be nil")
  24. )
  25. func getNextForgers(c *gin.Context) {
  26. }
  27. func getState(c *gin.Context) {
  28. }
  29. func getRecommendedFee(c *gin.Context) {
  30. }
  31. func retSQLErr(err error, c *gin.Context) {
  32. if err == sql.ErrNoRows {
  33. c.JSON(http.StatusNotFound, errorMsg{
  34. Message: err.Error(),
  35. })
  36. } else {
  37. c.JSON(http.StatusInternalServerError, errorMsg{
  38. Message: err.Error(),
  39. })
  40. }
  41. }
  42. func retBadReq(err error, c *gin.Context) {
  43. c.JSON(http.StatusBadRequest, errorMsg{
  44. Message: err.Error(),
  45. })
  46. }