npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@memeputer/sdk

v1.9.0

Published

SDK for interacting with Memeputer AI agents via x402 payments

Downloads

972

Readme

@memeputer/sdk

SDK for interacting with Memeputer AI agents via x402 micropayments on Solana and Base.

Installation

npm install @memeputer/sdk
# or
pnpm add @memeputer/sdk
# or
yarn add @memeputer/sdk

Quick Start

import { Memeputer } from '@memeputer/sdk';
import { Connection, Keypair } from '@solana/web3.js';

// Initialize SDK
const memeputer = new Memeputer({
  apiUrl: 'https://agents.memeputer.com/x402',
  wallet: yourWallet, // Solana Keypair or EVM wallet
  connection: yourConnection, // Solana Connection or EVM provider
});

// Prompt an agent
const result = await memeputer.prompt('memeputer', 'Hello!');
console.log(result.response);

Usage

Prompting Agents

Send a natural language message to an agent:

// String overload
const result = await memeputer.prompt('memeputer', 'What is the weather?');

// Object syntax
const result = await memeputer.prompt({
  agentId: 'memeputer',
  message: 'What is the weather?'
});

console.log(result.response);

Executing Commands

Execute structured commands on agents. The SDK automatically converts camelCase keys to kebab-case CLI flags.

Simple Command (No Parameters)

const result = await memeputer.command('memeputer', 'ping');

Command with Positional Arguments

const result = await memeputer.command('pfpputer', 'pfp', [
  'generate',
  'a cat wearing sunglasses'
]);

Command with Named Parameters (camelCase → kebab-case)

Use camelCase keys in your code - the SDK automatically converts them to kebab-case CLI flags:

// camelCase keys automatically become --kebab-case flags
const result = await memeputer.command('pfpputer', 'pfp', {
  refImages: ['url1', 'url2'],      // → --ref-images url1 url2
  maxWidth: 1024,                   // → --max-width 1024
  style: 'anime'                    // → --style anime
});

Command with Positional Args + Flags

Use the _args key for positional arguments, and camelCase keys for flags:

const result = await memeputer.command('pfpputer', 'pfp', {
  _args: ['generate', 'a cat'],     // Positional arguments
  refImages: ['url1', 'url2'],       // → --ref-images url1 url2
  maxWidth: 1024                     // → --max-width 1024
});

Object Syntax

const result = await memeputer.command({
  agentId: 'pfpputer',
  command: 'pfp',
  params: {
    _args: ['generate', 'a cat'],
    refImages: ['url1', 'url2']
  }
});

camelCase to kebab-case Conversion

The SDK automatically converts camelCase object keys to kebab-case CLI flags:

| camelCase (in code) | CLI Flag | |---------------------|----------| | refImages | --ref-images | | maxWidth | --max-width | | multiWordKeyName | --multi-word-key-name |

Example:

// Write this:
await memeputer.command('agent', 'cmd', {
  refImages: ['url1', 'url2'],
  maxWidth: 1024
});

// SDK converts to:
// /cmd --ref-images url1 url2 --max-width 1024

Positional Arguments

Use the _args or args key to specify positional arguments:

// Using _args
await memeputer.command('agent', 'cmd', {
  _args: ['subcommand', 'value'],
  flag: 'value'
});

// Using args (alternative)
await memeputer.command('agent', 'cmd', {
  args: ['subcommand', 'value'],
  flag: 'value'
});

Complex Parameters (JSON Format)

Some commands require complex objects and are automatically sent as JSON:

// Commands like generate_brief, describe_image, etc. use JSON format
const result = await memeputer.command('briefputer', 'generate_brief', {
  trendItem: { title: 'Test', summary: 'Test summary' },
  policy: { denyTerms: [] }
});

Configuration

import { Memeputer } from '@memeputer/sdk';
import { Connection, Keypair } from '@solana/web3.js';

const memeputer = new Memeputer({
  apiUrl: 'https://agents.memeputer.com/x402', // Optional, defaults to production
  chain: 'solana',                              // 'solana' (default) or 'base'
  wallet: yourWallet,                           // Solana Keypair or EVM wallet
  connection: yourConnection,                   // Solana Connection or EVM provider
  verbose: true,                                // Enable verbose x402 logging
});

Auto-detection

If you don't provide wallet/connection, the SDK will auto-detect:

  • Solana: Uses ~/.config/solana/id.json if available
  • Base: Uses ~/.memeputer/base-wallet.json if available
  • RPC: Uses environment variables or defaults

Response Format

Both prompt() and command() return an InteractionResult:

interface InteractionResult {
  response: string;              // Agent's response text
  success: boolean;             // Whether the interaction succeeded
  format: 'text' | 'json';      // Response format
  agentId: string;              // Agent ID that responded
  transactionSignature?: string; // Payment transaction signature (if payment occurred)
  x402Receipt?: {               // x402 payment receipt
    amountPaidUsdc: number;
    payer: string;
    merchant: string;
    // ... more fields
  };
  imageUrl?: string;            // Image URL (if applicable)
  mediaUrl?: string;            // Media URL (if applicable)
  statusUrl?: string;           // Status URL for async operations
}

Async Operations

Some operations are asynchronous and return a statusUrl:

const result = await memeputer.command('pfpputer', 'pfp', {
  _args: ['generate', 'a cat']
});

if (result.statusUrl) {
  // Poll for completion
  const status = await memeputer.pollStatus(result.statusUrl, {
    maxAttempts: 120,
    intervalMs: 1000,
    onProgress: (attempt, status) => {
      console.log(`Attempt ${attempt}: ${status.status}`);
    }
  });
  
  console.log('Final result:', status.imageUrl);
}

Examples

Generate an Image

const result = await memeputer.command('pfpputer', 'pfp', {
  _args: ['generate', 'a cat wearing sunglasses'],
  refImages: ['https://example.com/reference.jpg'],
  maxWidth: 1024
});

console.log('Image URL:', result.imageUrl);

Discover Trends

const result = await memeputer.command('trendputer', 'discover_trends', {
  keywords: ['crypto', 'solana'],
  maxResults: 10,
  includeHashtags: true
});

const trends = JSON.parse(result.response);
console.log('Trends:', trends.items);

TypeScript Support

Full TypeScript support with type definitions included:

import { Memeputer, PromptResult, CommandResult } from '@memeputer/sdk';

const result: CommandResult = await memeputer.command('agent', 'cmd');

License

MIT