CoinFello CLI Skill
Use the npx @coinfello/agent-cli@latest CLI to interact with CoinFello. The CLI handles smart account creation, SIWE authentication, delegation management, prompt-based transactions, and transaction status checks.
Prerequisites
- - Node.js 20 or later (npx is included with Node.js)
The CLI is available via npx @coinfello/agent-cli@latest. No manual build step is required.
Environment Variables
| Variable | Required | Default | Description |
|---|
| INLINECODE2 | No | INLINECODE3 | Base URL for the CoinFello API |
| INLINECODE4 |
No | — | QuickNode RPC base URL (e.g.
https://your-endpoint-name) |
|
RPC_API_KEY | No | — | QuickNode API key |
|
RPC_URL_OVERRIDE | No | — | Custom RPC URL override for development/testing (overrides all other RPC settings) |
If both RPC_BASE_URL and RPC_API_KEY are set, the CLI routes RPC requests through QuickNode for supported chains (Ethereum, Optimism, BSC, Polygon, Mantle, Base, Arbitrum, Linea, Sepolia, Base Sepolia). If either is missing or the chain is not supported, it falls back to the chain's default public RPC.
Set RPC_URL_OVERRIDE (e.g. http://127.0.0.1:8545) to route all RPC calls through a custom URL, regardless of chain or other RPC settings.
Security Notice
This skill performs the following sensitive operations:
- - Key generation and storage: By default,
create_account generates a hardware-backed P256 key in the macOS Secure Enclave (or TPM 2.0 where available). The private key never leaves the hardware and cannot be exported — only public key coordinates and a key tag are saved to ~/.clawdbot/skills/coinfello/config.json. If hardware key support is not available, the CLI warns and falls back to a software private key. You can also explicitly opt into a plaintext software key by passing --use-unsafe-private-key, which stores a raw private key in the config file — this is intended only for development and testing. - Signer daemon: Running
signer-daemon start authenticates once via Touch ID / password and caches the authorization. All subsequent signing operations reuse this cached context, eliminating repeated auth prompts. The daemon communicates over a user-scoped Unix domain socket with restricted permissions (0600). If the daemon is not running, signing operations fall back to direct execution (prompting Touch ID each time). - Session token storage: Running
sign_in stores a SIWE session token in the same config file. - Delegation signing: Running
send_prompt may receive a delegation request from the server, which is saved to a local file. Running approve_delegation_request creates and signs the delegation, then submits it to the CoinFello API.
Users should ensure they trust the CoinFello API endpoint configured via COINFELLO_BASE_URL before running delegation flows.
Quick Start
CODEBLOCK0
Commands
create_account
Creates a MetaMask Hybrid smart account. By default, the signing key is generated in the macOS Secure Enclave (hardware-backed, non-exportable). If Secure Enclave is unavailable, the CLI warns and falls back to a software key. Pass --use-unsafe-private-key to explicitly use a plaintext software key (development/testing only).
CODEBLOCK1
- - Default (Secure Enclave): Generates a P256 key in hardware; saves
key_tag, public_key_x, public_key_y, key_id, and smart_account_address to ~/.clawdbot/skills/coinfello/config.json. The private key never leaves the Secure Enclave. --use-unsafe-private-key: Generates a random secp256k1 private key and stores it in plaintext in the config file. Use only for development and testing.- Must be run before INLINECODE29
get_account
Displays the current smart account address from local config.
CODEBLOCK2
- - Prints the stored INLINECODE30
- Exits with an error if no account has been created yet
sign_in
Authenticates with CoinFello using Sign-In with Ethereum (SIWE) and your smart account. Saves the session token to local config.
CODEBLOCK3
- - Signs in using the private key stored in config
- Saves the session token to INLINECODE31
- The session token is loaded automatically for subsequent
send_prompt calls - Must be run after
create_account and before send_prompt for authenticated flows
set_delegation
Stores a signed parent delegation (JSON) in local config.
CODEBLOCK4
- -
<delegation-json> — A JSON string representing a Delegation object from MetaMask Smart Accounts Kit
new_chat
Clears the saved chat session ID from local config so the next send_prompt starts a fresh conversation.
CODEBLOCK5
- - Removes
chat_id from INLINECODE39 - Use this when you want to reset conversation context (for example, after context-window errors)
signer-daemon
Manages the Secure Enclave signing daemon. Starting the daemon authenticates once via Touch ID / password and caches the authorization, so subsequent signing operations (account creation, sign-in, delegation signing) do not prompt again.
CODEBLOCK6
- - If the daemon is not running, all Secure Enclave operations fall back to direct execution (prompting Touch ID each time)
- The daemon is optional — all commands work without it
send_prompt
Sends a natural language prompt to CoinFello. If the server requires a delegation to execute the action, the CLI saves the delegation request to a local file and logs the details to the terminal for review. The delegation is not signed automatically — you must explicitly approve it with approve_delegation_request.
CODEBLOCK7
Note that if you receive
Failed to send prompt: Conversation request failed (400): {"error":"Your input exceeds the context window of this model. Please adjust your input or start a new chat and try again."}
then you should call npx @coinfello/agent-cli@latest new_chat to start a new chat with a new context window.
What happens internally:
- 1. Fetches available agents from
/api/v1/automation/coinfello-agents and sends the prompt to CoinFello's conversation endpoint - If the server returns a read-only response (no
clientToolCalls and no txn_id) → prints the response text and exits - If the server returns a
txn_id directly with no tool calls → prints it and exits - If the server sends an
ask_for_delegation client tool call with a chainId and scope:
- Saves the delegation request (scope, chain ID, call ID, chat ID) to
~/.clawdbot/skills/coinfello/pending_delegation.json
- Logs a human-readable summary of the delegation request to the terminal
- Exits without signing — run
approve_delegation_request to approve
approvedelegationrequest
Approves and signs a pending delegation request saved by send_prompt, then submits it to CoinFello.
CODEBLOCK8
What happens internally:
- 1. Reads the pending delegation from INLINECODE53
- Fetches CoinFello's delegate address
- Rebuilds the smart account using the chain ID from the delegation request
- Parses the scope and creates a subdelegation (wraps with ERC-6492 signature if the smart account is not yet deployed on-chain)
- Sends the signed delegation back as a
clientToolCallResponse along with the chatId and INLINECODE56 - Clears the pending delegation file
- Returns a
txn_id for tracking
Common Workflows
Basic: Send a Prompt (Server-Driven Delegation)
CODEBLOCK9
Read-Only Prompt
Some prompts don't require a transaction. The CLI detects this automatically and just prints the response.
CODEBLOCK10
Gas Cost Estimates
Actual on-chain gas costs vary by network. Do not assume mainnet Ethereum gas prices for L2 chains.
| Network | Swap / Transfer Gas Cost |
|---|
| Base | $0.0003 – $0.0006 |
These are approximate ranges under normal network conditions. L2s like Base are significantly cheaper than Ethereum mainnet.
Edge Cases
- - No smart account: Run
create_account before send_prompt. The CLI checks for a saved private key and address in config. - Not signed in: Run
sign_in before send_prompt if the server requires authentication. - Invalid chain name: The CLI throws an error listing valid viem chain names.
- Unsupported chain: The CLI rejects chains where CoinFello infrastructure and MetaMask delegation contracts aren't available. Supported chains: Ethereum, OP Mainnet, BNB Smart Chain, Polygon, Mantle, Base, Arbitrum One, Linea, Sepolia, Base Sepolia. Funding a smart account on any other chain will result in permanently locked funds.
- Read-only response: If the server returns a text response with no transaction, the CLI prints it and exits without creating a delegation.
Bug Reports & Support
If you encounter a bug or unexpected behavior that cannot be resolved by following the troubleshooting steps, email support@coinfello.com with a description of the issue and any relevant error output.
Reference
See references/REFERENCE.md for the full config schema, supported chains, API details, scope types, and troubleshooting.
CoinFello CLI 技能
使用 npx @coinfello/agent-cli@latest CLI 与 CoinFello 交互。该 CLI 处理智能账户创建、SIWE 认证、委托管理、基于提示的交易以及交易状态检查。
前置条件
- - Node.js 20 或更高版本(npx 随 Node.js 一起提供)
该 CLI 可通过 npx @coinfello/agent-cli@latest 使用。无需手动构建步骤。
环境变量
| 变量 | 必需 | 默认值 | 描述 |
|---|
| COINFELLOBASEURL | 否 | https://app.coinfello.com/ | CoinFello API 的基础 URL |
| RPCBASEURL |
否 | — | QuickNode RPC 基础 URL(例如 https://your-endpoint-name) |
| RPC
APIKEY | 否 | — | QuickNode API 密钥 |
| RPC
URLOVERRIDE | 否 | — | 用于开发/测试的自定义 RPC URL 覆盖(覆盖所有其他 RPC 设置) |
如果同时设置了 RPCBASEURL 和 RPCAPIKEY,CLI 会通过 QuickNode 路由受支持链(Ethereum、Optimism、BSC、Polygon、Mantle、Base、Arbitrum、Linea、Sepolia、Base Sepolia)的 RPC 请求。如果缺少任一设置或链不受支持,则会回退到该链的默认公共 RPC。
设置 RPCURLOVERRIDE(例如 http://127.0.0.1:8545)可将所有 RPC 调用通过自定义 URL 路由,无论链或其他 RPC 设置如何。
安全须知
此技能执行以下敏感操作:
- - 密钥生成和存储:默认情况下,createaccount 在 macOS Secure Enclave(或可用的 TPM 2.0)中生成硬件支持的 P256 密钥。私钥永远不会离开硬件且无法导出——只有公钥坐标和密钥标签保存到 ~/.clawdbot/skills/coinfello/config.json。如果硬件密钥支持不可用,CLI 会发出警告并回退到软件私钥。您也可以通过传递 --use-unsafe-private-key 明确选择明文软件密钥,这会将原始私钥存储在配置文件中——这仅用于开发和测试。
- 签名守护进程:运行 signer-daemon start 通过 Touch ID / 密码进行一次认证并缓存授权。所有后续签名操作重用此缓存上下文,避免重复的认证提示。守护进程通过具有受限权限(0600)的用户作用域 Unix 域套接字进行通信。如果守护进程未运行,签名操作将回退到直接执行(每次提示 Touch ID)。
- 会话令牌存储:运行 signin 将 SIWE 会话令牌存储在同一配置文件中。
- 委托签名:运行 sendprompt 可能从服务器接收委托请求,该请求保存到本地文件。运行 approvedelegation_request 创建并签署委托,然后提交给 CoinFello API。
用户应确保在运行委托流程之前信任通过 COINFELLOBASEURL 配置的 CoinFello API 端点。
快速开始
bash
1. 启动签名守护进程(可选,但可避免重复的 Touch ID 提示)
npx @coinfello/agent-cli@latest signer-daemon start
2. 创建智能账户(默认使用 Secure Enclave)
npx @coinfello/agent-cli@latest create_account
3. 使用您的智能账户登录 CoinFello(SIWE)
npx @coinfello/agent-cli@latest sign_in
4. 发送自然语言提示——如果需要委托,将保存以供审查
npx @coinfello/agent-cli@latest send_prompt 发送 5 USDC 到 0xRecipient...
5. 批准委托请求(如果 send_prompt 保存了委托请求)
npx @coinfello/agent-cli@latest approve
delegationrequest
命令
create_account
创建 MetaMask Hybrid 智能账户。默认情况下,签名密钥在 macOS Secure Enclave(硬件支持,不可导出)中生成。如果 Secure Enclave 不可用,CLI 会发出警告并回退到软件密钥。传递 --use-unsafe-private-key 以明确使用明文软件密钥(仅限开发/测试)。
bash
npx @coinfello/agent-cli@latest create_account [--use-unsafe-private-key]
- - 默认(Secure Enclave):在硬件中生成 P256 密钥;将 keytag、publickeyx、publickeyy、keyid 和 smartaccountaddress 保存到 ~/.clawdbot/skills/coinfello/config.json。私钥永远不会离开 Secure Enclave。
- --use-unsafe-private-key:生成随机 secp256k1 私钥并以明文形式存储在配置文件中。仅用于开发和测试。
- 必须在 send_prompt 之前运行
get_account
显示本地配置中的当前智能账户地址。
bash
npx @coinfello/agent-cli@latest get_account
- - 打印存储的 smartaccountaddress
- 如果尚未创建账户,则退出并报错
sign_in
使用以太坊登录(SIWE)和您的智能账户向 CoinFello 进行认证。将会话令牌保存到本地配置。
bash
npx @coinfello/agent-cli@latest sign_in
- - 使用配置中存储的私钥登录
- 将会话令牌保存到 ~/.clawdbot/skills/coinfello/config.json
- 后续 sendprompt 调用会自动加载会话令牌
- 必须在 createaccount 之后、send_prompt 之前运行以进行认证流程
set_delegation
将已签署的父委托(JSON)存储到本地配置中。
bash
npx @coinfello/agent-cli@latest set_delegation
- - — 表示来自 MetaMask Smart Accounts Kit 的 Delegation 对象的 JSON 字符串
new_chat
从本地配置中清除保存的聊天会话 ID,以便下一次 send_prompt 开始新的对话。
bash
npx @coinfello/agent-cli@latest new_chat
- - 从 ~/.clawdbot/skills/coinfello/config.json 中移除 chat_id
- 当您想要重置对话上下文时使用(例如,在上下文窗口错误之后)
signer-daemon
管理 Secure Enclave 签名守护进程。启动守护进程通过 Touch ID / 密码进行一次认证并缓存授权,这样后续的签名操作(账户创建、登录、委托签名)不会再次提示。
bash
npx @coinfello/agent-cli@latest signer-daemon start # 启动守护进程(一次性认证)
npx @coinfello/agent-cli@latest signer-daemon status # 检查守护进程是否正在运行
npx @coinfello/agent-cli@latest signer-daemon stop # 停止守护进程
- - 如果守护进程未运行,所有 Secure Enclave 操作将回退到直接执行(每次提示 Touch ID)
- 守护进程是可选的——所有命令无需它也能工作
send_prompt
向 CoinFello 发送自然语言提示。如果服务器需要委托来执行操作,CLI 会将委托请求保存到本地文件并将详细信息记录到终端以供审查。委托不会自动签署——您必须使用 approvedelegationrequest 明确批准。
bash
npx @coinfello/agent-cli@latest send_prompt
请注意,如果您收到
Failed to send prompt: Conversation request failed (400): {error:Your input exceeds the context window of this model. Please adjust your input or start a new chat and try again.}
那么您应该调用 npx @coinfello/agent-cli@latest new_chat 以使用新的上下文窗口开始新的聊天。
内部处理流程:
- 1. 从 /api/v1/automation/coinfello-agents 获取可用代理,并将提示发送到 CoinFello 的对话端点
- 如果服务器返回只读响应(没有 clientToolCalls 且没有 txnid)→ 打印响应文本并退出
- 如果服务器直接返回 txnid 且没有工具调用 → 打印并退出
- 如果服务器发送带有 chainId 和 scope