npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@txfence/storage-sqlite

v0.1.2

Published

SQLite receipt storage backend for txfence. No database server required — ideal for local development and single-process environments.

Readme

@txfence/storage-sqlite

SQLite receipt storage backend for txfence. Ideal for local development and single-process staging environments — no database server required.

Installation

pnpm add @txfence/storage-sqlite better-sqlite3

Usage

import Database from 'better-sqlite3'
import { initSchema, createSqliteReceiptStore } from '@txfence/storage-sqlite'
import { createAgent } from '@txfence/core'

const db = new Database('./receipts.db')

// Run once at startup — idempotent, safe to call on every deploy
initSchema(db)

const receiptStore = createSqliteReceiptStore(db)

// Pass to createAgent or runPipeline
const agent = createAgent(config, adapters, rpcUrls, executor, undefined, undefined, undefined, receiptStore)

In-memory database (for tests)

const db = new Database(':memory:')
initSchema(db)
const store = createSqliteReceiptStore(db)

Custom table name

initSchema(db, { tableName: 'my_receipts' })
const store = createSqliteReceiptStore(db, { tableName: 'my_receipts' })

Table schema

CREATE TABLE IF NOT EXISTS txfence_receipts (
  tx_hash             TEXT PRIMARY KEY,
  chain               TEXT NOT NULL,
  action              TEXT NOT NULL,       -- JSON
  policy_eval         TEXT NOT NULL,       -- JSON
  simulation          TEXT NOT NULL,       -- JSON
  confirmed_at_block  INTEGER NOT NULL,
  confirmed_at_ms     INTEGER NOT NULL,
  gas_used            TEXT NOT NULL,       -- decimal string (bigint safe)
  created_at          TEXT DEFAULT (datetime('now'))
);

Indexes are created on chain and confirmed_at_block to support the filter parameters on list().

gas_used and bigint fields within JSON columns are stored as decimal strings to avoid JavaScript bigint precision loss. They are revived to bigint on read.

Synchronous API

better-sqlite3 is synchronous — no connection pool, no async setup:

const db = new Database('./receipts.db')
initSchema(db)
// db is ready to use immediately

The ReceiptStore interface methods return Promise to satisfy the interface contract, but the underlying SQLite calls are synchronous.

SQLite vs PostgreSQL

| | @txfence/storage-sqlite | @txfence/storage-pg | |---|---|---| | Setup | Zero — file or :memory: | Requires a running PostgreSQL server | | Concurrency | Single-process only | Multi-process safe | | Use case | Local dev, single-process staging | Production multi-process deployments | | Dependency | better-sqlite3 (native) | pg |