> ## 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.

# Contract Addresses

> Access deployed contract addresses for all networks

The `@zkp2p/contracts-v2/addresses` module provides pre-configured contract addresses for all deployed networks.

## Import Addresses

Import addresses for specific networks:

```typescript theme={null}
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:

<AccordionGroup>
  <Accordion title="Base Mainnet" icon="ethereum">
    ```typescript theme={null}
    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);
    ```
  </Accordion>

  <Accordion title="Base Sepolia (Testnet)" icon="flask">
    ```typescript theme={null}
    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);
    ```
  </Accordion>
</AccordionGroup>

## Address File Structure

Each network export contains:

```typescript theme={null}
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:

<CodeGroup>
  ```typescript Read-Only Contract theme={null}
  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();
  ```

  ```typescript Write Contract (with Signer) theme={null}
  import { ethers } from 'ethers';
  import { base } from '@zkp2p/contracts-v2/addresses';
  import { Orchestrator } from '@zkp2p/contracts-v2/abis/base';

  const provider = new ethers.providers.Web3Provider(window.ethereum);
  const signer = provider.getSigner();

  const orchestrator = new ethers.Contract(
    base.Orchestrator,
    Orchestrator,
    signer
  );

  // Write to contract
  const tx = await orchestrator.signalIntent({
    // ... intent parameters
  });
  await tx.wait();
  ```
</CodeGroup>

## Using with viem

Use addresses with viem:

```typescript theme={null}
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:

```typescript theme={null}
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:

```typescript theme={null}
import baseAddresses from '@zkp2p/contracts-v2/addresses/base.json';

console.log(baseAddresses.contracts.Orchestrator);
```

## Next Steps

<CardGroup cols={2}>
  <Card title="ABIs" icon="file-code" href="/sdk/abis">
    Learn how to use contract ABIs
  </Card>

  <Card title="Constants" icon="hashtag" href="/sdk/constants">
    Access protocol constants
  </Card>
</CardGroup>
