opentrade-wallet

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenTrade Custodial Wallet

OpenTrade 托管钱包

4 API endpoints for custodial wallet creation, account query, swap execution, and native token withdrawal.
IMPORTANT: Custodial wallet only supports BSC and Solana networks.
IMPORTANT: Newly created wallets have zero balance. You must deposit BNB (to the BSC address) or SOL (to the Solana address) before you can swap or withdraw. Do NOT send tokens from other chains (e.g., Ethereum, Polygon, Arbitrum) to these addresses — funds sent from unsupported chains will be lost.
提供4个API端点,用于托管钱包创建、账户查询、兑换执行和原生代币提现。
重要提示:托管钱包仅支持BSCSolana网络。
重要提示:新创建的钱包余额为零。您必须先向BSC地址存入BNB或向Solana地址存入SOL,才能进行兑换或提现操作。请勿将其他链(例如Ethereum、Polygon、Arbitrum)的代币发送到这些地址——从不支持的链发送的资金将会永久丢失。

Pre-flight Checks

前置检查

Every time before running any custodial wallet command, always follow these steps in order:
  1. Find or create a
    .env
    file in the project root to load the API credentials:
bash
OPEN_TOKEN=your_token_here
Get your API token at: https://6551.io/mcp
Security warning: Never commit .env to git (add it to .gitignore) and never expose credentials in logs, screenshots, or chat messages.
  1. Set the base URL and auth header:
bash
BASE_URL="https://ai.6551.io"
AUTH_HEADER="Authorization: Bearer $OPEN_TOKEN"
每次运行任何托管钱包命令前,请务必按顺序执行以下步骤:
  1. 在项目根目录中找到或创建
    .env
    文件,用于加载API凭证:
bash
OPEN_TOKEN=your_token_here
您可以在此处获取API令牌:https://6551.io/mcp
安全警告:切勿将.env提交到git(请将其添加到.gitignore中),也切勿在日志、截图或聊天消息中泄露凭证。
  1. 设置基础URL和认证头:
bash
BASE_URL="https://ai.6551.io"
AUTH_HEADER="Authorization: Bearer $OPEN_TOKEN"

Skill Routing

技能路由

  • For swap quotes (read-only price estimate) → use
    opentrade-dex-swap
  • For token search / metadata → use
    opentrade-token
  • For market prices → use
    opentrade-market
  • For wallet balances / portfolio → use
    opentrade-portfolio
  • For transaction broadcasting (non-custodial) → use
    opentrade-gateway
  • For custodial wallet management → use this skill (
    opentrade-wallet
    )
  • 兑换报价(只读价格估算)→ 使用
    opentrade-dex-swap
  • 代币搜索/元数据查询 → 使用
    opentrade-token
  • 市场价格查询 → 使用
    opentrade-market
  • 钱包余额/资产组合查询 → 使用
    opentrade-portfolio
  • 交易广播(非托管)→ 使用
    opentrade-gateway
  • 托管钱包管理 → 使用本技能(
    opentrade-wallet

Quickstart

快速开始

bash
undefined
bash
undefined

1. Create a custodial wallet (EVM + Solana)

1. 创建托管钱包(同时生成EVM和Solana地址)

curl -s -X POST "$BASE_URL/open/trader/custodial/create"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
curl -s -X POST "$BASE_URL/open/trader/custodial/create"
-H "$AUTH_HEADER" -H "Content-Type: application/json"

2. Get custodial account addresses

2. 获取托管账户地址

curl -s "$BASE_URL/open/trader/custodial/account"
-H "$AUTH_HEADER"
curl -s "$BASE_URL/open/trader/custodial/account"
-H "$AUTH_HEADER"

3. Custodial swap (auto-sign + broadcast)

3. 托管兑换(自动签名+广播)

curl -s -X POST "$BASE_URL/open/trader/custodial/swap"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress":"0x55d398326f99059fF775485246999027B3197955","amount":"1000000000000000000","slippagePercent":"1"}'
curl -s -X POST "$BASE_URL/open/trader/custodial/swap"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress":"0x55d398326f99059fF775485246999027B3197955","amount":"1000000000000000000","slippagePercent":"1"}'

4. Withdraw native tokens

4. 提现原生代币

curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"network":"bsc","to":"0xRecipientAddress","amount":1000000000000000000}'
undefined
curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"network":"bsc","to":"0xRecipientAddress","amount":1000000000000000000}'
undefined

Command Index

