Creating Wallets
Creating Wallets
In order to get wallets, please ensure that you have registered and installed the Caishen SDK.
With the Caishen SDK, you can create wallets for:
EVM
Bitcoin
Solana
SUI
XRP
🔍 Get Wallet Info
Fetch a wallet associated with a user or agent for a specific chain.
⚠️ Note: The privateKey will only be returned if the developer dashboard has explicitly allowed access. With it, you can construct your own signer. If not enabled, the SDK will only return the public data needed to interact via Caishen.
📥 Parameters
chainType
string
✅
Blockchain type (ETHEREUM, SOLANA, etc.)
chainId
number
❌
Optional chain ID (e.g., 1 for Ethereum)
account
number
✅
Account index or identifier
📘 Example
wallet = await sdk.crypto.get_wallet({
"chainType": "ETHEREUM",
"chainId": 1,
"account": 0
})📚 Type: IWalletAccount
⚠️ Private key is optional and only available if explicitly enabled in the dashboard.
MinimalWalletInput
Used for all cash and swap functions to avoid sending sensitive data.
🌐 Supported Chains
Returns the list of all chain types supported by the backend for wallet creation.
📦 Returns
📘 Example
🔗 Get EVM RPC URL
Returns the public RPC endpoint URL for a given EVM-compatible chain ID.
📥 Parameters
chainId
ChainIds
✅
Chain ID enum value
📦 Returns
💸 Token Operations
➕ Send Token
Send a token or native coin (like ETH, MATIC, SOL) to another address.
📥 Parameters
wallet
IWalletAccount
✅
Wallet object returned from getWallet()
payload
{ token?: string; amount: string; toAddress: string; memo?: number }
✅
Transfer details
🚫 Do not pass the full
IWalletAccountinto this function — onlyMinimalWalletInputis required and safer.
If
payload.tokenis undefined, the function sends the native gas token (e.g. ETH, MATIC).If
payload.tokenis provided, it sends that ERC20 or token instead.
📦 Returns
📘 Example
📊 Get Balance
Fetch the balance of a wallet for either the native coin or a specific token.
📥 Parameters
wallet
IWalletAccount
✅
Wallet object
payload
{ token?: string }
❌
If token is provided, fetch its balance; otherwise fetch native balance
🚫 Do not pass the full
IWalletAccountinto this function — onlyMinimalWalletInputis required and safer.
📦 Returns
Native Balance
Token Balance
🔁 Token Swap
🔍 Get Swap Route
Fetch a possible token swap route across chains.
📥 Parameters
wallet
Pick<IWalletAccount, 'account'>
Wallet account info
payload
object
Swap details including amount, from/to tokens
🚫 Do not pass the full
IWalletAccountinto this function — onlyMinimalWalletInputis required and safer.
payload structure:
📦 Returns
📘 Example
🔄 Execute Swap
Execute the swap route using a confirmation code.
📥 Parameters
wallet
Pick<IWalletAccount, 'account', 'chainType'>
Wallet info
payload
object
Swap payload including confirmationCode
🚫 Do not pass the full
IWalletAccountinto this function — onlyMinimalWalletInputis required and safer.
payload structure:
📦 Returns
📘 Example
Last updated