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

@kodykebab/eax-sdk

v1.0.0

Published

EAX — Privacy-preserving ad exchange SDK. 3 function calls to integrate encrypted ad serving into any website.

Readme

EAX SDK

The Encrypted Attention Exchange (EAX) SDK connects websites to a privacy-preserving ad network powered by Fully Homomorphic Encryption (FHE) on the Fhenix CoFHE network.

With a few lines of code, you can integrate EAX into your website, serve ads targeted using matching algorithms that never see the user's raw data, and automatically pay users ATTN tokens for viewing these ads.

Installation

Inside your project:

npm install eax-sdk ethers @cofhe/sdk

(Note: ethers and @cofhe/sdk are peer dependencies.)

Quick Start (Publisher Demo)

Using the SDK to serve a privacy-preserving ad to the user:

import { initEAX, getAd, renderAd } from "eax-sdk";

// 1. Initialize with your environments
await initEAX({ 
  contractAddress: "0xYourContractBasedOnNetwork...", 
  backendUrl: "http://localhost:4000" 
});

// 2. Fetch the assigned ad (Automatically queries the blockchain to figure out the assigned advertiser, then fetches the ad creative from backend)
const ad = await getAd();

if (ad) {
  // 3. Render the Ad on-screen. This automatically pays out the user their `ATTN` reward on-chain via a `recordImpression` transaction!
  const adSlot = document.getElementById("ad-slot");
  await renderAd(adSlot, ad);
} else {
  console.log("User currently does not have an active matching intent vector generated.");
}

Architecture Flow

The SDK abstracts away three major layers of the system:

  1. Extension Communication: Getting the local ML intent vector securely.
  2. On-Chain FHE Matching: Encrypting using CoFHE SDK, submitting the transaction (matchIntent), evaluating decryption signatures, and executing the revealMatch.
  3. Cross-Site Ad Serving: Querying the activeAdvertiser, pulling creatives smoothly, and executing recordImpression() to finalize payouts to the user.

API Reference

initEAX(config)

Initializes the EAX SDK. Must be called before any other functionality. Will prompt Metamask request connections.

Parameters:

  • config.contractAddress (string) - Deployed EAX contract.
  • config.backendUrl (string) - Ad creative storage server URL.

runMatch()

Runs the full intent matching pipeline for a user. Generally called by the main EAX central Hub/dApp, rather than third-party publishers.

  1. Listens for the user's intent vector via secure Extension postMessage.
  2. Encrypts intent via the CoFHE ZK pipeline.
  3. Submits matchIntent transaction on-chain.
  4. Uses CoFHE coprocessor to perform threshold decryption for the auction winner.
  5. Executes revealMatch to assign the winner across the network.

Returns: { advertiserId: number, taskId: string, txHash: string }


getAd(userAddress?)

Fetches the designated active ad creative for a user.

  1. Calls the blockchain to check activeAdvertiser.
  2. Fetches the designated JSON creative from the Backend server.

Parameters:

  • userAddress (string) - Optional. Defaults to the connected wallet.

Returns: Object (Ad Creative Interface) or null.

{
  "advertiserId": 1,
  "title": "Trade Crypto Securely",
  "image": "...",
  "cta": "Start Trading",
  "link": "https://..."
}

renderAd(container, ad, options?)

Injects an EAX Ad Interface cleanly into any DOM container and securely manages the recordImpression logic automatically.

Parameters:

  • container (HTMLElement) - DOM element container.
  • ad (Object) - Ad creative fetched from getAd.
  • options.triggerImpression (boolean) - Default true. Trigger recordImpression() on chain to reward the user when served.

Returns: { txHash: string, payout: number }


getActiveAdvertiser(userAddress?)

Directly checks the blockchain to determine what advertiser ID the user is actively assigned to right now.

Returns: { advertiserId: number } or null.


recordImpression()

Interacts with the Smart Contract to notify that the active intent match was successfully shown. This triggers the on-chain reset, and initiates the ATTN token payout from the Advertiser's budget to the User.

Returns: { txHash: string, payout: number, advertiserId: number }