From be03c688500a9e796b15c8e2c98ed86afbb5714b Mon Sep 17 00:00:00 2001 From: Mathieu Bruneau Date: Mon, 20 May 2024 02:45:55 +0000 Subject: [PATCH] Added route for /address/:addresses/txs/pending --- httpd/handlers/addresses.go | 10 ++++++++++ httpd/router.go | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/httpd/handlers/addresses.go b/httpd/handlers/addresses.go index 71321e9..232ed65 100644 --- a/httpd/handlers/addresses.go +++ b/httpd/handlers/addresses.go @@ -7,6 +7,7 @@ import ( "strings" "github.com/ledgerhq/satstack/httpd/svc" + "github.com/ledgerhq/satstack/types" "github.com/ledgerhq/satstack/utils" "github.com/gin-gonic/gin" @@ -60,3 +61,12 @@ func GetAddresses(s svc.AddressesService) gin.HandlerFunc { ctx.JSON(http.StatusOK, addresses) } } + +func GetPendingAddresses(s svc.AddressesService) gin.HandlerFunc { + return func(ctx *gin.Context) { + var addresses types.Addresses + addresses.Transactions = []types.Transaction{} + + ctx.JSON(http.StatusOK, addresses.Transactions) + } +} diff --git a/httpd/router.go b/httpd/router.go index 2440f99..4ed5149 100644 --- a/httpd/router.go +++ b/httpd/router.go @@ -49,5 +49,9 @@ func GetRouter(s *svc.Service) *gin.Engine { addressesRouter.GET(":addresses/transactions", handlers.GetAddresses(s)) } + addressRouter := currencyRouter.Group("/address") + { + addressRouter.GET(":addresses/txs/pending", handlers.GetPendingAddresses(s)) + } return engine }