Migration from React SDK v4
The new SDK is built with performance in mind and proper tree-shaking. Therefore, the minimum bundle size of your application is greatly reduced.
Below is the comparison of 2 similar applications, using ConnectWallet
(v4) & ConnectButton
(v5), which are identical in term of functionality.
(Built with Next.js 14.2.5)
The SDK v4 only supports a handful of web3 wallets and the more wallets you want to include in your app, the heavier it becomes.
SDK v5 supports over 300 wallets and this number is increasing! You can interact with wallets based on their unique IDs. Hence, adding more wallets to your app has little to no effect to the final bundle.
When building a React web3 application with thirdweb SDK v4, you have access to a set of prebuilt React hooks which let you conveniently interact with your smart contracts.
The issue with this approach is that, the number of smart-contract methods is ever-increasing, and for each hook that does not exist, we have to dedicate time & energy to write, test & maintain. This process is time-consuming & frankly, the more React hooks you add to your app, the slower and more unmaintainable your projects become.
In SDK v5, we introduce a novel concept called "prebuilt extensions" - a set of read & write methods for popular contracts which you can plug & play. For example:
As you can see, by pairing the contract extensions with useReadContract
(for read) and useSendTransaction
(for write),
we are able to greatly reduce the amount of code that is packaged & shipped to the end users. Plus, with this approach we can dedicate more time
to building contract extensions. The SDK v5 currenty supports over hundreds of extensions, with some popular protocols like Uniswap, Farcaster, Lens & more to come.
View a list of supported extensions here, or build your own!
Currently the SDK v4 is using [email protected]
and @tanstack/react-query@^4
which can be considered "outdated".
We unfortunately do not have a plan to upgrade v4's dependencies to the latest versions.
We highly recommend you to migrate to the SDK v5 to receive the latest software with better security and performance.
Want to keep using ethers.js 5? Worry not! The SDK v5 comes with powerful adapters which let you use thirdweb with popular web3 frameworks like viem or ethers 5 & 6.
Learn more