diff --git a/handle_balance_request.go b/handle_balance_request.go index 2e68e22b..1ba30b93 100644 --- a/handle_balance_request.go +++ b/handle_balance_request.go @@ -14,7 +14,7 @@ const ( func (svc *Service) HandleGetBalanceEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -55,8 +55,6 @@ func (svc *Service) HandleGetBalanceEvent(ctx context.Context, request *Nip47Req "eventKind": event.Kind, "appId": app.ID, }).Infof("Failed to fetch balance: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_GET_BALANCE_METHOD, Error: &Nip47Error{ @@ -79,8 +77,6 @@ func (svc *Service) HandleGetBalanceEvent(ctx context.Context, request *Nip47Req responsePayload.BudgetRenewal = appPermission.BudgetRenewal } - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_GET_BALANCE_METHOD, Result: responsePayload, diff --git a/handle_info_request.go b/handle_info_request.go index 041be66b..800ef404 100644 --- a/handle_info_request.go +++ b/handle_info_request.go @@ -10,7 +10,7 @@ import ( func (svc *Service) HandleGetInfoEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -51,8 +51,6 @@ func (svc *Service) HandleGetInfoEvent(ctx context.Context, request *Nip47Reques "eventKind": event.Kind, "appId": app.ID, }).Infof("Failed to fetch node info: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, Error: &Nip47Error{ @@ -71,9 +69,6 @@ func (svc *Service) HandleGetInfoEvent(ctx context.Context, request *Nip47Reques BlockHash: info.BlockHash, Methods: svc.GetMethods(&app), } - - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, Result: responsePayload, diff --git a/handle_list_transactions_request.go b/handle_list_transactions_request.go index acc9ec72..9bb23253 100644 --- a/handle_list_transactions_request.go +++ b/handle_list_transactions_request.go @@ -11,7 +11,7 @@ import ( func (svc *Service) HandleListTransactionsEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -66,8 +66,6 @@ func (svc *Service) HandleListTransactionsEvent(ctx context.Context, request *Ni "eventKind": event.Kind, "appId": app.ID, }).Infof("Failed to fetch transactions: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, Error: &Nip47Error{ @@ -82,8 +80,6 @@ func (svc *Service) HandleListTransactionsEvent(ctx context.Context, request *Ni } // fmt.Println(responsePayload) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, Result: responsePayload, diff --git a/handle_lookup_invoice_request.go b/handle_lookup_invoice_request.go index de1d979d..8814929e 100644 --- a/handle_lookup_invoice_request.go +++ b/handle_lookup_invoice_request.go @@ -13,7 +13,7 @@ import ( func (svc *Service) HandleLookupInvoiceEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { // TODO: move to a shared function - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -94,8 +94,6 @@ func (svc *Service) HandleLookupInvoiceEvent(ctx context.Context, request *Nip47 "invoice": lookupInvoiceParams.Invoice, "paymentHash": lookupInvoiceParams.PaymentHash, }).Infof("Failed to lookup invoice: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_LOOKUP_INVOICE_METHOD, Error: &Nip47Error{ @@ -109,8 +107,6 @@ func (svc *Service) HandleLookupInvoiceEvent(ctx context.Context, request *Nip47 Nip47Transaction: *transaction, } - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_LOOKUP_INVOICE_METHOD, Result: responsePayload, diff --git a/handle_make_invoice_request.go b/handle_make_invoice_request.go index 952aeda7..7b3a9ae7 100644 --- a/handle_make_invoice_request.go +++ b/handle_make_invoice_request.go @@ -14,7 +14,7 @@ import ( func (svc *Service) HandleMakeInvoiceEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { // TODO: move to a shared function - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -92,8 +92,6 @@ func (svc *Service) HandleMakeInvoiceEvent(ctx context.Context, request *Nip47Re "descriptionHash": makeInvoiceParams.DescriptionHash, "expiry": makeInvoiceParams.Expiry, }).Infof("Failed to make invoice: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_MAKE_INVOICE_METHOD, Error: &Nip47Error{ @@ -107,8 +105,6 @@ func (svc *Service) HandleMakeInvoiceEvent(ctx context.Context, request *Nip47Re Nip47Transaction: *transaction, } - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_MAKE_INVOICE_METHOD, Result: responsePayload, diff --git a/handle_multi_pay_invoice_request.go b/handle_multi_pay_invoice_request.go index 04c94933..406578bc 100644 --- a/handle_multi_pay_invoice_request.go +++ b/handle_multi_pay_invoice_request.go @@ -14,7 +14,7 @@ import ( func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.Subscription, request *Nip47Request, event *nostr.Event, app App, ss []byte) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err := svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -80,7 +80,7 @@ func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.S return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } @@ -115,7 +115,7 @@ func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } @@ -146,9 +146,6 @@ func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.S "appId": app.ID, "bolt11": bolt11, }).Infof("Failed to send payment: %v", err) - // TODO: https://github.com/getAlby/nostr-wallet-connect/issues/231 - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) resp, err := svc.createResponse(event, Nip47Response{ ResultType: request.Method, @@ -166,13 +163,10 @@ func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } payment.Preimage = &preimage - // TODO: https://github.com/getAlby/nostr-wallet-connect/issues/231 - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) svc.db.Save(&payment) resp, err := svc.createResponse(event, Nip47Response{ ResultType: request.Method, @@ -189,7 +183,7 @@ func (svc *Service) HandleMultiPayInvoiceEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) }(invoiceInfo) } diff --git a/handle_multi_pay_keysend_request.go b/handle_multi_pay_keysend_request.go index 82860442..ca4c468a 100644 --- a/handle_multi_pay_keysend_request.go +++ b/handle_multi_pay_keysend_request.go @@ -12,7 +12,7 @@ import ( func (svc *Service) HandleMultiPayKeysendEvent(ctx context.Context, sub *nostr.Subscription, request *Nip47Request, event *nostr.Event, app App, ss []byte) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err := svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -80,7 +80,7 @@ func (svc *Service) HandleMultiPayKeysendEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } @@ -111,9 +111,6 @@ func (svc *Service) HandleMultiPayKeysendEvent(ctx context.Context, sub *nostr.S "appId": app.ID, "senderPubkey": keysendInfo.Pubkey, }).Infof("Failed to send payment: %v", err) - // TODO: https://github.com/getAlby/nostr-wallet-connect/issues/231 - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) resp, err := svc.createResponse(event, Nip47Response{ ResultType: request.Method, @@ -131,13 +128,10 @@ func (svc *Service) HandleMultiPayKeysendEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } payment.Preimage = &preimage - // TODO: https://github.com/getAlby/nostr-wallet-connect/issues/231 - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) svc.db.Save(&payment) resp, err := svc.createResponse(event, Nip47Response{ ResultType: request.Method, @@ -154,7 +148,7 @@ func (svc *Service) HandleMultiPayKeysendEvent(ctx context.Context, sub *nostr.S }).Errorf("Failed to process event: %v", err) return } - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) }(keysendInfo) } diff --git a/handle_pay_keysend_request.go b/handle_pay_keysend_request.go index 7ebf7493..79173bb6 100644 --- a/handle_pay_keysend_request.go +++ b/handle_pay_keysend_request.go @@ -11,7 +11,7 @@ import ( func (svc *Service) HandlePayKeysendEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -73,8 +73,6 @@ func (svc *Service) HandlePayKeysendEvent(ctx context.Context, request *Nip47Req "appId": app.ID, "senderPubkey": payParams.Pubkey, }).Infof("Failed to send payment: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, Error: &Nip47Error{ @@ -84,8 +82,6 @@ func (svc *Service) HandlePayKeysendEvent(ctx context.Context, request *Nip47Req }, nostr.Tags{}, ss) } payment.Preimage = &preimage - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) svc.db.Save(&payment) return svc.createResponse(event, Nip47Response{ ResultType: request.Method, diff --git a/handle_payment_request.go b/handle_payment_request.go index 12550d2f..461be801 100644 --- a/handle_payment_request.go +++ b/handle_payment_request.go @@ -13,7 +13,7 @@ import ( func (svc *Service) HandlePayInvoiceEvent(ctx context.Context, request *Nip47Request, event *nostr.Event, app App, ss []byte) (result *nostr.Event, err error) { - nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content, State: "received"} + nostrEvent := NostrEvent{App: app, NostrId: event.ID, Content: event.Content} err = svc.db.Create(&nostrEvent).Error if err != nil { svc.Logger.WithFields(logrus.Fields{ @@ -94,8 +94,6 @@ func (svc *Service) HandlePayInvoiceEvent(ctx context.Context, request *Nip47Req "appId": app.ID, "bolt11": bolt11, }).Infof("Failed to send payment: %v", err) - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_ERROR - svc.db.Save(&nostrEvent) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_PAY_INVOICE_METHOD, Error: &Nip47Error{ @@ -105,8 +103,6 @@ func (svc *Service) HandlePayInvoiceEvent(ctx context.Context, request *Nip47Req }, nostr.Tags{}, ss) } payment.Preimage = &preimage - nostrEvent.State = NOSTR_EVENT_STATE_HANDLER_EXECUTED - svc.db.Save(&nostrEvent) svc.db.Save(&payment) return svc.createResponse(event, Nip47Response{ ResultType: NIP_47_PAY_INVOICE_METHOD, diff --git a/migrations/202401191539_initial_migration.sql b/migrations/202401191539_initial_migration.sql index 48d40947..8f32f14c 100644 --- a/migrations/202401191539_initial_migration.sql +++ b/migrations/202401191539_initial_migration.sql @@ -5,10 +5,13 @@ CREATE INDEX `idx_app_permissions_app_id` ON `app_permissions`(`app_id`); CREATE TABLE `payments` (`id` integer,`app_id` integer,`nostr_event_id` integer,`amount` integer,`payment_request` text,`preimage` text,`created_at` datetime,`updated_at` datetime, `preimage2` text,PRIMARY KEY (`id`),CONSTRAINT `fk_payments_app` FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON DELETE CASCADE,CONSTRAINT `fk_payments_nostr_event` FOREIGN KEY (`nostr_event_id`) REFERENCES `nostr_events`(`id`)); CREATE INDEX `idx_payments_nostr_event_id` ON `payments`(`nostr_event_id`); CREATE INDEX `idx_payments_app_id` ON `payments`(`app_id`); -CREATE TABLE "nostr_events" (`id` integer,`app_id` integer,`nostr_id` text UNIQUE,`reply_id` text,`content` text,`state` text,`replied_at` datetime,`created_at` datetime,`updated_at` datetime,PRIMARY KEY (`id`),CONSTRAINT `fk_nostr_events_app` FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON DELETE CASCADE); +CREATE TABLE "nostr_events" (`id` integer,`app_id` integer,`nostr_id` text UNIQUE,`content` text,`replied_at` datetime,`created_at` datetime,`updated_at` datetime,PRIMARY KEY (`id`),CONSTRAINT `fk_nostr_events_app` FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON DELETE CASCADE); CREATE UNIQUE INDEX `idx_nostr_events_nostr_id` ON `nostr_events`(`nostr_id`); CREATE INDEX `idx_nostr_events_app_id` ON `nostr_events`(`app_id`); CREATE INDEX idx_payment_sum ON payments (app_id, preimage, created_at); CREATE INDEX idx_nostr_events_app_id_and_id ON nostr_events(app_id, id); +CREATE TABLE "response_events" (`id` integer,`app_id` integer,`nostr_id` text UNIQUE,`request_id` integer,`content` text,`decrypted_content` text,`state` text,`replied_at` datetime,`created_at` datetime,`updated_at` datetime,PRIMARY KEY (`id`),CONSTRAINT `fk_response_events_app` FOREIGN KEY (`app_id`) REFERENCES `apps`(`id`) ON DELETE CASCADE,CONSTRAINT `fk_response_events_nostr_events` FOREIGN KEY (`request_id`) REFERENCES `nostr_events`(`id`)); +CREATE UNIQUE INDEX `idx_response_events_nostr_id` ON `response_events`(`nostr_id`); +CREATE INDEX `idx_response_events_app_id` ON `response_events`(`app_id`); CREATE TABLE "user_configs" ("id" integer, "key" text NOT NULL UNIQUE, "value" text, "encrypted" numeric, `created_at` datetime,`updated_at` datetime, PRIMARY KEY("id")); CREATE UNIQUE INDEX "idx_user_configs_key" ON "user_configs" ("key"); diff --git a/models.go b/models.go index 501d7e60..f6f5c949 100644 --- a/models.go +++ b/models.go @@ -63,14 +63,26 @@ type NostrEvent struct { AppId uint `validate:"required"` App App NostrId string `validate:"required"` - ReplyId string Content string - State string RepliedAt time.Time CreatedAt time.Time UpdatedAt time.Time } +type ResponseEvent struct { + ID uint + AppId uint `validate:"required"` + App App + NostrId string `validate:"required"` + ReplyId string + Content string + DecryptedContent string + State string + RepliedAt time.Time + CreatedAt time.Time + UpdatedAt time.Time +} + type Payment struct { ID uint AppId uint `validate:"required"` diff --git a/service.go b/service.go index d7fc573f..8af844ea 100644 --- a/service.go +++ b/service.go @@ -189,12 +189,35 @@ func (svc *Service) StartSubscription(ctx context.Context, sub *nostr.Subscripti } } -func (svc *Service) PublishEvent(ctx context.Context, sub *nostr.Subscription, event *nostr.Event, resp *nostr.Event) { +func (svc *Service) PublishEvent(ctx context.Context, sub *nostr.Subscription, event *nostr.Event, resp *nostr.Event, app App, ss []byte) { + payload, err := nip04.Decrypt(resp.Content, ss) + if err != nil { + svc.Logger.WithFields(logrus.Fields{ + "eventId": event.ID, + "eventKind": event.Kind, + "appId": app.ID, + "replyEventId": resp.ID, + }).Errorf("Failed to decrypt content: %v", err) + return + } + responseEvent := ResponseEvent{App: app, NostrId: resp.ID, DecryptedContent: payload, Content: resp.Content, State: "received"} + err = svc.db.Create(&responseEvent).Error + if err != nil { + svc.Logger.WithFields(logrus.Fields{ + "eventId": event.ID, + "eventKind": event.Kind, + "appId": app.ID, + "replyEventId": resp.ID, + }).Errorf("Failed to save response/reply event: %v", err) + return + } + status, err := sub.Relay.Publish(ctx, *resp) if err != nil { svc.Logger.WithFields(logrus.Fields{ "eventId": event.ID, "status": status, + "appId": app.ID, "replyEventId": resp.ID, }).Errorf("Failed to publish reply: %v", err) return @@ -206,42 +229,43 @@ func (svc *Service) PublishEvent(ctx context.Context, sub *nostr.Subscription, e svc.Logger.WithFields(logrus.Fields{ "eventId": event.ID, "status": status, + "appId": app.ID, "replyEventId": resp.ID, }).Error(result.Error) return } - nostrEvent.ReplyId = resp.ID if status == nostr.PublishStatusSucceeded { - nostrEvent.State = NOSTR_EVENT_STATE_PUBLISH_CONFIRMED + responseEvent.State = NOSTR_EVENT_STATE_PUBLISH_CONFIRMED + responseEvent.RepliedAt = time.Now() nostrEvent.RepliedAt = time.Now() svc.db.Save(&nostrEvent) svc.Logger.WithFields(logrus.Fields{ "nostrEventId": nostrEvent.ID, "eventId": event.ID, "status": status, + "appId": app.ID, "replyEventId": resp.ID, - "appId": nostrEvent.AppId, }).Info("Published reply") } else if status == nostr.PublishStatusFailed { - nostrEvent.State = NOSTR_EVENT_STATE_PUBLISH_FAILED + responseEvent.State = NOSTR_EVENT_STATE_PUBLISH_FAILED svc.db.Save(&nostrEvent) svc.Logger.WithFields(logrus.Fields{ "nostrEventId": nostrEvent.ID, "eventId": event.ID, "status": status, + "appId": app.ID, "replyEventId": resp.ID, - "appId": nostrEvent.AppId, }).Info("Failed to publish reply") } else { - nostrEvent.State = NOSTR_EVENT_STATE_PUBLISH_UNCONFIRMED + responseEvent.State = NOSTR_EVENT_STATE_PUBLISH_UNCONFIRMED svc.db.Save(&nostrEvent) svc.Logger.WithFields(logrus.Fields{ "nostrEventId": nostrEvent.ID, "eventId": event.ID, "status": status, + "appId": app.ID, "replyEventId": resp.ID, - "appId": nostrEvent.AppId, }).Info("Reply sent but no response from relay (timeout)") } } @@ -286,7 +310,7 @@ func (svc *Service) HandleEvent(ctx context.Context, sub *nostr.Subscription, ev Message: "The public key does not have a wallet connected.", }, }, nostr.Tags{}, ss) - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) return } @@ -364,7 +388,7 @@ func (svc *Service) HandleEvent(ctx context.Context, sub *nostr.Subscription, ev }).Errorf("Failed to process event: %v", err) } if resp != nil { - svc.PublishEvent(ctx, sub, event, resp) + svc.PublishEvent(ctx, sub, event, resp, app, ss) } }