命令索引

#EndpointMethodDescription
1
/open/trader/custodial/create
POST创建托管钱包(同时生成 EVM 和 Solana 地址)
2
/open/trader/custodial/account
GET获取托管钱包地址
3
/open/trader/custodial/swap
POST托管钱包执行 DEX swap(自动签名+广播)
4
/open/trader/custodial/withdraw
POST从托管钱包提现原生代币(BSC/SOL)
#EndpointMethodDescription
1
/open/trader/custodial/create
POST创建托管钱包(同时生成 EVM 和 Solana 地址)
2
/open/trader/custodial/account
GET获取托管钱包地址
3
/open/trader/custodial/swap
POST托管钱包执行 DEX swap(自动签名+广播)
4
/open/trader/custodial/withdraw
POST从托管钱包提现原生代币(BSC/SOL)

Supported Networks

支持的网络

Custodial wallet only supports BSC and Solana.
ChainchainIndexNative TokenWithdraw Network
BSC
56
BNB
bsc
Solana
501
SOL
sol
托管钱包仅支持BSC和Solana。
ChainchainIndexNative TokenWithdraw Network
BSC
56
BNB
bsc
Solana
501
SOL
sol

Cross-Skill Workflows

跨技能工作流

Workflow A: Create Wallet → Deposit → Check Balance → Swap

工作流A:创建钱包 → 充值 → 查余额 → 兑换

User: "Create a custodial wallet and swap 1 BNB for USDT"
1. opentrade-wallet         POST /open/trader/custodial/create              → get evm_address, sol_address
       → Tell user to deposit BNB (BSC) or SOL (Solana) to the new address
       → WARNING: only accept BNB/SOL, do NOT send other chain assets
2. opentrade-portfolio opentrade portfolio all-balances --address <evm_address> --chains bsc
       → verify BNB balance >= 1 (user must have deposited first)
3. opentrade-wallet         POST /open/trader/custodial/swap
       {"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "toTokenAddress":"0x55d398326f99059fF775485246999027B3197955",
        "amount":"1000000000000000000","slippagePercent":"1"}
       → returns tx_hash
Data handoff:
  • evm_address
    from step 1 →
    --address
    in step 2
  • Custodial swap auto-signs and broadcasts — no manual signing needed
用户:“创建一个托管钱包,并用1个BNB兑换USDT”
1. opentrade-wallet         POST /open/trader/custodial/create              → 获取 evm_address, sol_address
       → 告知用户向新地址存入BNB(BSC网络)或SOL(Solana网络)
       → 警告:仅接受BNB/SOL,请勿发送其他链的资产
2. opentrade-portfolio opentrade portfolio all-balances --address <evm_address> --chains bsc
       → 验证BNB余额≥1(用户必须先完成充值)
3. opentrade-wallet         POST /open/trader/custodial/swap
       {"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
        "toTokenAddress":"0x55d398326f99059fF775485246999027B3197955",
        "amount":"1000000000000000000","slippagePercent":"1"}
       → 返回 tx_hash
数据流转:
  • 步骤1返回的
    evm_address
    → 步骤2的
    --address
    参数
  • 托管兑换会自动签名和广播——无需手动签名

Workflow B: Swap Quote → Custodial Swap

工作流B:兑换报价 → 托管兑换

User: "Get a quote for swapping BNB to USDT, then execute with custodial wallet"
1. opentrade-dex-swap  opentrade swap quote \
       --from 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee \
       --to 0x55d398326f99059fF775485246999027B3197955 \
       --amount 1000000000000000000 --chain bsc
       → display quote: expected output, price impact
       ↓ user confirms
2. opentrade-wallet         POST /open/trader/custodial/swap
       → auto-sign and broadcast, returns tx_hash
用户:“查询BNB兑换USDT的报价,然后用托管钱包执行”
1. opentrade-dex-swap  opentrade swap quote \
       --from 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee \
       --to 0x55d398326f99059fF775485246999027B3197955 \
       --amount 1000000000000000000 --chain bsc
       → 展示报价:预期到账金额、价格影响
       ↓ 用户确认后
2. opentrade-wallet         POST /open/trader/custodial/swap
       → 自动签名并广播,返回 tx_hash

Workflow C: Withdraw After Swap

工作流C:兑换后提现

User: "Swap BNB to USDT, then withdraw BNB to my external wallet"
1. opentrade-wallet         POST /open/trader/custodial/swap → swap tokens
2. opentrade-wallet         POST /open/trader/custodial/withdraw
       {"network":"bsc","to":"0xExternalWallet","amount":1000000000000000000}
       → returns tx_hash
