Registry / storage / coco-cashu-sqlite-bun

coco-cashu-sqlite-bun

JSON →
library1.1.2-rc.50jsnpmunverified

SQLite adapter for coco-cashu cashu wallet library, leveraging Bun's built-in `bun:sqlite` module instead of `better-sqlite3`. Current stable version is 1.1.2-rc.50 (release candidate). Designed exclusively for Bun runtime, eliminates external SQLite dependencies. Released as part of the coco-cashu ecosystem (GitHub: cashubtc/coco). Key differentiator: zero native module installation needed on Bun, using `bun:sqlite` which is directly integrated. Requires peer dependency `coco-cashu-core` and TypeScript 5+.

npm install coco-cashu-sqlite-bun
INSTALL
IMPORT
SIG · COCO-CASHU-SQLITE-
C
coco-cashu-sqlite-bun
storagejavascriptv1.1.2-rc.50
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SqliteRepositories
import { SqliteRepositories } from 'coco-cashu-sqlite-bun'
import SqliteRepositories from 'coco-cashu-sqlite-bun'
Named export, not default. ESM-only; no CommonJS support.
Database (bun:sqlite)
import { Database } from 'bun:sqlite'
const Database = require('bun:sqlite')
`bun:sqlite` is a built-in Bun module; cannot be required via CommonJS. Always use ESM import.
SqliteRepository
import type { SqliteRepository } from 'coco-cashu-sqlite-bun'
import { SqliteRepository } from 'coco-cashu-sqlite-bun'
This is a type export, not a runtime value. Use `import type` to avoid bundling issues.

Initialize an in-memory SQLite database with coco-cashu repositories, then create a mint record using the repository.

import { SqliteRepositories } from 'coco-cashu-sqlite-bun'; import { Database } from 'bun:sqlite'; const database = new Database(':memory:'); const repositories = new SqliteRepositories({ database }); await repositories.init(); // Example: create a mint const mint = await repositories.mint.create('MyMint', 'http://localhost:3338'); console.log(mint);
Debug
Known issues
breakingRequires Bun runtime; does not work with Node.js or Deno.
fix
Use `coco-cashu-sqlite3` for Node.js, or run with Bun installed.
affects: >=1.0.0
gotchaThe `init()` method is async and must be awaited before using repositories.
fix
Always `await repositories.init()` after instantiation.
affects: all
deprecatedConstructor signature changed in v1.1.0: now expects an object with `database` property instead of direct database instance.
fix
Use `new SqliteRepositories({ database })` instead of `new SqliteRepositories(database)`.
affects: <1.1.0
gotchaDatabase path must be writable; `:memory:` works but data is lost on close.
fix
Specify a file path for persistent storage.
affects: all
Errors
Common errors & fixes
Bindings not found. Check your bun version.
Bun version too old or `bun:sqlite` not supported.
fix
Update Bun to at least 1.0.0 with `bun upgrade`.
Cannot find module 'coco-cashu-core'
Missing peer dependency `coco-cashu-core`.
fix
npm install coco-cashu-core
TypeError: repositories.init is not a function
Trying to call `init()` before resolving import, or old version where init didn't exist.
fix
Ensure you import `{ SqliteRepositories }` correctly and your version is >=1.1.0.
Upgrade
Version history
1.1.2-rc.50latest on npm
Audit
Dependencies
coco-cashu-corerequiredCore library providing wallet logic and interfaces; this adapter implements its repository interfaces for SQLite.
bunrequiredRuntime dependency: uses `bun:sqlite` built-in module; not installable via npm, but required to run.
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
1
Resources
coco-cashu-sqlite-bun — npm install coco-cashu-sqlite-bun · libregistry