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 參考。
x402 微型支付 為您的代理啟用按次付費的 API 呼叫。