-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: reconnection in nip47 * chore: spacing * chore: persist request event state in db * chore: use constants in json response * chore: remove unnecessary nested for loop * chore: add subscriptionToFilter function * chore: separate nip47 with and without webhook * chore: refactoring * fix: close custom relay before reconnecting * chore: further refactoring * chore: improve EOS handling * chore: refactor nip47 handlers * chore: remove unused validation * chore: check for deadline exceeded error * chore: fix tags in nip47 subscriptions * chore: use uuid to stop saving unnecessary subscriptions * chore: don't save in svc.stopSusbcription
- Loading branch information
1 parent
909b11e
commit 78a4d60
Showing
5 changed files
with
418 additions
and
313 deletions.
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 |
---|---|---|
|
@@ -50,7 +50,9 @@ This `GET` request returns a pubkey's NWC capabilities (if any) | |
|
||
### Publish NWC Request | ||
|
||
Returns the response event directly or to the Webhook URL if provided. | ||
Publishes the NWC request event and returns the response | ||
|
||
#### Without webhook | ||
|
||
<details> | ||
<summary> | ||
|
@@ -62,7 +64,6 @@ Returns the response event directly or to the Webhook URL if provided. | |
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
| webhookUrl | optional | string | Webhook URL to publish the response event, returns the event directly if not provided | | ||
| walletPubkey | required | string | Pubkey of the NWC Wallet Provider | | ||
| event | required | JSON object (see [example](#event-example)) | **Signed** request event | | ||
|
||
|
@@ -87,15 +88,7 @@ Returns the response event directly or to the Webhook URL if provided. | |
// Source: https://pkg.go.dev/github.com/nbd-wtf/[email protected]#Event | ||
``` | ||
|
||
#### Response (with webhook) | ||
|
||
```json | ||
{ | ||
"state": "WEBHOOK_RECEIVED" | ||
} | ||
``` | ||
|
||
#### Response (without webhook) | ||
#### Response | ||
|
||
```json | ||
{ | ||
|
@@ -122,6 +115,55 @@ Returns the response event directly or to the Webhook URL if provided. | |
``` | ||
</details> | ||
|
||
#### With webhook | ||
|
||
<details> | ||
<summary> | ||
<code>POST</code> <code><b>/nip47/webhook</b></code> | ||
</summary> | ||
|
||
#### Request Body | ||
|
||
| name | type | data type | description | | ||
|-----------|-----------|-------------------------|-----------------------------------------------------------------------| | ||
| relayUrl | optional | string | If no relay is provided, it uses the default relay (wss://relay.getalby.com/v1) | | ||
| webhookUrl | required | string | Webhook URL to publish the response event | | ||
| walletPubkey | required | string | Pubkey of the NWC Wallet Provider | | ||
| event | required | JSON object (see [example](#event-example)) | **Signed** request event | | ||
|
||
|
||
#### Response | ||
|
||
```json | ||
{ | ||
"state": "WEBHOOK_RECEIVED" | ||
} | ||
``` | ||
|
||
#### Response to webhook | ||
|
||
```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> | ||
|
||
------------------------------------------------------------------------------------------ | ||
|
||
### Publish Event | ||
|
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.