diff --git a/alby.go b/alby.go index 0f9eb2a7..8cff560a 100644 --- a/alby.go +++ b/alby.go @@ -111,7 +111,7 @@ func (svc *AlbyOAuthService) MakeInvoice(ctx context.Context, senderPubkey strin body := bytes.NewBuffer([]byte{}) payload := &MakeInvoiceRequest{ Amount: amount, - Memo: description, + Description: description, DescriptionHash: descriptionHash, // TODO: support expiry } @@ -155,6 +155,8 @@ func (svc *AlbyOAuthService) MakeInvoice(ctx context.Context, senderPubkey strin "expiry": expiry, "appId": app.ID, "userId": app.User.ID, + "paymentRequest": responsePayload.PaymentRequest, + "paymentHash": responsePayload.PaymentHash, }).Info("Make invoice successful") return responsePayload.PaymentRequest, responsePayload.PaymentHash, nil } else { diff --git a/handle_make_invoice_request.go b/handle_make_invoice_request.go index c1a14c47..c3e548d0 100644 --- a/handle_make_invoice_request.go +++ b/handle_make_invoice_request.go @@ -54,17 +54,25 @@ func (svc *Service) HandleMakeInvoiceEvent(ctx context.Context, request *Nip47Re } svc.Logger.WithFields(logrus.Fields{ - "eventId": event.ID, - "eventKind": event.Kind, - "appId": app.ID, + "eventId": event.ID, + "eventKind": event.Kind, + "appId": app.ID, + "amount": makeInvoiceParams.Amount, + "description": makeInvoiceParams.Description, + "descriptionHash": makeInvoiceParams.DescriptionHash, + "expiry": makeInvoiceParams.Expiry, }).Info("Making invoice") invoice, paymentHash, err := svc.lnClient.MakeInvoice(ctx, event.PubKey, makeInvoiceParams.Amount, makeInvoiceParams.Description, makeInvoiceParams.DescriptionHash, makeInvoiceParams.Expiry) if err != nil { svc.Logger.WithFields(logrus.Fields{ - "eventId": event.ID, - "eventKind": event.Kind, - "appId": app.ID, + "eventId": event.ID, + "eventKind": event.Kind, + "appId": app.ID, + "amount": makeInvoiceParams.Amount, + "description": makeInvoiceParams.Description, + "descriptionHash": makeInvoiceParams.DescriptionHash, + "expiry": makeInvoiceParams.Expiry, }).Infof("Failed to make invoice: %v", err) nostrEvent.State = "error" svc.db.Save(&nostrEvent) diff --git a/models.go b/models.go index 672f84b0..b82d54ab 100644 --- a/models.go +++ b/models.go @@ -27,6 +27,7 @@ const ( var nip47MethodDescriptions = map[string]string{ NIP_47_GET_BALANCE_METHOD: "Read your balance.", NIP_47_PAY_INVOICE_METHOD: "Send payments from your wallet.", + NIP_47_MAKE_INVOICE_METHOD: "Create invoices on your behalf.", } type AlbyMe struct { @@ -115,7 +116,7 @@ type PayResponse struct { type MakeInvoiceRequest struct { Amount int64 `json:"amount"` - Memo string `json:"memo"` + Description string `json:"description"` DescriptionHash string `json:"description_hash"` }