mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-24 08:05:02 +01:00
For now we simple return the getinfo response from LND. In the future we should limit the response and exactly define the response value. Also we should add some caching here to not always needing to hit the lightning node
33 lines
874 B
Go
33 lines
874 B
Go
package controllers
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/getAlby/lndhub.go/lib/service"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// GetBtcController : GetBtcController struct
|
|
type GetInfoController struct {
|
|
svc *service.LndhubService
|
|
}
|
|
|
|
func NewGetInfoController(svc *service.LndhubService) *GetInfoController {
|
|
return &GetInfoController{svc: svc}
|
|
}
|
|
|
|
// GetInfo : GetInfo handler
|
|
//
|
|
func (controller *GetInfoController) GetInfo(c echo.Context) error {
|
|
|
|
// TODO: add some caching for this GetInfo call. No need to always hit the node
|
|
info, err := controller.svc.GetInfo(context.TODO())
|
|
if err != nil {
|
|
return err
|
|
}
|
|
// BlueWallet right now requires a `identity_pubkey` in the response
|
|
// https://github.com/BlueWallet/BlueWallet/blob/a28a2b96bce0bff6d1a24a951b59dc972369e490/class/wallets/lightning-custodian-wallet.js#L578
|
|
return c.JSON(http.StatusOK, &info)
|
|
}
|