For the complete documentation index, see llms.txt. This page is also available as Markdown.

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

All Caishen wallets come with support for crosschain swaps and sending

πŸ” 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

Name
Type
Required
Description

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

Name
Type
Required
Description

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

Name
Type
Required
Description

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 β€” only MinimalWalletInput 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

πŸ“Š Get Balance

Fetch the balance of a wallet for either the native coin or a specific token.

πŸ“₯ Parameters

Name
Type
Required
Description

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 β€” only MinimalWalletInput is required and safer.

πŸ“¦ Returns

Native Balance

Token Balance


πŸ” Token Swap

πŸ” Get Swap Route

Fetch a possible token swap route across chains.

πŸ“₯ Parameters

Field
Type
Description

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 β€” only MinimalWalletInput is required and safer.

payload structure:

πŸ“¦ Returns

πŸ“˜ Example

πŸ”„ Execute Swap

Execute the swap route using a confirmation code.

πŸ“₯ Parameters

Field
Type
Description

wallet

Pick<IWalletAccount, 'account', 'chainType'>

Wallet info

payload

object

Swap payload including confirmationCode

🚫 Do not pass the full IWalletAccount into this function β€” only MinimalWalletInput is required and safer.

payload structure:

πŸ“¦ Returns

πŸ“˜ Example


Last updated