Installation
Caishen SDK – Plug & Play SDK JS
The Caishen SDK provides developers with seamless access to multichain wallets and gasless payment tools. With built-in support for Ethereum, Solana, Bitcoin, Sui, and XRP, you can integrate wallets, automate agents, and send cash instantly using only a few lines of code.
Caishen supports Typescript (for browser and Node.js) and Python (for backend automation and bots). You can build wallet-aware apps, agent-based bots, or embedded finance experiences with no seed phrases or infrastructure costs.
Requirements
For Typescript (Node.js / Browser)
Node.js v16+
Basic understanding of Promises and async/await
Supports React, Next.js, Vite, Vanilla JS, etc.
Resources
Example Applications: View working wallet + cash agent integrations.
Troubleshooting: Common setup issues and sandbox tips.
Source Code: Full SDK code and dev toolkits.
Support Portal: Get help directly from the Caishen team or join the community.
📦 Installation
npm install @caishen/sdk
# or
yarn add @caishen/sdk
# or
pnpm add @caishen/sdk⚠️ Requires Node.js ≥ 14.x and TypeScript ≥ 4.x
🚀 Quick Start
import { CaishenSDK, createAgentTools } from "@caishen/sdk";
const sdk = new CaishenSDK({ projectKey: "your-project-key" });
const tools = createAgentTools(sdk);🔑 Authentication
You can authenticate as either a user or an agent.
Connect as User
await sdk.connectAsUser({
token: 'USER TOKEN',
provider: 'USER PROVIDER',
});✅ Supported Providers
google,facebook,twitter,discord,github,linkedinreddit,line,kakao,weibo,farcaster,custom
🔐 Custom Authentication
If you want to authenticate users from your own backend, you can use the custom provider.
In this case:
You must encrypt a JWT on your backend using your
projectSecret(found in your Caishen developer dashboard).That encrypted token must contain an object like
{ id: string }, whereidis the user identifier in your system.You then pass this encrypted token into
connectAsUser.
💡 Example
Backend-side (Node.js):
import jwt from 'jsonwebtoken';
const payload = { id: 'user-123' };
const token = jwt.sign(payload, projectSecret);Frontend-side:
await sdk.connectAsUser({
provider: 'custom',
token: 'ENCRYPTED_JWT_TOKEN',
});On the Caishen backend, this token is decrypted with your projectSecret using:
jwt.verify(token, projectSecret); // -> { id: string }⚠️ Never share your
projectSecretpublicly. Only your server should have access to it.
Connect as Agent
await sdk.connectAsAgent({
agentId: 'AGENT ID',
userId: 'USER ID',
});Different values for
agentIdanduserIdwill generate different wallet scopes.
Last updated