Note: Withdraw only supports native tokens (BNB on BSC, SOL on Solana).
用户:“将BNB兑换为USDT,然后把BNB提现到我的外部钱包”
1. opentrade-wallet         POST /open/trader/custodial/swap → 完成代币兑换
2. opentrade-wallet         POST /open/trader/custodial/withdraw
       {"network":"bsc","to":"0xExternalWallet","amount":1000000000000000000}
       → 返回 tx_hash
注意:提现仅支持原生代币(BSC链的BNB、Solana链的SOL)。

Operation Flow

操作流程

Step 1: Identify Intent

步骤1:识别用户意图

  • Create a new custodial wallet →
    POST /open/trader/custodial/create
  • View custodial wallet addresses →
    GET /open/trader/custodial/account
  • Execute a swap automatically →
    POST /open/trader/custodial/swap
  • Withdraw native tokens →
    POST /open/trader/custodial/withdraw
  • 创建新的托管钱包 →
    POST /open/trader/custodial/create
  • 查看托管钱包地址 →
    GET /open/trader/custodial/account
  • 自动执行兑换 →
    POST /open/trader/custodial/swap
  • 提现原生代币 →
    POST /open/trader/custodial/withdraw

Step 2: Collect Parameters

步骤2:收集参数

  • Missing wallet address → call
    GET /open/trader/custodial/account
    first, or create one with
    POST /open/trader/custodial/create
  • Missing token addresses → use
    opentrade-token
    to search token by name
  • Missing amount → ask user, remind to convert to minimal units
  • Missing slippage → suggest 1% default
  • Missing network for withdraw → ask user, only
    bsc
    or
    sol
    supported
  • User requests unsupported chain → inform user that custodial wallet only supports BSC and Solana
  • 缺少钱包地址 → 先调用
    GET /open/trader/custodial/account
    查询,或调用
    POST /open/trader/custodial/create
    创建新钱包
  • 缺少代币地址 → 使用
    opentrade-token
    按名称搜索代币
  • 缺少金额 → 询问用户,提醒需要转换为最小单位
  • 缺少滑点 → 建议使用默认的1%
  • 提现缺少网络信息 → 询问用户,仅支持
    bsc
    sol
  • 用户请求不支持的链 → 告知用户托管钱包仅支持BSC和Solana

Step 3: Execute & Display

步骤3:执行并展示结果

  • Run the API call
  • Parse JSON response
  • Display human-readable summary
  • 调用API
  • 解析JSON返回结果
  • 展示易于理解的摘要信息

Step 4: Suggest Next Steps

步骤4:建议后续操作

Just completedSuggest
Wallet created1. Deposit BNB (BSC) or SOL (Solana) to the new address — do NOT send other chain assets 2. Check balance →
opentrade-portfolio
Account queried1. Check balance →
opentrade-portfolio
2. Execute a swap → custodial swap (this skill)
Swap executed1. Check updated balance →
opentrade-portfolio
2. Withdraw to external wallet → custodial withdraw (this skill)
Withdraw completed1. Check remaining balance →
opentrade-portfolio
2. Swap another token → custodial swap (this skill)
Present conversationally — never expose endpoint paths to the user.
刚完成的操作建议操作
钱包创建完成1. 向新地址存入BNB(BSC网络)或SOL(Solana网络)——请勿发送其他链的资产 2. 查看余额 →
opentrade-portfolio
账户查询完成1. 查看余额 →
opentrade-portfolio
2. 执行兑换 → 托管兑换(本技能)
兑换执行完成1. 查看更新后的余额 →
opentrade-portfolio
2. 提现到外部钱包 → 托管提现(本技能)
提现完成1. 查看剩余余额 →
opentrade-portfolio
2. 兑换其他代币 → 托管兑换(本技能)
请以对话形式呈现——切勿向用户暴露接口路径。

API Reference

API参考

1. Create Custodial Wallet

1. 创建托管钱包

创建托管钱包,同时生成 EVM(BSC)和 Solana 地址。每个用户只能创建一个钱包。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/create" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json"
Parameters: None (user identity from JWT token)
Response:
json
{
  "success": true,
  "data": {
    "evm_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "sol_address": "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
  }
}
Return fields:
FieldTypeDescription
evm_address
StringBSC 链地址
sol_address
StringSolana 链地址
Display to user:
  • "Custodial wallet created!"
  • "BSC Address: 0x742d..."
  • "Solana Address: 7EcD..."
  • "Please deposit BNB to your BSC address or SOL to your Solana address before trading."
  • "WARNING: Only send BNB (BSC network) or SOL (Solana network). Do NOT send tokens from other chains — funds will be lost."

