Skip to content

Nip47 notifications#30

Open
DoktorShift wants to merge 22 commits intolnbits:mainfrom
DoktorShift:nip47_notifications
Open

Nip47 notifications#30
DoktorShift wants to merge 22 commits intolnbits:mainfrom
DoktorShift:nip47_notifications

Conversation

@DoktorShift
Copy link
Copy Markdown

Added support for it.

  • Publishing info event with notifications tag
  • Added notifications to selectable permissions
  • Full support of handeling notification events
  • Backfall for polling if notification event not implemented by client app

Its the part of nwc service provider extension.

nwc funding source needs it in addition to support the spec as well and reduce potential load on server. Requested here:

lnbits/lnbits#3187

DoktorShift and others added 17 commits March 25, 2026 18:30
- Auto-format with black, ruff --fix, prettier
- Fix ruff C901: extract _notify_payment_sent helper to reduce complexity
- Fix ruff RUF059: prefix unused unpacked variable with underscore
- Add noqa: E402 for intentional late imports in standalone test mocks
- Fix pyright: add None guard on payment_status.success
- Fix mock parameter names to match send_notification signature
Standalone notification tests use heavy sys.modules patching to run
without lnbits installed. Exclude them from mypy/pyright since static
type checking cannot follow dynamic module injection.

Also add type ignore for optional lnurlp extension import.
Standalone test files with sys.modules mocking cause mypy "found twice"
errors when in the main package tree. Moving to tests/standalone/
(no __init__.py) prevents mypy from discovering them as package modules.

Also update pyright exclude and fix PROJECT_DIR paths.
- Re-run black/ruff/prettier after rebase
- Move standalone tests to tests/standalone/ (no __init__.py) to prevent
  mypy "found twice" module discovery conflict
- Exclude tests/standalone/ from mypy and pyright
- Fix PROJECT_DIR paths for new location
@DoktorShift DoktorShift force-pushed the nip47_notifications branch from 1324bd0 to c333590 Compare March 25, 2026 17:33
Our lock had mypy 1.19.1 which crashes on pydantic v1 env_settings.
Main uses mypy 1.17.1 which works correctly.
Adding pyrightconfig.json changed pyright's project resolution,
causing it to scan node_modules typeshed stubs. Without the config
file, pyright uses the lnbits shared CI workflow defaults which work.
These files use heavy sys.modules patching that pyright cannot follow.
Inline directives suppress the expected errors without needing a
pyrightconfig.json (which changes pyright's project resolution).
The pairing URL now encodes the relay with quote(), but the test
NWCWallet client was using the encoded value directly to connect,
causing 'scheme isn't ws or wss' errors.
@DoktorShift DoktorShift marked this pull request as ready for review March 25, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants