React SDK
Summary of breaking changes
-
The
setup-paraCLI tool needs to run before running your app to ensure all@getparalibraries are properly polyfilled. It is recommended to do this in yourpostinstallstep of yourpackage.json, something like: -
The
ParaProvideris now required to be used when using the@getpara/react-sdk -
A
queryClientfrom@tanstack/react-querymust be provided.See the@tanstack/react-querydocs for more information on setting up aQueryClient -
The
appNameprop has moved from a modal prop to a required config prop on theParaProvider. This name will be used throughout the modal and in any external wallet providers that may be used. -
The
ParaModalno longer needs to be provided separately, it is automatically included with theParaProviderand all modal props can be passed to theParaProvider.TheParaModalcan still be provided separately if that is preferred. In this case thedisableEmbeddedModal: truevalue should be passed to theParaProviderconfig. -
The
ParaModalprops,isOpenandonClose, are no longer required (though they can be provided if desired). These values are now handled by theParaProviderand developers can use theuseModalhook to control the modal state. -
When using external wallets the Para connector libraries no longer need to be provided, just installed. All config values for these connectors can be passed to the
ParaProvider.
Migration
Migration to V2 can be done one of two ways:- (PREFERRED) Remove the
ParaModalcomponent you are providing and use the modal that the updatedParaProviderprovides. This option offers the most code reduction and overall simpler developer experience. - Continue to use the
ParaModalcomponent you are providing in your app. This option is a bit quicker than the first but will lead to a poorer developer experience.
- Option 1 (PREFERRED)
- Option 2
Remove your After Migration:
<ParaModal> and use the one built into <ParaProvider>.
Starting Code:After Migration
Adding External Wallets
If you’re using external wallets with Para currently, those configs can now be passed to theParaProvider and the connectors will be instantiated for you. Assuming you already followed the migration steps above, a successful migration would look like:
Notes on the external wallet migration:
- All wallets are provided by default, if you wish for them all to be provided you can remove the
walletsvalue in theexternalWalletConfig - If you only wish to use EVM wallets only the
evmConnectorconfig needs to be passed, the other connectors will be skipped in that case.
Pregen Wallet Methods
Methods dealing with pregen wallets now use a simpler object-based notation to specify the type and identifier the wallet belongs to.Common Enums (optional)
Enum types used in certain methods, while still available, are now replaced with string union types. You will not be required to import these enums for methods that accept them.Type Definitions
Auth Objects
User identity attestations are now represented as auth objects with a single key and value, representing both the type of attestation and the relevant identifier. These objects are used for methods that require an attestation of this type, primarily those for authentication and pregenerated wallet management.Auth Object Examples
Phone number auth objects expect a string in international format, beginning with a
+ and containing only numbers without spaces or extra characters, i.e.: +${number}. If your UI deals in separated country codes and national phone numbers, you may use the exported formatPhoneNumber function to combine them into a correctly formatted string.Cancelable Methods (optional)
This feature is available in the following SDKs:
@getpara/web-sdk@alpha@getpara/react-sdk@alpha@getpara/react-native-sdk@alpha
waitForLogin, you may now pass a callback that is invoked on each polling interval, as well as a callback to indicate whether the method should be canceled and another invoked upon cancelation.
New Authentication Flow
The primary methods for authenticating via phone, email address, or third-party services have been overhauled and greatly simplified. If you are using a custom authentication UI, refer to the Custom Authentication UI page for detailed instructions and code samples. For new developers, the Para Modal is the preferred option to handle user authentication in your app.Modified Core Methods
We’ve streamlined and improved several core methods in version 2.0.0. The following sections outline what’s changed and what actions you need to take.Authentication Methods
Authentication Methods
Previous Methods
checkIfUserExistsinitiateUserLogincreateUsercheckIfUserExistsByPhoneinitiateUserLoginForPhonecreateUserByPhone
New Method
signUpOrLogInAction Required
Modify your current authentication flow to use the new simplified
signUpOrLogIn method as detailed on our Custom Authentication UI page.This change simplifies the authentication process by consolidating multiple methods into a single, more intuitive function.
Authentication Polling
Authentication Polling
Previous Methods
waitForLoginAndSetupwaitForAccountCreationwaitForPasskeyAndCreateWallet
New Methods
waitForLoginwaitForSignupwaitForWalletCreation
Action Required
Modify your current authentication flow to use the new simplified methods as detailed on our Custom Authentication UI page.
Pregen Wallet Methods
Pregen Wallet Methods
Farcaster Methods
Farcaster Methods
Previous Methods
initiateFarcasterLoginwaitForFarcasterStatus
New Method
verifyFarcasterAction Required
Use the simplified
verifyFarcaster method as detailed on our Custom Authentication UI page.OAuth Methods
OAuth Methods
Previous Methods
getOAuthUrlwaitForOAuth
New Method
verifyOAuthAction Required
Use the simplified
verifyOAuth method as detailed on our Custom Authentication UI page.Session Methods
Session Methods
2FA Methods
2FA Methods
Previous Methods
check2FAStatus(Deprecated)enable2FAverify2FAsetup2FA
New Methods
setup2fa(Replacescheck2FAStatus)enable2faverify2fa
Action Required
- Replace calls to
check2FAStatuswithsetup2fa, which will now either return{ isSetup: true }or{ isSetup: false, uri: string }depending on the current user’s settings - Update function instances to use the new spelling with lowercase “fa”