创建托管钱包,同时生成 EVM(BSC)和 Solana 地址。每个用户只能创建一个钱包。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/create" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json"
参数: 无(用户身份从JWT令牌中获取)
返回结果:
json
{
  "success": true,
  "data": {
    "evm_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "sol_address": "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
  }
}
返回字段说明:
字段类型描述
evm_address
StringBSC 链地址
sol_address
StringSolana 链地址
向用户展示的内容:
  • "托管钱包创建成功!"
  • "BSC地址: 0x742d..."
  • "Solana地址: 7EcD..."
  • "交易前请向BSC地址存入BNB,或向Solana地址存入SOL。"
  • "警告:仅可发送BSC网络的BNB或Solana网络的SOL。请勿发送其他链的代币——资金将会丢失。"

2. Get Custodial Account

2. 获取托管账户信息

获取当前用户的托管钱包地址。
bash
curl -s "$BASE_URL/open/trader/custodial/account" \
  -H "$AUTH_HEADER"
Parameters: None
Response:
json
{
  "success": true,
  "data": {
    "evm_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "sol_address": "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
  }
}
Return fields:
FieldTypeDescription
evm_address
StringBSC 链地址
sol_address
StringSolana 链地址

获取当前用户的托管钱包地址。
bash
curl -s "$BASE_URL/open/trader/custodial/account" \
  -H "$AUTH_HEADER"
参数: 无
返回结果:
json
{
  "success": true,
  "data": {
    "evm_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
    "sol_address": "7EcDhSYGxXyscszYEp35KHN8vvw3svAuLKTzXwCFLtV"
  }
}
返回字段说明:
字段类型描述
evm_address
StringBSC 链地址
sol_address
StringSolana 链地址

3. Custodial Swap

3. 托管兑换

使用托管钱包执行 DEX swap。服务端自动完成签名和广播。仅支持 BSC(chainIndex: 56)和 Solana(chainIndex: 501)。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/swap" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{
    "chainIndex": "56",
    "fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toTokenAddress": "0x55d398326f99059fF775485246999027B3197955",
    "amount": "1000000000000000000",
    "slippagePercent": "1"
  }'
Parameters:
FieldTypeRequiredDescription
chainIndex
StringYes链 ID:
"56"
(BSC)或
"501"
(Solana)
fromTokenAddress
StringYes源代币合约地址
toTokenAddress
StringYes目标代币合约地址
amount
StringYes交易数量(最小单位)
slippagePercent
StringNo滑点百分比(默认
"1"
,即 1%)
Response:
json
{
  "success": true,
  "data": {
    "tx_hash": "0xabc123def456...",
    "error": ""
  }
}
Return fields:
FieldTypeDescription
tx_hash
String交易哈希(成功时返回)
error
String错误信息(失败时返回)
Display to user:
  • "Swap executed successfully!"
  • "Tx Hash: 0xabc123..."
  • If
    error
    is non-empty, display the error message

使用托管钱包执行 DEX swap。服务端自动完成签名和广播。仅支持 BSC(chainIndex: 56)和 Solana(chainIndex: 501)。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/swap" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{
    "chainIndex": "56",
    "fromTokenAddress": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
    "toTokenAddress": "0x55d398326f99059fF775485246999027B3197955",
    "amount": "1000000000000000000",
    "slippagePercent": "1"
  }'
参数说明:
字段类型必填描述
chainIndex
String链 ID:
"56"
(BSC)或
"501"
(Solana)
fromTokenAddress
String源代币合约地址
toTokenAddress
String目标代币合约地址
amount
String交易数量(最小单位)
slippagePercent
String滑点百分比(默认
"1"
,即 1%)
返回结果:
json
{
  "success": true,
  "data": {
    "tx_hash": "0xabc123def456...",
    "error": ""
  }
}
返回字段说明:
字段类型描述
tx_hash
String交易哈希(成功时返回)
error
String错误信息(失败时返回)
向用户展示的内容:
  • "兑换执行成功!"
  • "交易哈希: 0xabc123..."
  • 如果
    error
    字段不为空,展示对应的错误信息

