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.

75 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. )
  19. var (
  20. // ErrNillBidderAddr is used when a nil bidderAddr is received in the getCoordinator method
  21. ErrNillBidderAddr = errors.New("biderAddr can not be nil")
  22. )
  23. func getAccounts(c *gin.Context) {
  24. }
  25. func getAccount(c *gin.Context) {
  26. }
  27. func getSlots(c *gin.Context) {
  28. }
  29. func getNextForgers(c *gin.Context) {
  30. }
  31. func getState(c *gin.Context) {
  32. }
  33. func getConfig(c *gin.Context) {
  34. c.JSON(http.StatusOK, cg)
  35. }
  36. func getRecommendedFee(c *gin.Context) {
  37. }
  38. func retSQLErr(err error, c *gin.Context) {
  39. if err == sql.ErrNoRows {
  40. c.JSON(http.StatusNotFound, errorMsg{
  41. Message: err.Error(),
  42. })
  43. } else {
  44. c.JSON(http.StatusInternalServerError, errorMsg{
  45. Message: err.Error(),
  46. })
  47. }
  48. }
  49. func retBadReq(err error, c *gin.Context) {
  50. c.JSON(http.StatusBadRequest, errorMsg{
  51. Message: err.Error(),
  52. })
  53. }