nostr-wot-sdk 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.6.0] - 2026-02-22
9
+
10
+ ### Added
11
+
12
+ - **SolidJS integration** (`nostr-wot-sdk/solid`) - First-class SolidJS support with reactive primitives
13
+ - `WoTProvider` - Context provider with automatic extension detection
14
+ - `createWoT(pubkey)` - Get distance, score, and details for a pubkey
15
+ - `createIsInWoT(pubkey)` - Check if pubkey is in your WoT (boolean)
16
+ - `createTrustScore(pubkey)` - Get trust score only
17
+ - `createBatchWoT(pubkeys)` - Check multiple pubkeys efficiently
18
+ - `useExtension()` - Get extension connection state
19
+ - `useWoTInstance()` - Get raw WoT instance for advanced usage
20
+ - `solid-js` as optional peer dependency (`>=1.0.0`)
21
+ - SolidJS build target in tsup config
22
+
23
+ ### Changed
24
+
25
+ - Updated package description to mention React and SolidJS support
26
+ - Updated README with SolidJS documentation and examples
27
+
28
+ ## [0.5.3] - 2025-02-05
29
+
30
+ ### Fixed
31
+
32
+ - **Improved extension detection with retry mechanism** - Extensions inject content scripts asynchronously after page load, so the SDK now polls for up to 1.5 seconds (15 attempts at 100ms intervals) to reliably detect the extension in both React and core contexts
33
+
8
34
  ## [0.5.2] - 2025-02-05
9
35
 
10
36
  ### Added
@@ -226,6 +252,8 @@ function Profile({ pubkey }) {
226
252
  - TypeScript support with full type definitions
227
253
  - Error classes: `WoTError`, `NetworkError`, `NotFoundError`, `TimeoutError`, `ValidationError`
228
254
 
255
+ [0.6.0]: https://github.com/nostr-wot/nostr-wot-sdk/compare/v0.5.3...v0.6.0
256
+ [0.5.3]: https://github.com/nostr-wot/nostr-wot-sdk/compare/v0.5.2...v0.5.3
229
257
  [0.5.2]: https://github.com/nostr-wot/nostr-wot-sdk/compare/v0.5.1...v0.5.2
230
258
  [0.5.1]: https://github.com/nostr-wot/nostr-wot-sdk/compare/v0.5.0...v0.5.1
231
259
  [0.5.0]: https://github.com/nostr-wot/nostr-wot-sdk/compare/v0.4.2...v0.5.0
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # nostr-wot-sdk
2
2
 
3
- JavaScript/TypeScript SDK for querying Nostr Web of Trust.
3
+ JavaScript/TypeScript SDK for querying Nostr Web of Trust. Includes first-class React and SolidJS support.
4
4
 
5
5
  ## Install
6
6
  ```bash
@@ -366,6 +366,83 @@ const {
366
366
  } = useExtension();
367
367
  ```
368
368
 
369
+ ### SolidJS
370
+
371
+ The SDK also provides SolidJS support with reactive primitives and automatic extension detection. Wrap your app with `WoTProvider` and use `create*` primitives for fine-grained reactivity.
372
+
373
+ ```javascript
374
+ import { WoTProvider, useExtension, createWoT } from 'nostr-wot-sdk/solid';
375
+
376
+ // Wrap your app - automatically detects extension
377
+ function App() {
378
+ return (
379
+ <WoTProvider>
380
+ <YourApp />
381
+ </WoTProvider>
382
+ );
383
+ }
384
+
385
+ // Check extension status anywhere
386
+ function ExtensionStatus() {
387
+ const ext = useExtension();
388
+
389
+ return (
390
+ <Show when={!ext.isChecking()} fallback={<span>Checking...</span>}>
391
+ <Show when={ext.isConnected()} fallback={<span>Extension not available</span>}>
392
+ <span>Extension connected!</span>
393
+ </Show>
394
+ </Show>
395
+ );
396
+ }
397
+
398
+ // Use WoT data in components
399
+ function Profile(props: { pubkey: string }) {
400
+ const wot = createWoT(() => props.pubkey);
401
+
402
+ return (
403
+ <Show when={!wot.loading()} fallback={<Spinner />}>
404
+ <Show when={wot.distance() !== null} fallback={<span>Not in your network</span>}>
405
+ <span>{wot.distance()} hops away (score: {wot.score().toFixed(2)})</span>
406
+ </Show>
407
+ </Show>
408
+ );
409
+ }
410
+ ```
411
+
412
+ #### Provider Options
413
+
414
+ ```javascript
415
+ // With fallback for when extension is not available
416
+ <WoTProvider options={{
417
+ fallback: { myPubkey: 'abc123...' }
418
+ }}>
419
+ ```
420
+
421
+ #### Available Primitives
422
+
423
+ | Primitive | Description |
424
+ |-----------|-------------|
425
+ | `createWoT(pubkey)` | Get distance, score, and details for a pubkey |
426
+ | `createIsInWoT(pubkey)` | Check if pubkey is in your WoT (boolean) |
427
+ | `createTrustScore(pubkey)` | Get trust score only |
428
+ | `createBatchWoT(pubkeys[])` | Check multiple pubkeys efficiently |
429
+ | `useExtension()` | Get extension connection state |
430
+ | `useWoTInstance()` | Get raw WoT instance for advanced usage |
431
+
432
+ #### Extension State
433
+
434
+ The `useExtension()` function provides extension status:
435
+
436
+ ```javascript
437
+ const ext = useExtension();
438
+
439
+ ext.state() // 'checking' | 'connected' | 'not-available'
440
+ ext.isConnected() // Extension is connected and ready
441
+ ext.isChecking() // Currently checking
442
+ ext.isChecked() // Check complete
443
+ ext.refresh() // Function to re-check extension availability
444
+ ```
445
+
369
446
  ## TypeScript
370
447
 
371
448
  Full type definitions included: