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

@degengineering/dexes

v1.0.0

Published

SDK for interacting with DEXES protocols (Web3PGP & Web3Sign) based on Ethereum and using Viem and OpenPGP

Readme

Dexes - Web3PGP & Web3Sign SDK

A TypeScript SDK for managing OpenPGP keys and timestamping documents on Ethereum through the Web3PGP and Web3Sign smart contracts. Build decentralized key infrastructure and document timestamping with cryptographic operations powered by OpenPGP.

Features

  • 🔐 OpenPGP Integration: Seamless integration with OpenPGP.js for cryptographic operations
  • ⛓️ Ethereum Native: Direct interaction with Web3PGP and Web3Sign smart contracts
  • 📅 Document Timestamping: Create immutable timestamps for any digital document
  • 🔍 Event Searching: Query blockchain events for key registrations, subkey additions, revocations, and timestamps
  • Viem integration: Viem is used for its fallback and batching features.
  • 📦 TypeScript First: Full type safety with comprehensive TypeScript support
  • 🧪 Well Tested: Comprehensive integration tests with contracts deployed on Sepolia

Installation

npm install @cryptogram/dexes

Or with yarn:

yarn add @cryptogram/dexes

Or with pnpm:

pnpm add @cryptogram/dexes

Quick Start

Basic Usage

import { Web3PGP, Web3Sign } from '@cryptogram/dexes';
import { createPublicClient, http } from 'viem';
import { sepolia } from 'viem/chains';

// Create a Viem public client
const publicClient = createPublicClient({
  chain: sepolia,
  transport: http('https://ethereum-sepolia-rpc.publicnode.com'),
});

// Initialize Web3PGP
const web3pgpAddress = '0x82733B49e65A2FE6B611e5CE454AC21237071638';
const web3pgp = new Web3PGP(publicClient, web3pgpAddress);

// Initialize Web3Sign
const web3signAddress = '0x6f81441691340Bcf41b7eC323b6E74645820389E';
const web3sign = new Web3Sign(publicClient, web3signAddress);

// Search for key events
const keyEvents = await web3pgp.searchKeyEvents('earliest', 'latest');
console.log('Key events:', keyEvents);

// Search for timestamp events
const timestampEvents = await web3sign.searchTimestampEvents('earliest', 'latest');
console.log('Timestamp events:', timestampEvents);

With Web3PGPService (High-Level API)

import { Web3PGPService, Web3PGP, Web3SignService, Web3Sign } from '@cryptogram/dexes';
import { createPublicClient, http } from 'viem';
import { sepolia } from 'viem/chains';

const publicClient = createPublicClient({
  chain: sepolia,
  transport: http('https://ethereum-sepolia-rpc.publicnode.com'),
});

const web3pgp = new Web3PGP(publicClient, '0x82733B49e65A2FE6B611e5CE454AC21237071638');
const web3pgpService = new Web3PGPService(web3pgp);

// Get a public key by fingerprint
const publicKey = await web3pgpService.getPublicKey('0x1234567890abcdef...');

// Register a new key
await web3pgpService.registerKey(armoredKey, walletClient);

// Add a subkey
await web3pgpService.addSubkey(fingerprint, armoredSubkey, walletClient);

// Revoke a key
await web3pgpService.revokeKey(fingerprint, revocationCertificate, walletClient);

// Web3Sign for timestamping
const web3sign = new Web3Sign(publicClient, '0x6f81441691340Bcf41b7eC323b6E74645820389E');
const web3signService = new Web3SignService(web3sign);

// Create a timestamp
await web3signService.timestampDocument(documentHash, signature, emitterFingerprint, walletClient);

// Verify a timestamp
const verification = await web3signService.verifyTimestamp(timestampId, documentHash);

API Reference

Web3PGP (Low-Level)

The Web3PGP class provides direct access to Web3PGP smart contract methods.

Methods

  • searchKeyEvents(fromBlock, toBlock): Search for key-related events
  • getPublicKey(fingerprint): Retrieve a public key from storage
  • registerKey(fingerprint, publicKey): Register a new key (requires wallet)
  • addSubkey(fingerprint, subkeyFingerprint, subkey): Add a subkey
  • revokeKey(fingerprint, revocationCertificate): Revoke a key

Web3Sign (Low-Level)

The Web3Sign class provides direct access to Web3Sign smart contract methods.

Methods

  • searchTimestampEvents(fromBlock, toBlock): Search for timestamp-related events
  • getTimestamp(timestampId): Retrieve a timestamp by ID
  • timestampDocument(documentHash, signature, emitterFingerprint): Create a timestamp (requires wallet)
  • verifyTimestamp(timestampId, documentHash): Verify a timestamp against a document hash

Web3PGPService (High-Level)

The Web3PGPService class provides a higher-level API with OpenPGP integration.

Methods

  • getPublicKey(fingerprint): Get an OpenPGP PublicKey object
  • registerKey(armoredKey, walletClient): Register an armored key
  • addSubkey(fingerprint, armoredSubkey, walletClient): Add an armored subkey
  • revokeKey(fingerprint, revocationCertificate, walletClient): Revoke with certificate
  • searchKeyEvents(fromBlock, toBlock): Search for events with parsed results

Web3SignService (High-Level)

The Web3SignService class provides a higher-level API for document timestamping with cryptographic verification.

Methods

  • timestampDocument(documentHash, signature, emitterFingerprint, walletClient): Create a timestamp for a document
  • verifyTimestamp(timestampId, documentHash): Verify a timestamp against a document hash
  • getTimestamp(timestampId): Get timestamp details by ID
  • searchTimestampsByHash(documentHash, fromBlock, toBlock): Find all timestamps for a document hash
  • searchTimestampEvents(fromBlock, toBlock): Search for timestamp events with parsed results

Environment

This SDK requires:

  • Node.js: 18.x or higher
  • Viem: ^2.0.0

Testing

Run the test suite:

# Unit tests
npm run test:unit

# Integration tests (connects to Sepolia testnet)
npm run test:integration

# All tests
npm run test:all

Updating Contract ABIs

The SDK includes contract ABIs that must stay synchronized with the deployed smart contracts. When the contracts in /contracts are modified, you need to refresh the ABIs:

Why Update ABIs?

The ABIs define the smart contract function signatures, events, and error types. When contract changes are deployed, the ABIs must be updated to ensure:

  • ✓ Type safety matches current contract implementation
  • ✓ New functions/events are available to the SDK
  • ✓ Integration tests work with the latest contract code
  • ✓ No runtime errors from mismatched function signatures

How to Update ABIs

npm run update-abis

This command:

  1. Compiles smart contracts using Foundry (forge build)
  2. Extracts ABIs from compiled artifacts
  3. Generates TypeScript files in src/abis/
  4. Validates all contract artifacts are present

Note: This task is automatically run before integration tests, but should be manually run whenever smart contracts are modified.

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests to the main repository.

Support

For issues, questions, or contributions, please visit:

  • GitHub: https://github.com/cryptogram/dexes
  • Documentation: https://github.com/cryptogram/cryptogram