Appearance
v1.x.x to v2.0.0 migration guide for react-auth
This guide will help you migrate your Privy React SDK from v1.x.x to v2.0.0.
v2 is currently in beta and scheduled to be released in January 2025. To use the beta version, install the package from the beta
tag:
bash
npm i @privy-io/[email protected]
Breaking changes
- Removed the deprecated
getEthersProvider
andgetWeb3jsProvider
from theConnectedWallet
class. UsegetEthereumProvider
instead.
ts
const provider = await wallet.getEthersProvider();
const privyProvider = await wallet.getEthereumProvider();
const provider = new ethers.providers.Web3Provider(privyProvider);
const provider = await wallet.getWeb3jsProvider();
const privyProvider = await wallet.getEthereumProvider();
const provider = new Web3(privyProvider);
- Ethereum
sendTransaction
method now returns aPromise<{hash: string}>
instead of aPromise<TransactionReceipt>
. To get the full details of the submitted transaction, use a library like viem.
tsx
const receipt = await sendTransaction({...});
const {hash} = await sendTransaction({...});
const receipt = await publicClient.waitForTransactionReceipt({hash});
- Removed the experimental
waitForTransactionConfirmation
config option as it is the default behavior.
tsx
<PrivyProvider
config={{
embeddedWallets: {
waitForTransactionConfirmation: false,
},
}}
>
...
</PrivyProvider>