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.

70 lines
1.3 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 getAccounts(c *gin.Context) {
  26. }
  27. func getAccount(c *gin.Context) {
  28. }
  29. func getNextForgers(c *gin.Context) {
  30. }
  31. func getState(c *gin.Context) {
  32. }
  33. func getRecommendedFee(c *gin.Context) {
  34. }
  35. func retSQLErr(err error, c *gin.Context) {
  36. if err == sql.ErrNoRows {
  37. c.JSON(http.StatusNotFound, errorMsg{
  38. Message: err.Error(),
  39. })
  40. } else {
  41. c.JSON(http.StatusInternalServerError, errorMsg{
  42. Message: err.Error(),
  43. })
  44. }
  45. }
  46. func retBadReq(err error, c *gin.Context) {
  47. c.JSON(http.StatusBadRequest, errorMsg{
  48. Message: err.Error(),
  49. })
  50. }