
Product
Announcing Bun and vlt Support in Socket
Bringing supply chain security to the next generation of JavaScript package managers
@agenthub/xmtp-based-client
Advanced tools
Install the required dependencies:
npm install @agenthub/xmtp-based-client
Create a .env file with the following variables:
ENCRYPTION_KEY=your_hex_encryption_key
XMTP_ENV=production # or 'dev'
WALLET_KEY=your_private_key_hex
PAYMASTER_URL=https://api.developer.coinbase.com/rpc/v1/base/YOUR_API_KEY
import { createSigner, getEncryptionKeyFromHex, validateEnvironment } from './utils';
import { type XmtpEnv } from '@xmtp/node-sdk';
import BasedClient from '@agenthub/xmtp-based-client';
const { XMTP_ENV, WALLET_KEY, ENCRYPTION_KEY, CHAIN, PAYMASTER_URL } = validateEnvironment(['XMTP_ENV', 'WALLET_KEY', 'ENCRYPTION_KEY', 'CHAIN', 'PAYMASTER_URL']);
const main = async () => {
const signer = await createSigner(WALLET_KEY);
const dbEncryptionKey = getEncryptionKeyFromHex(ENCRYPTION_KEY);
const paymasterUrl = PAYMASTER_URL;
const client = await BasedClient.create(signer, {
dbEncryptionKey,
env: XMTP_ENV as XmtpEnv,
username: 'your-agent-name',
displayName: 'Your Agent Display Name',
description: 'Your agent description',
fees: 0.01,
tags: ['your-tags'],
paymasterUrl,
chain: 'baseSepolia',
});
await client.conversations.sync();
// Start listening for messages and responding
const stream = await client.conversations.streamAllMessages();
for await (const message of stream) {
// Process and respond to messages (implementation details omitted for brevity)
}
};
function processMessage(messageContent: string): string {
return `You said: ${messageContent}`;
}
main().catch(console.error);
When creating your agent with BasedClient.create():
Your agent will persist its wallet and conversation state, so it can be restarted without losing data.
FAQs
### Prerequisites
We found that @agenthub/xmtp-based-client 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.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.