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

@droplinked_inc/web3-kit

v2.0.0

Published

Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original [email protected].

Readme

@droplinked_inc/web3-kit

Higher-level web3 building blocks for the Droplinked frontend stack: a frozen chain registry, a hard-coded known-token registry, decimal-safe display formatters, and viem-backed transaction builders.

This is a hardened rebuild of the original [email protected]. See THREAT_MODEL.md for the security deltas.

Status

Initial rebuild. Stable surface; coverage 96.81% statements / 96.87% branches.

Install

pnpm add @droplinked_inc/web3-kit @droplinked_inc/wallet-connection

@droplinked_inc/wallet-connection is a peer dependency — this kit does not reimplement EIP-1193 provider discovery, EIP-712 login signing, session storage, or wallet-protocol logic. Those primitives live in @droplinked_inc/wallet-connection.

Modules

| Module | Surface | | ------------- | ----------------------------------------------------------------------------- | | chains | chains, getChainByName, getChainDetails, isRpcUrlAllowed, getTransactionLink | | tokens | TOKEN_REGISTRY, getTokenInfo, hasToken, listTokens, assertCanonicalTokenAddress | | format | formatAmount, parseAmount, formatEther, parseEther, shortenAddress, escapeTokenDisplay, formatBalance | | tx-builder | buildErc20Transfer, buildErc20Approve, buildNativeTransfer, buildEip712Domain | | types | Chains, Network, Groups, PaymentTokens, zod schemas | | errors | typed exception hierarchy mirroring v1.0.13 |

Quick examples

Look up a chain and a token

import { Chains, Network, getChainDetails, getTokenInfo } from '@droplinked_inc/web3-kit';

const polygon = getChainDetails(Chains.POLYGON, Network.MAINNET);
// polygon.chainIdNumber === 137

const usdc = getTokenInfo(Chains.POLYGON, Network.MAINNET, 'USDC');
// usdc.address === '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359'

Reject a spoofed token address

import { assertCanonicalTokenAddress, TokenAddressMismatchError } from '@droplinked_inc/web3-kit';

try {
  assertCanonicalTokenAddress({
    chain: Chains.POLYGON,
    network: Network.MAINNET,
    symbol: 'USDC',
    claimedAddress: backendResponse.usdcAddress, // attacker-controlled
  });
} catch (err) {
  if (err instanceof TokenAddressMismatchError) {
    // refuse the checkout — your backend lied about what address USDC has
  }
}

Build an ERC-20 transfer

import { buildErc20Transfer, parseAmount } from '@droplinked_inc/web3-kit';

const call = buildErc20Transfer({
  chain: Chains.POLYGON,
  network: Network.MAINNET,
  tokenSymbol: 'USDC',
  to: recipient,
  amount: parseAmount('1.5', 6),
});
// call.to       === USDC contract on Polygon
// call.data     === 0x...a9059cbb… (transfer(address,uint256))
// call.value    === 0n
// call.chainIdNumber === 137

Then hand call to a wallet connector from @droplinked_inc/wallet-connection to actually broadcast it.

Format balances safely

import { formatBalance, escapeTokenDisplay } from '@droplinked_inc/web3-kit';

formatBalance({ value: 1_999_999n, decimals: 6, displayDecimals: 2 });
// "1.99"  — truncated, never rounded up. The user can't be shown more than they hold.

escapeTokenDisplay(maliciousTokenName);
// HTML-escaped, control-char-stripped, bidi-override-stripped, length-capped.

Security model

See THREAT_MODEL.md. Highlights:

  • The chain registry and the known-token registry are frozen at package build time. No remote fetches, no backend-driven addresses.
  • Caller-supplied token addresses for known symbols (USDC, USDT, DAI, WETH, USDS) are validated against the registry — passing any other address as e.g. "USDC" throws TokenAddressMismatchError.
  • All amounts are bigint. parseAmount rejects inputs with more fractional digits than the token allows, preventing silent truncation that could let a UI display "1.234 USDC" but submit "1.23 USDC".
  • escapeTokenDisplay strips ASCII control chars, Unicode bidi-override chars, and HTML metachars before any on-chain string reaches a UI.
  • RPC URLs passed by callers are validated against the registry via isRpcUrlAllowed (https-only, exact host+path match).
  • Transaction-hash inputs to getTransactionLink are regex-validated to block javascript: open-redirect payloads.

License

MIT — see LICENSE.