To maximize flexibility, Wagmi, Ethers, and Viem packages are decoupled from the core SDKs. Therefore, to add support you'll need to install the relevant packages. These packages follow the naming convention @usecapsule/{NAME}-{VERSION}-integration (eg @usecapsule/wagmi-v2-integration)
Add the SDK to your project using the following command:
# Example illustrates ethers v6npminstall@usecapsule/ethers-v6-integrationORpnpminstall@usecapsule/ethers-v6-integrationORyarnadd@usecapsule/ethers-v6-integration
Wagmi
If youβre looking to get started with Capsule as quickly as possible and you already use wagmi within your web application, we have built a wagmi connector, called the CapsuleConnector
NOTE: Capsule has support for Wagmi v1 and v2. The example below indicates v2 integration instructions. To use v1, replace the wagmi package name with @usecapsule/wagmi-v1-integration
NOTE: CapsuleConnector is not yet supported for mobile. If this is needed for your use case, please get in touch!
NOTE: Capsule has support for Ethers v5 and v6. The example below indicates v6 integration instructions. To use v5, replace the ethers package name with @usecapsule/ethers-v5-integration
// in frontend - once a user is created/signed in, you can export the sessionconstserializedSession=capsule.exportSession();// then transfer `serializedSession` to your backend over some secure method// in backend - import `serializedSession` to enable signing functionalityimport { CapsuleEthersSigner } from'@usecapsule/ethers-v6-integration';import Capsule, { Environment } from'@usecapsule/server-sdk';import { ethers } from'ethers';constcapsule=newCapsule(Environment.DEVELOPMENT,YOUR_API_KEY);// read in `serializedSession` from your secure transfer methodawaitcapsule.importSession(serializedSession);constethersSigner=newCapsuleEthersSigner(capsule,undefined);constsignature=awaitethersSigner.signMessage('hello-world');
Viem
NOTE: Capsule has support for Viem v1 and v2. The example below indicates v2 integration instructions. To use v1, replace the viem package name with @usecapsule/viem-v1-integration