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

@solana/web3-compat

v0.0.21

Published

Compatibility layer that preserves the web3.js API while delegating to Kit primitives under the hood

Downloads

1,032

Readme

@solana/web3-compat

Phase 0 of a backwards‑compatible surface that lets existing @solana/web3.js code run on top of Kit primitives.

This package is designed to help migrate from web3.js to Kit.

The goal of this release is zero breaking changes for applications that only touch the subset of web3.js APIs listed below. There will be future releases that slowly implement breaking changes as they move over to Kit primitives and intuitions.

Migrating from @solana/web3.js

The migration process is straightforward and can be done incrementally:

Install the compatibility package

pnpm add @solana/web3-compat

Make sure you also have the required Kit peer dependencies:

pnpm add @solana/kit @solana/client

Update your imports

Replace your web3.js imports with the compatibility layer. Both import styles are supported:

Named imports (TypeScript/ES6 style)

Before:

import {
  Connection,
  Keypair,
  PublicKey,
  SystemProgram,
  Transaction,
  sendAndConfirmTransaction,
} from "@solana/web3.js";

After:

import {
  Connection,
  Keypair,
  PublicKey,
  SystemProgram,
  Transaction,
  sendAndConfirmTransaction,
} from "@solana/web3-compat";

Namespace imports

Before:

const solanaWeb3 = require("@solana/web3.js");
const connection = new solanaWeb3.Connection(
  "https://api.mainnet-beta.solana.com"
);

After:

const solanaWeb3 = require("@solana/web3-compat");
const connection = new solanaWeb3.Connection(
  "https://api.mainnet-beta.solana.com"
);

Or with ES6 modules:

import * as solanaWeb3 from "@solana/web3-compat";

(Optional): Leverage Kit features

You can gradually adopt Kit primitives alongside the compatibility layer using bridge helpers:

import { toAddress, toPublicKey, toKitSigner } from "@solana/web3-compat";

// Convert between web3.js and Kit types
const web3PublicKey = new PublicKey("11111111111111111111111111111111");
const kitAddress = toAddress(web3PublicKey);

// Convert back if needed
const backToWeb3 = toPublicKey(kitAddress);

Migration checklist

  • [ ] Install @solana/web3-compat and Kit dependencies
  • [ ] Update import statements from @solana/web3.js to @solana/web3-compat
  • [ ] Test your application
  • [ ] Keep legacy @solana/web3.js for any unimplemented methods (see limitations below)

Implemented in Phase 0

  • Connection backed by Kit with support for:
    • getLatestBlockhash
    • getBalance
    • getAccountInfo
    • getProgramAccounts
    • getSignatureStatuses
    • sendRawTransaction
    • confirmTransaction
    • simulateTransaction
  • Bridge helpers re-exported from @solana/compat:
    • toAddress, toPublicKey, toWeb3Instruction, toKitSigner
  • Programs:
    • SystemProgram.transfer (manual u8/u64 little‑endian encoding)
  • Utilities:
    • LAMPORTS_PER_SOL
    • compileFromCompat
    • sendAndConfirmTransaction
  • Re‑exports of all Web3 primitives (PublicKey, Keypair, Transaction, VersionedTransaction, TransactionInstruction, etc)

Running package locally

Building the package

# Build TypeScript definitions
pnpm --filter @solana/web3-compat build

# Or build components separately
pnpm --filter @solana/web3-compat compile:js
pnpm --filter @solana/web3-compat compile:typedefs

Running tests

# Run all tests
pnpm --filter @solana/web3-compat test

Known limitations & edge cases

Phase 0 does not fully replace web3.js. Notable gaps:

  • Only the Connection methods listed above are implemented. Any other Web3 call (e.g. getTransaction, subscriptions, requestAirdrop) still needs the legacy connection for now
  • getProgramAccounts currently returns just the value array even when withContext: true is supplied
  • Account data is decoded from base64 only. Other encodings such as jsonParsed or base64+zstd are passed through to Kit but not post‑processed
  • Numeric fields are coerced to JavaScript numbers to match Web3 behaviour, which means values above Number.MAX_SAFE_INTEGER will lose precision (which is how it currently works)
  • The compatibility layer does not yet try to normalise websocket connection options or retry policies that web3.js exposes

Future phases will expand coverage and introduce intentional breaking changes once users have an easy migration path.

More resources