Initial Setup
Installing the SDK & Incorporating it into Your Project
Getting set up with Capsule is easy, just get an API Key, Install the Capsule packages, and Instantiate the Capsule Class!
1. Get an API Key
First, you'll need an API key from the Capsule team. Please request one if you don't have one yet.
2. Install Capsule Packages
Install the relevant SDK packages using the following
2a. [Mobile App Only] Configure Project
Skip these steps if you're using Capsule with a web-based project
Note: These steps are for a bare React Native project. See our Expo example for how to use Capsule with Expo.
Install pods
Add capsule domains to your associated domains list(s)
For iOS, open ios/Runner.xcworkspace in Xcode
Navigate to Signing & Capabilities and add the capability "Associated Domains"
Add a new associated domain for each environment you will be using (this will most likely be beta and prod) Beta should be webcredentials:app.beta.usecapsule.com
and Prod should be webcredentials:app.usecapsule.com
You will also need to send us your full App ID, which is formatted as follows: <TEAM_ID>.bundleIdentifier You can find your Team ID via Apple developer console.
Polyfill the necessary libraries
Note: These steps are for React Native v0.73. See our examples for how to setup on previous React Native versions.
Add the following to your
metro.config.js
fileCreate a
shim.js
file in the root of your project with the following contentsCall your
shim.js
file in yourindex.js
file
3. Instantiating the Capsule Class and Component
NOTE: There are two hosted Capsule environments, Environment.BETA
is for development and testing and Environment.PROD
is for production. If you prefer, you can also reference Beta as Environment.DEVELOPMENT.
If you're referencing Environments as strings, for example in a .env
file, you should refer to these environments as BETA
and PRODUCTION
, respectively.
Web Modal
If you're using the CapsuleModal
component, simply import the Modal Component into your application and configure it to your preferences. If you're using Next.js or a Server-Side rendering framework, you may need to do this via a dynamic import
For the full list of configuration options on both capsule
andCapsuleModal
, check out the Customize Capsule section
Core SDKs
If you are using the Core SDK directly, either on Web or Mobile, here’s how you can import it.
If you are using the SDKs directly, you'll need to implement your own logic to connect the different auth steps. We've simplified this to ~5 functions, but as this approach is more nuanced, we recommend studying one of the Examples first and basing your integration off of them.
With the SDK now incorporated, the Capsule wallet should serve as a near seamless replacement for your existing wallet setup. The key replacement you'll need to make is substituting current Remote Wallet imports with the import from the Capsule library.
NOTE: Capsule is compatible with major libraries for signing like ethers.js , wagmi. and viem. For more on this, check out the Wagmi, Viem, and Ethers Quickstart
Last updated