claw-wallet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUse this skill when...
适用场景
Use this skill when the user wants to bind, unlock, or recover a wallet for an AI agent.
Use this skill when the user wants to sign messages, sign transactions, or transfer assets through a policy-controlled wallet flow.
Use this skill when the user wants to interact with supported DeFi flows such as swap.
Use this skill when the user wants to inspect wallet balances, token holdings, addresses, wallet status, or transaction history.
Use this skill when the user wants to manage wallet security policies such as chain allowlists, token allowlists, transfer limits, or confirmation thresholds.
You can always know how-to-use by Swagger-UI at
{CLAY_SANDBOX_URL}/docs当用户需要为AI Agent绑定、解锁或恢复钱包时使用此技能。
当用户需要通过策略控制的钱包流签名消息、签名交易或转账资产时使用此技能。
当用户需要与swap等支持的DeFi流程交互时使用此技能。
当用户需要查看钱包余额、代币持有量、地址、钱包状态或交易历史时使用此技能。
当用户需要管理钱包安全策略(如链白名单、代币白名单、转账限额或确认阈值)时使用此技能。
你可以随时通过 路径的Swagger-UI查看使用说明。
{CLAY_SANDBOX_URL}/docsclaw wallet skill
Claw钱包技能
This skill equips an OpenClaw agent with a local multi-chain wallet sandbox.
- All wallet-related operations must go through the local sandbox. Use the localhost API or sandbox CLI instead. Open or use --help command. If sandbox is not running, start/restart it first.
{CLAY_SANDBOX_URL}/docs - Before executing any transaction, the agent must ask the user for confirmation (e.g. "Confirm to execute this transaction?"). Do not proceed without explicit user consent.
此技能为OpenClaw Agent配备了本地多链钱包沙箱。
- 所有钱包相关操作必须经过本地沙箱,使用本地API或沙箱CLI执行。打开 或使用--help命令查看说明。如果沙箱未运行,先启动/重启沙箱。
{CLAY_SANDBOX_URL}/docs - 执行任何交易前,Agent必须向用户申请确认(例如“确认执行此交易吗?”),未获得用户明确同意不得继续操作。
Bootstrap
初始化引导
Installation path
安装路径
All files live in one directory:
{your_workspace}/skills/claw-wallet/| Platform | Resolved path |
|---|---|
| Linux/macOS | |
| Windows | |
所有文件都存放在同一个目录下:
{your_workspace}/skills/claw-wallet/| 平台 | 解析后路径 |
|---|---|
| Linux/macOS | |
| Windows | |
Install
安装
Before cloning or running the installer, first check from the workspace root whether already exists (same path as in Installation path below). Use that check to decide whether this is a reuse flow or a new clone flow.
skills/claw-wallet-
If it exists: Do not run the git clone or/
install.shbootstrap unless the user explicitly wants a reinstall.install.ps1- Start the sandbox first.
- Linux/macOS:
skills/claw-wallet/claw-wallet.sh start - Windows:
skills/claw-wallet/claw-wallet.ps1 start - Use if the sandbox is unhealthy.
restart
- Linux/macOS:
- Call with
POST {CLAY_SANDBOX_URL}/api/v1/wallet/initfrom .env.clay.Authorization: Bearer <token>- This call is idempotent, so it is safe to run even when the wallet already exists.
- Call with the same bearer token and get status, report to the user with the *status.
GET {CLAY_SANDBOX_URL}/api/v1/wallet/status - If is
relay_user_boundorfalseis notrelay_binding_status, report bind_urlvalidto the user, hint them to bind their agent wallet+.https://www.clawwallet.cc/claim/<uid> - Stop here after the report. Do not bootstrap again unless the user explicitly asks for reinstall.
- Start the sandbox first.
-
If it does not exist: Continue with Bootstrap (new clone) below.
克隆仓库或运行安装程序前,先从工作区根目录检查****是否已存在(路径与下方安装路径一致),根据检查结果判断是复用流程还是新克隆流程。
skills/claw-wallet-
如果已存在: 除非用户明确要求重新安装,否则不要执行git clone或/
install.sh初始化操作。install.ps1- 先启动沙箱
- Linux/macOS:
skills/claw-wallet/claw-wallet.sh start - Windows:
skills/claw-wallet/claw-wallet.ps1 start - 如果沙箱运行异常,使用参数重启
restart
- Linux/macOS:
- 携带**中的
.env.clay**调用Authorization: Bearer <token>POST {CLAY_SANDBOX_URL}/api/v1/wallet/init- 此调用是幂等的,即使钱包已存在运行也安全
- 使用相同的Bearer token调用获取状态,并向用户报告状态
GET {CLAY_SANDBOX_URL}/api/v1/wallet/status - 如果为
relay_user_bound或false不是relay_binding_status,向用户提供bind_urlvalid,提示用户绑定Agent钱包https://www.clawwallet.cc/claim/<uid> - 报告完成后终止操作,除非用户明确要求重新安装,否则不要再次执行初始化
- 先启动沙箱
-
如果不存在: 继续执行下方的**初始化引导(新克隆)**流程
Bootstrap (new clone)
初始化引导(新克隆)
Clone this repo into under your workspace and run the installer. The installer automatically initializes the wallet.
After the installer finishes, immediately run the status disclosure flow and emit the fixed disclosure format below.
skills/claw-walletLinux/macOS:
bash
mkdir -p skills
git clone https://github.com/ClawWallet/Claw-Wallet-Skill.git skills/claw-wallet
bash skills/claw-wallet/install.shWindows PowerShell:
powershell
New-Item -ItemType Directory -Path "skills" -Force | Out-Null
git clone https://github.com/ClawWallet/Claw-Wallet-Skill.git "skills/claw-wallet"
& "skills/claw-wallet/install.ps1"After install, use with — confirm wallet is ready. The response includes address information and uid (when present). You must show the user: wallet addresses (from the response), uid (from the response when present) ( HTTP API under , Swagger at , same origin). read it only from / for (see HTTP authentication (sandbox) below).
GET {CLAY_SANDBOX_URL}/api/v1/wallet/statusAuthorization: Bearer <token>/api/v1/…/docs.env.clayidentity.jsonAuthorizationUse this exact format to respond to the user after finishing the install:
-
Wallet ready -
Addresses: <address map from wallet/status> -
UID: <uid from wallet/status/identity.json> -
AGENT_TOKEN: <agent_token from .env.clay or identity> -
Tell the user: To fully control your wallet with a better experience, open(substitute
https://www.clawwallet.cc/claim/<uid>with the value from<uid>orwallet/status) to register and bind your sandbox wallet within 15 minutes. Ask them to reply complete bind when they have finished the bind workflow; then you can explain what the wallet can do.identity.json -
After the user says they completed the bind workflow, tell them: You can use this wallet to transfer, receive, and perform complex DeFi interactions.
将此仓库克隆到工作区下的目录并运行安装程序,安装程序会自动初始化钱包。
安装完成后,立即运行状态披露流程,并按照下方固定格式输出披露信息。
skills/claw-walletLinux/macOS:
bash
mkdir -p skills
git clone https://github.com/ClawWallet/Claw-Wallet-Skill.git skills/claw-wallet
bash skills/claw-wallet/install.shWindows PowerShell:
powershell
New-Item -ItemType Directory -Path "skills" -Force | Out-Null
git clone https://github.com/ClawWallet/Claw-Wallet-Skill.git "skills/claw-wallet"
& "skills/claw-wallet/install.ps1"安装完成后,携带调用,确认钱包已就绪。响应包含地址信息和uid(存在时返回)。你必须向用户展示: 钱包地址(从响应获取)、uid(响应存在时返回)(HTTP API路径前缀为,Swagger页面在,同源)。仅从/读取所需的token(参见下方HTTP身份验证(沙箱))。
Authorization: Bearer <token>GET {CLAY_SANDBOX_URL}/api/v1/wallet/status/api/v1/…/docs.env.clayidentity.jsonAuthorization安装完成后使用以下固定格式回复用户:
-
Wallet ready -
Addresses: <wallet/status接口返回的地址映射> -
UID: <wallet/status/identity.json返回的uid> -
AGENT_TOKEN: <.env.clay或identity文件中的agent_token> -
告知用户:如需获得更好的钱包全控制体验,请在15分钟内打开(将
https://www.clawwallet.cc/claim/<uid>替换为<uid>或wallet/status中的值)注册并绑定沙箱钱包。提示用户完成绑定流程后回复complete bind,之后你可以向用户说明钱包的功能。identity.json -
用户告知已完成绑定流程后,告知用户:你可以使用此钱包进行转账、收款以及复杂的DeFi交互。
Startup rule:
启动规则:
- do not run directly as a long-lived foreground daemon from OpenClaw
clay-sandbox - use /
skills/claw-wallet/claw-wallet.sh startskills/claw-wallet/claw-wallet.ps1 start - use if the process exists but is unhealthy
restart - use only when you intentionally want a foreground process
serve - If the user wants balances or transaction history, call first, or use
POST {CLAY_SANDBOX_URL}/api/v1/wallet/refreshfor a fresh balance snapshot.refreshAndAssets
- 不要在OpenClaw中直接将作为长期前台守护进程运行
clay-sandbox - 使用/
skills/claw-wallet/claw-wallet.sh start启动skills/claw-wallet/claw-wallet.ps1 start - 如果进程存在但运行异常,使用参数
restart - 仅当你明确需要前台进程时使用参数
serve - 如果用户需要余额或交易历史,先调用,或使用
POST {CLAY_SANDBOX_URL}/api/v1/wallet/refresh获取最新余额快照refreshAndAssets
Register and bind (website vs agent)
注册与绑定(网页端与Agent端)
End users (browser): Open in the browser, substituting with the wallet uid from , to start the bind flow; the path must include that uid (see Claw Wallet).
https://www.clawwallet.cc/claim/<uid><uid>wallet/status/claim/…Agents (automating bind after the user starts the flow): The user will obtain a from the Claw bind / challenge step and paste or send it to you. You must call the sandbox bind API with the same bearer token used for all authenticated sandbox requests.
message_hash_hex- Token: Use /
AGENT_TOKENfromCLAY_AGENT_TOKEN(orskills/claw-wallet/.env.clayinagent_token). Send it as:identity.jsonAuthorization: Bearer <token>
- Request:
- Method:
POST - URL:
{CLAY_SANDBOX_URL}/api/v1/wallet/bind - Headers: , plus
Content-Type: application/jsonaboveAuthorization - Body (JSON):
{ "message_hash_hex": "<value from user>" }
- Method:
- Behavior: The sandbox signs locally and forwards the result to the relay
Example (bash / Linux / macOS): is usually available.
curlbash
curl -sS -X POST "${CLAY_SANDBOX_URL}/api/v1/wallet/bind" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-d "{\"message_hash_hex\":\"<hex from user>\"}"Windows: A plain CMD window may not have on older systems, or agents may run only PowerShell. Prefer one of:
curl- PowerShell 7+ / Windows Terminal often ships with (real curl). If
curl.exeworks, the bash example above is fine (usecurl --version/$env:CLAY_SANDBOX_URLor substitute literals).$env:AGENT_TOKEN - If is missing or fails, use
curl(built in):Invoke-RestMethod
powershell
$body = @{ message_hash_hex = "<hex from user>" } | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$env:CLAY_SANDBOX_URL/api/v1/wallet/bind" `
-ContentType "application/json" `
-Headers @{ Authorization = "Bearer $env:AGENT_TOKEN" } `
-Body $body终端用户(浏览器): 在浏览器打开,将替换为返回的钱包uid,启动绑定流程;路径必须包含该uid(参见Claw Wallet)。
https://www.clawwallet.cc/claim/<uid><uid>wallet/status/claim/…Agent端(用户启动流程后自动绑定): 用户会从Claw绑定/验证步骤获取**并粘贴或发送给你,你必须使用所有沙箱认证请求通用的Bearer token调用沙箱**绑定API。
message_hash_hex- Token: 使用中的**
skills/claw-wallet/.env.clay** /AGENT_TOKEN(或CLAY_AGENT_TOKEN中的identity.json),按如下格式发送:agent_tokenAuthorization: Bearer <token>
- 请求:
- 方法:
POST - URL:
{CLAY_SANDBOX_URL}/api/v1/wallet/bind - 请求头: ,加上上述
Content-Type: application/json头Authorization - 请求体(JSON):
{ "message_hash_hex": "<用户提供的值>" }
- 方法:
- 执行逻辑: 沙箱在本地签名并将结果转发到中继节点
示例(bash / Linux / macOS): 通常系统自带
curlbash
curl -sS -X POST "${CLAY_SANDBOX_URL}/api/v1/wallet/bind" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${AGENT_TOKEN}" \
-d "{\"message_hash_hex\":\"<用户提供的十六进制值>\"}"Windows: 旧版本系统的普通CMD窗口可能没有,或者Agent仅运行PowerShell,优先选择以下方案之一:
curl- PowerShell 7+ / Windows Terminal通常自带****(原生curl)。如果
curl.exe命令可用,上述bash示例也适用(使用curl --version/$env:CLAY_SANDBOX_URL或直接替换为字面量)。$env:AGENT_TOKEN - 如果缺失或运行失败,使用内置的**
curl**:Invoke-RestMethod
powershell
$body = @{ message_hash_hex = "<用户提供的十六进制值>" } | ConvertTo-Json
Invoke-RestMethod -Method Post -Uri "$env:CLAY_SANDBOX_URL/api/v1/wallet/bind" `
-ContentType "application/json" `
-Headers @{ Authorization = "Bearer $env:AGENT_TOKEN" } `
-Body $bodyHealth check
健康检查
After install or relaunch, verify:
GET {CLAY_SANDBOX_URL}/health- expected response:
{"status":"ok"}
安装或重启后,验证以下接口:
GET {CLAY_SANDBOX_URL}/health- 预期响应:
{"status":"ok"}
HTTP authentication (sandbox)
HTTP身份验证(沙箱)
- Most routes under (wallet status, sign, transfer, etc.) require:
/api/v1/…Authorization: Bearer <token>- where is exactly the same value as
<token>/AGENT_TOKEN.CLAY_AGENT_TOKEN
- Typical failure without the header: HTTP 401 with body .
Unauthorized: invalid claw wallet sandbox token
- 下的大多数路由(钱包状态、签名、转账等)需要:
/api/v1/…Authorization: Bearer <token>- 其中与
<token>/AGENT_TOKEN的值完全一致CLAY_AGENT_TOKEN
- 未携带该请求头的典型失败响应: HTTP 401,响应体为
Unauthorized: invalid claw wallet sandbox token
Where to read the token (same secret, duplicated for convenience)
Token读取位置(同一密钥,为方便使用做了多位置冗余)
| Location | Field(s) |
|---|---|
| |
| |
Example workspace test layout (same idea):
wallet_test/<sim>/.env.claywallet_test/<sim>/identity.json
| 位置 | 字段 |
|---|---|
| |
| |
示例工作区测试布局(逻辑相同):
wallet_test/<sim>/.env.claywallet_test/<sim>/identity.json
Swagger UI (/docs
)
/docsSwagger UI (/docs
)
/docsWe have a list of sandbox API at ,
{CLAY_SANDBOX_URL}/docs我们在路径提供了沙箱API列表。
{CLAY_SANDBOX_URL}/docsUnauthenticated or special paths (examples)
无需认证或特殊路径(示例)
- — no bearer required
GET /health - ,
GET /docs— no bearer (documentation only)GET /openapi.yaml - Exact list is defined by the sandbox binary; see on a running sandbox
/openapi.yaml
- — 无需Bearer token
GET /health - 、
GET /docs— 无需Bearer token(仅文档)GET /openapi.yaml - 完整列表由沙箱二进制文件定义,可在运行中的沙箱查看
/openapi.yaml
Primary wallet API
核心钱包API
When is set, authenticated requests require:
AGENT_TOKENAuthorization: Bearer <CLAY_AGENT_TOKEN>Use the token value from or as described in HTTP authentication (sandbox) above.
.env.clayidentity.jsonYou can Open to see the list of our API and how to use.
{CLAY_SANDBOX_URL}/docs设置后,认证请求需要携带:
AGENT_TOKENAuthorization: Bearer <CLAY_AGENT_TOKEN>使用上文**HTTP身份验证(沙箱)**中说明的或中的token值。
.env.clayidentity.json你可以打开查看我们的API列表和使用方法。
{CLAY_SANDBOX_URL}/docsUpgrade and Uninstall
升级与卸载
Upgrade
升级
- If installed via git clone: →
git stash→git pull, then rerun the installer. Local changes are preserved.git stash pop - If installed via npx skills add (no ): Backs up
.git/.env.clay/identity.jsonto a temp dir, thenshare3.json→git init→git fetch→ restore from temp → rerun installer. After the first upgrade,git reset --hard origin/mainexists so future upgrades use the normal git flow..git
Wallet data (, , ) is preserved in both cases.
.env.clayidentity.jsonshare3.jsonLinux/macOS:
bash
skills/claw-wallet/claw-wallet.sh upgradeWindows PowerShell:
powershell
& "skills/claw-wallet/claw-wallet.ps1" upgrade- 如果通过git clone安装: →
git stash→git pull,然后重新运行安装程序,本地修改会被保留。git stash pop - 如果通过npx skills add安装(无目录): 将
.git/.env.clay/identity.json备份到临时目录,然后执行share3.json→git init→git fetch→ 从临时目录恢复备份 → 重新运行安装程序。首次升级后会生成git reset --hard origin/main目录,后续升级使用常规git流程。.git
两种场景下钱包数据(、、)都会被保留。
.env.clayidentity.jsonshare3.jsonLinux/macOS:
bash
skills/claw-wallet/claw-wallet.sh upgradeWindows PowerShell:
powershell
& "skills/claw-wallet/claw-wallet.ps1" upgradeUninstall
卸载
If you are an agent:
- You must ask the user for permission before executing the uninstall command. Do not run it automatically.
- You must inform the user: "Before uninstalling, you must backup ,
.env.clay, andidentity.jsonif you need to recover the wallet later. Deletion is irreversible."share3.json - Proceed only after the user has explicitly confirmed.
If you are a user: Before uninstalling, you must backup , , and if you need to recover the wallet later. Deletion is irreversible.
.env.clayidentity.jsonshare3.jsonThe uninstall script will:
- Stop the sandbox process
- Display a warning and ask for confirmation
- Proceed only if you type
yes - Remove the entire skill directory
Linux/macOS:
bash
bash skills/claw-wallet/claw-wallet.sh uninstallWindows PowerShell:
powershell
& "skills/claw-wallet/claw-wallet.ps1" uninstall如果你是Agent:
- 执行卸载命令前必须征求用户许可,不得自动运行。
- 必须告知用户:"卸载前如果你后续需要恢复钱包,必须备份、
.env.clay和identity.json,删除操作不可逆。"share3.json - 仅在用户明确确认后继续操作。
如果你是用户: 卸载前如果你后续需要恢复钱包,必须备份、和,删除操作不可逆。
.env.clayidentity.jsonshare3.json卸载脚本会执行以下操作:
- 停止沙箱进程
- 展示警告并申请确认
- 仅当你输入后继续执行
yes - 删除整个技能目录
Linux/macOS:
bash
bash skills/claw-wallet/claw-wallet.sh uninstallWindows PowerShell:
powershell
& "skills/claw-wallet/claw-wallet.ps1" uninstallCLI and Manage
CLI与管理
Use the wrapper scripts to either manage the sandbox process or call the binary CLI.
Public wrapper entrypoints:
- Linux/macOS:
skills/claw-wallet/claw-wallet.sh - Windows CMD:
skills\claw-wallet\claw-wallet.cmd - Windows PowerShell:
& "skills/claw-wallet/claw-wallet.ps1"
Process management:
- starts the sandbox in the background when it is installed but not running
start - stops the sandbox
stop - stops and then starts again
restart - exits
is-runningwhen the sandbox is running,0otherwise1 - pulls the latest code (git or npx skills update) and reruns the installer
upgrade - stops the sandbox, asks for confirmation, and removes the skill directory
uninstall
CLI commands:
- ,
help,-hprint the built-in CLI usage text--help - prints a one-line status summary
status --short - prints the wallet address map
addresses - prints transaction history through
history [chain] [limit]; chain and limit are optional query filters applied in memory. Example:GET /api/v1/wallet/historyhistory solana 20 - prints cached multichain balances through
assetsGET /api/v1/wallet/assets - prints a fresh balance snapshot by combining refresh + assets in one request
refreshAndAssets - prints the oracle price cache
prices - prints the security and risk cache
security - prints recent audit log entries
audit [number] - triggers an async asset refresh through
refreshPOST /api/v1/wallet/refresh - broadcasts a signed transaction payload
broadcast signed-tx.json - builds, signs, and submits a transfer payload
transfer transfer.json - prints the local
policy getviapolicy.json(read-only). The merged policy view also appears onGET /api/v1/policy/localunderGET /api/v1/wallet/status.policy - Policy cannot be changed from the sandbox CLI or a generic sandbox POST API. After the wallet is bound, users adjust limits and rules in the frontend; the relay may also push policy updates to the sandbox (file on disk).
Windows equivalents use the same subcommands through , for example:
claw-wallet.ps1& "skills/claw-wallet/claw-wallet.ps1" help& "skills/claw-wallet/claw-wallet.ps1" status --shortGet-Content policy.json | & "skills/claw-wallet/claw-wallet.ps1" policy set -
Help and usage:
- ,
help, and-hare equivalent for the sandbox binary--help - These flags print the built-in CLI usage text from the binary itself, not a wrapper-specific summary
- The help output is grouped by area: server, wallet read commands, policy, transaction helpers, and local bootstrap / utility commands
- Wallet read commands are thin wrappers over the local HTTP API and still require the bearer token from /
.env.clayidentity.json - Running the binary with no subcommand starts the HTTP server, so use explicitly when you want usage text instead of a foreground daemon
help
使用包装脚本管理沙箱进程或调用二进制CLI。
公开包装入口:
- Linux/macOS:
skills/claw-wallet/claw-wallet.sh - Windows CMD:
skills\claw-wallet\claw-wallet.cmd - Windows PowerShell:
& "skills/claw-wallet/claw-wallet.ps1"
进程管理命令:
- :当沙箱已安装但未运行时,后台启动沙箱
start - :停止沙箱
stop - :停止后重新启动沙箱
restart - :沙箱运行时退出码为
is-running,否则为01 - :拉取最新代码(git或npx skills update)并重新运行安装程序
upgrade - :停止沙箱、申请确认后删除技能目录
uninstall
CLI命令:
- 、
help、-h:打印内置CLI使用说明--help - :打印单行状态摘要
status --short - :打印钱包地址映射
addresses - :通过
history [chain] [limit]打印交易历史;chain和limit是可选的内存查询过滤器,示例:GET /api/v1/wallet/historyhistory solana 20 - :通过
assets打印缓存的多链余额GET /api/v1/wallet/assets - :合并refresh+assets请求,打印最新余额快照
refreshAndAssets - :打印预言机价格缓存
prices - :打印安全与风险缓存
security - :打印最近的审计日志条目
audit [number] - :通过
refresh触发异步资产刷新POST /api/v1/wallet/refresh - :广播已签名的交易 payload
broadcast signed-tx.json - :构建、签名并提交转账payload
transfer transfer.json - :通过**
policy get打印本地GET /api/v1/policy/local(只读),合并后的策略视图也会在policy.json**的GET /api/v1/wallet/status字段下展示policy - 策略不能通过沙箱CLI或通用沙箱POST API修改。钱包绑定后,用户在前端调整限额和规则;中继节点也可能推送策略更新到沙箱(写入磁盘文件)
Windows平台使用相同的子命令,通过调用,例如:
claw-wallet.ps1& "skills/claw-wallet/claw-wallet.ps1" help& "skills/claw-wallet/claw-wallet.ps1" status --shortGet-Content policy.json | & "skills/claw-wallet/claw-wallet.ps1" policy set -
帮助与使用说明:
- 沙箱二进制的、
help、-h功能等价--help - 这些标志打印二进制本身内置的CLI使用说明,不是包装脚本专属的摘要
- 帮助输出按领域分组:服务、钱包读取命令、策略、交易助手、本地初始化/工具命令
- 钱包读取命令是本地HTTP API的轻量包装,仍然需要从/
.env.clay获取Bearer tokenidentity.json - 不带子命令运行二进制会启动HTTP服务,因此如果你需要查看使用说明而不是启动前台守护进程,明确使用命令
help
Refresh policy
刷新规则
Use refresh only when it protects correctness:
- Must refresh before ,
transfer,swap, or any action that depends on fresh balances, history, price, or risk.invoke - The sandbox already refreshes automatically in the corresponding managed execution paths when it needs to.
- For manual refresh, use the sandbox CLI command or the
refreshAPI.POST /api/v1/wallet/refresh - If you need a fresh snapshot immediately after refresh, prefer instead of
refreshAndAssetsalone.assets - For OpenClaw / agent automation, call the sandbox refresh API explicitly before transaction execution when the cached state may be stale.
- Do not refresh on every read. Assets/history views should stay cache-first unless the cache is stale or the user explicitly requests a refresh.
仅当需要保证正确性时才使用刷新:
- 执行、
transfer、swap或任何依赖最新余额、历史、价格或风险的操作前必须刷新invoke - 沙箱在需要时已经会在对应的托管执行路径中自动刷新
- 手动刷新可以使用沙箱CLI命令或
refreshAPIPOST /api/v1/wallet/refresh - 如果你需要刷新后立即获取最新快照,优先使用而非单独使用
refreshAndAssetsassets - 对于OpenClaw/Agent自动化场景,当缓存状态可能过期时,在交易执行前显式调用沙箱刷新API
- 不要每次读取都刷新。资产/历史视图应优先使用缓存,除非缓存已过期或用户明确要求刷新。