4. Custodial Withdraw

4. 托管提现

从托管钱包提现原生代币。仅支持 BSC (BNB) 和 Solana (SOL)。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "bsc",
    "to": "0xRecipientAddress",
    "amount": 1000000000000000000
  }'
Parameters:
FieldTypeRequiredDescription
network
StringYes网络类型:
bsc
sol
to
StringYes接收地址
amount
IntegerYes提现数量(最小单位,必须大于 0)。BSC 单位为 wei(1 BNB = 10^18 wei),Solana 单位为 lamports(1 SOL = 10^9 lamports)
Response:
json
{
  "success": true,
  "data": {
    "tx_hash": "0xdef789...",
    "network": "bsc"
  }
}
Return fields:
FieldTypeDescription
tx_hash
String提现交易哈希
network
String执行提现的网络
Display to user:
  • "Withdrawal successful!"
  • "Tx Hash: 0xdef789..."
  • "Network: BSC"
从托管钱包提现原生代币。仅支持 BSC (BNB) 和 Solana (SOL)。
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw" \
  -H "$AUTH_HEADER" \
  -H "Content-Type: application/json" \
  -d '{
    "network": "bsc",
    "to": "0xRecipientAddress",
    "amount": 1000000000000000000
  }'
参数说明:
字段类型必填描述
network
String网络类型:
bsc
sol
to
String接收地址
amount
Integer提现数量(最小单位,必须大于 0)。BSC 单位为 wei(1 BNB = 10^18 wei),Solana 单位为 lamports(1 SOL = 10^9 lamports)
返回结果:
json
{
  "success": true,
  "data": {
    "tx_hash": "0xdef789...",
    "network": "bsc"
  }
}
返回字段说明:
字段类型描述
tx_hash
String提现交易哈希
network
String执行提现的网络
向用户展示的内容:
  • "提现成功!"
  • "交易哈希: 0xdef789..."
  • "网络: BSC"

Native Token Addresses

原生代币地址

ChainNative Token Address
BSC
0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Solana
11111111111111111111111111111111
原生代币地址
BSC
0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
Solana
11111111111111111111111111111111

Input / Output Examples

输入/输出示例

User says: "Create a custodial wallet for me"
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/create" -H "$AUTH_HEADER" -H "Content-Type: application/json"
用户说: "给我创建一个托管钱包"
bash
curl -s -X POST "$BASE_URL/open/trader/custodial/create" -H "$AUTH_HEADER" -H "Content-Type: application/json"

→ Wallet created! BSC: 0x742d..., Solana: 7EcD...

→ 钱包创建成功!BSC地址: 0x742d..., Solana地址: 7EcD...


**User says:** "Swap 0.1 BNB for USDT on BSC using my custodial wallet"

```bash

**用户说:** "用我的托管钱包在BSC链上将0.1个BNB兑换为USDT"

```bash

Amount: 0.1 BNB = 100000000000000000 wei

金额: 0.1 BNB = 100000000000000000 wei

curl -s -X POST "$BASE_URL/open/trader/custodial/swap"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress":"0x55d398326f99059fF775485246999027B3197955","amount":"100000000000000000","slippagePercent":"1"}'
curl -s -X POST "$BASE_URL/open/trader/custodial/swap"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"chainIndex":"56","fromTokenAddress":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","toTokenAddress":"0x55d398326f99059fF775485246999027B3197955","amount":"100000000000000000","slippagePercent":"1"}'

→ Swap executed! Tx Hash: 0xabc...

→ 兑换执行成功!交易哈希: 0xabc...


**User says:** "Withdraw 1 SOL to my external wallet"

```bash

**用户说:** "将1个SOL提现到我的外部钱包"

```bash

Amount: 1 SOL = 1000000000 lamports

金额: 1 SOL = 1000000000 lamports

curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"network":"sol","to":"ExternalSolanaAddress","amount":1000000000}'
curl -s -X POST "$BASE_URL/open/trader/custodial/withdraw"
-H "$AUTH_HEADER" -H "Content-Type: application/json"
-d '{"network":"sol","to":"ExternalSolanaAddress","amount":1000000000}'

→ Withdrawal successful! Tx Hash: 5xYz...

→ 提现成功!交易哈希: 5xYz...

undefined
undefined

Edge Cases

