Migration from SDK v4
High-level changes
- All imports from
@thirdweb-dev/*
should be replaced withthirdweb
SDK with sub-exports. - The new SDK is
function
based rather thanclass
based for better tree shaking and performance. - All contract calls are now prepared using
prepareContractCall
and sent using thesendTransaction
function. - Transactions are submitted without waiting for receipt by default. You can call the
waitForReceipt
function to wait for the transaction to be mined.
Progressive migration
If you're currently using the @thirdweb-dev/sdk
, you can progressively migrate to the new thirdweb
SDK. Both SDKs can be used side by side and are interoperable with each other.
You can easily share the same wallet between the two SDKs by using the ethers5adapter
utility, allowing you to progressively replace calls one by one.
In React, you can mix and match the v4 and v5 ThirdwebProvider
, that gives you access to the hooks and functionality of both SDKs.
From thre, you can obtain the current signer using the useSigner
hook, and convert it when needed using the ethers5Adapter
: