add /fee and /pubkey methods (#2)
This commit is contained in:
parent
a1429c7d8d
commit
43f80f009d
14
methods.go
14
methods.go
@ -37,6 +37,20 @@ func sendJSONResponse(resp interface{}, code int, c *gin.Context) {
|
|||||||
c.Writer.Write(dec)
|
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) {
|
func payFee(c *gin.Context) {
|
||||||
// HTTP GET Params required
|
// HTTP GET Params required
|
||||||
// feeTx - serialized wire.MsgTx
|
// feeTx - serialized wire.MsgTx
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
type getPubKeyResponse struct {
|
type pubKeyResponse struct {
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
PubKey []byte `json:"pubKey"`
|
PubKey []byte `json:"pubKey"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type getFeeResponse struct {
|
type feeResponse struct {
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
Fee float64 `json:"fee"`
|
Fee float64 `json:"fee"`
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user