eth-agent
БесплатноБез исполняемых скриптовНе проверенExpert knowledge for using the eth-agent library - the simplest, safest way for AI agents to send stablecoins on Ethereum. Use when writing code that…
от diegosouzapw★ 68 звёзд на GitHubОб этом скилле
eth-agent Library Expert
You are an expert in the eth-agent library - a TypeScript library that provides the simplest, safest way for AI agents to interact with Ethereum and send stablecoins.
Core Philosophy
- Simplicity: Send USDC in one line, not 15+
- Safety First: Built-in spending limits, human approval, address policies
- AI-Centric: Structured errors with suggestions, predictable APIs
- Human-in-the-Loop: Easy integration with approval workflows
Installation
npm install @lambdaclass/eth-agent
Quick Start
import { AgentWallet } from '@lambdaclass/eth-agent';
const wallet = AgentWallet.create({
privateKey: process.env.ETH_PRIVATE_KEY,
rpcUrl: 'https://eth.llamarpc.com',
});
// Send stablecoins (human-readable amounts, no decimals needed)
await wallet.sendUSDC({ to: 'alice.eth', amount: '100' });
await wallet.sendUSDT({ to: 'bob.eth', amount: '50.25' });
// Send ETH
await wallet.send({ to: 'alice.eth', amount: '0.1 ETH' });
Stablecoins
The library has first-class support for major stablecoins across chains:
import { USDC, USDT, USDS, DAI, PYUSD, FRAX } from '@lambdaclass/eth-agent';
// Each token has: symbol, name, decimals, and addresses per chain
// Amounts are always human-readable strings - NO manual decimal handling
await wallet.sendUSDC({ to: 'alice.eth', amount: '100' }); // Sends 100 USDC
await wallet.sendUSDT({ to: 'bob.eth', amount: '50.25' }); // Sends 50.25 USDT
// Generic stablecoin method
await wallet.sendStablecoin({ token: DAI, to: 'carol.eth', amount: '1000' });
// Check balances (returns formatted string like "1,234.56")
const balance = await wallet.getStablecoinBalance(USDC);
const allBalances = await wallet.getStablecoinBalances(); // All stablecoins
Supported Chains for Stablecoins
USDC, USDT, DAI are available on: Ethereum, Arbitrum, Optimism, Base, Polygon, Avalanche
Safety Features
Spending Limits
const wallet = AgentWallet.create({
privateKey: KEY,
rpcUrl: URL,
limits: {
perTransaction: '100', // Max per single tx (in token units or ETH)
perHour: '500', // Hourly spending cap
perDay: '2000', // Daily spending cap
emergencyStopBelow: '10', // Halt if balance drops below this
},
});
// Check current limits and usage
const limits = await wallet.getLimits();
console.log(limits.daily.remaining); // How much left today
Human Approval
const wallet = AgentWallet.create({
privateKey: KEY,
rpcUrl: URL,
approvalConfig: {
requireApprovalWhen: {
amountExceeds: '50', // Amounts over $50 need approval
recipientIsNew: true, // New recipients need approval
recipientNotInTrusted: true // Non-trusted addresses need approval
},
trustedAddresses: ['0x...', 'alice.eth'],
},
onApprovalRequired: async (request) => {
// Integrate with Slack, email, or UI
console.log(`Approval needed: ${request.summary}`);
return await askHumanForApproval(request);
},
});
Address Policies
const wallet = AgentWallet.create({
privateKey: KEY,
rpcUrl: URL,
addressPolicy: {
mode: 'allowlist', // or 'blocklist'
addresses: ['0x...', 'alice.eth', 'bob.eth'],
},
});
Error Handling
Safe Methods (Result Type)
All methods have safe* variants that return Result types instead of throwing:
import { isOk, isErr, matchResult } from '@lambdaclass/eth-agent';
const result = await wallet.safeSendUSDC({ to: 'alice.eth', amount: '100' });
if (isOk(result)) {
console.log(`Success! TX: ${result.value.hash}`);
} else {
console.log(`Error: ${result.error.code}`);
console.log(`Suggestion: ${result.error.suggestion}`);
}
Pattern Matching
const message = matchResult(result)
.ok(r => `Sent! TX: ${r.hash}`)
.errWith({ code: 'INSUFFICIENT_FUNDS' }, e => `Need more: ${e.details.shortage}`)
.errWith({ code: 'DAILY_LIMIT_EXCEEDED' }, () => 'Wait until tomorrow')
.errWith({ code: 'APPROVAL_REQUIRED' }, () => 'Human approval needed')
.err(e => e.suggestion)
.run();
Structured Errors
All errors have:
code: Machine-readable (e.g.,DAILY_LIMIT_EXCEEDED)message: Human-readable descriptionsuggestion: Recovery actionretryable: BooleanretryAfter: Milliseconds to wait (if applicable)
Transaction Preview
Preview transactions before sending:
const preview = await wallet.preview({
to: 'alice.eth',
amount: '0.5 ETH',
});
console.log(preview.canExecute); // boolean
console.log(preview.costs.total.eth); // Total cost including gas
console.log(preview.costs.gas.eth); // Gas cost
console.log(preview.blockers); // Array of reasons if can't execute
console.log(preview.warnings); // Non-blocking warnings
Smart Accounts (Gasless Transactions)
For gasless and batch o
Установить eth-agent в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл eth-agent?
Expert knowledge for using the eth-agent library - the simplest, safest way for AI agents to send stablecoins on Ethereum. Use when writing code that interacts with Ethereum, sends tokens, or builds AI agent payment systems.
Как установить скилл eth-agent?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл eth-agent запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic