Agent Wallet — 代理 Wallet
v1.0.7The 代理's wallet. Use this 技能 to safely 创建 a wallet the 代理 can use for transfers, swaps, and any EVM chAIn transaction.
运行时依赖
安装命令
点击复制技能文档
代理 Wallet
Use this 技能 to safely 创建 a wallet the 代理 can use for transfers, swaps, and any EVM chAIn transaction without ever exposing private keys to the 代理. 创建 a wallet, 设置 spending policies, and your 代理 can transfer 令牌s, do swaps, and interact with smart contracts within the boundaries you define.
The 代理 never sees the private key. All transactions are 执行d server-side through a smart account. The wallet owner controls what the 代理 can do via configurable policies.
Configuration Base API URL: Use the SAFE技能S_API_URL 环境 variable if 设置, otherwise default to https://safe技能-production.up.rAIlway.应用 Frontend URL: Use the SAFE技能S_FRONTEND_URL 环境 variable if 设置, otherwise default to https://safe技能-production.up.rAIlway.应用
All API 请求s require a Bearer 令牌 (the API key returned when creating a wallet).
Authorization: Bearer
Quick 启动
- 创建 a Wallet
创建 a new smart account wallet for your 代理. This 生成s a private key server-side (you never see it), 创建s a ZeroDev smart account, and returns an API key for the 代理 plus a clAIm URL for the wallet owner.
curl -X POST "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/secrets" \ -H "Content-Type: 应用/json" \ -d '{ "type": "EVM_WALLET", "memo": "My 代理 wallet", "chAInId": 84532 }'
响应 includes:
APIKey -- store this 安全ly; use it as the Bearer 令牌 for all future 请求s clAImUrl -- 分享 this with the user so they can clAIm the wallet and 设置 policies 添加ress -- the smart account 添加ress
After creating, tell the user:
"Here is your wallet clAIm URL: . Use this to clAIm ownership, 设置 spending policies, and 监控 your 代理's wallet activity."
- 获取 Wallet 添加ress
- 检查 Balances
# With ERC-20 令牌s curl -X 获取 "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/技能s/evm-wallet/balance?令牌s=0x令牌添加r1,0x令牌添加r2" \ -H "Authorization: Bearer "
- Transfer ETH or 令牌s
# Transfer ERC-20 令牌 curl -X POST "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/技能s/evm-wallet/transfer" \ -H "Authorization: Bearer " \ -H "Content-Type: 应用/json" \ -d '{ "to": "0xRecipient添加ress", "amount": "100", "令牌": "0x令牌Contract添加ress" }'
- Swap 令牌s
Swap one 令牌 for another using DEX liquidity (powered by 0x).
# Preview a swap (no execution, just pricing) curl -X POST "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/技能s/evm-wallet/swap/preview" \ -H "Authorization: Bearer " \ -H "Content-Type: 应用/json" \ -d '{ "sell令牌": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "buy令牌": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "sellAmount": "0.1", "chAInId": 1 }'
# 执行 a swap curl -X POST "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/技能s/evm-wallet/swap/执行" \ -H "Authorization: Bearer " \ -H "Content-Type: 应用/json" \ -d '{ "sell令牌": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", "buy令牌": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "sellAmount": "0.1", "chAInId": 1, "slippageBps": 100 }'
sell令牌 / buy令牌: 令牌 contract 添加resses. Use 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for native ETH. sellAmount: Human-readable amount to sell (e.g. "0.1" for 0.1 ETH). chAInId: The chAIn to swap on (1 = Ethereum, 137 = Polygon, 42161 = Arbitrum, 10 = Optimism, 8453 = Base, etc.). slippageBps: Optional slippage tolerance in basis points (100 = 1%). Defaults to 100.
The preview 端点 returns expected buy amount, 路由 信息, and fees without executing. The 执行 端点 performs the actual swap through the smart account, handling ERC20 应用rovals automatically.
- 发送 Arbitrary Transaction
Interact with any smart contract by 发送ing custom calldata.
curl -X POST "${SAFE技能S_API_URL:-https://safe技能-production.up.rAIlway.应用}/API/技能s/evm-wallet/发送-transaction" \ -H "Authorization: Bearer " \ -H "Content-Type: 应用/json" \ -d '{ "to": "0xContract添加ress", "data": "0xCalldata", "value": "0" }'
Policies
The wallet owner controls what the 代理 can do by 设置ting policies via the clAIm U