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

@zkp2p/contracts-v2

v0.2.0

Published

ZKP2P V2 smart contract interfaces and utilities

Readme

@zkp2p/contracts-v2

Official npm package for ZKP2P V2 smart contract interfaces, ABIs, addresses, and utilities.

Installation

npm install @zkp2p/contracts-v2
# or
yarn add @zkp2p/contracts-v2
# or
pnpm add @zkp2p/contracts-v2

Quick Start

// Import addresses for specific networks
import { base, baseSepolia } from "@zkp2p/contracts-v2/addresses"

// Import specific contract ABIs from a network
import { Escrow, Orchestrator } from "@zkp2p/contracts-v2/abis/baseSepolia"

// Import constants
import { USDC, INTENT_EXPIRATION_PERIOD } from "@zkp2p/contracts-v2/constants/base"

// Import payment method configurations
import { baseSepolia as paymentMethods } from "@zkp2p/contracts-v2/paymentMethods"

// Import TypeScript types
import type { Escrow, Orchestrator } from "@zkp2p/contracts-v2/types"

// Import utility functions
import { getKeccak256Hash, calculateIntentHash } from "@zkp2p/contracts-v2/utils/protocolUtils"

// Example: Create contract instance with ethers
import { ethers } from 'ethers';

const provider = new ethers.providers.JsonRpcProvider('https://mainnet.base.org');
const orchestrator = new ethers.Contract(
  base.Orchestrator,
  Orchestrator,
  provider
);

console.log('Intent expiration:', INTENT_EXPIRATION_PERIOD);
console.log('Venmo config:', paymentMethods.venmo);

Features

📍 Network-Specific Contract Addresses

Pre-configured addresses for all deployed networks:

import { base, baseSepolia } from "@zkp2p/contracts-v2/addresses"

console.log(base.Orchestrator);
console.log(base.Escrow);
console.log(baseSepolia.UnifiedPaymentVerifier);

Supported networks:

  • Base (base)
  • Base Sepolia (baseSepolia)

📜 Network-Specific Contract ABIs

Minimal ABIs extracted from on-chain deployments:

// Import specific contracts from a network
import { Orchestrator, Escrow } from "@zkp2p/contracts-v2/abis/baseSepolia"

// Use the ABIs directly with ethers or viem
const orchestratorABI = Orchestrator;
const escrowABI = Escrow;

// Alternative: Import all ABIs for a network
import * as baseSepoliaAbis from "@zkp2p/contracts-v2/abis/baseSepolia"
const unifiedVerifierABI = baseSepoliaAbis.UnifiedPaymentVerifier;

// Also supports direct JSON imports for bundle optimization
import EscrowABI from "@zkp2p/contracts-v2/abis/baseSepolia/Escrow.json"

🔧 Network-Specific Protocol Constants

All protocol parameters and configurations per network:

import { INTENT_EXPIRATION_PERIOD, MAX_INTENTS_PER_DEPOSIT, DUST_THRESHOLD } from "@zkp2p/contracts-v2/constants/base"
import * as baseSepoliaConstants from "@zkp2p/contracts-v2/constants/baseSepolia"

// Use specific constants
console.log('Intent expiration:', INTENT_EXPIRATION_PERIOD);
console.log('Max intents:', MAX_INTENTS_PER_DEPOSIT);

// Or access all constants for a network
console.log('USDC address:', baseSepoliaConstants.USDC);

💳 Payment Methods with Provider Hashes

Unified payment method configurations including provider hashes from deployment:

import { base, baseSepolia } from "@zkp2p/contracts-v2/paymentMethods"

// Access payment method configurations
const venmoConfig = base.venmo;
console.log('Payment Method Hash:', venmoConfig.paymentMethodHash);
console.log('Currencies:', venmoConfig.currencies);

// Or use testnet configurations
const testnetPaymentMethods = baseSepolia;
console.log('Available methods:', Object.keys(testnetPaymentMethods));

🛠️ Utility Functions

Protocol utility functions:

// Import protocol utilities
import { getKeccak256Hash, calculateIntentHash, getCurrencyInfo } from "@zkp2p/contracts-v2/utils/protocolUtils"
import { Currency } from "@zkp2p/contracts-v2/utils/types"

// Use utility functions
const paymentMethodHash = getKeccak256Hash("venmo");
const intentHash = calculateIntentHash(depositor, depositId, signalIntentParams);

// Get currency information
const usdInfo = getCurrencyInfo(Currency.USD);
console.log('Currency code:', usdInfo.code);
console.log('Decimals:', usdInfo.decimals);

API Reference

Package Structure

The package follows modern ESM/CJS patterns with clean subpath exports:

@zkp2p/contracts-v2/
├── addresses/          # Network-specific contract addresses
├── abis/              # Network-specific contract ABIs  
├── constants/         # Protocol constants per network
├── paymentMethods/    # Payment method configurations
├── types/             # TypeScript type definitions
└── utils/             # Utility functions

Import Patterns

All modules are directly accessible via subpath exports:

  • @zkp2p/contracts-v2/addresses - Contract addresses for all networks
  • @zkp2p/contracts-v2/abis/<network> - Contract ABIs per network (e.g., /abis/baseSepolia)
  • @zkp2p/contracts-v2/abis/<network>/<contract>.json - Direct JSON import for specific contracts
  • @zkp2p/contracts-v2/constants/<network> - Constants per network
  • @zkp2p/contracts-v2/paymentMethods - Payment method configs
  • @zkp2p/contracts-v2/utils/protocolUtils - Protocol utilities
  • @zkp2p/contracts-v2/types - TypeScript types

Export Format Details

The package now uses explicit wrapper modules for each network to ensure reliable imports across all environments:

// Recommended: Import from network-specific wrappers
import { Escrow, Orchestrator } from "@zkp2p/contracts-v2/abis/baseSepolia"

// Alternative: Direct JSON imports for bundle size optimization
import EscrowABI from "@zkp2p/contracts-v2/abis/baseSepolia/Escrow.json"

// CommonJS compatibility
const { Escrow } = require("@zkp2p/contracts-v2/abis/baseSepolia")

Each network export provides:

  • CommonJS support (.cjs)
  • ESM support (.mjs)
  • TypeScript definitions (.d.ts)
  • Direct JSON file access

Version

Current version: 0.0.1-rc5

Development

Build & Publish

From packages/contracts:

  • yarn build – Clean, extract, and bundle package
  • npm pack – Preview tarball contents
  • npm publish --access public – Publish (runs prepublishOnly)

Note: The package uses modern module patterns with _esm/, _cjs/, and _types/ folders for optimal compatibility.

License

MIT

Links