
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
sample-agent
Advanced tools
Abstraxn Agent SDK for zero-code web3 multi-agent service integration with chat, authentication, transactions, and real-time features
Web3 AI Agent SDK for chat, authentication, and agent backend integration.
The Abstraxn Agent SDK provides a simple interface to integrate with your agent backend API, enabling AI-powered Web3 interactions with minimal code.
npm install @abstraxn/agent
Before using the SDK, you need:
https://your-agent-backend.com)import { Agent } from '@abstraxn/agent';
import { ethers } from 'ethers';
// Initialize the agent with your backend API
const agent = new Agent({
apiUrl: "https://your-agent-backend.com", // Your agent backend URL
chainId: 1, // Ethereum mainnet
signer: new ethers.Wallet("your-private-key"), // Any wallet provider
autoConnect: true,
});
// Initialize and authenticate
await agent.init();
await agent.login({ address: "0x..." });
// Chat with AI agent
const response = await agent.ask("What's my ETH balance?");
// Get session history
const history = await agent.chat.getCurrentHistory();
console.log("Chat history:", history.data);
The SDK provides complete integration with your agent backend API. All API endpoints are automatically handled with proper error handling and response conversion.
// Login with wallet signature
await agent.login({ address: "0x..." });
// Get current user info
const user = await agent.getCurrentUser();
// Logout
await agent.logout();
// Send a message
const response = await agent.chat.send("What's my ETH balance?");
// Get user sessions
const sessions = await agent.chat.getSessions();
// Get session messages
const messages = await agent.chat.getHistory(sessionId);
// Check system health
const health = await agent.getHealth();
// Wallet-based authentication (automatic)
await agent.login({ address: wallet.address });
// Check authentication status
const isAuth = agent.auth.isAuthenticated();
const user = await agent.auth.getCurrentUser();
// Handle auth events
agent.auth.onAuthChange((isAuthenticated, user) => {
console.log('Auth status:', isAuthenticated, user);
});
// Send a message
const response = await agent.chat.send("What's my balance?", {
context: {
chain_ids: [137],
wallet_address: address
}
});
// Streaming chat
for await (const chunk of agent.chat.sendStream("Explain DeFi")) {
console.log(chunk.content);
}
// Session management
const session = await agent.chat.createSession({ title: "DeFi Discussion" });
const history = await agent.chat.getHistory(session.id);
// Error handling
agent.on('onError', (error) => {
console.error('Agent error:', error);
});
// Health monitoring
const health = await agent.getHealth();
console.log('Service status:', health);
// Storage management
await agent.clearAllData(); // Clear all cached data
const agent = new Agent({
// Required
apiUrl: "http://localhost:8000",
chainId: 137, // Polygon
signer: wallet, // Any wallet provider
// Optional
autoConnect: true,
// Storage configuration
storage: {
type: "localStorage", // or "sessionStorage" or "custom"
prefix: "abstraxn_agent_"
},
// WebSocket configuration
webSocket: {
enabled: true,
autoConnect: true,
reconnection: true
}
});
The SDK supports any wallet provider that implements the WalletSigner interface:
import { ethers } from 'ethers';
const wallet = new ethers.Wallet("private-key");
const agent = new Agent({
apiUrl: "https://your-backend.com",
chainId: 1,
signer: wallet, // ethers.Signer
});
const web3AuthSigner = {
async getAddress(): Promise<string> {
return await web3Auth.getUserInfo().then(user => user.address);
},
async signMessage(message: string): Promise<string> {
return await web3Auth.signMessage(message);
}
};
const agent = new Agent({
apiUrl: "https://your-backend.com",
chainId: 1,
signer: web3AuthSigner, // Generic WalletSigner
});
const walletConnectSigner = {
async getAddress(): Promise<string> {
return await walletConnect.getAccounts()[0];
},
async signMessage(message: string): Promise<string> {
return await walletConnect.signMessage(message);
}
};
const agent = new Agent({
apiUrl: "https://your-backend.com",
chainId: 1,
signer: walletConnectSigner, // Generic WalletSigner
});
const metaMaskSigner = {
async getAddress(): Promise<string> {
const accounts = await window.ethereum.request({ method: 'eth_accounts' });
return accounts[0];
},
async signMessage(message: string): Promise<string> {
const accounts = await window.ethereum.request({ method: 'eth_accounts' });
return await window.ethereum.request({
method: 'personal_sign',
params: [message, accounts[0]]
});
}
};
const agent = new Agent({
apiUrl: "https://your-backend.com",
chainId: 1,
signer: metaMaskSigner, // Generic WalletSigner
});
class CustomWallet {
async getAddress(): Promise<string> {
// Your custom logic
return "0x...";
}
async signMessage(message: string): Promise<string> {
// Your custom signing logic
return "0x...";
}
}
const agent = new Agent({
apiUrl: "https://your-backend.com",
chainId: 1,
signer: new CustomWallet(), // Custom WalletSigner
});
const agent = new Agent({ /* config */ });
await agent.init();
// Ask about portfolio
const portfolio = await agent.ask("Show my DeFi portfolio across all chains");
// Get AI suggestions
const suggestions = await agent.ask("What are the best DeFi strategies for my portfolio?");
const agent = new Agent({ /* config */ });
// Get market analysis
const analysis = await agent.ask("Analyze current market conditions and suggest trading opportunities");
// Get specific token information
const tokenInfo = await agent.ask("What's the current price and analysis for ETH?");
// Get NFT collection analysis
const collection = await agent.ask("Analyze my NFT collection and suggest which ones to sell");
// Get floor price information
const floorPrices = await agent.ask("What are the current floor prices for Bored Apes?");
The Agent SDK integrates directly with your backend APIs for maximum simplicity:
const agent = new Agent({
apiUrl: "http://localhost:8000", // Your backend API
chainId: 137, // Polygon
signer: wallet,
// All blockchain operations handled by your backend
});
init() - Initialize the agentlogin(credentials) - Authenticate userask(message, sessionId?) - Send chat messagegetHealth() - Check service healthgetCurrentUser() - Get current userlogout() - Logout userisAuthenticated() - Check auth statusrefreshToken() - Refresh access tokengetCurrentUser() - Get user profileclearTokens() - Clear stored tokenssend(message, options) - Send messagesendStream(message) - Streaming chatcreateSession() - Create new sessiongetSessions() - Get all sessionsgetHistory(sessionId) - Get chat historygetCurrentHistory() - Get current session historyBefore (Manual Implementation):
// Complex setup + manual API calls
const response = await fetch('/api/v1/chat/', {
method: 'POST',
headers: { 'Authorization': `Bearer ${token}` },
body: JSON.stringify({ message, session_id, context })
});
const data = await response.json();
After (Agent SDK):
// Simple solution
const response = await agent.ask(message);
MIT License - see LICENSE file for details
Built with ❤️ by the Abstraxn team for the Web3 developer community.
FAQs
Abstraxn Agent SDK for zero-code web3 multi-agent service integration with chat, authentication, transactions, and real-time features
We found that sample-agent demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.