New: External Wallets
Learn how to seamlessly integrate external wallets into your Capsule-enabled application
This guide will walk you through the process of integrating external wallets into your Capsule-enabled application, allowing you to onboard new users and connect with existing users who may already have external wallets accross EVM and Solana networks.
Prerequisites
You primarily need an existing Capsule project setup. If you haven’t already set up Capsule, refer to the React & Web quick start guide to get started.
Note: If using our EVM wallet provider with WalletConnect you will need to create a WalletConnect project and obtain a project ID to set up external wallets. You can do so on their developer portal. Otherwise you can pass in an empty string to the projectId prop.
Quick Start
EVM Setup
Capsule integrates with a number of browser EVM wallets, including MetaMask, Rainbow, Coinbase Wallet, WalletConnect, Zerion, and Rabby.
Install dependencies
Install the following packages in addition to your current Capsule dependencies:
Import required components and wallets
To get started with external wallets, import all the wallets you will support in your application and the CapsuleEvmProvider
component. The following example import includes all available wallets. You can adjust the wallets and chains as needed for your application.
Ensure you’ve imported all necessary components and wallets for your specific integration needs. React Query is a prerequisite dependency.
Set up the CapsuleEvmProvider
With all the necessary imports in place, you can now set up the CapsuleEvmProvider
component. First, create a new QueryClient
instance, then wrap your application content in the QueryClientProvider
and CapsuleEvmProvider
components. It’s advised to wrap these as high up in your component tree as possible. Lastly, pass in a config object.
CapsuleEvmProvider
is built on top of Wagmi’s WagmiConfig
and WagmiProvider
. This means that all Wagmi hooks will function as expected, as long as this provider wraps your application. The config
object you pass to CapsuleEvmProvider
is a Wagmi config object extended with Capsule-specific configurations. This includes modified Wagmi wallet connectors to work seamlessly with Capsule.
At a minimum, ensure the following parameters are set in your config
object:
projectId
(the project ID for your wallet connectors)appName
(the name of your application)chains
(the list of EVM chains you want to support)wallets
(the wallet connectors you want to enable)capsule
(your Capsule client instance)
All other Wagmi configurations are also supported.
Solana Setup
Capsule integrates with Solana browser wallets Phantom, Glow, and Backpack.
Install dependencies
Install the following packages in addition to your current Capsule dependencies:
Import Solana components and wallets
Similar to the EVM setup, import the necessary components and wallets for Solana integration. The following example includes all available wallets. You can adjust the wallets as needed for your application.
Set up Solana network and endpoint
You’ll need to set up the Solana network and endpoint for your application. The following example sets up the Devnet network. You can adjust the network as needed for your application.
Configure the CapsuleSolanaProvider
Now configure the CapsuleSolanaProvider
component by wrapping your application content in the QueryClientProvider
and CapsuleSolanaProvider
components. Pass in the endpoint, wallets, chain, and app identity as props.
Cosmos Setup
Capsule currently supports two Cosmos browser wallets, Keplr and Leap. The wallet integration makes use of a modified fork of the graz React library.
Install dependencies
Install the following packages in addition to your current Capsule dependencies:
Configure the CapsuleCosmosProvider
Configure the CapsuleSolanaProvider
component by wrapping your application content in the QueryClientProvider
and CapsuleCosmosProvider
components. chain ID, available wallets, and available chains as props.
The CapsuleCosmosProvider
offers most of the same configuration props as the GrazProvider component from graz.
Combining Multiple Providers
You can use EVM, Solana, and Cosmos providers together by nesting them. Note that because of graz implementation details, CapsuleCosmosProvider
must be the outermost component if present, and you will not need to wrap the providers in a QueryClientProvider
.
Configuring CapsuleModal
With the providers set up, you can now configure the CapsuleModal
component to display external wallets. This
configuration works for both EVM and Solana wallets:
Customization
You can customize the appearance and behavior of the external wallet integration using various props on the
CapsuleModal
component:
An array of external wallet options to display. This determines which wallets will be supported and the order they will appear in the modal. This array should include the wallets you imported in the provider setup.
An array defining the layout of authentication options. This determines whether the auth options are displayed in an expanded or collapsed format. If you’d like to learn more about what each layout might look like check our our Modal Designer
Theming options for the modal, including color mode, foreground color, background color, and accent color. You can learn more about theming capsule in the
UI & Themingguide.
URL of your application’s logo to be displayed in the modal.
The name of your application to display in the modal.
For more detailed customization options and advanced configurations:
Examples
For an example of what the Capsule External Wallets Modal might look like in your application, check out our demo:
Troubleshooting
For a more comprehensive list of solutions, visit our troubleshooting guide:
Integration Support
If you’re experiencing issues that aren’t resolved by our troubleshooting resources, please contact our team for assistance. To help us resolve your issue quickly, please include the following information in your request:
1
A detailed description of the problem you’re encountering.
2
Any relevant error messages or logs.
3
Steps to reproduce the issue.
4
Details about your system or environment (e.g., device, operating system, software version).
Providing this information will enable our team to address your concerns more efficiently.
Was this page helpful?