Align Wallet Connections with proven Alby Hub API contract
This commit is contained in:
committed by
GitHub
parent
f24be16b98
commit
82ee21f13f
@@ -0,0 +1,74 @@
|
||||
diff --git a/api/models.go b/api/models.go
|
||||
index 27bc0c6..3986c0f 100644
|
||||
--- a/api/models.go
|
||||
+++ b/api/models.go
|
||||
@@ -43,7 +43,7 @@ type API interface {
|
||||
GetBalances(ctx context.Context) (*BalancesResponse, error)
|
||||
ListTransactions(ctx context.Context, appId *uint, limit uint64, offset uint64) (*ListTransactionsResponse, error)
|
||||
SendPayment(ctx context.Context, invoice string, amountMsat *uint64) (*SendPaymentResponse, error)
|
||||
- CreateInvoice(ctx context.Context, amount uint64, description string) (*MakeInvoiceResponse, error)
|
||||
+ CreateInvoice(ctx context.Context, amount uint64, description string, appId *uint) (*MakeInvoiceResponse, error)
|
||||
LookupInvoice(ctx context.Context, paymentHash string) (*LookupInvoiceResponse, error)
|
||||
RequestMempoolApi(endpoint string) (interface{}, error)
|
||||
GetInfo(ctx context.Context) (*InfoResponse, error)
|
||||
@@ -308,8 +308,9 @@ type PayInvoiceRequest struct {
|
||||
}
|
||||
|
||||
type MakeInvoiceRequest struct {
|
||||
- Amount uint64 `json:"amount"`
|
||||
- Description string `json:"description"`
|
||||
+ Amount uint64 `json:"amount"`
|
||||
+ Description string `json:"description"`
|
||||
+ AppId *uint `json:"appId"`
|
||||
}
|
||||
|
||||
type ResetRouterRequest struct {
|
||||
diff --git a/api/transactions.go b/api/transactions.go
|
||||
index 8a10267..ce8e080 100644
|
||||
--- a/api/transactions.go
|
||||
+++ b/api/transactions.go
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
-func (api *api) CreateInvoice(ctx context.Context, amount uint64, description string) (*MakeInvoiceResponse, error) {
|
||||
+func (api *api) CreateInvoice(ctx context.Context, amount uint64, description string, appId *uint) (*MakeInvoiceResponse, error) {
|
||||
if api.svc.GetLNClient() == nil {
|
||||
return nil, errors.New("LNClient not started")
|
||||
}
|
||||
- transaction, err := api.svc.GetTransactionsService().MakeInvoice(ctx, amount, description, "", 0, nil, api.svc.GetLNClient(), nil, nil)
|
||||
+ transaction, err := api.svc.GetTransactionsService().MakeInvoice(ctx, amount, description, "", 0, nil, api.svc.GetLNClient(), appId, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
diff --git a/http/http_service.go b/http/http_service.go
|
||||
index 1ec1de6..84a2650 100644
|
||||
--- a/http/http_service.go
|
||||
+++ b/http/http_service.go
|
||||
@@ -518,7 +518,12 @@ func (httpSvc *HttpService) makeInvoiceHandler(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
- invoice, err := httpSvc.api.CreateInvoice(c.Request().Context(), makeInvoiceRequest.Amount, makeInvoiceRequest.Description)
|
||||
+ invoice, err := httpSvc.api.CreateInvoice(
|
||||
+ c.Request().Context(),
|
||||
+ makeInvoiceRequest.Amount,
|
||||
+ makeInvoiceRequest.Description,
|
||||
+ makeInvoiceRequest.AppId,
|
||||
+ )
|
||||
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, ErrorResponse{
|
||||
diff --git a/wails/wails_handlers.go b/wails/wails_handlers.go
|
||||
index 1ca87f2..8b91f68 100644
|
||||
--- a/wails/wails_handlers.go
|
||||
+++ b/wails/wails_handlers.go
|
||||
@@ -634,7 +634,7 @@ func (app *WailsApp) WailsRequestRouter(route string, method string, body strin
|
||||
return WailsRequestRouterResponse{Body: nil, Error: err.Error()}
|
||||
}
|
||||
}
|
||||
- invoice, err := app.api.CreateInvoice(ctx, makeInvoiceRequest.Amount, makeInvoiceRequest.Description)
|
||||
+ invoice, err := app.api.CreateInvoice(ctx, makeInvoiceRequest.Amount, makeInvoiceRequest.Description, nil)
|
||||
if err != nil {
|
||||
return WailsRequestRouterResponse{Body: nil, Error: err.Error()}
|
||||
}
|
||||
Reference in New Issue
Block a user