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

@openacid/adapter-viem

v0.2.2

Published

viem-backed ChainAdapter and SignerAdapter for @openacid/acid — works with any EVM (Base, Unichain, 0G Galileo, mainnet).

Readme

@openacid/adapter-viem

Chain-aware adapters for @openacid/acid, built on viem.

Two adapters wired against viem's primitives, ready for any EVM chain (Base, Unichain, 0G Galileo, mainnet — anywhere viem connects):

  • ViemChainAdapterChainAdapter over a PublicClient. Surfaces tx status (pending / mined / finalized / replaced / failed), waits for finality at a configurable confirmation depth, looks up txs by (address, nonce) for replacement detection.
  • ViemSignerSignerAdapter that signs raw 32-byte digests with secp256k1 via viem/accounts. Pair with receipted() to produce verifiable EIP-712 receipts.

Install

npm i @openacid/adapter-viem @openacid/acid viem

Usage

Signer

import { ViemSigner } from '@openacid/adapter-viem'
import { receipted } from '@openacid/acid'

const signer = new ViemSigner({
  privateKey: process.env.EVM_PRIVATE_KEY as `0x${string}`,
})

const action = receipted({
  storage,
  signer,
  chain: { chainId: 84532 },   // EIP-712 domain matches your target chain
  fnName: 'rebalance',
})(saga)

Chain adapter

import { createPublicClient, http } from 'viem'
import { baseSepolia } from 'viem/chains'
import { ViemChainAdapter } from '@openacid/adapter-viem'

const client = createPublicClient({ chain: baseSepolia, transport: http() })
const chain = new ViemChainAdapter({ client })

await chain.getBlockNumber()                              // → number
await chain.getTxByHash('0x...')                          // → 'mined' | 'finalized' | ...
await chain.getTxByNonce('0xabc...', 42)                  // → 'mined' | 'pending' | 'replaced' | null
await chain.waitForFinality('0x...', 1)                   // → 'finalized'

Crash-safe broadcasting

Combine with chainAwareBroadcast from @openacid/acid to make a tx broadcast survive a crash mid-broadcast — on restart, the helper queries the chain for the prior tx and waits for it instead of re-broadcasting:

import { chainAwareBroadcast } from '@openacid/acid'

const out = await chainAwareBroadcast(
  { storage, chain, trackKey: `swap:${args.id}:tx`, confirmations: 1 },
  async () => walletClient.writeContract({ ... }),    // returns hash
)

if (out.reused) {
  // a previous run already broadcast; we just waited for finality.
}

Tested against

  • Base Sepolia (chainId 84532) — live integration tests in this repo's CI
  • 0G Galileo (chainId 16602) — receipts target this chain via the receipted() domain
  • Any EVM viem supports — mainnet, arbitrum, optimism, etc.

API

ViemChainAdapter

new ViemChainAdapter({
  client: PublicClient,            // any viem PublicClient
  chainId?: number,                // override the client's chain id
  defaultPollIntervalMs?: number,  // for waitForFinality; default 2000
  defaultTimeoutMs?: number,       // for waitForFinality; default 120000
})

Replacement-tx detection: when a user bumps gas, the original tx is replaced — getTxByHash(originalHash) returns 'replaced', and getTxByNonce(address, nonce) will find the new one. Surface this and never re-broadcast on 'replaced'.

ViemSigner

new ViemSigner({
  privateKey: '0x...',             // 32-byte hex private key
})

signer.identity            // → 0x address derived from the key
await signer.publicKey()   // → same address
await signer.sign(digest)  // → 65-byte serialized signature

The signature recovers to identity via verifyReceipt(receipt, signer.identity, domain) from @openacid/acid, and on-chain via ecrecover(digest, v, r, s) in your own contracts.

License

MIT — part of the openacid library.