Documentation Index Fetch the complete documentation index at: https://docs.agentwallex.com/llms.txt
Use this file to discover all available pages before exploring further.
前置条件
Node.js 18+ 或 Python 3.9+
AgentWallex API 密钥(awx_...)— 注册抢先体验
对区块链交易的基本了解
npm install @agentwallex/sdk
分步集成
初始化客户端
使用您的 API 密钥创建 AgentWallex 客户端。测试时使用 sandbox,主网使用 production。 import { AgentWallex } from "@agentwallex/sdk" ;
const aw = new AgentWallex ({
apiKey: process . env . AGENTWALLEX_API_KEY ! ,
environment: "sandbox" , // use "production" for mainnet
});
创建代理钱包
每个代理都有自己的 MPC 安全钱包,并可配置策略。 const agent = await aw . agents . create ({
name: "my-trading-agent" ,
chain: "eip155:84532" ,
policies: {
maxTransactionAmount: "100" , // USDC
dailyLimit: "1000" ,
allowedAddresses: [ "0x..." ],
},
});
console . log ( `Agent ID: ${ agent . id } ` );
console . log ( `Wallet: ${ agent . wallet . address } ` );
为钱包充值
向代理的钱包地址发送测试网代币。在 Base Sepolia 上,您可以使用水龙头 获取测试 USDC。 在沙盒模式下,您的代理钱包位于测试网上。不会涉及真实资金风险。
发送支付
通过代理执行链上支付。 const tx = await aw . payments . send ({
agentId: agent . id ,
to: "0xRecipientAddress" ,
amount: "10.00" ,
token: "USDC" ,
});
console . log ( `Transaction hash: ${ tx . hash } ` );
console . log ( `Status: ${ tx . status } ` ); // "confirmed"
底层运作机制
策略检查 — 策略引擎根据代理的规则(消费限额、地址白名单、频率控制)验证交易。
MPC 签名 — 交易使用 2-of-3 阈值 MPC 签名。没有任何单一方持有完整密钥。
广播 — 签名后的交易被提交到网络。
确认 — AgentWallex 监控并确认交易,然后发送 Webhook 事件。
后续步骤
TypeScript SDK 包含所有方法和类型的完整 SDK 参考。
REST API 用于自定义集成的 HTTP 端点。
x402 微支付 为您的代理启用按 API 调用付费功能。