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

@haggle-protocol/evm

v0.1.0

Published

SDK for Haggle Protocol — on-chain negotiation for AI agents on EVM chains

Readme

@haggle-protocol/evm

SDK for Haggle Protocol — the first on-chain negotiation protocol for AI agents on EVM chains.

Install

npm install @haggle-protocol/evm ethers

Quick Start

import { ethers } from "ethers";
import { HaggleSDK, CHAINS } from "@haggle-protocol/evm";

// Connect to a chain
const chain = CHAINS.monad_testnet; // or base_sepolia, arbitrum_sepolia
const provider = new ethers.JsonRpcProvider(chain.rpc);
const signer = new ethers.Wallet(privateKey, provider);

// Initialize SDK
const haggle = new HaggleSDK(chain.contractAddress, signer);

// Create a negotiation
const { negotiationId } = await haggle.createNegotiation({
  seller: "0x...",
  escrowAmount: 1000000n,
  tokenAddress: chain.mockToken,
  serviceHash: ethers.keccak256(ethers.toUtf8Bytes("my-service")),
});

// Submit an offer
await haggle.submitOffer(negotiationId, 550000n);

// Accept the current offer
await haggle.acceptOffer(negotiationId);

// Read negotiation state
const neg = await haggle.getNegotiation(negotiationId);
console.log(neg.status, neg.currentOfferAmount);

Supported Chains

| Chain | Key | Network | |-------|-----|---------| | Monad | monad_testnet | Testnet | | Base | base_sepolia | Sepolia | | Arbitrum | arbitrum_sepolia | Sepolia |

Use CHAINS.monad_testnet, CHAINS.base_sepolia, or CHAINS.arbitrum_sepolia for pre-configured chain settings.

Custom Chain

const haggle = new HaggleSDK("0xYourContract", signer);

API

Write Operations

| Method | Description | |--------|-------------| | createNegotiation(params) | Create a new negotiation with escrow deposit | | acceptInvitation(id) | Seller accepts the negotiation invitation | | submitOffer(id, amount) | Submit an offer (turn-based) | | acceptOffer(id) | Accept the counterparty's current offer → settlement | | rejectNegotiation(id) | Reject and refund escrow to buyer | | expireNegotiation(id) | Expire a timed-out negotiation (permissionless) |

Read Operations

| Method | Description | |--------|-------------| | getNegotiation(id) | Get full negotiation state | | isActive(id) | Check if negotiation is still active | | getEffectiveEscrow(id) | Get current escrow after decay | | getConfig() | Get protocol configuration |

Helpers

| Method | Description | |--------|-------------| | isMyTurn(negotiation, myAddress) | Check if it's your turn to act | | calculateDecay(escrow, bps) | Calculate escrow decay amount | | calculateMinOffer(escrow, bps) | Calculate minimum offer threshold | | calculateProtocolFee(amount, bps) | Calculate protocol fee |

Event Listeners

haggle.onOfferSubmitted(negotiationId, (offerer, amount, round, effectiveEscrow) => {
  console.log(`Round ${round}: ${offerer} offered ${amount}`);
});

haggle.onSettled(negotiationId, (buyer, seller, settledAmount, totalRounds, fee) => {
  console.log(`Settled at ${settledAmount} after ${totalRounds} rounds`);
});

License

BSL 1.1 — see LICENSE