mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-22 23:25:26 +01:00
remove old api docs
This commit is contained in:
@@ -30,18 +30,6 @@ type AddInvoiceResponseBody struct {
|
||||
PayReq string `json:"pay_req"`
|
||||
}
|
||||
|
||||
// AddInvoice godoc
|
||||
// @Summary Generate a new invoice
|
||||
// @Description Returns a new bolt11 invoice
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Invoice
|
||||
// @Param invoice body AddInvoiceRequestBody True "Add Invoice"
|
||||
// @Success 200 {object} AddInvoiceResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /addinvoice [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *AddInvoiceController) AddInvoice(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
return AddInvoice(c, controller.svc, userID)
|
||||
|
||||
@@ -22,17 +22,6 @@ type BalanceResponse struct {
|
||||
}
|
||||
}
|
||||
|
||||
// Balance godoc
|
||||
// @Summary Retrieve balance
|
||||
// @Description Current user's balance in satoshi
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Success 200 {object} BalanceResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /balance [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *BalanceController) Balance(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
balance, err := controller.svc.CurrentUserBalance(c.Request().Context(), userId)
|
||||
|
||||
@@ -21,18 +21,6 @@ func NewCheckPaymentController(svc *service.LndhubService) *CheckPaymentControll
|
||||
return &CheckPaymentController{svc: svc}
|
||||
}
|
||||
|
||||
// CheckPayment godoc
|
||||
// @Summary Check if an invoice is paid
|
||||
// @Description Checks if an invoice is paid, can be incoming our outgoing
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Invoice
|
||||
// @Param payment_hash path string true "Payment hash"
|
||||
// @Success 200 {object} CheckPaymentResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /checkpayment/{payment_hash} [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *CheckPaymentController) CheckPayment(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
rHash := c.Param("payment_hash")
|
||||
|
||||
@@ -28,17 +28,6 @@ type CreateUserRequestBody struct {
|
||||
AccountType string `json:"accounttype"`
|
||||
}
|
||||
|
||||
// CreateUser godoc
|
||||
// @Summary Create an account
|
||||
// @Description Create a new account with a login and password
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Param account body CreateUserRequestBody false "Create User"
|
||||
// @Success 200 {object} CreateUserResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /create [post]
|
||||
func (controller *CreateUserController) CreateUser(c echo.Context) error {
|
||||
|
||||
var body CreateUserRequestBody
|
||||
|
||||
@@ -73,17 +73,6 @@ func NewGetInfoController(svc *service.LndhubService) *GetInfoController {
|
||||
return &GetInfoController{svc: svc}
|
||||
}
|
||||
|
||||
// GetInfo godoc
|
||||
// @Summary Get info about the Lightning node
|
||||
// @Description Returns info about the backend node powering this LNDhub instance
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Info
|
||||
// @Success 200 {object} GetInfoResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /getinfo [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *GetInfoController) GetInfo(c echo.Context) error {
|
||||
|
||||
info, err := controller.svc.GetInfo(c.Request().Context())
|
||||
|
||||
@@ -46,17 +46,6 @@ type IncomingInvoice struct {
|
||||
CustomRecords map[uint64][]byte `json:"custom_records"`
|
||||
}
|
||||
|
||||
// GetTXS godoc
|
||||
// @Summary Retrieve outgoing payments
|
||||
// @Description Returns a list of outgoing payments for a user
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Success 200 {object} []OutgoingInvoice
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /gettxs [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *GetTXSController) GetTXS(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
|
||||
@@ -84,17 +73,6 @@ func (controller *GetTXSController) GetTXS(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, &response)
|
||||
}
|
||||
|
||||
// GetUserInvoices godoc
|
||||
// @Summary Retrieve incoming invoices
|
||||
// @Description Returns a list of incoming invoices for a user
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Success 200 {object} []IncomingInvoice
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /getuserinvoices [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *GetTXSController) GetUserInvoices(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
|
||||
|
||||
@@ -17,18 +17,6 @@ func NewInvoiceController(svc *service.LndhubService) *InvoiceController {
|
||||
return &InvoiceController{svc: svc}
|
||||
}
|
||||
|
||||
// Invoice godoc
|
||||
// @Summary Generate a new invoice
|
||||
// @Description Returns a new bolt11 invoice for a user with given login, without an Authorization Header
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Invoice
|
||||
// @Param user_login path string true "User Login"
|
||||
// @Param invoice body AddInvoiceRequestBody True "Add Invoice"
|
||||
// @Success 200 {object} AddInvoiceResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /invoice/{user_login} [post]
|
||||
func (controller *InvoiceController) Invoice(c echo.Context) error {
|
||||
user, err := controller.svc.FindUserByLogin(c.Request().Context(), c.Param("user_login"))
|
||||
if err != nil {
|
||||
|
||||
@@ -27,20 +27,6 @@ func NewInvoiceStreamController(svc *service.LndhubService) *InvoiceStreamContro
|
||||
return &InvoiceStreamController{svc: svc}
|
||||
}
|
||||
|
||||
// StreamInvoices godoc
|
||||
// @Summary Websocket for incoming payments
|
||||
// @Description Websocket: won't work with Swagger web UI. Returns a stream of settled incoming payments.
|
||||
// @Description A keep-alive message is sent on startup and every 30s.
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Invoice
|
||||
// @Param token query string true "Auth token, retrieved from /auth endpoint"
|
||||
// @Param since_payment_hash query string false "Payment hash of earliest invoice. If specified, missing updates starting from this payment will be sent."
|
||||
// @Success 200 {object} []InvoiceEventWrapper
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /invoices/stream [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *InvoiceStreamController) StreamInvoices(c echo.Context) error {
|
||||
userId, err := tokens.ParseToken(controller.svc.Config.JWTSecret, (c.QueryParam("token")), false)
|
||||
if err != nil {
|
||||
|
||||
@@ -41,18 +41,6 @@ type KeySendResponseBody struct {
|
||||
PaymentRoute *service.Route `json:"payment_route,omitempty"`
|
||||
}
|
||||
|
||||
//// KeySend godoc
|
||||
// @Summary Make a keysend payment
|
||||
// @Description Pay a node without an invoice using it's public key
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Payment
|
||||
// @Param KeySendRequestBody body KeySendRequestBody True "Invoice to pay"
|
||||
// @Success 200 {object} KeySendResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /keysend [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *KeySendController) KeySend(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
reqBody := KeySendRequestBody{}
|
||||
|
||||
@@ -39,18 +39,6 @@ type PayInvoiceResponseBody struct {
|
||||
PaymentRoute *service.Route `json:"payment_route,omitempty"`
|
||||
}
|
||||
|
||||
// PayInvoice godoc
|
||||
// @Summary Pay an invoice
|
||||
// @Description Pay a bolt11 invoice
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Payment
|
||||
// @Param PayInvoiceRequest body PayInvoiceRequestBody True "Invoice to pay"
|
||||
// @Success 200 {object} PayInvoiceResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /payinvoice [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
reqBody := PayInvoiceRequestBody{}
|
||||
|
||||
@@ -17,9 +17,9 @@ func NewBalanceController(svc *service.LndhubService) *BalanceController {
|
||||
}
|
||||
|
||||
type BalanceResponse struct {
|
||||
BTC struct {
|
||||
AvailableBalance int64
|
||||
}
|
||||
Balance int64 `json:"balance"`
|
||||
Currency string `json:"currency"`
|
||||
Unit string `json:"unit"`
|
||||
}
|
||||
|
||||
// Balance godoc
|
||||
@@ -31,7 +31,7 @@ type BalanceResponse struct {
|
||||
// @Success 200 {object} BalanceResponse
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /balance [get]
|
||||
// @Router /v2/balance [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *BalanceController) Balance(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
@@ -40,8 +40,8 @@ func (controller *BalanceController) Balance(c echo.Context) error {
|
||||
return err
|
||||
}
|
||||
return c.JSON(http.StatusOK, &BalanceResponse{
|
||||
BTC: struct{ AvailableBalance int64 }{
|
||||
AvailableBalance: balance,
|
||||
},
|
||||
Balance: balance,
|
||||
Currency: "BTC",
|
||||
Unit: "sat",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@ package v2controllers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/getAlby/lndhub.go/common"
|
||||
"github.com/getAlby/lndhub.go/lib"
|
||||
"github.com/getAlby/lndhub.go/lib/responses"
|
||||
"github.com/getAlby/lndhub.go/lib/service"
|
||||
"github.com/getsentry/sentry-go"
|
||||
@@ -20,44 +20,35 @@ func NewInvoiceController(svc *service.LndhubService) *InvoiceController {
|
||||
return &InvoiceController{svc: svc}
|
||||
}
|
||||
|
||||
type OutgoingInvoice struct {
|
||||
RHash interface{} `json:"r_hash,omitempty"`
|
||||
PaymentHash interface{} `json:"payment_hash"`
|
||||
PaymentPreimage string `json:"payment_preimage"`
|
||||
Value int64 `json:"value"`
|
||||
Type string `json:"type"`
|
||||
Fee int64 `json:"fee"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
Memo string `json:"memo"`
|
||||
Keysend bool `json:"keysend"`
|
||||
CustomRecords map[uint64][]byte `json:"custom_records"`
|
||||
}
|
||||
|
||||
type IncomingInvoice struct {
|
||||
RHash interface{} `json:"r_hash,omitempty"`
|
||||
PaymentHash interface{} `json:"payment_hash"`
|
||||
type Invoice struct {
|
||||
PaymentHash string `json:"payment_hash"`
|
||||
PaymentRequest string `json:"payment_request"`
|
||||
Description string `json:"description"`
|
||||
PayReq string `json:"pay_req"`
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
DescriptionHash string `json:"description_hash"`
|
||||
PaymentPreimage string `json:"payment_preimage,omitempty"`
|
||||
Destination string `json:"destination"`
|
||||
Amount int64 `json:"amount"`
|
||||
Fee int64 `json:"fee"`
|
||||
Status string `json:"status"`
|
||||
Type string `json:"type"`
|
||||
ExpireTime int64 `json:"expire_time"`
|
||||
Amount int64 `json:"amt"`
|
||||
IsPaid bool `json:"ispaid"`
|
||||
ErrorMessage string `json:"error_message,omitempty"`
|
||||
SettledAt time.Time `json:"settled_at"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
IsPaid bool `json:"is_paid"`
|
||||
Keysend bool `json:"keysend"`
|
||||
CustomRecords map[uint64][]byte `json:"custom_records"`
|
||||
}
|
||||
|
||||
// GetTXS godoc
|
||||
// GetOutgoingInvoices godoc
|
||||
// @Summary Retrieve outgoing payments
|
||||
// @Description Returns a list of outgoing payments for a user
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Success 200 {object} []OutgoingInvoice
|
||||
// @Success 200 {object} []Invoice
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /gettxs [get]
|
||||
// @Router /v2/invoices/outgoing [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *InvoiceController) GetOutgoingInvoices(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
@@ -67,18 +58,23 @@ func (controller *InvoiceController) GetOutgoingInvoices(c echo.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
response := make([]OutgoingInvoice, len(invoices))
|
||||
response := make([]Invoice, len(invoices))
|
||||
for i, invoice := range invoices {
|
||||
rhash, _ := lib.ToJavaScriptBuffer(invoice.RHash)
|
||||
response[i] = OutgoingInvoice{
|
||||
RHash: rhash,
|
||||
PaymentHash: rhash,
|
||||
response[i] = Invoice{
|
||||
PaymentHash: invoice.RHash,
|
||||
PaymentRequest: invoice.PaymentRequest,
|
||||
Description: invoice.Memo,
|
||||
DescriptionHash: invoice.DescriptionHash,
|
||||
PaymentPreimage: invoice.Preimage,
|
||||
Value: invoice.Amount,
|
||||
Type: common.InvoiceTypePaid,
|
||||
Destination: invoice.DestinationPubkeyHex,
|
||||
Amount: invoice.Amount,
|
||||
Fee: invoice.Fee,
|
||||
Timestamp: invoice.CreatedAt.Unix(),
|
||||
Memo: invoice.Memo,
|
||||
Status: invoice.State,
|
||||
Type: common.InvoiceTypePaid,
|
||||
ErrorMessage: invoice.ErrorMessage,
|
||||
SettledAt: invoice.SettledAt.Time,
|
||||
ExpiresAt: invoice.ExpiresAt.Time,
|
||||
IsPaid: invoice.State == common.InvoiceStateSettled,
|
||||
Keysend: invoice.Keysend,
|
||||
CustomRecords: invoice.DestinationCustomRecords,
|
||||
}
|
||||
@@ -86,16 +82,16 @@ func (controller *InvoiceController) GetOutgoingInvoices(c echo.Context) error {
|
||||
return c.JSON(http.StatusOK, &response)
|
||||
}
|
||||
|
||||
// GetUserInvoices godoc
|
||||
// GetIncomingInvoices godoc
|
||||
// @Summary Retrieve incoming invoices
|
||||
// @Description Returns a list of incoming invoices for a user
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Tags Account
|
||||
// @Success 200 {object} []IncomingInvoice
|
||||
// @Success 200 {object} []Invoice
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /getuserinvoices [get]
|
||||
// @Router /v2/invoices/incoming [get]
|
||||
// @Security OAuth2Password
|
||||
func (controller *InvoiceController) GetIncomingInvoices(c echo.Context) error {
|
||||
userId := c.Get("UserID").(int64)
|
||||
@@ -105,19 +101,22 @@ func (controller *InvoiceController) GetIncomingInvoices(c echo.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
response := make([]IncomingInvoice, len(invoices))
|
||||
response := make([]Invoice, len(invoices))
|
||||
for i, invoice := range invoices {
|
||||
rhash, _ := lib.ToJavaScriptBuffer(invoice.RHash)
|
||||
response[i] = IncomingInvoice{
|
||||
RHash: rhash,
|
||||
response[i] = Invoice{
|
||||
PaymentHash: invoice.RHash,
|
||||
PaymentRequest: invoice.PaymentRequest,
|
||||
Description: invoice.Memo,
|
||||
PayReq: invoice.PaymentRequest,
|
||||
Timestamp: invoice.CreatedAt.Unix(),
|
||||
Type: common.InvoiceTypeUser,
|
||||
ExpireTime: 3600 * 24,
|
||||
DescriptionHash: invoice.DescriptionHash,
|
||||
PaymentPreimage: invoice.Preimage,
|
||||
Destination: invoice.DestinationPubkeyHex,
|
||||
Amount: invoice.Amount,
|
||||
Fee: invoice.Fee,
|
||||
Status: invoice.State,
|
||||
Type: common.InvoiceTypeUser,
|
||||
ErrorMessage: invoice.ErrorMessage,
|
||||
SettledAt: invoice.SettledAt.Time,
|
||||
ExpiresAt: invoice.ExpiresAt.Time,
|
||||
IsPaid: invoice.State == common.InvoiceStateSettled,
|
||||
Keysend: invoice.Keysend,
|
||||
CustomRecords: invoice.DestinationCustomRecords,
|
||||
@@ -127,15 +126,15 @@ func (controller *InvoiceController) GetIncomingInvoices(c echo.Context) error {
|
||||
}
|
||||
|
||||
type AddInvoiceRequestBody struct {
|
||||
Amount interface{} `json:"amt"` // amount in Satoshi
|
||||
Memo string `json:"memo"`
|
||||
Amount int64 `json:"amount" validate:"required,gt=0"`
|
||||
Description string `json:"description"`
|
||||
DescriptionHash string `json:"description_hash" validate:"omitempty,hexadecimal,len=64"`
|
||||
}
|
||||
|
||||
type AddInvoiceResponseBody struct {
|
||||
RHash string `json:"r_hash"`
|
||||
PaymentHash string `json:"payment_hash"`
|
||||
PaymentRequest string `json:"payment_request"`
|
||||
PayReq string `json:"pay_req"`
|
||||
ExpiresAt time.Time `json:"expires_at"`
|
||||
}
|
||||
|
||||
// AddInvoice godoc
|
||||
@@ -148,7 +147,7 @@ type AddInvoiceResponseBody struct {
|
||||
// @Success 200 {object} AddInvoiceResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /addinvoice [post]
|
||||
// @Router /v2/invoices [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *InvoiceController) AddInvoice(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
@@ -168,18 +167,19 @@ func (controller *InvoiceController) AddInvoice(c echo.Context) error {
|
||||
if err != nil || amount < 0 {
|
||||
return c.JSON(http.StatusBadRequest, responses.BadArgumentsError)
|
||||
}
|
||||
c.Logger().Infof("Adding invoice: user_id:%v memo:%s value:%v description_hash:%s", userID, body.Memo, amount, body.DescriptionHash)
|
||||
c.Logger().Infof("Adding invoice: user_id:%v memo:%s value:%v description_hash:%s", userID, body.Description, amount, body.DescriptionHash)
|
||||
|
||||
invoice, err := controller.svc.AddIncomingInvoice(c.Request().Context(), userID, amount, body.Memo, body.DescriptionHash)
|
||||
invoice, err := controller.svc.AddIncomingInvoice(c.Request().Context(), userID, amount, body.Description, body.DescriptionHash)
|
||||
if err != nil {
|
||||
c.Logger().Errorf("Error creating invoice: user_id:%v error: %v", userID, err)
|
||||
sentry.CaptureException(err)
|
||||
return c.JSON(http.StatusBadRequest, responses.BadArgumentsError)
|
||||
}
|
||||
responseBody := AddInvoiceResponseBody{}
|
||||
responseBody.RHash = invoice.RHash
|
||||
responseBody.PaymentRequest = invoice.PaymentRequest
|
||||
responseBody.PayReq = invoice.PaymentRequest
|
||||
responseBody := AddInvoiceResponseBody{
|
||||
PaymentHash: invoice.RHash,
|
||||
PaymentRequest: invoice.PaymentRequest,
|
||||
ExpiresAt: invoice.ExpiresAt.Time,
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, &responseBody)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package v2controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/getAlby/lndhub.go/lib"
|
||||
"github.com/getAlby/lndhub.go/lib/responses"
|
||||
"github.com/getAlby/lndhub.go/lib/service"
|
||||
"github.com/getAlby/lndhub.go/lnd"
|
||||
@@ -31,14 +29,14 @@ type KeySendRequestBody struct {
|
||||
}
|
||||
|
||||
type KeySendResponseBody struct {
|
||||
RHash *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
|
||||
Amount int64 `json:"num_satoshis,omitempty"`
|
||||
Amount int64 `json:"amount,omitempty"`
|
||||
Fee int64 `json:"fee,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DescriptionHash string `json:"description_hash,omitempty"`
|
||||
Destination string `json:"destination,omitempty"`
|
||||
DescriptionHashStr string `json:"description_hash,omitempty"`
|
||||
PaymentError string `json:"payment_error,omitempty"`
|
||||
PaymentPreimage *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
|
||||
PaymentRoute *service.Route `json:"payment_route,omitempty"`
|
||||
PaymentPreimage string `json:"payment_preimage,omitempty"`
|
||||
PaymentHash string `json:"payment_hash,omitempty"`
|
||||
}
|
||||
|
||||
//// KeySend godoc
|
||||
@@ -51,7 +49,7 @@ type KeySendResponseBody struct {
|
||||
// @Success 200 {object} KeySendResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /keysend [post]
|
||||
// @Router /v2/payments/keysend [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *KeySendController) KeySend(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
@@ -109,19 +107,20 @@ func (controller *KeySendController) KeySend(c echo.Context) error {
|
||||
return c.JSON(http.StatusBadRequest, echo.Map{
|
||||
"error": true,
|
||||
"code": 10,
|
||||
"message": fmt.Sprintf("Payment failed. Does the receiver have enough inbound capacity? (%v)", err),
|
||||
"message": err.Error(),
|
||||
})
|
||||
}
|
||||
|
||||
responseBody := &KeySendResponseBody{}
|
||||
responseBody.RHash = &lib.JavaScriptBuffer{Data: sendPaymentResponse.PaymentHash}
|
||||
responseBody.Amount = invoice.Amount
|
||||
responseBody.Destination = invoice.DestinationPubkeyHex
|
||||
responseBody.Description = invoice.Memo
|
||||
responseBody.DescriptionHashStr = invoice.DescriptionHash
|
||||
responseBody.PaymentError = sendPaymentResponse.PaymentError
|
||||
responseBody.PaymentPreimage = &lib.JavaScriptBuffer{Data: sendPaymentResponse.PaymentPreimage}
|
||||
responseBody.PaymentRoute = sendPaymentResponse.PaymentRoute
|
||||
responseBody := &KeySendResponseBody{
|
||||
Amount: sendPaymentResponse.Invoice.Amount,
|
||||
Fee: sendPaymentResponse.Invoice.Fee,
|
||||
Description: sendPaymentResponse.Invoice.Memo,
|
||||
DescriptionHash: sendPaymentResponse.Invoice.DescriptionHash,
|
||||
Destination: sendPaymentResponse.Invoice.DestinationPubkeyHex,
|
||||
PaymentError: sendPaymentResponse.PaymentError,
|
||||
PaymentPreimage: sendPaymentResponse.PaymentPreimageStr,
|
||||
PaymentHash: sendPaymentResponse.PaymentHashStr,
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, responseBody)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package v2controllers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/getAlby/lndhub.go/lib"
|
||||
"github.com/getAlby/lndhub.go/lib/responses"
|
||||
"github.com/getAlby/lndhub.go/lib/service"
|
||||
"github.com/getAlby/lndhub.go/lnd"
|
||||
@@ -25,18 +23,18 @@ func NewPayInvoiceController(svc *service.LndhubService) *PayInvoiceController {
|
||||
|
||||
type PayInvoiceRequestBody struct {
|
||||
Invoice string `json:"invoice" validate:"required"`
|
||||
Amount interface{} `json:"amount" validate:"omitempty"`
|
||||
Amount int64 `json:"amount" validate:"omitempty,gte=0"`
|
||||
}
|
||||
type PayInvoiceResponseBody struct {
|
||||
RHash *lib.JavaScriptBuffer `json:"payment_hash,omitempty"`
|
||||
PaymentRequest string `json:"payment_request,omitempty"`
|
||||
PayReq string `json:"pay_req,omitempty"`
|
||||
Amount int64 `json:"num_satoshis,omitempty"`
|
||||
Amount int64 `json:"amount,omitempty"`
|
||||
Fee int64 `json:"fee,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
DescriptionHashStr string `json:"description_hash,omitempty"`
|
||||
DescriptionHash string `json:"description_hash,omitempty"`
|
||||
Destination string `json:"destination,omitempty"`
|
||||
PaymentError string `json:"payment_error,omitempty"`
|
||||
PaymentPreimage *lib.JavaScriptBuffer `json:"payment_preimage,omitempty"`
|
||||
PaymentRoute *service.Route `json:"payment_route,omitempty"`
|
||||
PaymentPreimage string `json:"payment_preimage,omitempty"`
|
||||
PaymentHash string `json:"payment_hash,omitempty"`
|
||||
}
|
||||
|
||||
// PayInvoice godoc
|
||||
@@ -49,7 +47,7 @@ type PayInvoiceResponseBody struct {
|
||||
// @Success 200 {object} PayInvoiceResponseBody
|
||||
// @Failure 400 {object} responses.ErrorResponse
|
||||
// @Failure 500 {object} responses.ErrorResponse
|
||||
// @Router /payinvoice [post]
|
||||
// @Router /v2/payments/bolt11 [post]
|
||||
// @Security OAuth2Password
|
||||
func (controller *PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
userID := c.Get("UserID").(int64)
|
||||
@@ -115,22 +113,22 @@ func (controller *PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
hub.CaptureException(err)
|
||||
})
|
||||
}
|
||||
return c.JSON(http.StatusBadRequest, echo.Map{
|
||||
return c.JSON(http.StatusInternalServerError, echo.Map{
|
||||
"error": true,
|
||||
"code": 10,
|
||||
"message": fmt.Sprintf("Payment failed. Does the receiver have enough inbound capacity? (%v)", err),
|
||||
"message": err.Error(),
|
||||
})
|
||||
}
|
||||
responseBody := &PayInvoiceResponseBody{}
|
||||
responseBody.RHash = &lib.JavaScriptBuffer{Data: sendPaymentResponse.PaymentHash}
|
||||
responseBody.PaymentRequest = paymentRequest
|
||||
responseBody.PayReq = paymentRequest
|
||||
responseBody.Amount = invoice.Amount
|
||||
responseBody.Description = invoice.Memo
|
||||
responseBody.DescriptionHashStr = invoice.DescriptionHash
|
||||
responseBody.PaymentError = sendPaymentResponse.PaymentError
|
||||
responseBody.PaymentPreimage = &lib.JavaScriptBuffer{Data: sendPaymentResponse.PaymentPreimage}
|
||||
responseBody.PaymentRoute = sendPaymentResponse.PaymentRoute
|
||||
responseBody := &PayInvoiceResponseBody{
|
||||
Amount: sendPaymentResponse.Invoice.Amount,
|
||||
Fee: sendPaymentResponse.Invoice.Fee,
|
||||
Description: sendPaymentResponse.Invoice.Memo,
|
||||
DescriptionHash: sendPaymentResponse.Invoice.DescriptionHash,
|
||||
Destination: sendPaymentResponse.Invoice.DestinationPubkeyHex,
|
||||
PaymentError: sendPaymentResponse.PaymentError,
|
||||
PaymentPreimage: sendPaymentResponse.PaymentPreimageStr,
|
||||
PaymentHash: sendPaymentResponse.PaymentHashStr,
|
||||
}
|
||||
|
||||
return c.JSON(http.StatusOK, responseBody)
|
||||
}
|
||||
|
||||
808
docs/docs.go
808
docs/docs.go
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,23 +1,5 @@
|
||||
basePath: /
|
||||
definitions:
|
||||
controllers.AddInvoiceRequestBody:
|
||||
properties:
|
||||
amt:
|
||||
description: amount in Satoshi
|
||||
description_hash:
|
||||
type: string
|
||||
memo:
|
||||
type: string
|
||||
type: object
|
||||
controllers.AddInvoiceResponseBody:
|
||||
properties:
|
||||
pay_req:
|
||||
type: string
|
||||
payment_request:
|
||||
type: string
|
||||
r_hash:
|
||||
type: string
|
||||
type: object
|
||||
controllers.AuthRequestBody:
|
||||
properties:
|
||||
login:
|
||||
@@ -34,128 +16,61 @@ definitions:
|
||||
refresh_token:
|
||||
type: string
|
||||
type: object
|
||||
controllers.BalanceResponse:
|
||||
responses.ErrorResponse:
|
||||
properties:
|
||||
btc:
|
||||
properties:
|
||||
availableBalance:
|
||||
code:
|
||||
type: integer
|
||||
type: object
|
||||
type: object
|
||||
controllers.Chain:
|
||||
properties:
|
||||
chain:
|
||||
description: The blockchain the node is on (eg bitcoin, litecoin)
|
||||
type: string
|
||||
network:
|
||||
description: The network the node is on (eg regtest, testnet, mainnet)
|
||||
type: string
|
||||
type: object
|
||||
controllers.CheckPaymentResponseBody:
|
||||
properties:
|
||||
paid:
|
||||
error:
|
||||
type: boolean
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
controllers.CreateUserRequestBody:
|
||||
v2controllers.AddInvoiceRequestBody:
|
||||
properties:
|
||||
accounttype:
|
||||
amount:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
login:
|
||||
description_hash:
|
||||
type: string
|
||||
partnerid:
|
||||
required:
|
||||
- amount
|
||||
type: object
|
||||
v2controllers.AddInvoiceResponseBody:
|
||||
properties:
|
||||
expires_at:
|
||||
type: string
|
||||
payment_hash:
|
||||
type: string
|
||||
payment_request:
|
||||
type: string
|
||||
type: object
|
||||
v2controllers.BalanceResponse:
|
||||
properties:
|
||||
balance:
|
||||
type: integer
|
||||
currency:
|
||||
type: string
|
||||
unit:
|
||||
type: string
|
||||
type: object
|
||||
v2controllers.CreateUserRequestBody:
|
||||
properties:
|
||||
password:
|
||||
type: string
|
||||
type: object
|
||||
controllers.CreateUserResponseBody:
|
||||
properties:
|
||||
login:
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
v2controllers.CreateUserResponseBody:
|
||||
properties:
|
||||
password:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
type: object
|
||||
controllers.Feature:
|
||||
v2controllers.Invoice:
|
||||
properties:
|
||||
is_known:
|
||||
type: boolean
|
||||
is_required:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
type: object
|
||||
controllers.GetInfoResponse:
|
||||
properties:
|
||||
alias:
|
||||
description: If applicable, the alias of the current node, e.g. "bob"
|
||||
type: string
|
||||
best_header_timestamp:
|
||||
description: Timestamp of the block best known to the wallet
|
||||
type: integer
|
||||
block_hash:
|
||||
description: The node's current view of the hash of the best block
|
||||
type: string
|
||||
block_height:
|
||||
description: The node's current view of the height of the best block
|
||||
type: integer
|
||||
chains:
|
||||
description: A list of active chains the node is connected to
|
||||
items:
|
||||
$ref: '#/definitions/controllers.Chain'
|
||||
type: array
|
||||
color:
|
||||
description: The color of the current node in hex code format
|
||||
type: string
|
||||
commit_hash:
|
||||
description: The SHA1 commit hash that the daemon is compiled with.
|
||||
type: string
|
||||
features:
|
||||
additionalProperties:
|
||||
$ref: '#/definitions/controllers.Feature'
|
||||
description: |-
|
||||
Features that our node has advertised in our init message, node
|
||||
announcements and invoices.
|
||||
type: object
|
||||
identity_pubkey:
|
||||
description: The identity pubkey of the current node.
|
||||
type: string
|
||||
num_active_channels:
|
||||
description: Number of active channels
|
||||
type: integer
|
||||
num_inactive_channels:
|
||||
description: Number of inactive channels
|
||||
type: integer
|
||||
num_peers:
|
||||
description: Number of peers
|
||||
type: integer
|
||||
num_pending_channels:
|
||||
description: Number of pending channels
|
||||
type: integer
|
||||
synced_to_chain:
|
||||
description: Whether the wallet's view is synced to the main chain
|
||||
type: boolean
|
||||
synced_to_graph:
|
||||
description: Whether we consider ourselves synced with the public channel
|
||||
graph.
|
||||
type: boolean
|
||||
testnet:
|
||||
description: |-
|
||||
Whether the current node is connected to testnet. This field is
|
||||
deprecated and the network field should be used instead
|
||||
|
||||
Deprecated: Do not use.
|
||||
type: boolean
|
||||
uris:
|
||||
description: The URIs of the current node.
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
version:
|
||||
description: The version of the LND software that the node is running.
|
||||
type: string
|
||||
type: object
|
||||
controllers.IncomingInvoice:
|
||||
properties:
|
||||
amt:
|
||||
amount:
|
||||
type: integer
|
||||
custom_records:
|
||||
additionalProperties:
|
||||
@@ -165,31 +80,34 @@ definitions:
|
||||
type: object
|
||||
description:
|
||||
type: string
|
||||
expire_time:
|
||||
description_hash:
|
||||
type: string
|
||||
destination:
|
||||
type: string
|
||||
error_message:
|
||||
type: string
|
||||
expires_at:
|
||||
type: string
|
||||
fee:
|
||||
type: integer
|
||||
ispaid:
|
||||
is_paid:
|
||||
type: boolean
|
||||
keysend:
|
||||
type: boolean
|
||||
pay_req:
|
||||
payment_hash:
|
||||
type: string
|
||||
payment_preimage:
|
||||
type: string
|
||||
payment_hash: {}
|
||||
payment_request:
|
||||
type: string
|
||||
r_hash: {}
|
||||
timestamp:
|
||||
type: integer
|
||||
settled_at:
|
||||
type: string
|
||||
status:
|
||||
type: string
|
||||
type:
|
||||
type: string
|
||||
type: object
|
||||
controllers.InvoiceEventWrapper:
|
||||
properties:
|
||||
invoice:
|
||||
$ref: '#/definitions/controllers.IncomingInvoice'
|
||||
type:
|
||||
type: string
|
||||
type: object
|
||||
controllers.KeySendRequestBody:
|
||||
v2controllers.KeySendRequestBody:
|
||||
properties:
|
||||
amount:
|
||||
type: integer
|
||||
@@ -205,101 +123,55 @@ definitions:
|
||||
- amount
|
||||
- destination
|
||||
type: object
|
||||
controllers.KeySendResponseBody:
|
||||
v2controllers.KeySendResponseBody:
|
||||
properties:
|
||||
amount:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
description_hash:
|
||||
type: string
|
||||
destination:
|
||||
type: string
|
||||
num_satoshis:
|
||||
fee:
|
||||
type: integer
|
||||
payment_error:
|
||||
type: string
|
||||
payment_hash:
|
||||
$ref: '#/definitions/lib.JavaScriptBuffer'
|
||||
payment_preimage:
|
||||
$ref: '#/definitions/lib.JavaScriptBuffer'
|
||||
payment_route:
|
||||
$ref: '#/definitions/service.Route'
|
||||
type: object
|
||||
controllers.OutgoingInvoice:
|
||||
properties:
|
||||
custom_records:
|
||||
additionalProperties:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
type: object
|
||||
fee:
|
||||
type: integer
|
||||
keysend:
|
||||
type: boolean
|
||||
memo:
|
||||
type: string
|
||||
payment_hash: {}
|
||||
payment_preimage:
|
||||
type: string
|
||||
r_hash: {}
|
||||
timestamp:
|
||||
type: integer
|
||||
type:
|
||||
type: string
|
||||
value:
|
||||
type: integer
|
||||
type: object
|
||||
controllers.PayInvoiceRequestBody:
|
||||
v2controllers.PayInvoiceRequestBody:
|
||||
properties:
|
||||
amount: {}
|
||||
amount:
|
||||
minimum: 0
|
||||
type: integer
|
||||
invoice:
|
||||
type: string
|
||||
required:
|
||||
- invoice
|
||||
type: object
|
||||
controllers.PayInvoiceResponseBody:
|
||||
v2controllers.PayInvoiceResponseBody:
|
||||
properties:
|
||||
amount:
|
||||
type: integer
|
||||
description:
|
||||
type: string
|
||||
description_hash:
|
||||
type: string
|
||||
num_satoshis:
|
||||
type: integer
|
||||
pay_req:
|
||||
destination:
|
||||
type: string
|
||||
fee:
|
||||
type: integer
|
||||
payment_error:
|
||||
type: string
|
||||
payment_hash:
|
||||
$ref: '#/definitions/lib.JavaScriptBuffer'
|
||||
type: string
|
||||
payment_preimage:
|
||||
$ref: '#/definitions/lib.JavaScriptBuffer'
|
||||
type: string
|
||||
payment_request:
|
||||
type: string
|
||||
payment_route:
|
||||
$ref: '#/definitions/service.Route'
|
||||
type: object
|
||||
lib.JavaScriptBuffer:
|
||||
properties:
|
||||
data:
|
||||
items:
|
||||
type: integer
|
||||
type: array
|
||||
type: object
|
||||
responses.ErrorResponse:
|
||||
properties:
|
||||
code:
|
||||
type: integer
|
||||
error:
|
||||
type: boolean
|
||||
message:
|
||||
type: string
|
||||
type: object
|
||||
service.Route:
|
||||
properties:
|
||||
total_amt:
|
||||
type: integer
|
||||
total_fees:
|
||||
type: integer
|
||||
type: object
|
||||
info:
|
||||
contact:
|
||||
@@ -314,38 +186,6 @@ info:
|
||||
title: LNDhub.go
|
||||
version: 0.6.1
|
||||
paths:
|
||||
/addinvoice:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a new bolt11 invoice
|
||||
parameters:
|
||||
- description: Add Invoice
|
||||
in: body
|
||||
name: invoice
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.AddInvoiceRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.AddInvoiceResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Generate a new invoice
|
||||
tags:
|
||||
- Invoice
|
||||
/auth:
|
||||
post:
|
||||
consumes:
|
||||
@@ -375,7 +215,7 @@ paths:
|
||||
summary: Authenticate
|
||||
tags:
|
||||
- Account
|
||||
/balance:
|
||||
/v2/balance:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -386,7 +226,7 @@ paths:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.BalanceResponse'
|
||||
$ref: '#/definitions/v2controllers.BalanceResponse'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
@@ -400,78 +240,25 @@ paths:
|
||||
summary: Retrieve balance
|
||||
tags:
|
||||
- Account
|
||||
/checkpayment/{payment_hash}:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Checks if an invoice is paid, can be incoming our outgoing
|
||||
parameters:
|
||||
- description: Payment hash
|
||||
in: path
|
||||
name: payment_hash
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.CheckPaymentResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Check if an invoice is paid
|
||||
tags:
|
||||
- Invoice
|
||||
/create:
|
||||
/v2/invoices:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new account with a login and password
|
||||
description: Returns a new bolt11 invoice
|
||||
parameters:
|
||||
- description: Create User
|
||||
- description: Add Invoice
|
||||
in: body
|
||||
name: account
|
||||
name: invoice
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.CreateUserRequestBody'
|
||||
$ref: '#/definitions/v2controllers.AddInvoiceRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.CreateUserResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Create an account
|
||||
tags:
|
||||
- Account
|
||||
/getinfo:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns info about the backend node powering this LNDhub instance
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.GetInfoResponse'
|
||||
$ref: '#/definitions/v2controllers.AddInvoiceResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
@@ -482,37 +269,10 @@ paths:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Get info about the Lightning node
|
||||
summary: Generate a new invoice
|
||||
tags:
|
||||
- Info
|
||||
/gettxs:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a list of outgoing payments for a user
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/controllers.OutgoingInvoice'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Retrieve outgoing payments
|
||||
tags:
|
||||
- Account
|
||||
/getuserinvoices:
|
||||
- Invoice
|
||||
/v2/invoices/incoming:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -524,7 +284,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/controllers.IncomingInvoice'
|
||||
$ref: '#/definitions/v2controllers.Invoice'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
@@ -539,60 +299,11 @@ paths:
|
||||
summary: Retrieve incoming invoices
|
||||
tags:
|
||||
- Account
|
||||
/invoice/{user_login}:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns a new bolt11 invoice for a user with given login, without
|
||||
an Authorization Header
|
||||
parameters:
|
||||
- description: User Login
|
||||
in: path
|
||||
name: user_login
|
||||
required: true
|
||||
type: string
|
||||
- description: Add Invoice
|
||||
in: body
|
||||
name: invoice
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.AddInvoiceRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.AddInvoiceResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Generate a new invoice
|
||||
tags:
|
||||
- Invoice
|
||||
/invoices/stream:
|
||||
/v2/invoices/outgoing:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: |-
|
||||
Websocket: won't work with Swagger web UI. Returns a stream of settled incoming payments.
|
||||
A keep-alive message is sent on startup and every 30s.
|
||||
parameters:
|
||||
- description: Auth token, retrieved from /auth endpoint
|
||||
in: query
|
||||
name: token
|
||||
required: true
|
||||
type: string
|
||||
- description: Payment hash of earliest invoice. If specified, missing updates
|
||||
starting from this payment will be sent.
|
||||
in: query
|
||||
name: since_payment_hash
|
||||
type: string
|
||||
description: Returns a list of outgoing payments for a user
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@@ -600,7 +311,7 @@ paths:
|
||||
description: OK
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/controllers.InvoiceEventWrapper'
|
||||
$ref: '#/definitions/v2controllers.Invoice'
|
||||
type: array
|
||||
"400":
|
||||
description: Bad Request
|
||||
@@ -612,42 +323,10 @@ paths:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Websocket for incoming payments
|
||||
summary: Retrieve outgoing payments
|
||||
tags:
|
||||
- Invoice
|
||||
/keysend:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Pay a node without an invoice using it's public key
|
||||
parameters:
|
||||
- description: Invoice to pay
|
||||
in: body
|
||||
name: KeySendRequestBody
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.KeySendRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.KeySendResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Make a keysend payment
|
||||
tags:
|
||||
- Payment
|
||||
/payinvoice:
|
||||
- Account
|
||||
/v2/payments/bolt11:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
@@ -658,14 +337,14 @@ paths:
|
||||
name: PayInvoiceRequest
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.PayInvoiceRequestBody'
|
||||
$ref: '#/definitions/v2controllers.PayInvoiceRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/controllers.PayInvoiceResponseBody'
|
||||
$ref: '#/definitions/v2controllers.PayInvoiceResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
@@ -679,6 +358,67 @@ paths:
|
||||
summary: Pay an invoice
|
||||
tags:
|
||||
- Payment
|
||||
/v2/payments/keysend:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Pay a node without an invoice using it's public key
|
||||
parameters:
|
||||
- description: Invoice to pay
|
||||
in: body
|
||||
name: KeySendRequestBody
|
||||
required: true
|
||||
schema:
|
||||
$ref: '#/definitions/v2controllers.KeySendRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/v2controllers.KeySendResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
security:
|
||||
- OAuth2Password: []
|
||||
summary: Make a keysend payment
|
||||
tags:
|
||||
- Payment
|
||||
/v2/users:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Create a new account with a username and password
|
||||
parameters:
|
||||
- description: Create User
|
||||
in: body
|
||||
name: account
|
||||
schema:
|
||||
$ref: '#/definitions/v2controllers.CreateUserRequestBody'
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/v2controllers.CreateUserResponseBody'
|
||||
"400":
|
||||
description: Bad Request
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
"500":
|
||||
description: Internal Server Error
|
||||
schema:
|
||||
$ref: '#/definitions/responses.ErrorResponse'
|
||||
summary: Create an account
|
||||
tags:
|
||||
- Account
|
||||
schemes:
|
||||
- https
|
||||
- http
|
||||
|
||||
Reference in New Issue
Block a user