okx-agentic-wallet by okx/onchainos-skills
npx skills add https://github.com/okx/onchainos-skills --skill okx-agentic-wallet钱包操作:身份验证、余额查询、代币转账、交易历史记录和智能合约调用。
每次运行任何 onchainos 命令之前,请务必按顺序执行以下步骤。不要向用户回显常规命令输出;仅在安装、更新或处理失败时提供简短的状态更新。
解析最新稳定版本:从 GitHub API 获取最新的稳定发布标签:
curl -sSL "https://api.github.com/repos/okx/onchainos-skills/releases/latest"
提取 tag_name 字段(例如 v1.0.5)到 LATEST_TAG 中。如果 API 调用失败且 onchainos 已在本地安装,则跳过步骤 2-3 并继续运行命令(用户可能离线或受到速率限制;过时的二进制文件总比阻塞要好)。如果 onchainos 未安装,则停止并告知用户检查网络连接或从 手动安装。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
安装或更新:如果未找到 onchainos,或者 ~/.onchainos/last_check(Windows 上为 $env:USERPROFILE\.onchainos\last_check)处的缓存超过 12 小时:
curl -sSL "https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh" -o /tmp/onchainos-install.sh" curl -sSL "https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" -o /tmp/installer-checksums.txtInvoke-WebRequest -Uri "https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.ps1" -OutFile "$env:TEMP\onchainos-install.ps1" Invoke-WebRequest -Uri "https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" -OutFile "$env:TEMP\installer-checksums.txt"installer-checksums.txt 验证安装程序的 SHA256。如果不匹配,停止并发出警告——安装程序可能已被篡改。sh /tmp/onchainos-install.sh(或在 Windows 上执行 & "$env:TEMP\onchainos-install.ps1")。安装程序内部处理版本比较,仅在需要时下载二进制文件。验证二进制文件完整性(每个会话一次):运行 onchainos --version 获取已安装版本(例如 1.0.5 或 2.0.0-beta.0)。将已安装标签构造为 v<version>。下载已安装版本标签(不一定是 LATEST_TAG)的 checksums.txt:curl -sSL "https://github.com/okx/onchainos-skills/releases/download/v<version>/checksums.txt" -o /tmp/onchainos-checksums.txt 查找平台目标,并将已安装二进制文件的 SHA256 与校验和进行比较。如果不匹配,请重新安装(步骤 2)并重新验证。如果仍然不匹配,停止并发出警告。
arm64->aarch64-apple-darwin,x86_64->;Linux:->,->,->,->;Windows:->,->,->检查技能版本漂移(每个会话一次):如果 onchainos --version 比此技能的 metadata.version 新,则显示一次性通知,告知技能可能已过时,并建议用户通过其平台的方法重新安装技能。不要阻塞。
命令失败时不要自动重新安装。 报告错误并建议运行 onchainos --version 或从 https://github.com/okx/onchainos-skills 手动重新安装。
速率限制错误。 如果命令遇到速率限制,共享的 API 密钥可能被限制。建议在 OKX 开发者门户 创建个人密钥。如果用户创建了 .env 文件,提醒他们将 .env 添加到 .gitignore。
onchainos wallet chainsokx-dex-marketokx-wallet-portfoliookx-dex-marketokx-dex-tokenokx-dex-signalokx-dex-trenchesokx-dex-swapokx-onchain-gatewayokx-securityokx-security--chain 解析重要:--chain 仅接受数字链 ID(例如,以太坊为 1,Solana 为 501,X Layer 为 196)。不接受文本值,如 sol、xlayer、eth 或任何链名称/别名,否则将导致命令失败。
每当命令需要 --chain 时,请遵循以下步骤:
onchainos wallet chains 输出中的 chainName、showName 或 alias 值(如果对话上下文中可用)进行推理,推断目标链。这是语义匹配——处理拼写错误、缩写和通俗名称(例如 "ethereuma" → 1,"币安链" → 56)。如果您对匹配结果不是 100% 有信心,请在继续之前要求用户确认。realChainIndex 传递给 --chain。切勿直接传递链名称、别名或用户提供的文本。onchainos wallet chains 获取完整列表并找到匹配的 realChainIndex。⚠️ 如果无法自信地匹配任何链,请勿猜测。要求用户澄清,并显示可用的链列表以供参考。向用户显示链名称时,始终使用人类可读的名称(例如 "Ethereum"、"BNB Chain"),切勿使用内部 ID。
示例流程:
# 用户说:"Show my balance on Ethereum"
# 步骤 1:从用户输入推断链 → Ethereum → realChainIndex=1
# 步骤 2:将 realChainIndex 传递给 --chain
→ onchainos wallet balance --chain 1
适用于:
onchainos wallet balance --chainonchainos wallet send --chainonchainos wallet contract-call --chainonchainos wallet history --chain(详情模式)onchainos wallet addresses --chain--amount / --value 单位重要:始终以 UI 单位(人类可读)传递金额,切勿使用基础单位(wei、lamports 等)。 CLI 在内部处理单位转换。
| 用户说 | --amount 值 | ❌ 错误 |
|---|---|---|
| "Transfer 0.15 ETH" | "0.15" | "150000000000000000" (wei) |
| "Send 100 USDC" | "100" | "100000000" (6 位小数) |
| "Send 0.5 SOL" | "0.5" | "500000000" (lamports) |
适用于:
onchainos wallet send --amountonchainos wallet contract-call --valueCLI 参考:有关完整的参数表、返回字段模式和用法示例,请参阅 cli-reference.md。
登录命令(
wallet login、wallet verify)在步骤 2:身份验证中介绍。
---|---|---|---
A3 | onchainos wallet add | 添加新的钱包账户 | 是
A4 | onchainos wallet switch <account_id> | 切换到不同的钱包账户 | 否
A5 | onchainos wallet status | 显示当前登录状态和活跃账户 | 否
A6 | onchainos wallet logout | 登出并清除所有存储的凭据 | 否
A7 | onchainos wallet addresses [--chain <chainId>] | 按链类别(X Layer、EVM、Solana)分组显示钱包地址 | 否
---|---|---|---
B1 | onchainos wallet balance | 当前账户概览 — EVM/SOL 地址、全链代币列表和总美元价值 | 是
B2 | onchainos wallet balance --chain <chainId> | 当前账户 — 特定链上的所有代币 | 是
B3 | onchainos wallet balance --chain <chainId> --token-address <addr> | 当前账户 — 按合约地址查询的特定代币(需要 --chain) | 是
B4 | onchainos wallet balance --all | 所有账户批量资产 — 仅在用户明确要求查看每个账户时使用 | 是
B5 | onchainos wallet balance --force | 强制刷新 — 绕过所有缓存,从 API 重新获取 | 是
---|---|---|---
D1 | onchainos wallet send | 向地址发送原生或合约代币。支持 --force 以绕过确认提示。 | 是
D2 | onchainos wallet contract-call | 使用自定义 calldata 调用智能合约。支持 --force 以绕过确认提示。 | 是
⚠️ 关键 — 选择正确的命令: 使用错误的命令可能导致资金损失。在执行之前,您必须确定用户的确切意图:
意图 命令 示例 发送原生代币(ETH、SOL、BNB…) wallet send --chain <chainId>"Send 0.1 ETH to 0xAbc" 发送 ERC-20 / SPL 代币(USDC、USDT…) wallet send --chain <chainId> --contract-token"Transfer 100 USDC to 0xAbc" 与智能合约交互(授权、存款、取款、自定义函数调用…) wallet contract-call --chain <chainId>"Approve USDC for spender", "Call withdraw on contract 0xDef" 如果意图不明确,在继续之前务必要求用户澄清。切勿猜测。
---|---|---|---|---
E1 | 列表 | onchainos wallet history | 浏览近期交易,支持可选过滤器 | 是
E2 | 详情 | onchainos wallet history --tx-hash <hash> --chain <chainId> --address <addr> | 按哈希值查找特定交易 | 是
| 用户意图 | → | 命令 |
|---|---|---|
| "Log in" / "sign in" / "登录钱包" | 步骤 2 | 参见步骤 2:身份验证 |
| "Verify OTP" / "验证OTP" | 步骤 2 | 参见步骤 2:身份验证 |
| "Add a new wallet" / "添加钱包" | A | wallet add |
| "Switch account" / "切换账户" | A | wallet switch <account_id> |
| "Am I logged in?" / "钱包状态" | A | wallet status |
| "Show my addresses" / "我的地址" / "钱包地址" / "充值" / "充币" / "收款" / "deposit" / "receive" | A | wallet addresses |
| "Log out" / "退出登录" | A | wallet logout |
| "Show my balance" / "余额" / "我的资产" | B | wallet balance (当前账户) |
| "Show all accounts' balance" / "所有钱包资产" / "Show all accounts' assets" | B | wallet balance --all |
| "Refresh my wallet" / "刷新钱包" / "同步余额" | B | wallet balance --force |
| "Balance on Ethereum" / "What's on Solana?" | B | wallet balance --chain <chainId> |
| "Check token 0x3883... on Ethereum" | B | wallet balance --chain 1 --token-address <addr> |
| "Send 0.01 ETH to 0xAbc" / "转账" / "发送代币" | D | wallet send --amount "0.01" --receipt <addr> --chain 1 |
| "Transfer 100 USDC on Ethereum" | D | wallet send --amount "100" --receipt <addr> --chain 1 --contract-token <addr> |
| "Show my recent transactions" / "交易历史" | E | wallet history |
| "Check tx 0xabc..." / "tx status" | E | wallet history --tx-hash <hash> --chain <chainId> --address <addr> |
| "Approve USDC for contract" / "合约调用" | D | wallet contract-call --to <addr> --chain 1 --input-data <hex> |
| "Execute Solana program" | D | wallet contract-call --to <addr> --chain 501 --unsigned-tx <base58> |
对于需要身份验证的命令(B、D、E 部分),检查登录状态:
onchainos wallet status。如果 loggedIn: true,则继续。在添加钱包之前,您需要先使用您的电子邮件登录。您的电子邮件地址是什么?我们还提供不需要电子邮件的 API Key 登录方式。如果有兴趣,请访问 https://web3.okx.com/onchainos/dev-docs/home/api-access-and-usage
* **2b.** 用户提供电子邮件后,运行:`onchainos wallet login <email> --locale <locale>`。然后逐字显示以下消息(翻译成用户的语言):
English : "A verification code has been sent to {email}. Please check your inbox and tell me the code." Chinese : "验证码已发送到 {email} ,请查收邮件并告诉我验证码。" 用户提供验证码后,运行:
onchainos wallet verify <code>。AI 应始终从对话上下文中推断--locale并包含它:* 中文(简体/繁体,或用户使用中文书写)→ `zh-CN` * 日语(用户使用日语书写)→ `ja-JP` * 英语或任何其他语言 → `en-US` (默认)如果您无法确定用户的语言,则默认为
en-US。
我们还提供不需要电子邮件的 API Key 登录方式。如果有兴趣,请访问 https://web3.okx.com/onchainos/dev-docs/home/api-access-and-usage
* **3b.** 如果用户确认他们想使用 API Key,首先检查是否需要切换 API Key:使用 `wallet status` 的结果(来自步骤 1 或重新运行)。如果 `loginType` 是 `"ak"` 且返回的 `apiKey` 与当前环境变量 `OKX_API_KEY` 不同,则向用户显示两个密钥并要求确认切换。如果用户确认,则运行 `onchainos wallet login --force`。如果 `apiKey` 不存在、为空或相同,则跳过确认并直接运行 `onchainos wallet login`。
* **3c.** 静默登录成功后,通知用户他们已通过 API Key 方式登录。
4. 登录成功后,通过运行 onchainos wallet balance 显示带有地址的完整账户列表。
重要: 在
wallet login或wallet verify之后,切勿自动调用wallet add。仅当用户已登录且明确要求添加新账户时才调用wallet add。
请参阅以下各部分的详细信息(A 到 E)。
| 刚刚完成 | 显示 | 建议 |
|---|---|---|
| 添加 | 显示新的 accountName,检查余额、账户数量,并指示当前活跃的钱包 | 充值(推荐 X Layer — 免 Gas 费) |
| 切换 | 显示新的 accountName,检查余额、账户数量,并指示当前活跃的钱包 | 充值(推荐 X Layer — 免 Gas 费)、转账、兑换 |
| 状态(已登录) | 显示电子邮件、账户名称、账户数量 | 充值、转账、兑换 |
| 状态(未登录) | 引导完成登录流程(步骤 2) | 登录 |
| 登出 | 确认凭据已清除 | 需要时再次登录 |
| 地址 | 按 X Layer / EVM / Solana 分组显示地址 | 检查余额、发送代币、兑换 |
onchainos wallet addresses显示当前账户的所有钱包地址,按链类别分组:
xlayer — X Layer (chainIndex 196),AA 钱包地址
evm — 所有其他 EVM 链(Ethereum、BNB Chain、Polygon 等),EOA 地址
solana — Solana (chainIndex 501)
onchainos wallet addresses
onchainos wallet addresses --chain 1
onchainos wallet addresses --chain 501
参数:
| 参数 | 必需 | 描述 |
|---|---|---|
--chain | 否 | 按链 ID 过滤(例如,以太坊为 1,Solana 为 501,XLayer 为 196)。省略则显示所有。 |
返回字段:
| 字段 | 类型 | 描述 |
|---|---|---|
accountId | String | 当前账户 ID |
accountName | String | 当前账户名称 |
xlayer | Array | X Layer 地址 |
evm | Array | 其他 EVM 链地址 |
solana | Array | Solana 地址 |
每个地址条目包含:address、chainIndex、chainName。
wallet balance — 当前账户概览仅显示活跃账户(使用 balance_single,无缓存 — 始终获取最新数据)。响应包括 accountCount — 如果 accountCount > 1,提示用户可以运行 wallet balance --all 查看所有账户。
按此顺序呈现:
No tokens+-- Wallet 1 (active) -- Balance Total $1,565.74
EVM: 0x1234...abcd SOL: 5xYZ...
X Layer (AA) · Gas-free $1,336.00
Ethereum $229.74
BNB Chain $60.00
No tokens on: Base -- Arbitrum One -- Solana -- ...
显示:账户名称 + ID、EVM 地址 (evmAddress)、SOL 地址 (solAddress)、总美元价值 (totalValueUsd)。如果 accountCount > 1,添加备注:"您有 N 个账户。使用 wallet balance --all 查看所有账户。"
wallet balance --all — 所有账户批量查询仅在用户明确要求查看每个账户的资产时使用。使用 balance_batch(60 秒缓存)。
wallet balance --chain <chainId>(例如 --chain 1)— 链详情+-- Wallet 1 -- Ethereum $229.74
ETH 0.042 $149.24
USDC 80.500 $80.50
1.5 ETH),切勿使用原始基础单位$1.2M)No tokens on this chain| 刚刚完成 | 建议 |
|---|---|
balance | 1. 深入查看特定链 wallet balance --chain 2. 检查特定代币 wallet balance --token-address 3. 兑换代币 4. (如果 accountCount > 1) 查看所有账户 wallet balance --all |
balance --all | 1. 深入查看当前账户 wallet balance 2. 检查特定链 wallet balance --chain |
balance --chain | 1. 完整钱包概览 wallet balance 2. 检查特定代币 wallet balance --token-address 3. 在此链上兑换代币 |
balance --token-address | 1. 完整钱包概览 wallet balance 2. 兑换此代币 |
以对话方式呈现,例如:"您想查看按链的细分,还是兑换其中任何代币?" — 切勿暴露技能名称、命令路径或内部字段名称。
okx-dex-token 解析合约地址。onchainos wallet balance --chain <chainId>(例如,以太坊为 --chain 1)检查余额。与用户确认:"我将向 Ethereum 上的 0xAbc...1234 发送 0.01 ETH。是否继续?"onchainos wallet send ...txHash。如果可用,提供区块浏览器链接。如果模拟失败,显示 executeErrorMsg 并且不要广播。使用 TEE 签名和自动广播调用 EVM 合约或 Solana 程序。需要 JWT。
常见函数选择器:
approve(address,uint256) -> 0x095ea7b3transfer(address,uint256) -> 0xa9059cbbwithdraw() -> 0x3ccfd60bdeposit() -> 0xd0e30db0对于 EVM,帮助用户进行 ABI 编码:识别函数签名,编码参数,将 4 字节选择器与编码后的参数组合。
onchainos security tx-scan 检查风险。(使用 okx-security 技能进行 tx-scan)onchainos wallet contract-call ...txHash。如果模拟失败,显示 executeErrorMsg。谨慎处理授权调用:警告无限授权(type(uint256).max)。尽可能建议有限授权。
| 刚刚完成 | 建议 |
|---|---|
| 发送成功 | 1. 检查交易状态(E 部分) 2. 检查更新后的余额(B 部分) |
| 失败(余额不足) | 1. 检查余额(B 部分) 2. 兑换代币以获取所需资产 |
| 失败(模拟错误) | 1. 验证接收方地址 2. 检查代币合约地址 3. 尝试较小金额 |
| 合约调用成功 | 1. 检查交易状态(E 部分) 2. 检查余额(B 部分) |
| 合约调用失败(模拟) | 1. 检查输入数据编码 2. 验证合约地址 3. 检查 Gas 余额 |
| 授权成功 | 1. 继续执行需要授权的操作(例如,兑换) |
1 个命令,2 种模式:列表模式(浏览近期交易)和详情模式(按交易哈希查找)。需要 JWT。
+-- Recent Transactions Page 1
2024-01-15 14:23 Send 0.5 ETH Ethereum Success 0xabc1...
2024-01-15 13:10 Receive 100 USDC Base Success 0xdef2...
2024-01-14 09:45 Send 50 USDC Ethereum Pending 0xghi3...
-> More transactions available. Say "next page" to load more.
cursor 值作为下一个请求中的 --page-num 以加载更多结果+-- Transaction Detail
Hash: 0xabc123...def456
Status: Success
Time: 2024-01-15 14:23:45 UTC
Chain: Ethereum
From: 0xSender...1234
To: 0xRecipient...5678
Amount: 0.5 ETH
Gas Fee: 0.0005 ETH ($1.23)
Explorer: https://etherscan.io/tx/0xabc123...
failReason| 刚刚完成 | 建议 |
|---|---|
| 列表模式 | 1. 查看特定交易的详情 2. 检查余额(B 部分) |
| 详情(成功) | 1. 检查更新后的余额 2. 发送另一笔交易 |
| 详情(待处理) | 1. 几分钟后再次检查 |
| 详情(失败) | 1. 检查余额 2. 重试交易 |
contract-call 命令通过 --mev-protection 标志支持 MEV(最大可提取价值)保护。启用后,广播 API 会在 extraData 中传递 isMEV: true,以通过 MEV 保护通道路由交易,防止抢先交易、三明治攻击和其他 MEV 利用。
⚠️ Solana MEV 保护:在 Solana 上,启用
--mev-protection还需要--jito-unsigned-tx参数。没有它,命令将失败。此参数提供 Solana MEV 保护路由所需的 Jito 捆绑未签名交易数据。
🚨 关键 — 切勿用
--unsigned-tx替代--jito-unsigned-tx
--jito-unsigned-tx和--unsigned-tx是完全不同的参数,具有不同的数据源。如果用户请求 MEV 保护,但您没有有效的 Jito 捆绑交易数据传递给--jito-unsigned-tx,您绝不能将--unsigned-tx的值作为替代品传递给--jito-unsigned-tx— 这样做将导致无效交易。相反,立即停止,告知用户由于所需的 Jito 捆绑数据不可用,无法发起 MEV 保护交易,并询问用户希望如何继续(例如,在没有 MEV 保护的情况下继续,或取消)。
| 链 | MEV 保护 | 额外要求 |
|---|---|---|
| Ethereum | 是 | — |
| BSC | 是 | — |
| Base | 是 | — |
| Solana | 是 | 必须同时传递 --jito-unsigned-tx |
| 其他链 | 不支持 | — |
contract-call 执行的 DEX 兑换交易# EVM 合约调用,启用 MEV 保护(Ethereum/BSC/Base)
onchainos wallet contract-call --to 0xDef... --chain 1 --input-data 0x... --mev-protection
# Solana 合约调用,启用 MEV 保护(需要 --jito-unsigned-tx)
onchainos wallet contract-call --to <program_id> --chain 501 --unsigned-tx <base58_tx> --mev-protection --jito-unsigned-tx <jito_base58_tx>
用户:"I want to use my wallet"
1. onchainos wallet status -> 检查登录状态
2. 如果未登录:
2a. onchainos wallet login <email> --locale <locale> -> 发送 OTP(主要方式)
(用户提供 OTP)
onchainos wallet verify <otp> -> 登录完成
2b. 如果用户拒绝电子邮件:onchainos wallet login -> 静默登录(备用方式)
3. (okx-wallet-portfolio) onchainos portfolio all-balances ... -> 检查持仓
用户:"Add a new wallet and swap some tokens"
1. onchainos wallet add -> 添加新账户(自动切换到该账户)
2. (okx-dex-swap) onchainos swap quote --from ... --to ... --amount ... --chain <chainId> -> 获取报价
3. (okx-dex-swap) onchainos swap swap --from ... --to ... --amount ... --chain <chainId> --wallet <addr> -> 获取兑换 calldata
4. onchainos wallet contract-call --to <tx.to> --chain <chainId> --value <value_in_UI_units> --input-data <tx.data>
-> 通过 Agentic Wallet 签名和广播(Solana:使用 --unsigned-tx 替代 --input-data)
用户:"Swap 50 USDC for ETH on Ethereum"
1. onchainos wallet balance --chain 1 --token-address "<USDC_addr>"
-> 验证 USDC 余额 >= 50
-> 确认 chain=eth, tokenContractAddress
2. (okx-dex-swap) onchainos swap quote --from <USDC_addr> --to <ETH_addr> --amount 50000000 --chain 1
3. (okx-dex-swap) onchainos swap approve --token <USDC_addr> --amount 50000000 --chain 1 -> 获取授权 calldata
4. 执行授权:
onchainos wallet contract-call --to <token_contract_address> --chain 1 --input-data <approve_calldata>
5. (okx-dex-swap) onchainos swap swap --from <USDC_addr> --to <ETH_addr> --amount 50000000 --chain 1 --wallet <addr>
-> 获取兑换 calldata
6. 执行兑换:
onchainos wallet contract-call --to <tx.to> --chain 1 --value <value_in_UI_units> --input-data <tx.data>
数据传递:balance 使用 UI 单位;兑换需要最小单位 -> 乘以 10^decimal(USDC = 6 位小数)。
用户:"Show my wallet and swap the lowest-value token"
1. onchainos wallet balance -> 完整概览
2. 用户选择代币
3. (okx-dex-swap) onchainos swap quote --from <token_addr> --to ... --amount ... --chain <chainId> -> 获取报价
4. (okx-dex-swap) onchainos swap swap --from <token_addr> --to ... --amount ... --chain <chainId> --wallet <addr> -> 获取兑换 calldata
5. 执行兑换:
onchainos wallet contract-call --to <tx.to> --chain <chainId> --value <value_in_UI
Wallet operations: authentication, balance, token transfers, transaction history, and smart contract calls.
Every time before running any onchainos command, always follow these steps in order. Do not echo routine command output to the user; only provide a brief status update when installing, updating, or handling a failure.
Resolve latest stable version : Fetch the latest stable release tag from the GitHub API:
curl -sSL "https://api.github.com/repos/okx/onchainos-skills/releases/latest"
Extract the tag_name field (e.g., v1.0.5) into LATEST_TAG. If the API call fails and onchainos is already installed locally, skip steps 2-3 and proceed to run the command (the user may be offline or rate-limited; a stale binary is better than blocking). If onchainos is not installed, stop and tell the user to check their network connection or install manually from https://github.com/okx/onchainos-skills.
Install or update : If onchainos is not found, or if the cache at ~/.onchainos/last_check ($env:USERPROFILE\.onchainos\last_check on Windows) is older than 12 hours:
curl -sSL "https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh" -o /tmp/onchainos-install.sh curl -sSL "https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" -o /tmp/installer-checksums.txtInvoke-WebRequest -Uri "https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.ps1" -OutFile "$env:TEMP\onchainos-install.ps1" onchainos wallet chainsokx-dex-marketokx-wallet-portfoliookx-dex-marketokx-dex-tokenokx-dex-signalokx-dex-trenchesokx-dex-swap--chain ResolutionIMPORTANT:--chain only accepts a numeric chain ID (e.g. 1 for Ethereum, 501 for Solana, 196 for X Layer). Text values such as sol, xlayer, eth, or any chain name/alias are NOT accepted and will cause the command to fail.
Whenever a command requires --chain, follow these steps:
chainName, showName, or alias values from onchainos wallet chains output (if available in conversation context). This is semantic matching — handle typos, abbreviations, and colloquial names (e.g. "ethereuma" → 1, "币安链" → 56). If you are not 100% confident in the match, ask the user to confirm before proceeding.realChainIndex to --chain. Never pass chain names, aliases, or user-provided text directly.onchainos wallet chains to get the full list and find the matching .⚠️ If no chain can be confidently matched, do NOT guess. Ask the user to clarify, and show the available chain list for reference. When displaying chain names to the user, always use human-readable names (e.g. "Ethereum", "BNB Chain"), never the internal IDs.
Example flow:
# User says: "Show my balance on Ethereum"
# Step 1: infer chain from user input → Ethereum → realChainIndex=1
# Step 2: pass realChainIndex to --chain
→ onchainos wallet balance --chain 1
Applies to:
onchainos wallet balance --chainonchainos wallet send --chainonchainos wallet contract-call --chainonchainos wallet history --chain (detail mode)onchainos wallet addresses --chain--amount / --value UnitsIMPORTANT: Always pass amounts in UI units (human-readable), never in base units (wei, lamports, etc.). The CLI handles unit conversion internally.
| User says | --amount value | ❌ Wrong |
|---|---|---|
| "Transfer 0.15 ETH" | "0.15" | "150000000000000000" (wei) |
| "Send 100 USDC" | "100" | "100000000" (6 decimals) |
| "Send 0.5 SOL" | "0.5" | "500000000" (lamports) |
Applies to:
onchainos wallet send --amountonchainos wallet contract-call --valueCLI Reference : For full parameter tables, return field schemas, and usage examples, see cli-reference.md.
Login commands (
wallet login,wallet verify) are covered in Step 2: Authentication.
---|---|---|---
A3 | onchainos wallet add | Add a new wallet account | Yes
A4 | onchainos wallet switch <account_id> | Switch to a different wallet account | No
A5 | onchainos wallet status | Show current login status and active account | No
A6 | onchainos wallet logout | Logout and clear all stored credentials | No
A7 | onchainos wallet addresses [--chain <chainId>] | Show wallet addresses grouped by chain category (X Layer, EVM, Solana) | No
---|---|---|---
B1 | onchainos wallet balance | Current account overview — EVM/SOL addresses, all-chain token list and total USD value | Yes
B2 | onchainos wallet balance --chain <chainId> | Current account — all tokens on a specific chain | Yes
B3 | onchainos wallet balance --chain <chainId> --token-address <addr> | Current account — specific token by contract address (requires --chain) | Yes
B4 | onchainos wallet balance --all | All accounts batch assets — only use when user explicitly asks to see every account | Yes
B5 | onchainos wallet balance --force | Force refresh — bypass all caches, re-fetch from API | Yes
---|---|---|---
D1 | onchainos wallet send | Send native or contract tokens to an address. Supports --force to bypass confirmation prompts. | Yes
D2 | onchainos wallet contract-call | Call a smart contract with custom calldata. Supports --force to bypass confirmation prompts. | Yes
⚠️ CRITICAL — Choosing the correct command: Using the wrong command may cause loss of funds. You MUST determine the user's exact intent before executing:
Intent Command Example Send native token (ETH, SOL, BNB…) wallet send --chain <chainId>"Send 0.1 ETH to 0xAbc" Send ERC-20 / SPL token (USDC, USDT…) wallet send --chain <chainId> --contract-token"Transfer 100 USDC to 0xAbc" Interact with a smart contract (approve, deposit, withdraw, custom function call…) wallet contract-call --chain <chainId>"Approve USDC for spender", "Call withdraw on contract 0xDef" If the intent is ambiguous, always ask the user to clarify before proceeding. Never guess.
---|---|---|---|---
E1 | List | onchainos wallet history | Browse recent transactions with optional filters | Yes
E2 | Detail | onchainos wallet history --tx-hash <hash> --chain <chainId> --address <addr> | Look up a specific transaction by hash | Yes
| User Intent | → | Command |
|---|---|---|
| "Log in" / "sign in" / "登录钱包" | Step 2 | See Step 2: Authentication |
| "Verify OTP" / "验证OTP" | Step 2 | See Step 2: Authentication |
| "Add a new wallet" / "添加钱包" | A | wallet add |
| "Switch account" / "切换账户" | A | wallet switch <account_id> |
| "Am I logged in?" / "钱包状态" | A | wallet status |
| "Show my addresses" / "我的地址" / "钱包地址" / "充值" / "充币" / "收款" / "deposit" / "receive" | A | wallet addresses |
For commands requiring auth (sections B, D, E), check login state:
onchainos wallet status. If loggedIn: true, proceed.You need to log in with your email first before adding a wallet. What is your email address? We also offer an API Key login method that doesn't require an email. If interested, visit https://web3.okx.com/onchainos/dev-docs/home/api-access-and-usage
* **2b.** Once the user provides their email, run: `onchainos wallet login <email> --locale <locale>`. Then display the following message verbatim (translated to the user's language):
English : "A verification code has been sent to {email}. Please check your inbox and tell me the code." Chinese : "验证码已发送到 {email} ,请查收邮件并告诉我验证码。" Once the user provides the code, run:
onchainos wallet verify <code>. AI should always infer--localefrom conversation context and include it:* Chinese (简体/繁体, or user writes in Chinese) → `zh-CN` * Japanese (user writes in Japanese) → `ja-JP` * English or any other language → `en-US` (default)If you cannot confidently determine the user's language, default to
en-US.
We also offer an API Key login method that doesn't require an email. If interested, visit https://web3.okx.com/onchainos/dev-docs/home/api-access-and-usage
* **3b.** If the user confirms they want to use API Key, first check whether an API Key switch is needed: Use the `wallet status` result (from step 1 or re-run). If `loginType` is `"ak"` and the returned `apiKey` differs from the current environment variable `OKX_API_KEY`, show both keys to the user and ask to confirm the switch. If the user confirms, run `onchainos wallet login --force`. If `apiKey` is absent, empty, or identical, skip the confirmation and run `onchainos wallet login` directly.
* **3c.** After silent login succeeds, inform the user that they have been logged in via the API Key method.
4. After login succeeds, display the full account list with addresses by running onchainos wallet balance.
IMPORTANT: Never call
wallet addautomatically afterwallet loginorwallet verify. Only callwallet addwhen the user is already logged in and explicitly asks to add a new account.
See the per-section details below (A through E).
| Just completed | Display | Suggest |
|---|---|---|
| Add | Show new accountName, check balance, account amount, and indicate the currently active wallet | Deposit (recommend X Layer — gas-free) |
| Switch | Show new accountName, check balance, account amount, and indicate the currently active wallet | Deposit (recommend X Layer — gas-free), Transfer, Swap |
| Status (logged in) | Show email, account name, account amount | Deposit, Transfer, Swap |
| Status (not logged in) | Guide through login flow (Step 2) | Login |
| Logout | Confirm credentials cleared | Login again when needed |
| Addresses | Show addresses grouped by X Layer / EVM / Solana | Check balance, send tokens, swap |
onchainos wallet addressesShow all wallet addresses for the current account, grouped by chain category:
xlayer — X Layer (chainIndex 196), AA wallet address
evm — All other EVM chains (Ethereum, BNB Chain, Polygon, etc.), EOA addresses
solana — Solana (chainIndex 501)
onchainos wallet addresses
onchainos wallet addresses --chain 1
onchainos wallet addresses --chain 501
Parameters :
| Param | Required | Description |
|---|---|---|
--chain | No | Filter by chain ID (e.g. 1 for Ethereum, 501 for Solana, 196 for XLayer). Omit to show all. |
Return fields :
| Field | Type | Description |
|---|---|---|
accountId | String | Current account ID |
accountName | String | Current account name |
xlayer | Array | X Layer addresses |
evm | Array | Other EVM chain addresses |
solana | Array | Solana addresses |
Each address entry contains: address, chainIndex, chainName.
wallet balance — Current Account OverviewShows the active account only (uses balance_single, no cache — always fetches latest data). Response includes accountCount — if accountCount > 1, hint that user can run wallet balance --all to see all accounts.
Present in this order:
No tokens+-- Wallet 1 (active) -- Balance Total $1,565.74
EVM: 0x1234...abcd SOL: 5xYZ...
X Layer (AA) · Gas-free $1,336.00
Ethereum $229.74
BNB Chain $60.00
No tokens on: Base -- Arbitrum One -- Solana -- ...
Display: Account name + ID, EVM address (evmAddress), SOL address (solAddress), total USD (totalValueUsd). If accountCount > 1, add a note: "You have N accounts. Use wallet balance --all to see all."
wallet balance --all — All Accounts BatchOnly use when user explicitly asks to see every account's assets. Uses balance_batch (60 s cache).
wallet balance --chain <chainId> (e.g. --chain 1) — Chain Detail+-- Wallet 1 -- Ethereum $229.74
ETH 0.042 $149.24
USDC 80.500 $80.50
1.5 ETH), never raw base units$1.2M)No tokens on this chain| Just completed | Suggest |
|---|---|
balance | 1. Drill into a specific chain wallet balance --chain 2. Check a specific token wallet balance --token-address 3. Swap a token 4. (if accountCount > 1) See all accounts wallet balance --all |
balance --all | 1. Drill into current account wallet balance 2. Check a specific chain wallet balance --chain |
Present conversationally, e.g.: "Would you like to see the breakdown by chain, or swap any of these tokens?" — never expose skill names, command paths, or internal field names.
okx-dex-token to resolve contract address.onchainos wallet balance --chain <chainId> (e.g. --chain 1 for Ethereum). Confirm with user: "I'll send 0.01 ETH to 0xAbc...1234 on Ethereum. Proceed?"onchainos wallet send ...txHash. Provide block explorer link if available. If simulation fails, show executeErrorMsg and do NOT broadcast.Calls EVM contracts or Solana programs with TEE signing and auto-broadcast. Requires JWT.
Common function selectors:
approve(address,uint256) -> 0x095ea7b3transfer(address,uint256) -> 0xa9059cbbwithdraw() -> 0x3ccfd60bdeposit() -> 0xd0e30db0For EVM, help the user ABI-encode: identify function signature, encode parameters, combine 4-byte selector with encoded params.
onchainos security tx-scan to check for risks. (Use okx-security skill for tx-scan)onchainos wallet contract-call ...txHash. If simulation fails, show executeErrorMsg.Be cautious with approve calls : Warn about unlimited approvals (type(uint256).max). Suggest limited approvals when possible.
| Just completed | Suggest |
|---|---|
| Successful send | 1. Check tx status (Section E) 2. Check updated balance (Section B) |
| Failed (insufficient balance) | 1. Check balance (Section B) 2. Swap tokens to get required asset |
| Failed (simulation error) | 1. Verify recipient address 2. Check token contract address 3. Try smaller amount |
| Successful contract call | 1. Check tx status (Section E) 2. Check balance (Section B) |
| Failed contract call (simulation) | 1. Check input data encoding 2. Verify contract address 3. Check balance for gas |
| Approve succeeded | 1. Proceed with the operation that required approval (e.g., swap) |
1 command with 2 modes: list mode (browse recent transactions) and detail mode (lookup by tx hash). Requires JWT.
+-- Recent Transactions Page 1
2024-01-15 14:23 Send 0.5 ETH Ethereum Success 0xabc1...
2024-01-15 13:10 Receive 100 USDC Base Success 0xdef2...
2024-01-14 09:45 Send 50 USDC Ethereum Pending 0xghi3...
-> More transactions available. Say "next page" to load more.
cursor value from the response as --page-num in the next request to load more results+-- Transaction Detail
Hash: 0xabc123...def456
Status: Success
Time: 2024-01-15 14:23:45 UTC
Chain: Ethereum
From: 0xSender...1234
To: 0xRecipient...5678
Amount: 0.5 ETH
Gas Fee: 0.0005 ETH ($1.23)
Explorer: https://etherscan.io/tx/0xabc123...
failReason if failed| Just completed | Suggest |
|---|---|
| List mode | 1. View detail of a specific tx 2. Check balance (Section B) |
| Detail (success) | 1. Check updated balance 2. Send another tx |
| Detail (pending) | 1. Check again in a few minutes |
| Detail (failed) | 1. Check balance 2. Retry the transaction |
The contract-call command supports MEV (Maximal Extractable Value) protection via the --mev-protection flag. When enabled, the broadcast API passes isMEV: true in extraData to route the transaction through MEV-protected channels, preventing front-running, sandwich attacks, and other MEV exploitation.
⚠️ Solana MEV Protection : On Solana, enabling
--mev-protectionalso requires the--jito-unsigned-txparameter. Without it, the command will fail. This parameter provides the Jito bundle unsigned transaction data needed for Solana MEV-protected routing.
🚨 CRITICAL — NEVER substitute
--unsigned-txfor--jito-unsigned-tx
--jito-unsigned-txand--unsigned-txare completely different parameters with different data sources. If the user requests MEV protection but you do not have a valid Jito bundle transaction to pass to--jito-unsigned-tx, you MUST NOT pass the--unsigned-txvalue into--jito-unsigned-txas a substitute — doing so will result in an invalid transaction. Instead, stop immediately , inform the user that the MEV-protected transaction cannot be initiated because the required Jito bundle data is unavailable, and ask the user how they would like to proceed (e.g., proceed without MEV protection, or cancel).
| Chain | MEV Protection | Additional Requirements |
|---|---|---|
| Ethereum | Yes | — |
| BSC | Yes | — |
| Base | Yes | — |
| Solana | Yes | Must also pass --jito-unsigned-tx |
| Other chains | Not supported | — |
contract-call# EVM contract call with MEV protection (Ethereum/BSC/Base)
onchainos wallet contract-call --to 0xDef... --chain 1 --input-data 0x... --mev-protection
# Solana contract call with MEV protection (requires --jito-unsigned-tx)
onchainos wallet contract-call --to <program_id> --chain 501 --unsigned-tx <base58_tx> --mev-protection --jito-unsigned-tx <jito_base58_tx>
User: "I want to use my wallet"
1. onchainos wallet status -> check login state
2. If not logged in:
2a. onchainos wallet login <email> --locale <locale> -> sends OTP (primary)
(user provides OTP)
onchainos wallet verify <otp> -> login complete
2b. If user declines email: onchainos wallet login -> silent login (fallback)
3. (okx-wallet-portfolio) onchainos portfolio all-balances ... -> check holdings
User: "Add a new wallet and swap some tokens"
1. onchainos wallet add -> new account added (auto-switches to it)
2. (okx-dex-swap) onchainos swap quote --from ... --to ... --amount ... --chain <chainId> -> get quote
3. (okx-dex-swap) onchainos swap swap --from ... --to ... --amount ... --chain <chainId> --wallet <addr> -> get swap calldata
4. onchainos wallet contract-call --to <tx.to> --chain <chainId> --value <value_in_UI_units> --input-data <tx.data>
-> sign & broadcast via Agentic Wallet (Solana: use --unsigned-tx instead of --input-data)
User: "Swap 50 USDC for ETH on Ethereum"
1. onchainos wallet balance --chain 1 --token-address "<USDC_addr>"
-> verify USDC balance >= 50
-> confirm chain=eth, tokenContractAddress
2. (okx-dex-swap) onchainos swap quote --from <USDC_addr> --to <ETH_addr> --amount 50000000 --chain 1
3. (okx-dex-swap) onchainos swap approve --token <USDC_addr> --amount 50000000 --chain 1 -> get approve calldata
4. Execute approval:
onchainos wallet contract-call --to <token_contract_address> --chain 1 --input-data <approve_calldata>
5. (okx-dex-swap) onchainos swap swap --from <USDC_addr> --to <ETH_addr> --amount 50000000 --chain 1 --wallet <addr>
-> get swap calldata
6. Execute swap:
onchainos wallet contract-call --to <tx.to> --chain 1 --value <value_in_UI_units> --input-data <tx.data>
Data handoff : balance is UI units; swap needs minimal units -> multiply by 10^decimal (USDC = 6 decimals).
User: "Show my wallet and swap the lowest-value token"
1. onchainos wallet balance -> full overview
2. User picks token
3. (okx-dex-swap) onchainos swap quote --from <token_addr> --to ... --amount ... --chain <chainId> -> get quote
4. (okx-dex-swap) onchainos swap swap --from <token_addr> --to ... --amount ... --chain <chainId> --wallet <addr> -> get swap calldata
5. Execute swap:
onchainos wallet contract-call --to <tx.to> --chain <chainId> --value <value_in_UI_units> --input-data <tx.data>
User: "Send 0.5 ETH to 0xAbc..."
1. onchainos wallet balance --chain 1
-> verify ETH balance >= 0.5 (plus gas)
2. onchainos wallet send --amount "0.5" --receipt "0xAbc..." --chain 1
-> obtain txHash
3. onchainos wallet history --tx-hash "0xTxHash" --chain 1 --address "0xSenderAddr"
-> verify transaction status
User: "Send 100 USDC to 0xAbc... on Ethereum"
1. onchainos token search --query USDC --chain 1 -> find contract address
2. onchainos security token-scan --tokens "1:0xA0b86991..."
-> verify token is not malicious (use okx-security skill for token-scan)
3. onchainos wallet balance --chain 1 --token-address "0xA0b86991..."
-> verify balance >= 100
4. onchainos wallet send --amount "100" --receipt "0xAbc..." --chain 1 --contract-token "0xA0b86991..."
User: "Send 1 SOL from my second wallet to SolAddress..."
1. onchainos wallet status -> list accounts
2. onchainos wallet send --amount "1" --receipt "SolAddress..." --chain 501 --from "SenderSolAddr"
User: "Did my ETH transfer go through?"
1. onchainos wallet history --tx-hash "0xTxHash..." --chain 1 --address "0xSenderAddr"
-> check txStatus
2. txStatus=1 -> "Success!" | txStatus=0/3 -> "Still pending" | txStatus=2 -> "Failed: <reason>"
User: "Show me my recent transactions"
1. onchainos wallet history --limit 10 -> display list
2. User picks a transaction
3. onchainos wallet history --tx-hash "0xSelectedTx..." --chain <chainId> --address <addr>
-> full detail
User: "I just swapped tokens, what happened?"
1. onchainos wallet history --limit 5 -> find recent swap
2. Display the assetChange array to show what was swapped
User: "Approve USDC for this spender contract"
1. onchainos security tx-scan --chain 1 --from 0xWallet --to 0xToken --data 0x095ea7b3...
-> check SPENDER_ADDRESS_BLACK, approve_eoa risks (use okx-security skill for tx-scan)
2. If safe: onchainos wallet contract-call --to "0xToken" --chain 1 --input-data "0x095ea7b3..."
3. onchainos wallet history --tx-hash "0xTxHash" --chain 1 --address "0xWallet"
-> verify succeeded
User: "Call the withdraw function on contract 0xAbc"
1. Agent encodes: withdraw() -> "0x3ccfd60b"
2. onchainos wallet contract-call --to "0xAbc..." --chain 1 --input-data "0x3ccfd60b"
User: "Deposit 0.1 ETH into contract 0xDef"
1. Agent encodes: deposit() -> "0xd0e30db0"
2. onchainos wallet contract-call --to "0xDef..." --chain 1 --value "0.1" --input-data "0xd0e30db0"
wallet send) and contract interactions (wallet contract-call). Use okx-dex-swap for DEX swaps.1.5 ETH), never base units (1500000000000000000)$1.2M, $340K)0x1234...abcd). For native tokens with empty tokenContractAddress, display (native).wETH, stETH, , ) AND the reported price differs >50% from the known base token price, add an inline flag and suggest running to cross-check.executeResult is false, the transaction would fail on-chain. Show executeErrorMsg and do NOT broadcast.accessToken, refreshToken, apiKey, secretKey, passphrase, , , , , , raw transaction data. Only show: , , , , , .wallet verify (email login) or wallet login (API key login) succeeds, a wallet account is automatically created — never call wallet add automatically after login. wallet add is only for adding additional accounts when the user is already logged in and explicitly requests it.onchainos wallet switch with non-existent account ID will fail. Use wallet status to see available accounts.wallet switch manually.onchainos wallet login, then retryNo tokens on this chain, not an error--contract-token must exist on the specified chain.executeErrorMsg, do NOT broadcast.--chain with --tx-hash. Ask user which chain.--address with --tx-hash. Use current account's address.executeErrorMsg, do NOT broadcast.--gas-limit for higher limit.Some commands may return a confirming response instead of a success or error. This happens when the backend requires explicit user confirmation before proceeding (e.g., high-risk transactions). The CLI exits with code 2 (not 0 or 1).
{
"confirming": true,
"message": "The human-readable prompt to show the user.",
"next": "Instructions for what the agent should do after user confirms."
}
| Field | Type | Description |
|---|---|---|
confirming | bool | Always true. Indicates this is a confirmation prompt, not a success or error. |
message | String | The confirmation message to display to the user verbatim. |
next | String | Instructions describing the action the agent should take after the user confirms. Follow these instructions exactly. |
message field to the user and ask for confirmation.next field (typically re-running the same command with --force flag appended).# 1. Agent runs the command
onchainos wallet send --amount "100" --receipt "0xAbc..." --chain 1
# 2. CLI returns confirming response (exit code 2)
{
"confirming": true,
"message": "This transaction may result in significant loss. Please confirm.",
"next": "If the user confirms, re-run the same command with --force flag appended to proceed."
}
# 3. Agent shows message to user, user confirms
# 4. Agent re-runs with --force
onchainos wallet send --amount "100" --receipt "0xAbc..." --chain 1 --force
Weekly Installs
882
Repository
GitHub Stars
176
First Seen
8 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykFail
Installed on
codex865
opencode861
amp856
gemini-cli856
github-copilot856
kimi-cli855
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
Gemini Interactions API 指南:统一接口、智能体交互与服务器端状态管理
833 周安装
Apollo MCP 服务器:让AI代理通过GraphQL API交互的完整指南
834 周安装
智能体记忆系统构建指南:分块策略、向量存储与检索优化
835 周安装
Scrapling官方网络爬虫框架 - 自适应解析、绕过Cloudflare、Python爬虫库
836 周安装
抽奖赢家选取器 - 随机选择工具,支持CSV、Excel、Google Sheets,公平透明
838 周安装
Medusa 前端开发指南:使用 SDK、React Query 构建电商商店
839 周安装
x86_64-apple-darwinx86_64x86_64-unknown-linux-gnuaarch64aarch64-unknown-linux-gnui686i686-unknown-linux-gnuarmv7larmv7-unknown-linux-gnueabihfAMD64x86_64-pc-windows-msvcx86i686-pc-windows-msvcARM64aarch64-pc-windows-msvcshasum -a 256 ~/.local/bin/onchainos;Windows:(Get-FileHash "$env:USERPROFILE\.local\bin\onchainos.exe" -Algorithm SHA256).Hash.ToLower()Invoke-WebRequest -Uri "https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt" -OutFile "$env:TEMP\installer-checksums.txt"installer-checksums.txt. On mismatch, stop and warn — the installer may have been tampered with.sh /tmp/onchainos-install.sh (or & "$env:TEMP\onchainos-install.ps1" on Windows). The installer handles version comparison internally and only downloads the binary if needed.Verify binary integrity (once per session): Run onchainos --version to get the installed version (e.g., 1.0.5 or 2.0.0-beta.0). Construct the installed tag as v<version>. Download checksums.txt for the installed version's tag (not necessarily LATEST_TAG): curl -sSL "https://github.com/okx/onchainos-skills/releases/download/v<version>/checksums.txt" -o /tmp/onchainos-checksums.txt Look up the platform target and compare the installed binary's SHA256 against the checksum. On mismatch, reinstall (step 2) and re-verify. If still mismatched, stop and warn.
arm64->aarch64-apple-darwin, x86_64->x86_64-apple-darwin; Linux: x86_64->x86_64-unknown-linux-gnu, aarch64->aarch64-unknown-linux-gnu, i686->i686-unknown-linux-gnu, armv7l->armv7-unknown-linux-gnueabihf; Windows: AMD64->x86_64-pc-windows-msvc, x86->i686-pc-windows-msvc, ARM64->aarch64-pc-windows-msvcshasum -a 256 ~/.local/bin/onchainos; Windows: (Get-FileHash "$env:USERPROFILE\.local\bin\onchainos.exe" -Algorithm SHA256).Hash.ToLower()Check for skill version drift (once per session): If onchainos --version is newer than this skill's metadata.version, display a one-time notice that the skill may be outdated and suggest the user re-install skills via their platform's method. Do not block.
Do NOT auto-reinstall on command failures. Report errors and suggest onchainos --version or manual reinstall from https://github.com/okx/onchainos-skills.
Rate limit errors. If a command hits rate limits, the shared API key may be throttled. Suggest creating a personal key at the OKX Developer Portal. If the user creates a .env file, remind them to add .env to .gitignore.
okx-onchain-gatewayokx-securityokx-securityrealChainIndex| "Log out" / "退出登录" | A | wallet logout |
| "Show my balance" / "余额" / "我的资产" | B | wallet balance (current account) |
| "Show all accounts' balance" / "所有钱包资产" / "Show all accounts' assets" | B | wallet balance --all |
| "Refresh my wallet" / "刷新钱包" / "同步余额" | B | wallet balance --force |
| "Balance on Ethereum" / "What's on Solana?" | B | wallet balance --chain <chainId> |
| "Check token 0x3883... on Ethereum" | B | wallet balance --chain 1 --token-address <addr> |
| "Send 0.01 ETH to 0xAbc" / "转账" / "发送代币" | D | wallet send --amount "0.01" --receipt <addr> --chain 1 |
| "Transfer 100 USDC on Ethereum" | D | wallet send --amount "100" --receipt <addr> --chain 1 --contract-token <addr> |
| "Show my recent transactions" / "交易历史" | E | wallet history |
| "Check tx 0xabc..." / "tx status" | E | wallet history --tx-hash <hash> --chain <chainId> --address <addr> |
| "Approve USDC for contract" / "合约调用" | D | wallet contract-call --to <addr> --chain 1 --input-data <hex> |
| "Execute Solana program" | D | wallet contract-call --to <addr> --chain 501 --unsigned-tx <base58> |
balance --chain | 1. Full wallet overview wallet balance 2. Check a specific token wallet balance --token-address 3. Swap a token on this chain |
balance --token-address | 1. Full wallet overview wallet balance 2. Swap this token |
wBTCxOKBprice unverifiedonchainos token price-info--amount for wallet send is in UI units — the CLI handles conversion internallysessionKeysessionCertteeIdencryptedSessionSksigningKeyemailaccountIdaccountNameisNewaddressListtxHashaccessToken is about to expire (within 60 seconds), the CLI auto-refreshes using refreshToken. If refreshToken also expires, user must log in again.~/.okxweb3/keyring.json (or $OKXWEB3_HOME/keyring.json). Wallet metadata in ~/.onchainos/wallets.json.block > warn > empty (safe). The top-level action field reflects the highest priority from riskItemDetail.type(uint256).max). Suggest limited approvals when possible.