-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add nip47 notifications endpoint #60
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e3f1117
feat: add nip47 subscription endpoint
im-adithya 51d3616
feat: add nip47 subscription readme
im-adithya 6bd57e0
Merge branch 'main' into task-sub-nip47
im-adithya 18ec7d9
chore: refactor nip47 subscription handler
im-adithya e7c21b4
chore: subscribe to notifications (23196)
im-adithya 8364b7b
Merge branch 'main' into task-sub-nip47
im-adithya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -198,6 +198,61 @@ Notifies about new events matching the filter provided via webhooks. | |
// Source: https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Filter | ||
``` | ||
|
||
#### Response | ||
|
||
```json | ||
{ | ||
"subscription_id": "f370d1fc-x0x0-x0x0-x0x0-8f68fa12f32c", | ||
"webhookUrl": "https://your.webhook.url" | ||
} | ||
``` | ||
|
||
#### Response to Webhook URL | ||
|
||
```json | ||
{ | ||
"id": "a16ycf4a01bcxx........xxxxx", | ||
"pubkey": "a16y69effexxxx........xxxxx", | ||
"created_at": 1709033612, | ||
"kind": 23195, | ||
"tags": [ | ||
[ | ||
"p", | ||
"f490f5xxxxx........xxxxx" | ||
], | ||
[ | ||
"e", | ||
"a41aefxxxxx........xxxxx" | ||
] | ||
], | ||
"content": "<encrypted content>", | ||
"sig": "<signature>" | ||
} | ||
``` | ||
|
||
</details> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
||
### Subscribe to NWC Events | ||
|
||
Notifies about new response events which are requested by the pubkey to the wallet service. | ||
|
||
<details> | ||
<summary> | ||
<code>POST</code> <code><b>/nip47/subscriptions</b></code> | ||
</summary> | ||
|
||
#### Request Body | ||
|
||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay | | ||
| webhookUrl | required | string | Webhook URL to publish events | | ||
| walletPubkey | required | string | Pubkey of the NWC Wallet Provider | | ||
| connectionPubkey | required | string | Public key of the user (derived from secret in NWC connection string) | | ||
|
||
|
||
#### Response | ||
|
||
```json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this optional and we default to our relay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup it defaults to
cfg.DefaultRelayURL
("wss://relay.getalby.com/v1") when not set