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

@thru/wallet-store

v0.2.7

Published

Browser-side IndexedDB storage layer for the Thru wallet. Provides typed helpers for persisting accounts, connected dApps, and passkey profiles in a single unified database. Replaces the legacy `@thru/indexed-db-stamper` package.

Downloads

575

Readme

@thru/wallet-store

Browser-side IndexedDB storage layer for the Thru wallet. Provides typed helpers for persisting accounts, connected dApps, and passkey profiles in a single unified database. Replaces the legacy @thru/indexed-db-stamper package.

Installation

pnpm add @thru/wallet-store

Basic Usage

import {
  AccountStorage,
  ConnectedAppsStorage,
  loadPasskeyProfiles,
  savePasskeyProfiles,
} from '@thru/wallet-store';

// Save and retrieve accounts
await AccountStorage.saveAccount({
  index: 0,
  label: 'Main',
  publicKey: '...',
  path: "m/44'/501'/0'/0'",
  createdAt: new Date(),
});
const accounts = await AccountStorage.getAccounts();

// Track connected dApps per account
await ConnectedAppsStorage.upsert({
  accountId: 0,
  appId: 'my-dapp',
  origin: 'https://my-dapp.example',
  metadata: { name: 'My dApp', icon: '...' },
});
const apps = await ConnectedAppsStorage.listByAccount(0);

// Manage passkey profiles
const store = await loadPasskeyProfiles();
if (store) {
  await savePasskeyProfiles(store);
}

Key Capabilities

  • Single shared IndexedDB database (thru-wallet v1) with lazy singleton connection
  • AccountStorage -- CRUD for HD-derived account metadata (does not store private keys)
  • ConnectedAppsStorage -- track which dApps are authorized per account, with upsert and indexed lookups
  • Passkey profiles -- load, save, create, and update WebAuthn passkey profiles with built-in schema migration support
  • Pure in-memory transform helpers (updateProfilePasskey, updatePasskeyLastUsed) that separate mutation from persistence
  • SSR-safe: passkey helpers return null / false when window is undefined

Database Schema

The package opens a single IndexedDB database named thru-wallet at version 1 with three object stores:

| Store | Key | Indexes | Purpose | |---|---|---|---| | accounts | index | by-created | HD wallet account metadata | | connectedApps | accountId:appId | by-account, by-updated | Authorized dApp connections | | passkeyProfiles | id | -- | WebAuthn passkey profiles and settings |

Access the raw database connection when needed:

import { getUnifiedDB } from '@thru/wallet-store';

const db = await getUnifiedDB();

API Reference

AccountStorage

| Method | Description | |---|---| | saveAccount(account) | Insert or update an account record | | getAccounts() | List all accounts sorted by index | | getAccount(index) | Fetch a single account by its BIP-44 index | | updateAccountLabel(index, label) | Rename an account | | getNextAccountIndex() | Return the next unused account index | | hasAccounts() | Check whether any accounts exist | | getAccountCount() | Return total account count | | clearAccounts() | Delete all account records |

ConnectedAppsStorage

| Method | Description | |---|---| | upsert(app) | Insert or update a connected app record | | listByAccount(accountId) | List apps for an account, most recently updated first | | get(accountId, appId) | Fetch a single connection record | | remove(accountId, appId) | Delete a connection | | clear() | Delete all connected app records |

Passkey Profiles

| Function | Description | |---|---| | loadPasskeyProfiles() | Load all profiles and settings from IndexedDB | | savePasskeyProfiles(store) | Persist the full profile store (replaces all records) | | createDefaultProfileStore() | Create an in-memory store with one empty default profile | | updateProfilePasskey(store, index, passkey) | Pure transform: attach passkey metadata to a profile | | updatePasskeyLastUsed(store, index) | Pure transform: bump lastUsedAt timestamp |

Dependencies

  • idb -- Promise-based IndexedDB wrapper
  • @thru/chain-interfaces -- shared type definitions