Creating Wallets
Creating Wallets
Last updated
Creating Wallets
Last updated
In order to get wallets, please ensure that you have .
With the Caishen SDK, you can create wallets for:
EVM
Bitcoin
Solana
SUI
XRP
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
📚 Type: IWalletAccount
⚠️ Private key is optional and only available if explicitly enabled in the dashboard.
Used for all cash
and swap
functions to avoid sending sensitive data.
Returns the list of all chain types supported by the backend for wallet creation.
📦 Returns
📘 Example
Returns the public RPC endpoint URL for a given EVM-compatible chain ID.
chainId
ChainIds
✅
Chain ID enum value
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
IWalletAccount
into this function — onlyMinimalWalletInput
is required and safer.
If payload.token
is undefined, the function sends the native gas token (e.g. ETH, MATIC).
If payload.token
is provided, it sends that ERC20 or token instead.
📦 Returns
📘 Example
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
IWalletAccount
into this function — onlyMinimalWalletInput
is required and safer.
📦 Returns
Native Balance
Token Balance
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
IWalletAccount
into this function — onlyMinimalWalletInput
is required and safer.
payload
structure:
📦 Returns
📘 Example
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
IWalletAccount
into this function — onlyMinimalWalletInput
is required and safer.
payload
structure:
📦 Returns
📘 Example