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 🙏

© 2026 – Pkg Stats / Ryan Hefner

agent-escrow-sdk

v1.0.0

Published

Production-grade Node.js SDK for AgentEscrowProtocol on Base mainnet

Downloads

18

Readme

Agent Escrow SDK

Production-grade Node.js SDK for the AgentEscrowProtocol deployed on Base mainnet.

Enables autonomous agents and backends to create, manage, and settle USDC escrow agreements on-chain — with built-in reputation tracking and dispute resolution.

Architecture

┌─────────────────────────────────────────────────┐
│              Your Agent / Backend                │
│                                                  │
│   const client = new AgentEscrowClient({...})    │
│   await client.createEscrow(provider, amt, dur)  │
└──────────────────────┬──────────────────────────┘
                       │ ethers v6
                       ▼
┌──────────────────────────────────────────────────┐
│              Base Mainnet (Chain 8453)            │
│                                                  │
│   ┌──────────────────────────────────────────┐   │
│   │  AgentEscrowProtocol                     │   │
│   │  0x6AC844Ef070ee564ee40b81134b7707A3A4eb7eb │
│   │                                          │   │
│   │  • createEscrow()    • completeEscrow()  │   │
│   │  • raiseDispute()    • getEscrow()       │   │
│   │  • reputationScore()                     │   │
│   └──────────────────────────────────────────┘   │
│                                                  │
│   ┌──────────────────────────────────────────┐   │
│   │  USDC (ERC-20)                           │   │
│   │  0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 │
│   └──────────────────────────────────────────┘   │
└──────────────────────────────────────────────────┘

Installation

npm install agent-escrow-sdk

Requires Node.js ≥ 18. Single runtime dependency: ethers v6.

Quick Start

import { AgentEscrowClient } from 'agent-escrow-sdk';

const client = new AgentEscrowClient({
  privateKey: process.env.PRIVATE_KEY,
});

// Approve 50 USDC for the protocol
await client.approveUSDC('50');

// Create a 1-hour escrow for 50 USDC
const { escrowId } = await client.createEscrow(
  '0xProviderAddress',
  '50',
  3600
);

// Complete the escrow — provider receives funds minus 2.5% fee
await client.completeEscrow(escrowId);

Autonomous Agent Workflow

import { AgentEscrowClient } from 'agent-escrow-sdk';

const client = new AgentEscrowClient({
  privateKey: process.env.AGENT_PRIVATE_KEY,
});

async function executeTask(providerAddress, usdcAmount, taskDurationSecs) {
  // 1. Approve USDC spend
  await client.approveUSDC(usdcAmount);

  // 2. Lock funds in escrow
  const { escrowId } = await client.createEscrow(
    providerAddress,
    usdcAmount,
    taskDurationSecs
  );

  // 3. Wait for off-chain task completion...
  const taskSucceeded = await performOffChainWork();

  if (taskSucceeded) {
    // 4a. Release payment to provider
    await client.completeEscrow(escrowId);
  } else {
    // 4b. Raise dispute for resolution
    await client.raiseDispute(escrowId);
  }

  // 5. Check provider reputation
  const rep = await client.getReputation(providerAddress);
  return { escrowId, reputation: rep };
}

API Reference

Constructor

new AgentEscrowClient({ privateKey, rpcUrl?, contractAddress? })

| Parameter | Type | Required | Default | |---|---|---|---| | privateKey | string | ✅ | — | | rpcUrl | string | — | https://mainnet.base.org | | contractAddress | string | — | Deployed protocol address |

Write Methods

All write methods return { hash, receipt, gasUsed }.

| Method | Description | |---|---| | approveUSDC(amount) | Approve protocol to spend USDC | | createEscrow(provider, amount, durationSeconds) | Create escrow — also returns escrowId | | completeEscrow(escrowId) | Release funds to provider | | raiseDispute(escrowId) | Flag escrow for dispute resolution |

Read Methods

| Method | Returns | |---|---| | getEscrow(escrowId) | { client, provider, amount, deadline, completed, disputed } | | getReputation(address) | bigint reputation score |

Static Helpers

| Method | Description | |---|---| | AgentEscrowClient.parseUSDC(amount) | Convert human-readable amount → 6-decimal bigint |

Contract Details

| | | |---|---| | Network | Base Mainnet (Chain ID 8453) | | Contract | 0x6AC844Ef070ee564ee40b81134b7707A3A4eb7eb | | USDC | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 | | Protocol Fee | 2.5% (250 basis points) | | RPC | https://mainnet.base.org |

Security Notes

  • Private key handling — The SDK validates key format at construction time but never logs, stores, or transmits it. Always load keys from environment variables or a secure vault; never commit them to source control.
  • Allowance management — Call approveUSDC() with only the amount you need. Avoid unlimited approvals in production agent workflows.
  • Deadline calculationcreateEscrow computes deadlines from Date.now(). Ensure the host clock is accurate, or pass a custom RPC with a trusted block-time source.
  • Gas estimation — The SDK relies on ethers' default gas estimation. On Base mainnet, gas costs are minimal, but callers should monitor the signer's ETH balance.
  • Error boundaries — All contract reverts are decoded into human-readable messages. Wrap SDK calls in your own error handling for retry logic or alerting.

License

MIT