open-index/open-npm huggingface dataset:
npm package: @nostorykingdom/concurrent-task
Description: Run multiple async tasks with limited concurrency
Author: Robert
Latest version: 1.0.0

# concurrentTask
`concurrentTask` returns a task excution function which has a concurrency limit. U can call the task excution function at anywhere in ur code repo to excute a task, and each call will get a promise returned, while the task excution concurrency is limited.

## Usage

```
$ npm install @nostroykingdom/concurrent-task
```

```js
import concurrentTask from '@nostorykingdom/concurrent-task';

const task = ([arg, ms]) => new Promise(resolve => setTimeout(() => resolve(arg), ms));

const run = concurrentTask(2, task);

run(['task1', 500]).then(console.log);
run(['task2', 1000]).then(console.log);
run(['task3', 500]).then(console.log);

// result
// task1 start
// task2 start
// 500ms later
// task1 done 
// task3 start
// console task1
// 500ms later
// task2 done
// console task2
// task3 done
// console task3

```

## License

MIT
npm package: @nostr-binding/sdk
Description: sdk for nostr-binding protocol
Latest version: 0.1.0-rc10

# SDK for Nostr binding protocol

## Install

```bash
npm install @nostr-binding/sdk
```

## Usage

```ts
import { NostrBindingSDK, TESTNET_CONFIGS } from '@nostr-binding/sdk';
const sdk = new NostrBindingSDK(TESTNET_CONFIGS);
const nostrPublicKey = '0x45c41f21e1cf715fa6d9ca20b8e002a574db7bb49e96ee89834c66dac5446b7a';
const nostrLockScript = sdk.lock.buildScript(nostrPublicKey);
const ckbAddress = sdk.lock.encodeToCKBAddress(nostrPublicKey);

//**** Signed a nostr-lock input transaction ****//

// construct a nostr signer first
const signer = async (event: EventToSign) => {
  //...nostr signing event code
  const signedEvent: SignedEvent = //...
  return signedEvent;
};
// sdk.lock.signTx will overwrite the witness lock with dummyLock and then generate sigHashAll,
// sign it and return signed transaction. It is a easy way to do nostr lock signing if
// transaction fee estimation is not a problem to you. After calling this function, witness
// is auto-filled with signedEvent.
tx = await sdk.lock.signTx(tx, signer);

// or prepare your transaction first
import { createTransactionFromSkeleton } from "@ckb-lumos/lumos/helpers";
const tx = createTransactionFromSkeleton(txSkeleton);
// fill-in the witness of nostr-lock with corresponding dummyLock
const {transaction, lockIndexes} = await sdk.lock.prepareTx(transaction: Transaction);
// sdk.lock.signPreparedTx will checks if the transaction is placed with correct Nostr-lock dummyLock
// and then directly generate sigHashAll from the giving transaction, sign it and return
// signed transaction. You need to call prepareTx before this function.
const signedTx = await sdk.lock.signPreparedTx(transaction, lockIndexes, signer);


//**** Get Nostr Scripts CellDeps ****//
const lockCellDeps = await sdk.lock.buildCellDeps();
const bindingCellDeps = await sdk.binding.buildCellDeps();
```
npm package: @nostr-dev-kit/cache-dexie
Description: NDK Dexie Cache Adapter
Latest version: 2.7.8

# cache-dexie

