Back to Blog

Table of Contents

Highlights

Now Available: Solana JavaScript SDK 2.0

Written By

Anza Developers

November 7, 2024

Today we have dropped the Release Candidate label from @solana/web3.js v2.0.0. We now recommend it for general use.

Thank you

The Release Candidate program began in August. Developers from all across the industry, notably some from Tensor, Triton One, and Orca, gave the new library a workout, finding bugs and making suggestions as they went. The final release of 2.0.0 today is better for it, and we want to recognize those who joined us to play on the bleeding edge.

What changed?

The 2.0.0 line of @solana/web3.js offers a new API for interacting with Solana. Because it is incompatible with the API from version 1.x, we will delay making it the default (ie. giving it the npm tag latest) when you install it without specifying a version.

If you have authored developer content or shell scripts that automate the installation of @solana/web3.js you have two options:

  1. Port your software to the new v2.0 API

  2. Lock to v1.x by specifying the version explicitly (read how)

Here's how you can expect npm install to behave, going forward.

Before December 16, 2024:

npm install @solana/web3.js         # Installs v1.x
npm install @solana/web3.js@latest  # Installs v1.x
npm install @solana/web3.js@1       # Installs v1.x
npm install @solana/web3.js@2       # Installs v2.x

On December 16, 2024:

npm install @solana/web3.js         # Installs v2.x
npm install @solana/web3.js@latest  # Installs v2.x
npm install @solana/web3.js@1       # Installs v1.x
npm install @solana/web3.js@2       # Installs v2.x

How can I try it?

Does it work with X?

Some SDKs have already been ported to be compatible with version 2.0.0, like Tensor's Toolkit, Orca's ts-sdk, the Lighthouse SDK, and more. If your application depends on one that has not yet been ported, you have a few options.

  • If you can eliminate the SDK, do. Finding another way to achieve the same goal can help you reduce the size of your application, and the number of external packages your build depends upon.

  • If it's legacy program client for a built-in Solana program (eg. @solana/spl-token, or SystemProgram) use the new clients published in the @solana-program org on GitHub.

  • If the dependency is the @solana/wallet-adapter, examine the React example app to see the new way of interacting with browser wallets.

  • If the dependency is an Anchor program client or that of a program annotated with Shank macros, generate a new program client using Codama.

  • Otherwise, encourage the developer of the SDK to release a version that's compatible with 2.0. Let them know we're here to help them migrate, every step of the way. There's help available on Stack Exchange and bug reports can be filed on GitHub.