Learn how to combine the Para Modal with Cosmos wallets.
This guide will walk you through the process of integrating Cosmos Wallets into your Para Modal and Para-enabled application, allowing you to onboard new users and connect with existing users who may already have external wallets like Keplr, Leap, Cosmostation and more.
Para integrates with leading Cosmos wallets. Our integration leverages a modified fork of the React library.
Para supports the following Cosmos wallets:
Import components
Import the necessary wallet connectors and chain configurations:
If you encounter type issues with @getpara/graz/chains
,@alpha you’ll need to generate the chain files. You can:
npx graz --generate
manually after installationConfigure chains
Set up your Cosmos chain configurations with the necessary RPC and REST endpoints. You can extend the existing chain configurations with your custom endpoints:
Configure the provider
Similar to the Cosmos and Solana providers, configure the ParaProvider
component by wrapping your application content in the ParaProvider
component. Pass in the required configuration props:
For the ParaCosmosProvider wrapping you don’t need to include a QueryClientProvider as the provider already includes one.
You can also provision linked embedded wallets for external wallets.
In this case, the external wallet would be the Para auth method for the user’s embedded wallet (instead of an email or social login). Embedded wallets would be created according to your API key settings.
To enable this, you can include the createLinkedEmbeddedForExternalWallets
prop to indicate which external wallets this setting should be applied to.
Setting up a dedicated provider component that encapsulates all the necessary providers and modal state management is considered a best practice. This pattern makes it easier to manage the modal state globally and handle session management throughout your application.
When using Next.js or other SSR frameworks, proper client-side initialization is crucial since web3 functionality relies on browser APIs. There are two main approaches:
Using the 'use client'
directive in Next.js 13+:
Using dynamic imports:
After setting up your providers you need to configure the ParaModal component to display the external wallets and
authentication options to your users. You need to pass in the externalWallets
and authLayout
configuration options
to the ParaModal component to control which of the wallets show in the modal that were specified in the provider
configuration.
Modal prop options for customizing the Para Modal are included below. For advanced customization options, refer to
External wallet verification adds a verification step during external connection to ensure the user owns the wallet.
Enabling this feature establishes a valid Para session, which you can later use in your app to securely validate wallet ownership.
To enable this, set the following option on your externalWalletConfig
of your ParaProvider
:
Connection only external wallets bypass all Para functionality (account creation, user tracking, etc.) when connecting an external wallet. To enable this, set the following option on your externalWalletConfig
of your ParaProvider
:
Since connection only wallets bypass Para, most Para functionality will be unavailable. This includes linked embedded wallets, external wallet verification, on & off ramping, etc.
For an example of what the Para External Wallets Modal might look like in your application, check out our live demo:
For an example code implementation using Cosmos Wallets, check out our GitHub repository:
Now that you have integrated Cosmos wallets into your Para Modal, you can explore more advanced features like signing
using the Para SDK with popular libraries like CosmJS
.