Skip to content
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: subscribe to NIP-47 notifications #217

Merged
merged 5 commits into from
Apr 9, 2024
Merged

Conversation

rolznz
Copy link
Contributor

@rolznz rolznz commented Mar 31, 2024

For getAlby/nostr-wallet-connect-next#183

Also removes some unnecessary kind checks in other methods since they already use a filter which specifies the kind

Example output:

$ node examples/nwc/client/subscribe.js 
Waiting for notifications...
Got notification {
  result: {
    type: 'incoming',
    invoice: 'lnbc10n1pnqn99ydqafet5xgzrd35k2mn5ypjhsctdwpkx2np4qtuqfrmmrt9nf5fg4ahkraszktyl98u4zj54mp427kcztlyjdyts7pp5gkhls9e6aj8yjcjvsdylp03kl0g6rlewxyk2yv3gl6ktk9uhascssp5ndqrw7spngrgg5fnf4dud639ez5lkhxyuepzk6e5m2f4879jeexs9qyysgqcqpcxqyz5vqrzjq2w2zkkjagc80a0s2fxyex7zv6z5c99eljqmnnpaddywy3s27ylk2zkga9t8zhj93uqqqqlgqqqqqzsqygrzjqwh05slmksqfkgdyz2wst9fewjmah2amldg3jg2pqzqgvr723mslp4pgjtsk665zd5qqqqlgqqqqqzsqygrzjqvdnqyc82a9maxu6c7mee0shqr33u4z9z04wpdwhf96gxzpln8jcrapyqqqqqqqesuqqqqqqqqqqqqqq2qc7s06vhsry9rqpn5p9wfucgcv2cgy7vappy7hclnesekg45yfm3pwqslw7vs6zkedhu9n9kpqvpweykx270qy5ks7rnfm32kk84j8ngp4gvttg',
    description: 'NWC Client example',
    description_hash: '',
    preimage: 'be5c93a61acbc7b00a5e97d5445a8bbfc878c8d93ca0a19adea7b8ca1bb7060b',
    payment_hash: '45aff8173aec8e49624c8349f0be36fbd1a1ff2e312ca23228feacbb1797ec31',
    amount: 1000,
    fees_paid: 0,
    created_at: 1711903908,
    expires_at: 1711990308,
    settled_at: 1711903929
  },
  result_type: 'payment_received'
}

TODOs

  • re-connect to relay while subscribing
  • add typings for notifications

src/NWCClient.ts Outdated Show resolved Hide resolved
@rolznz rolznz merged commit 42984f0 into master Apr 9, 2024
3 checks passed
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.

1 participant