From 506abdda15941ec5573f024d50a642a5552172cc Mon Sep 17 00:00:00 2001 From: Aleix Date: Thu, 30 Nov 2023 10:40:46 +0100 Subject: [PATCH] Returning waitPeriod info in the authTypes endpoint (#11) Returning waitPeriod info in the authTypes endpoint --- handlers.go | 4 +++- types.go | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/handlers.go b/handlers.go index be60509..b904b68 100644 --- a/handlers.go +++ b/handlers.go @@ -70,8 +70,10 @@ func (f *faucet) registerHandlers(api *apirest.API) { // Returns the list of supported auth types func (f *faucet) authTypesHandler(_ *apirest.APIdata, ctx *httprouter.HTTPContext) error { data := &AuthTypes{ - AuthTypes: f.authTypes, + AuthTypes: f.authTypes, + WaitSeconds: uint64(f.waitPeriod.Seconds()), } + return ctx.Send(new(HandlerResponse).Set(data).MustMarshall(), apirest.HTTPstatusOK) } diff --git a/types.go b/types.go index cad2b32..f0816e6 100644 --- a/types.go +++ b/types.go @@ -4,7 +4,8 @@ import "fmt" // AuthTypes is a struct to return the supported authentication types. type AuthTypes struct { - AuthTypes map[string]uint64 `json:"auth"` + AuthTypes map[string]uint64 `json:"auth"` + WaitSeconds uint64 `json:"waitSeconds"` } var errAddressAlreadyFunded = fmt.Errorf("address already funded")