边缘情况处理

  • Wallet already exists:
    POST /open/trader/custodial/create
    will return an error if the user already has a wallet. Use
    GET /open/trader/custodial/account
    to retrieve existing addresses.
  • New wallet has zero balance: After creating a wallet, the user must deposit BNB (via BSC network) or SOL (via Solana network) before performing any swap or withdraw. Do NOT deposit tokens from other chains (Ethereum, Polygon, Arbitrum, etc.) — those funds will be permanently lost.
  • Unsupported chain: Custodial wallet only supports BSC (chainIndex: 56) and Solana (chainIndex: 501). If the user requests another chain (e.g., Ethereum, Arbitrum), inform them that the custodial wallet does not support that chain and suggest using a non-custodial workflow with
    opentrade-dex-swap
    +
    opentrade-gateway
    .
  • Insufficient balance: Swap or withdraw will fail if the custodial wallet has insufficient funds. Check balance with
    opentrade-portfolio
    first.
  • Unsupported network for withdraw: Only
    bsc
    and
    sol
    are supported for withdraw.
  • Amount must be positive: The
    amount
    field for withdraw must be greater than 0.
  • High slippage swap: If slippage is too low, the swap may fail. Suggest increasing slippage for volatile tokens.
  • Network error: Retry once, then prompt user to try again later.
  • Region restriction (error code 50125 or 80001): Do NOT show the raw error code to the user. Instead, display a friendly message:
    Service is not available in your region. Please switch to a supported region and try again.
  • 钱包已存在: 如果用户已经创建过钱包,
    POST /open/trader/custodial/create
    会返回错误。请使用
    GET /open/trader/custodial/account
    获取已有的地址。
  • 新钱包余额为零: 创建钱包后,用户必须先存入BSC网络的BNB或Solana网络的SOL,才能执行兑换或提现操作。请勿存入其他链(Ethereum、Polygon、Arbitrum等)的代币——这些资金将会永久丢失。
  • 不支持的链: 托管钱包仅支持BSC(chainIndex: 56)和Solana(chainIndex: 501)。如果用户请求其他链(例如Ethereum、Arbitrum),告知用户托管钱包不支持该链,建议使用
    opentrade-dex-swap
    +
    opentrade-gateway
    的非托管工作流。
  • 余额不足: 如果托管钱包资金不足,兑换或提现会失败。请先使用
    opentrade-portfolio
    查询余额。
  • 提现网络不支持: 提现仅支持
    bsc
    sol
    网络。
  • 金额必须为正: 提现的
    amount
    字段必须大于0。
  • 高滑点兑换: 如果滑点设置过低,兑换可能会失败。对于波动较大的代币,建议提高滑点。
  • 网络错误: 重试一次后,如果仍然失败,提示用户稍后再试。
  • 区域限制(错误码50125或80001): 请勿向用户展示原始错误码,而是展示友好提示:
    您所在的区域无法使用该服务。请切换到支持的区域后重试。

Amount Display Rules

金额展示规则

  • Input/output amounts in UI units (
    0.1 BNB
    ,
    50 USDT
    )
  • Internal API params use minimal units (
    1 BNB
    =
    "1000000000000000000"
    ,
    1 SOL
    =
    1000000000
    )
  • Display tx hash as clickable link when possible
  • 界面上的输入/输出金额使用常规单位(
    0.1 BNB
    50 USDT
  • 内部API参数使用最小单位(
    1 BNB
    =
    "1000000000000000000"
    1 SOL
    =
    1000000000
  • 尽可能将交易哈希展示为可点击的链接

Global Notes

全局注意事项

  • All endpoints require
    Authorization: Bearer <token>
    header
  • Only BSC and Solana are supported — do not attempt other chains
  • Amounts must be in minimal units (wei for BSC, lamports for Solana)
  • EVM contract addresses must be all lowercase
  • Custodial swap handles signing and broadcasting automatically — no need to call sign or broadcast separately
  • Withdraw only supports native tokens (BNB/SOL)
  • The custodial wallet is powered by Turnkey with AWS KMS for delegated key custody — 6551 does NOT store your private keys
  • 所有接口都需要携带
    Authorization: Bearer <token>
    请求头
  • 仅支持BSC和Solana——请勿尝试其他链
  • 金额必须使用最小单位(BSC用wei,Solana用lamports)
  • EVM合约地址必须全小写
  • 托管兑换会自动处理签名和广播——无需单独调用签名或广播接口
  • 提现仅支持原生代币(BNB/SOL)
  • 托管钱包由Turnkey提供支持,使用AWS KMS进行委托密钥托管——6551不会存储您的私钥