NDK cache adapter for [Dexie](https://dexie.org/). Dexie is a wrapper around IndexedDB, an in-browser database.

## Usage

NDK will attempt to use the Dexie adapter to store users, events, and tags. The default behaviour is to always check the cache first and then hit relays, replacing older cached events as needed.

### Install

```
pnpm add @nostr-dev-kit/cache-dexie
```

### Add as a cache adapter

```ts
import NDKCacheAdapterDexie from "@nostr-dev-kit/cache-dexie";

const dexieAdapter = new NDKCacheAdapterDexie({ dbName: 'your-db-name' });
const ndk = new NDK({cacheAdapter: dexieAdapter, ...other config options});
```

🚨 Because Dexie only exists client-side, this cache adapter will not work in pure node.js environments. You'll need to make sure that you're using the right cache adapter in the right place (e.g. Redis on the backend, Dexie on the frontend).

# License

MIT
npm package: @nostr-dev-kit/cache-memory
Description: NDK In-Memory LRU Cache Adapter
Latest version: 2.7.8

# NDK Memory Cache Adapter

A fast in-memory LRU cache adapter for NDK (Nostr Development Kit).

## Features

- **LRU Eviction**: Uses Least Recently Used algorithm to manage memory efficiently
- **Fast Queries**: Synchronous cache lookups with `locking: true`
- **Configurable Size**: Customize maximum cache sizes for events and profiles
- **Complete Implementation**: Supports all NDKCacheAdapter methods including:
  - Event caching and querying
  - Profile management
  - NIP-05 verification caching
  - LNURL document caching
  - Relay status tracking
  - Unpublished event tracking
  - Decrypted event storage
  - Nutzap state management
  - Cashu mint info/keys caching

## Installation

```bash
npm install @nostr-dev-kit/cache-memory
# or
yarn add @nostr-dev-kit/cache-memory
# or
pnpm add @nostr-dev-kit/cache-memory
# or
bun add @nostr-dev-kit/cache-memory
```

## Usage

```typescript
import NDK from "@nostr-dev-kit/ndk";
import NDKMemoryCacheAdapter from "@nostr-dev-kit/cache-memory";

const ndk = new NDK({
    cacheAdapter: new NDKMemoryCacheAdapter({
        maxSize: 5000,        // Max events to cache (default: 5000)
        profileMaxSize: 1000  // Max profiles to cache (default: 1000)
    })
});

await ndk.connect();
```

## Configuration Options

- `maxSize` (optional): Maximum number of events to cache. Default: 5000
- `profileMaxSize` (optional): Maximum number of profiles to cache. Default: 1000

## Performance

This adapter is designed for speed:
- Synchronous queries (no async overhead)
- LRU eviction ensures most frequently accessed data stays in cache
- Efficient memory usage with configurable limits

## When to Use

The memory cache adapter is ideal for:
- Client applications where fast access is critical
- Short-lived sessions
- Applications with predictable memory constraints
- Development and testing

For persistent caching across sessions, consider:
- `@nostr-dev-kit/cache-dexie` (IndexedDB)
- `@nostr-dev-kit/cache-sqlite` (SQLite)

## License

MIT
npm package: @nostr-dev-kit/cache-nostr
Description: NDK cache adapter that uses a local nostr relay.
Author: pablof7z
Latest version: 0.1.66

# cache-nostr

NDK cache adapter using a nostr relay as the database.

This cache adapter is meant to be run against a local relay. This adapter will generate two NDK instances:

`ndk` -- This talks exclusively to the local relay, with outbox model disabled.
`fallbackNdk` -- This is used to hydrate the cache and uses the outbox model -- each query the cache receives is placed in a queue in the background so that subsequent requests can be served from the cache. All events from other relays

## Usage

### Install

```
npm add @nostr-dev-kit/cache-nostr

```

### Add as a cache adapter

```ts
import NDKCacheAdapterNostr from "@nostr-dev-kit/cache-nostr";

const cacheAdapter = new NDKCacheAdapterNostr({
    relayUrl: "ws://localhost:5577",
});
const ndk = new NDK({ cacheAdapter });
```

If running server-side in a NodeJS environment, you should make sure to polyfill `WebSocket`.

# License

MIT
npm package: @nostr-dev-kit/cache-redis
Description: NDK Redis Cache Adapter
Latest version: 0.1.52

# cache-redis

NDK cache adapter for redis.

This cache is mostly a skeleton; the cache hit logic is very basic and only checks if
a query is using precisely `kinds` and `authors` filtering.

## Usage

### Install

```
npm add @nostr-dev-kit/cache-redis
```

### Add as a cache adapter

```ts
import NDKRedisCacheAdapter from "@nostr-dev-kit/cache-redis";

const cacheAdapter = new NDKRedisCacheAdapter();
const ndk = new NDK({ cacheAdapter });
```

# License

MIT
npm package: @nostr-dev-kit/cache-sqlite
Description: SQLite cache adapter for NDK using better-sqlite3, compatible with Node.js environments.
Author: Nostr Dev Kit Contributors
Latest version: 8.0.0

# NDK Cache SQLite

SQLite cache adapter for NDK using better-sqlite3, compatible with Node.js environments.

## Features

- **Node.js Compatible**: Uses better-sqlite3 for native Node.js SQLite support
- **Schema Compatibility**: Uses the same database schema as cache-sqlite-wasm for easy migration
- **High Performance**: Leverages better-sqlite3's synchronous API for optimal performance
- **Full NDK Integration**: Implements the complete NDKCacheAdapter interface
- **TypeScript Support**: Full TypeScript definitions included

## Installation

```bash
npm install @nostr-dev-kit/cache-sqlite
# or
yarn add @nostr-dev-kit/cache-sqlite
# or
bun add @nostr-dev-kit/cache-sqlite
```

## Usage

```typescript
import NDK from '@nostr-dev-kit/ndk';
import { NDKCacheAdapterSqlite } from '@nostr-dev-kit/cache-sqlite';

const cache = new NDKCacheAdapterSqlite({
  dbPath: './ndk-cache.db', // Optional: custom database path
  dbName: 'ndk-cache'       // Optional: database name (used if dbPath not provided)
});

const ndk = new NDK({
  cacheAdapter: cache,
  // ... other NDK options
});

// Initialize the cache adapter
await cache.initializeAsync(ndk);
await ndk.connect();
```

## Configuration Options

```typescript
interface NDKCacheAdapterSqliteOptions {
  dbPath?: string;  // Custom path to SQLite database file
  dbName?: string;  // Database name (default: 'ndk-cache')
}
```

## Database Schema

The adapter uses the same schema as cache-sqlite-wasm:

- `events` - Stores Nostr events
- `profiles` - Stores user profiles
- `decrypted_events` - Stores decrypted events
- `unpublished_events` - Tracks unpublished events
- `event_tags` - Indexes event tags for fast queries
- `relay_status` - Tracks relay connection status
- `nutzap_monitor_state` - Stores nutzap monitoring state

## Compatibility

This package is designed to be a drop-in replacement for cache-sqlite-wasm in Node.js environments. The database schema is identical, allowing for easy migration between the two adapters.

## Development

```bash
# Install dependencies
bun install

# Run tests
bun test

# Build the package
bun run build
```

## License

MIT
npm package: @nostr-dev-kit/cache-upstash
Description: NDK Upstash REST Cache Adapter
Latest version: 0.1.3

# cache-upstash

NDK cache adapter for Upstash Redis over REST.

This adapter is designed for serverless and edge-friendly deployments. It only
indexes exact filter shapes that are safe and predictable for SSR cache hits:

- `ids`
- `kinds + authors`
- `kinds + authors + #d`

Unsupported filters are treated as cache misses.

## Install

```bash
npm add @nostr-dev-kit/cache-upstash
```

## Usage

```ts
import NDK from "@nostr-dev-kit/ndk";
import NDKCacheUpstashAdapter from "@nostr-dev-kit/cache-upstash";

const cacheAdapter = new NDKCacheUpstashAdapter({
  url: process.env.UPSTASH_REDIS_REST_URL,
  token: process.env.UPSTASH_REDIS_REST_TOKEN,
  namespace: "my-app:ssr:v1",
  expirationTime: 3600
});

const ndk = new NDK({ cacheAdapter });
```

You can also pass an existing `@upstash/redis` client via the `redis` option.

## License

MIT
npm package: @nostr-dev-kit/mobile
Description: NDK Mobile
Latest version: 0.9.3

# NDK Mobile

A React Native/Expo implementation of [NDK (Nostr Development Kit)](https://github.com/nostr-dev-kit/ndk) that provides a complete toolkit for building Nostr applications on mobile platforms.

## Features

- 🔐 Multiple signer implementations (NIP-07, NIP-46, Private Key)
- 💾 SQLite-based caching for offline support
- 🔄 Subscription management with automatic reconnection
- 📱 React Native and Expo compatibility
- 🪝 React hooks for easy state management
- 👛 Integrated wallet support

## Installation

npm install @nostr-dev-kit/mobile

## Usage

When using this library don't import `@nostr-dev-kit/ndk` directly, instead import `@nostr-dev-kit/mobile`. `@nostr-dev-kit/mobile` exports the same classes as `ndk`, so you can just swap the import.

## Example

There is a barebones repository showing how to use this library:
[ndk-mobile-sample](https://github.com/pablof7z/ndk-mobile-sample).

For a real application using this look at [Olas](https://github.com/pablof7z/snapstr).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Author

[@pablof7z](https://njump.me/f7z.io)
npm package: @nostr-dev-kit/ndk-cache-dexie
Description: NDK Dexie Cache Adapter
Latest version: 2.6.44

# ndk-cache-dexie

NDK cache adapter for [Dexie](https://dexie.org/). Dexie is a wrapper around IndexedDB, an in-browser database.

## Usage

NDK will attempt to use the Dexie adapter to store users, events, and tags. The default behaviour is to always check the cache first and then hit relays, replacing older cached events as needed.

### Install

```
pnpm add @nostr-dev-kit/ndk-cache-dexie
```

### Add as a cache adapter

```ts
import NDKCacheAdapterDexie from "@nostr-dev-kit/ndk-cache-dexie";

const dexieAdapter = new NDKCacheAdapterDexie({ dbName: 'your-db-name' });
const ndk = new NDK({cacheAdapter: dexieAdapter, ...other config options});
```

🚨 Because Dexie only exists client-side, this cache adapter will not work in pure node.js environments. You'll need to make sure that you're using the right cache adapter in the right place (e.g. Redis on the backend, Dexie on the frontend).

# License

MIT
npm package: @nostr-dev-kit/ndk-cache-nostr
Description: NDK cache adapter that uses a local nostr relay.
Author: pablof7z
Latest version: 0.1.55

# ndk-cache-nostr

NDK cache adapter using a nostr relay as the database.

This cache adapter is meant to be run against a local relay. This adapter will generate two NDK instances:

`ndk` -- This talks exclusively to the local relay, with outbox model disabled.
`fallbackNdk` -- This is used to hydrate the cache and uses the outbox model -- each query the cache receives is placed in a queue in the background so that subsequent requests can be served from the cache. All events from other relays

## Usage

### Install

```
npm add @nostr-dev-kit/ndk-cache-nostr

```

### Add as a cache adapter

```ts
import NDKCacheAdapterNostr from "@nostr-dev-kit/ndk-cache-nostr";

const cacheAdapter = new NDKCacheAdapterNostr({
    relayUrl: "ws://localhost:5577",
});
const ndk = new NDK({ cacheAdapter });
```

If running server-side in a NodeJS environment, you should make sure to polyfill `WebSocket`.

# License

MIT
npm package: @nostr-dev-kit/ndk-cache-redis
Description: NDK Redis Cache Adapter
Latest version: 0.1.41

# ndk-cache-redis

NDK cache adapter for redis.

This cache is mostly a skeleton; the cache hit logic is very basic and only checks if
a query is using precisely `kinds` and `authors` filtering.

## Usage

### Install

```
npm add @nostr-dev-kit/ndk-cache-redis
```

### Add as a cache adapter

```ts
import NDKRedisCacheAdapter from "@nostr-dev-kit/ndk-cache-redis";

const cacheAdapter = new NDKRedisCacheAdapter();
const ndk = new NDK({ cacheAdapter });
```

# License

MIT
npm package: @nostr-dev-kit/ndk-cache-sqlite
Description: SQLite cache adapter for NDK using better-sqlite3, compatible with Node.js environments.
Author: Nostr Dev Kit Contributors
Latest version: 3.0.0

# NDK Cache SQLite

SQLite cache adapter for NDK using better-sqlite3, compatible with Node.js environments.

## Features

- **Node.js Compatible**: Uses better-sqlite3 for native Node.js SQLite support
- **Schema Compatibility**: Uses the same database schema as ndk-cache-sqlite-wasm for easy migration
- **High Performance**: Leverages better-sqlite3's synchronous API for optimal performance
- **Full NDK Integration**: Implements the complete NDKCacheAdapter interface
- **TypeScript Support**: Full TypeScript definitions included

## Installation

```bash
npm install @nostr-dev-kit/ndk-cache-sqlite
# or
yarn add @nostr-dev-kit/ndk-cache-sqlite
# or
bun add @nostr-dev-kit/ndk-cache-sqlite
```

## Usage

```typescript
import NDK from '@nostr-dev-kit/ndk';
import { NDKCacheAdapterSqlite } from '@nostr-dev-kit/ndk-cache-sqlite';

const cache = new NDKCacheAdapterSqlite({
  dbPath: './ndk-cache.db', // Optional: custom database path
  dbName: 'ndk-cache'       // Optional: database name (used if dbPath not provided)
});

const ndk = new NDK({
  cacheAdapter: cache,
  // ... other NDK options
});

// Initialize the cache adapter
await cache.initializeAsync(ndk);
await ndk.connect();
```

## Configuration Options

```typescript
interface NDKCacheAdapterSqliteOptions {
  dbPath?: string;  // Custom path to SQLite database file
  dbName?: string;  // Database name (default: 'ndk-cache')
}
```

## Database Schema

The adapter uses the same schema as ndk-cache-sqlite-wasm:

- `events` - Stores Nostr events
- `profiles` - Stores user profiles
- `decrypted_events` - Stores decrypted events
- `unpublished_events` - Tracks unpublished events
- `event_tags` - Indexes event tags for fast queries
- `relay_status` - Tracks relay connection status
- `nutzap_monitor_state` - Stores nutzap monitoring state

## Compatibility

This package is designed to be a drop-in replacement for ndk-cache-sqlite-wasm in Node.js environments. The database schema is identical, allowing for easy migration between the two adapters.

## Development

```bash
# Install dependencies
bun install

# Run tests
bun test

# Build the package
bun run build
```

## License

MIT
npm package: @nostr-dev-kit/ndk-hooks
Description: React hooks for the Nostr Development Kit (NDK)
Author: _@f7z.io
Latest version: 1.3.4

# @nostr-dev-kit/ndk-hooks

> React hooks for the Nostr Development Kit (NDK)

## Overview

`@nostr-dev-kit/ndk-hooks` provides a set of React hooks and utilities to easily integrate Nostr functionality into your React applications using NDK. This library helps you efficiently manage Nostr data in your React components, including:

- NDK instance management with `useNDKInit` and `useNDK`
- Current user management with `useNDKCurrentUser`
- User resolution from various formats with `useUser`
- User profile management with `useProfileValue`
- Multi-user session management
- Event subscriptions with modern callback patterns

## Installation

```bash
# npm
npm install @nostr-dev-kit/ndk-hooks

# pnpm
pnpm add @nostr-dev-kit/ndk-hooks

# yarn
yarn add @nostr-dev-kit/ndk-hooks
```
npm package: @nostr-dev-kit/ndk-mobile
Description: NDK Mobile
Latest version: 0.8.43

# NDK Mobile

A React Native/Expo implementation of [NDK (Nostr Development Kit)](https://github.com/nostr-dev-kit/ndk) that provides a complete toolkit for building Nostr applications on mobile platforms.

## Features

- 🔐 Multiple signer implementations (NIP-07, NIP-46, Private Key)
- 💾 SQLite-based caching for offline support
- 🔄 Subscription management with automatic reconnection
- 📱 React Native and Expo compatibility
- 🪝 React hooks for easy state management
- 👛 Integrated wallet support

## Installation

npm install @nostr-dev-kit/ndk-mobile

## Usage

When using this library don't import `@nostr-dev-kit/ndk` directly, instead import `@nostr-dev-kit/ndk-mobile`. `ndk-mobile` exports the same classes as `ndk`, so you can just swap the import.

## Example

There is a barebones repository showing how to use this library:
[ndk-mobile-sample](https://github.com/pablof7z/ndk-mobile-sample).

For a real application using this look at [Olas](https://github.com/pablof7z/snapstr).

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Author

[@pablof7z](https://njump.me/f7z.io)