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

book: add NIP21 JavaScript examples #590

Closed

Conversation

RydalWater
Copy link
Contributor

Description

  • Updated index.js
  • Added nip21.js
  • Updated nip21.md

Notes to the reviewers

Wasn’t able to adde the full URI examples for note and npub, figured it was related to the JS bindings not having toNostrUri() method exposed currently. If you’re able to add this let me know and I’ll update the examples.

Similarly, consider adding fromNostrUri() to the the Coordinate class and I’ll tweak the current Bech32 example so that it show how to decode the URI.

Finally, I noticed the NIP21 with parse() method wasn’t available for the js bindings, as with python. Was this intentional or is it a limitation of the js binding themselves?

Checklist

- Updated index.js
- Added nip21.js
- Updated nip21.md
- Corrected nip21.js run statement
@yukibtc
Copy link
Member

yukibtc commented Oct 18, 2024

Thanks, I'll add them. A thing that we can do for the next times (I'm going to do the same right now) is to add the example also for missing stuff but commented with a prefix, like:

// UNCOMMENT_ON_RELEASE: let pk_uri = keys.publicKey.toNostrUri();
// UNCOMMENT_ON_RELEASE: console.log(` Public key (URI): ${pk_uri}`);

@yukibtc
Copy link
Member

yukibtc commented Oct 18, 2024

Regarding the NIP21 parse: unfortunately I can't expose enums with fields in variants in JavaScript

@yukibtc yukibtc closed this in d01a2bf Oct 18, 2024
yukibtc added a commit that referenced this pull request Oct 18, 2024
@RydalWater
Copy link
Contributor Author

Regarding the NIP21 parse: unfortunately I can't expose enums with fields in variants in JavaScript

Figured this was the case. No worries, cheers

@RydalWater RydalWater deleted the nostr-js-book-example branch October 23, 2024 15:16
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