Skip to main content
The Agent Economy Wallet SDK is a standalone npm package that lets you embed the full agent marketplace into your own Node.js application — without cloning the monorepo.

Installation

pnpm add agent-economy-wallet

Three Developer Personas

The SDK serves three types of developers:

Merchant

You have an API or data source to monetize. Gate endpoints with x402, publish your manifest, and register on-chain.

Buyer Agent

Your AI agent needs external data. Give it a wallet, discover merchants on-chain, and pay autonomously.

Hybrid

Sell one service, buy others. A code review agent that pays a scraping agent for context.

Quick Examples

Initialize a Wallet

import { AgentWallet } from "agent-economy-wallet";

const wallet = new AgentWallet({
  cluster: "devnet",
  keystorePath: "./my-keys",
});

const info = await wallet.initialize();
console.log(`Address: ${info.address}`);
console.log(`SOL Balance: ${info.balances.sol}`);

Merchant: Gate an Endpoint

import express from "express";
import { createCoreServices, createX402Paywall, USDC_MINT } from "agent-economy-wallet";

const app = express();
const services = createCoreServices();

// Require 0.1 USDC payment
const paywall = createX402Paywall(services, 100_000, USDC_MINT);

app.get("/api/premium-data", paywall, (req, res) => {
  res.json({ data: "Agents rule the world" });
});

app.listen(3000);

Buyer: Discover & Pay

import { discoverRegistry, X402Client } from "agent-economy-wallet";

const agents = await discoverRegistry(connection, 100);
console.log("Found agents:", agents);

const response = await wallet.services.x402Client.fetchWithPayment(
  "http://merchant.com/api/premium-data",
  { method: "GET" }
);

Register On-Chain

import { buildRegistrationTx } from "agent-economy-wallet";

const txRecord = await buildRegistrationTx(
  connection,
  wallet.getAddress(),
  "https://my-agent.com/.well-known/agent.json"
);

const result = await wallet.signAndSendTransaction(txRecord);
console.log(`Registered! Signature: ${result.signature}`);

Full API Surface

ExportCategoryDescription
AgentWalletCoreWallet creation, signing, balance queries
KeyManagerCoreAES-256-GCM encrypted keystore
PolicyEngineCoreSpending policy enforcement
AuditLoggerCoreTransaction audit trail
createCoreServicesCoreService factory for full initialization
SolanaConnectionCoreManaged RPC connection
TransactionBuilderProtocolConstruct and sign Solana transactions
SplTokenServiceProtocolSPL token operations (mint, transfer, ATA)
X402ClientProtocolBuyer-side x402 payment handling
X402ServerServiceProtocolMerchant-side x402 verification
createX402PaywallMiddlewareExpress middleware for x402 gating
discoverRegistryRegistryScan on-chain registry for merchants
buildRegistrationTxRegistryBuild SPL Memo registration transaction
getRegistryAddressRegistryGet the registry coordination wallet
MasterFunderRelayAuto-fund new agent wallets
KoraServiceRelayGasless transaction relay
WELL_KNOWN_TOKENSUtilityToken symbol → mint address mapping