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: add nip 44 and versioning support #273

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

im-adithya
Copy link
Member

Ready for review

  • This needs the long pending update to nostr-tools v2 as nip44 library doesn't match the latest spec (and hence gives errors as it doesn't match with the Hub's nip-44)
  • For now I added the nip-44 folder so we can test it, in the meantime I'll work on a PR to shift to nostr-tools v2 so we can remove it.

@@ -895,6 +927,7 @@ export class NWCClient {
resultValidator: (result: T) => boolean,
): Promise<(T & { dTag: string })[]> {
await this._checkConnected();
await this._checkCompatibility();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you choose to check compatibility here?

what about once in the constructor? then we also know what notification kind to subscribe to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's an async function (fetching wallet service info), so I thought of doing the call before making a request

then we also know what notification kind to subscribe to?

We are doing that right? We store the version in this.version/this.supportedVersion and use that before passing the kind in subscribeNotifications

}
}

private selectHighestCompatibleVersion(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is nice, but I am wondering if such a complex algorithm is needed?

What about just:
if the wallet supports version 1.0, use it. Otherwise use 0.0.

As Bumi mentioned:

I do not expect many versions (and rather bigger changes like the switch to nip-44) because too many versions (of a spec) lead to incompatibilities which must be avoided.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, I was also thinking about this, but then thought to add this as this is an sdk and can face any possibility... (a weird case where the wallet service info gives "0.5" or "1.1" for example)

@rolznz
Copy link
Contributor

rolznz commented Nov 30, 2024

This needs the long pending update to nostr-tools v2

@im-adithya this is great! 🚀

please let me know when it's ready for testing.

src/NWCClient.ts Outdated Show resolved Hide resolved
@im-adithya
Copy link
Member Author

Done, ready for testing!

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