-
Notifications
You must be signed in to change notification settings - Fork 4
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
Replace nostr-hooks with NDK #21
Conversation
@sepehr-safari thanks for the PR! I was originally thinking caching could be added to nostr-hooks to support the feature. Why did you decide to use NDK instead (and then this PoS no longer uses your library)? is it unfeasable to add caching to nostr-hooks right now? I will try review and get this merged before the end of the week. Regarding the context: it's a simple Point of Sale with the ability to manage your items on nostr. This is possible by using the private key of the NWC URL to sign events. All you need is to connect a wallet (or you can try mine which already has a public profile and some items attached to it) |
that would be possible. but for now, unfortunately, I don't have a plan.
NDK is a masterpiece by Pablo. it's feature-rich, super easy-to-use, and up-to-date with the edge of Nostr. I suggest using it over my nostr-hooks these days.
yeap. totally replaced with NDK and NDK-cache-dexie.
good luck. ping me in case of any issue. |
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.
tACK
src/state/store.ts
Outdated
} | ||
|
||
interface Actions { | ||
setProvider(provider: webln.NostrWebLNProvider | undefined): void; | ||
addItemToCart(item: Item): void; | ||
removeItemFromCart(item: Item): void; | ||
clearCart(): void; | ||
addRelay(relay: string): void; |
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.
these 2 methods were supposed to address this TODO:
Line 5 in fb3511a
// TODO: allow dynamic list of relays |
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.
@sepehr-safari I removed them since they are not actually used (and I think we need to consider the UX there)
@sepehr-safari I just tried it out now. There were several issues but overall quite impressive considering you didn't test it! showing items and the user profile is super fast now! 🚀 There are a few strange things about ndk - I couldn't see how to disconnect a subscription or disconnect the instance itself which would probably be good to figure out, but the app works as-is right now. And there is some additional management needed now since there are no nice hooks. Do let me know if you update nostr-hooks to be powered by ndk, I will use it in my next app! |
great to hear!
you can use the option
thank you for this motivation. I will do. |
this pr should solve this #14
considerations
please review and test all functionalities before merging.
there was no test cases and I didn't know much about the context so was unable to test it manually.