Documentation Index
Fetch the complete documentation index at: https://mintlify.com/zkp2p/zkp2p-contracts/llms.txt
Use this file to discover all available pages before exploring further.
The @zkp2p/contracts-v2/addresses module provides pre-configured contract addresses for all deployed networks.
Import Addresses
Import addresses for specific networks:
import { base, baseSepolia } from '@zkp2p/contracts-v2/addresses';
console.log('Base Orchestrator:', base.Orchestrator);
console.log('Base Escrow:', base.Escrow);
Supported Networks
The package includes addresses for the following networks:
import { base } from '@zkp2p/contracts-v2/addresses';
// Network info
console.log(base.name); // "base"
console.log(base.chainId); // 8453
// Contract addresses
console.log(base.Orchestrator);
console.log(base.Escrow);
console.log(base.UnifiedPaymentVerifier);
console.log(base.AcrossBridgeHook);
import { baseSepolia } from '@zkp2p/contracts-v2/addresses';
// Network info
console.log(baseSepolia.name); // "base_sepolia"
console.log(baseSepolia.chainId); // 84532
// Contract addresses
console.log(baseSepolia.Orchestrator);
console.log(baseSepolia.Escrow);
console.log(baseSepolia.UnifiedPaymentVerifier);
Address File Structure
Each network export contains:
interface AddressFile {
name: string; // Network name
chainId: number; // Chain ID
contracts: Record<string, `0x${string}`>; // Contract addresses
meta?: { // Metadata
generatedAt: string;
};
}
Available Contracts
Common contracts available across networks:
| Contract | Description |
|---|
Orchestrator | Main protocol orchestrator contract |
Escrow | Handles escrow of funds |
UnifiedPaymentVerifier | Verifies payment proofs |
AcrossBridgeHook | Bridge integration hook (mainnet only) |
Using with ethers.js
Create contract instances with ethers:
import { ethers } from 'ethers';
import { base } from '@zkp2p/contracts-v2/addresses';
import { Orchestrator } from '@zkp2p/contracts-v2/abis/base';
const provider = new ethers.providers.JsonRpcProvider(
'https://mainnet.base.org'
);
const orchestrator = new ethers.Contract(
base.Orchestrator,
Orchestrator,
provider
);
// Read contract state
const intentExpiration = await orchestrator.intentExpirationPeriod();
Using with viem
Use addresses with viem:
import { createPublicClient, http } from 'viem';
import { base as baseChain } from 'viem/chains';
import { base } from '@zkp2p/contracts-v2/addresses';
import { Orchestrator } from '@zkp2p/contracts-v2/abis/base';
const client = createPublicClient({
chain: baseChain,
transport: http(),
});
const intentExpiration = await client.readContract({
address: base.Orchestrator,
abi: Orchestrator,
functionName: 'intentExpirationPeriod',
});
Type Safety
All addresses are typed as 0x${string} for enhanced type safety:
import { base } from '@zkp2p/contracts-v2/addresses';
// Type-safe address
const address: `0x${string}` = base.Orchestrator;
// Compile-time error if not a valid address format
// const invalid: `0x${string}` = "not-an-address"; // Error!
Direct JSON Import
For bundle size optimization, import JSON directly:
import baseAddresses from '@zkp2p/contracts-v2/addresses/base.json';
console.log(baseAddresses.contracts.Orchestrator);
Next Steps
ABIs
Learn how to use contract ABIs
Constants
Access protocol constants