diff --git a/methods.go b/methods.go index 65b2d09..e01be6f 100644 --- a/methods.go +++ b/methods.go @@ -37,6 +37,20 @@ func sendJSONResponse(resp interface{}, code int, c *gin.Context) { c.Writer.Write(dec) } +func pubKey(c *gin.Context) { + sendJSONResponse(pubKeyResponse{ + Timestamp: time.Now().Unix(), + PubKey: cfg.pubKey, + }, http.StatusOK, c) +} + +func fee(c *gin.Context) { + sendJSONResponse(feeResponse{ + Timestamp: time.Now().Unix(), + Fee: cfg.poolFees, + }, http.StatusOK, c) +} + func payFee(c *gin.Context) { // HTTP GET Params required // feeTx - serialized wire.MsgTx diff --git a/responses.go b/responses.go index 2422607..4d9c185 100644 --- a/responses.go +++ b/responses.go @@ -1,11 +1,11 @@ package main -type getPubKeyResponse struct { +type pubKeyResponse struct { Timestamp int64 `json:"timestamp"` PubKey []byte `json:"pubKey"` } -type getFeeResponse struct { +type feeResponse struct { Timestamp int64 `json:"timestamp"` Fee float64 `json:"fee"` } diff --git a/router.go b/router.go index 1f7f694..b542353 100644 --- a/router.go +++ b/router.go @@ -11,6 +11,8 @@ func newRouter() *gin.Engine { api.Use() { + router.GET("/fee", fee) + router.GET("/pubkey", pubKey) router.GET("/payfee", payFee) }