fluxa-agent-wallet
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFluxA Agent Wallet
FluxA Agent Wallet
FluxA Agent Wallet lets AI agents perform onchain financial operations — payments, payouts, and payment links — without managing private keys. All operations use the CLI ().
scripts/fluxa-cli.bundle.jsFluxA Agent Wallet 让AI Agent无需管理私钥即可执行链上金融操作——支付、付款和支付链接。所有操作均使用CLI()。
scripts/fluxa-cli.bundle.jsSetup
安装配置
The CLI bundle is located at within this skill directory. It requires Node.js v18+.
scripts/fluxa-cli.bundle.jsbash
node scripts/fluxa-cli.bundle.js <command> [options]All commands output JSON to stdout:
json
{ "success": true, "data": { ... } }Or on error:
json
{ "success": false, "error": "Error message" }Exit code = success, = failure.
01CLI包位于本skill目录下的,需要Node.js v18或更高版本。
scripts/fluxa-cli.bundle.jsbash
node scripts/fluxa-cli.bundle.js <command> [options]所有命令会将JSON输出到标准输出:
json
{ "success": true, "data": { ... } }错误时输出:
json
{ "success": false, "error": "Error message" }退出码表示成功,表示失败。
01Capabilities
功能特性
| Capability | What it does | When to use |
|---|---|---|
| x402 Payment (v3) | Pay for APIs using the x402 protocol with intent mandates | Agent hits HTTP 402, needs to pay for API access |
| Payout | Send USDC to any wallet address | Agent needs to transfer funds to a recipient |
| Payment Link | Create shareable URLs to receive payments | Agent needs to charge users, create invoices, sell content |
| 功能 | 说明 | 使用场景 |
|---|---|---|
| x402 Payment (v3) | 使用带有意图委托的x402协议为API付费 | Agent收到HTTP 402响应,需要付费以获取API访问权限 |
| 付款(Payout) | 向任意钱包地址发送USDC | Agent需要向接收方转账资金 |
| 支付链接(Payment Link) | 创建可分享的URL以接收付款 | Agent需要向用户收费、创建发票、售卖内容 |
Prerequisites — Register Agent ID
前置条件 — 注册Agent ID
Before any operation, the agent must have an Agent ID. Register once:
bash
node scripts/fluxa-cli.bundle.js init \
--email "agent@example.com" \
--name "My AI Agent" \
--client "Agent v1.0"Or pre-configure via environment variables:
bash
export AGENT_ID="ag_xxxxxxxxxxxx"
export AGENT_TOKEN="tok_xxxxxxxxxxxx"
export AGENT_JWT="eyJhbGciOiJ..."Verify status:
bash
node scripts/fluxa-cli.bundle.js statusThe CLI automatically refreshes expired JWTs.
在执行任何操作前,Agent必须拥有一个Agent ID。只需注册一次:
bash
node scripts/fluxa-cli.bundle.js init \
--email "agent@example.com" \
--name "My AI Agent" \
--client "Agent v1.0"也可通过环境变量预先配置:
bash
export AGENT_ID="ag_xxxxxxxxxxxx"
export AGENT_TOKEN="tok_xxxxxxxxxxxx"
export AGENT_JWT="eyJhbGciOiJ..."验证状态:
bash
node scripts/fluxa-cli.bundle.js statusCLI会自动刷新过期的JWT。
Opening Authorization URLs (UX Pattern)
打开授权URL(UX模式)
Many operations require user authorization via a URL (mandate signing, payout approval, agent registration). When you need the user to open a URL:
-
Always ask the user first usingtool with options:
AskUserQuestion- "Yes, open the link"
- "No, show me the URL"
-
If user chooses YES: Use thecommand to open the URL in their default browser:
openbashopen "<URL>" -
If user chooses NO: Display the URL and ask how they'd like to proceed.
Example interaction flow:
Agent: I need to open the authorization URL to sign the mandate.
[Yes, open the link] [No, show me the URL]
User: [Yes, open the link]
Agent: *runs* open "https://agentwallet.fluxapay.xyz/onboard/intent?oid=..."
Agent: I've opened the authorization page in your browser. Please sign the mandate, then let me know when you're done.This pattern applies to:
- Mandate authorization (from
authorizationUrl)mandate-create - Payout approval (from
approvalUrl)payout - Agent registration (if manual registration is needed)
许多操作需要用户通过URL授权(委托签名、付款审批、Agent注册)。当需要用户打开URL时:
-
务必先询问用户,使用工具提供以下选项:
AskUserQuestion- "是,打开链接"
- "否,显示URL"
-
如果用户选择“是”:使用命令在默认浏览器中打开URL:
openbashopen "<URL>" -
如果用户选择“否”:显示URL并询问用户希望如何操作。
交互流程示例:
Agent: 我需要打开授权URL来签署委托协议。
[是,打开链接] [否,显示URL]
用户: [是,打开链接]
Agent: *执行* open "https://agentwallet.fluxapay.xyz/onboard/intent?oid=..."
Agent: 我已在你的浏览器中打开了授权页面。请签署委托协议,完成后告知我。此模式适用于:
- 委托授权(返回的
mandate-create)authorizationUrl - 付款审批(返回的
payout)approvalUrl - Agent注册(如需手动注册)
Quick Decision Guide
快速决策指南
| I want to... | Document |
|---|---|
| Pay for an API that returned HTTP 402 | X402-PAYMENT.md |
| Pay to a payment link (agent-to-agent) | PAYMENT-LINK.md — "Paying TO a Payment Link" section |
| Send USDC to a wallet address | PAYOUT.md |
| Create a payment link to receive payments | PAYMENT-LINK.md — "Create Payment Link" section |
| 我想要... | 参考文档 |
|---|---|
| 为返回HTTP 402的API付费 | X402-PAYMENT.md |
| 向支付链接付款(Agent间转账) | PAYMENT-LINK.md — “向支付链接付款”章节 |
| 向钱包地址发送USDC | PAYOUT.md |
| 创建支付链接以接收付款 | PAYMENT-LINK.md — “创建支付链接”章节 |
Common Flow: Paying to a Payment Link
常见流程:向支付链接付款
This is a 6-step process using CLI:
1. PAYLOAD=$(curl -s <payment_link_url>) → Get full 402 payload JSON
2. mandate-create --desc "..." --amount <amount> → Create mandate (BOTH flags required)
3. User signs at authorizationUrl → Mandate becomes "signed"
4. mandate-status --id <mandate_id> → Verify signed (use --id, NOT --mandate)
5. x402-v3 --mandate <id> --payload "$PAYLOAD" → Get xPaymentB64 (pass FULL 402 JSON)
6. curl -H "X-Payment: <token>" <url> → Submit paymentCritical: The for must be the complete 402 response JSON including the array, not just extracted fields.
--payloadx402-v3acceptsSee PAYMENT-LINK.md for the complete walkthrough with examples.
这是一个使用CLI的6步流程:
1. PAYLOAD=$(curl -s <payment_link_url>) → 获取完整的402负载JSON
2. mandate-create --desc "..." --amount <amount> → 创建委托协议(两个参数均为必填)
3. 用户在authorizationUrl处签署协议 → 委托协议变为“已签署”状态
4. mandate-status --id <mandate_id> → 验证协议已签署(使用--id,而非--mandate)
5. x402-v3 --mandate <id> --payload "$PAYLOAD" → 获取xPaymentB64(传入完整的402 JSON)
6. curl -H "X-Payment: <token>" <url> → 提交付款关键注意事项:的必须是完整的402响应JSON,包含数组,而非仅提取部分字段。
x402-v3--payloadaccepts详细内容请参考PAYMENT-LINK.md中的完整示例步骤。
Amount Format
金额格式
All amounts are in smallest units (atomic units). For USDC (6 decimals):
| Human-readable | Atomic units |
|---|---|
| 0.01 USDC | |
| 0.10 USDC | |
| 1.00 USDC | |
| 10.00 USDC | |
所有金额均以最小单位(原子单位)表示。对于USDC(6位小数):
| 易读格式 | 原子单位 |
|---|---|
| 0.01 USDC | |
| 0.10 USDC | |
| 1.00 USDC | |
| 10.00 USDC | |
CLI Commands Quick Reference
CLI命令速查
| Command | Required Flags | Description |
|---|---|---|
| (none) | Check agent configuration |
| | Register agent ID |
| | Create an intent mandate |
| | Query mandate status (NOT |
| | Execute x402 v3 payment |
| | Create a payout |
| | Query payout status |
| | Create a payment link |
| (none) | List payment links |
| | Get payment link details |
| | Update a payment link |
| | Delete a payment link |
| | Get payment records for a link |
Common Mistakes to Avoid:
| Wrong | Correct |
|---|---|
| |
| |
| |
| 命令 | 必填参数 | 说明 |
|---|---|---|
| 无 | 检查Agent配置 |
| | 注册Agent ID |
| | 创建意图委托协议 |
| | 查询委托协议状态(使用--id,而非--mandate) |
| | 执行x402 v3支付 |
| | 创建付款请求 |
| | 查询付款状态 |
| | 创建支付链接 |
| 无 | 列出所有支付链接 |
| | 获取支付链接详情 |
| | 更新支付链接 |
| | 删除支付链接 |
| | 获取支付链接的付款记录 |
常见错误规避:
| 错误用法 | 正确用法 |
|---|---|
| |
| |
| |
Environment Variables
环境变量
| Variable | Description |
|---|---|
| Pre-configured agent ID |
| Pre-configured agent token |
| Pre-configured agent JWT |
| Email for auto-registration |
| Agent name for auto-registration |
| Client info for auto-registration |
| Custom data directory (default: |
| Wallet API base URL (default: |
| Agent ID API base URL (default: |
| 变量名 | 说明 |
|---|---|
| 预配置的Agent ID |
| 预配置的Agent令牌 |
| 预配置的Agent JWT |
| 自动注册用的邮箱 |
| 自动注册用的Agent名称 |
| 自动注册用的客户端信息 |
| 自定义数据目录(默认: |
| 钱包API基础URL(默认: |
| Agent ID API基础URL(默认: |